[U-Boot] [PATCHv1 00/14] reset: remove request and free functions

Hi,
It appears that the reset and request functions in the dm reset manager driver do not do anything useful. All of the platforms that implement the request and free do not implement any thing useful, just debugging prints.
The first 9 patches in this series remove the platform specific implementation of request/free. The next 4 patches remove the global reset_free() and reset_request() functions from drivers that are calling them, specifically, dwc_eth_qos, phy, and usb.
The final patch removes the request/free functions from the reset manager driver itself.
Dinh
Dinh Nguyen (14): reset: tegra: remove request and free functions reset: sti: remove request and free functions reset: uniphier: remove request and free functions reset: rockchip: remove request and free functions reset: meson: remove request and free functions reset: bcm6345: remove request and free functions reset: ast2500: remove request function reset: socfpga: remove request and free functions reset: sandbox: remove request and free functions net: dwc_eth_qos: remove reset_free from driver phy: bcm63xx: remove reset_free function usb: ehci/ohci: remove reset_free function reset: test: remove sandbox_reset_test_free function reset: remove request and free functions
arch/sandbox/include/asm/reset.h | 1 - drivers/net/dwc_eth_qos.c | 4 ---- drivers/phy/bcm6318-usbh-phy.c | 4 ---- drivers/phy/bcm6348-usbh-phy.c | 4 ---- drivers/phy/bcm6358-usbh-phy.c | 4 ---- drivers/phy/bcm6368-usbh-phy.c | 4 ---- drivers/reset/ast2500-reset.c | 9 --------- drivers/reset/reset-bcm6345.c | 21 ++++++--------------- drivers/reset/reset-meson.c | 18 +++--------------- drivers/reset/reset-rockchip.c | 26 +++----------------------- drivers/reset/reset-socfpga.c | 18 ------------------ drivers/reset/reset-uclass.c | 28 ---------------------------- drivers/reset/reset-uniphier.c | 12 ------------ drivers/reset/sandbox-reset-test.c | 7 ------- drivers/reset/sandbox-reset.c | 25 ++++++------------------- drivers/reset/sti-reset.c | 12 ------------ drivers/reset/stm32-reset.c | 12 ------------ drivers/reset/tegra-car-reset.c | 24 +++++------------------- drivers/reset/tegra186-reset.c | 18 ------------------ drivers/spi/bcm63xx_hsspi.c | 4 ---- drivers/spi/bcm63xx_spi.c | 4 ---- drivers/usb/host/ehci-generic.c | 1 - drivers/usb/host/ohci-generic.c | 1 - include/reset-uclass.h | 21 --------------------- include/reset.h | 23 ----------------------- test/dm/reset.c | 2 -- 26 files changed, 23 insertions(+), 284 deletions(-)

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/tegra-car-reset.c | 24 +++++------------------- drivers/reset/tegra186-reset.c | 18 ------------------ 2 files changed, 5 insertions(+), 37 deletions(-)
diff --git a/drivers/reset/tegra-car-reset.c b/drivers/reset/tegra-car-reset.c index 3147a50..b776adf 100644 --- a/drivers/reset/tegra-car-reset.c +++ b/drivers/reset/tegra-car-reset.c @@ -10,7 +10,7 @@ #include <asm/arch/clock.h> #include <asm/arch-tegra/clk_rst.h>
-static int tegra_car_reset_request(struct reset_ctl *reset_ctl) +static int tegra_car_reset_assert(struct reset_ctl *reset_ctl) { debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, reset_ctl->dev, reset_ctl->id); @@ -19,22 +19,6 @@ static int tegra_car_reset_request(struct reset_ctl *reset_ctl) if (reset_ctl->id >= PERIPH_ID_COUNT) return -EINVAL;
- return 0; -} - -static int tegra_car_reset_free(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - -static int tegra_car_reset_assert(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - reset_set_enable(reset_ctl->id, 1);
return 0; @@ -45,14 +29,16 @@ static int tegra_car_reset_deassert(struct reset_ctl *reset_ctl) debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, reset_ctl->dev, reset_ctl->id);
+ /* PERIPH_ID_COUNT varies per SoC */ + if (reset_ctl->id >= PERIPH_ID_COUNT) + return -EINVAL; + reset_set_enable(reset_ctl->id, 0);
return 0; }
struct reset_ops tegra_car_reset_ops = { - .request = tegra_car_reset_request, - .free = tegra_car_reset_free, .rst_assert = tegra_car_reset_assert, .rst_deassert = tegra_car_reset_deassert, }; diff --git a/drivers/reset/tegra186-reset.c b/drivers/reset/tegra186-reset.c index 228adda..f83c50b 100644 --- a/drivers/reset/tegra186-reset.c +++ b/drivers/reset/tegra186-reset.c @@ -10,22 +10,6 @@ #include <reset-uclass.h> #include <asm/arch-tegra/bpmp_abi.h>
-static int tegra186_reset_request(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - -static int tegra186_reset_free(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - static int tegra186_reset_common(struct reset_ctl *reset_ctl, enum mrq_reset_commands cmd) { @@ -60,8 +44,6 @@ static int tegra186_reset_deassert(struct reset_ctl *reset_ctl) }
struct reset_ops tegra186_reset_ops = { - .request = tegra186_reset_request, - .free = tegra186_reset_free, .rst_assert = tegra186_reset_assert, .rst_deassert = tegra186_reset_deassert, };

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/sti-reset.c | 12 ------------ drivers/reset/stm32-reset.c | 12 ------------ 2 files changed, 24 deletions(-)
diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index 0fc5a28..672dd97 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -277,16 +277,6 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert) return 0; }
-static int sti_reset_request(struct reset_ctl *reset_ctl) -{ - return 0; -} - -static int sti_reset_free(struct reset_ctl *reset_ctl) -{ - return 0; -} - static int sti_reset_assert(struct reset_ctl *reset_ctl) { return sti_reset_program_hw(reset_ctl, true); @@ -298,8 +288,6 @@ static int sti_reset_deassert(struct reset_ctl *reset_ctl) }
struct reset_ops sti_reset_ops = { - .request = sti_reset_request, - .free = sti_reset_free, .rst_assert = sti_reset_assert, .rst_deassert = sti_reset_deassert, }; diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c index e98f34b..efde745 100644 --- a/drivers/reset/stm32-reset.c +++ b/drivers/reset/stm32-reset.c @@ -23,16 +23,6 @@ struct stm32_reset_priv { fdt_addr_t base; };
-static int stm32_reset_request(struct reset_ctl *reset_ctl) -{ - return 0; -} - -static int stm32_reset_free(struct reset_ctl *reset_ctl) -{ - return 0; -} - static int stm32_reset_assert(struct reset_ctl *reset_ctl) { struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev); @@ -68,8 +58,6 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl) }
static const struct reset_ops stm32_reset_ops = { - .request = stm32_reset_request, - .free = stm32_reset_free, .rst_assert = stm32_reset_assert, .rst_deassert = stm32_reset_deassert, };

Hi Dinh
On 04/14/2018 08:51 PM, Dinh Nguyen wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org
drivers/reset/sti-reset.c | 12 ------------ drivers/reset/stm32-reset.c | 12 ------------ 2 files changed, 24 deletions(-)
diff --git a/drivers/reset/sti-reset.c b/drivers/reset/sti-reset.c index 0fc5a28..672dd97 100644 --- a/drivers/reset/sti-reset.c +++ b/drivers/reset/sti-reset.c @@ -277,16 +277,6 @@ static int sti_reset_program_hw(struct reset_ctl *reset_ctl, int assert) return 0; }
-static int sti_reset_request(struct reset_ctl *reset_ctl) -{
- return 0;
-}
-static int sti_reset_free(struct reset_ctl *reset_ctl) -{
- return 0;
-}
- static int sti_reset_assert(struct reset_ctl *reset_ctl) { return sti_reset_program_hw(reset_ctl, true);
@@ -298,8 +288,6 @@ static int sti_reset_deassert(struct reset_ctl *reset_ctl) }
struct reset_ops sti_reset_ops = {
- .request = sti_reset_request,
- .free = sti_reset_free, .rst_assert = sti_reset_assert, .rst_deassert = sti_reset_deassert, };
diff --git a/drivers/reset/stm32-reset.c b/drivers/reset/stm32-reset.c index e98f34b..efde745 100644 --- a/drivers/reset/stm32-reset.c +++ b/drivers/reset/stm32-reset.c @@ -23,16 +23,6 @@ struct stm32_reset_priv { fdt_addr_t base; };
-static int stm32_reset_request(struct reset_ctl *reset_ctl) -{
- return 0;
-}
-static int stm32_reset_free(struct reset_ctl *reset_ctl) -{
- return 0;
-}
- static int stm32_reset_assert(struct reset_ctl *reset_ctl) { struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev);
@@ -68,8 +58,6 @@ static int stm32_reset_deassert(struct reset_ctl *reset_ctl) }
static const struct reset_ops stm32_reset_ops = {
- .request = stm32_reset_request,
- .free = stm32_reset_free, .rst_assert = stm32_reset_assert, .rst_deassert = stm32_reset_deassert, };
Reviewed-by: Patrice Chotard patrice.chotard@st.com
Thanks

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-uniphier.c | 12 ------------ 1 file changed, 12 deletions(-)
diff --git a/drivers/reset/reset-uniphier.c b/drivers/reset/reset-uniphier.c index a40cea5..5b1d923 100644 --- a/drivers/reset/reset-uniphier.c +++ b/drivers/reset/reset-uniphier.c @@ -171,16 +171,6 @@ struct uniphier_reset_priv { const struct uniphier_reset_data *data; };
-static int uniphier_reset_request(struct reset_ctl *reset_ctl) -{ - return 0; -} - -static int uniphier_reset_free(struct reset_ctl *reset_ctl) -{ - return 0; -} - static int uniphier_reset_update(struct reset_ctl *reset_ctl, int assert) { struct uniphier_reset_priv *priv = dev_get_priv(reset_ctl->dev); @@ -226,8 +216,6 @@ static int uniphier_reset_deassert(struct reset_ctl *reset_ctl) }
static const struct reset_ops uniphier_reset_ops = { - .request = uniphier_reset_request, - .free = uniphier_reset_free, .rst_assert = uniphier_reset_assert, .rst_deassert = uniphier_reset_deassert, };

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-rockchip.c | 26 +++----------------------- 1 file changed, 3 insertions(+), 23 deletions(-)
diff --git a/drivers/reset/reset-rockchip.c b/drivers/reset/reset-rockchip.c index 01047a2..5eecd51 100644 --- a/drivers/reset/reset-rockchip.c +++ b/drivers/reset/reset-rockchip.c @@ -24,27 +24,6 @@ struct rockchip_reset_priv { u32 reset_reg_num; };
-static int rockchip_reset_request(struct reset_ctl *reset_ctl) -{ - struct rockchip_reset_priv *priv = dev_get_priv(reset_ctl->dev); - - debug("%s(reset_ctl=%p) (dev=%p, id=%lu) (reg_num=%d)\n", __func__, - reset_ctl, reset_ctl->dev, reset_ctl->id, priv->reset_reg_num); - - if (reset_ctl->id / ROCKCHIP_RESET_NUM_IN_REG >= priv->reset_reg_num) - return -EINVAL; - - return 0; -} - -static int rockchip_reset_free(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - static int rockchip_reset_assert(struct reset_ctl *reset_ctl) { struct rockchip_reset_priv *priv = dev_get_priv(reset_ctl->dev); @@ -55,6 +34,9 @@ static int rockchip_reset_assert(struct reset_ctl *reset_ctl) reset_ctl, reset_ctl->dev, reset_ctl->id, priv->base + (bank * 4));
+ if (reset_ctl->id / ROCKCHIP_RESET_NUM_IN_REG >= priv->reset_reg_num) + return -EINVAL; + rk_setreg(priv->base + (bank * 4), BIT(offset));
return 0; @@ -76,8 +58,6 @@ static int rockchip_reset_deassert(struct reset_ctl *reset_ctl) }
struct reset_ops rockchip_reset_ops = { - .request = rockchip_reset_request, - .free = rockchip_reset_free, .rst_assert = rockchip_reset_assert, .rst_deassert = rockchip_reset_deassert, };

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-meson.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-)
diff --git a/drivers/reset/reset-meson.c b/drivers/reset/reset-meson.c index 5324f86..8bbaa6c 100644 --- a/drivers/reset/reset-meson.c +++ b/drivers/reset/reset-meson.c @@ -20,19 +20,6 @@ struct meson_reset_priv { struct regmap *regmap; };
-static int meson_reset_request(struct reset_ctl *reset_ctl) -{ - if (reset_ctl->id > (REG_COUNT * BITS_PER_REG)) - return -EINVAL; - - return 0; -} - -static int meson_reset_free(struct reset_ctl *reset_ctl) -{ - return 0; -} - static int meson_reset_level(struct reset_ctl *reset_ctl, bool assert) { struct meson_reset_priv *priv = dev_get_priv(reset_ctl->dev); @@ -41,6 +28,9 @@ static int meson_reset_level(struct reset_ctl *reset_ctl, bool assert) uint reg_offset = LEVEL_OFFSET + (bank << 2); uint val;
+ if (reset_ctl->id > (REG_COUNT * BITS_PER_REG)) + return -EINVAL; + regmap_read(priv->regmap, reg_offset, &val); if (assert) val &= ~BIT(offset); @@ -62,8 +52,6 @@ static int meson_reset_deassert(struct reset_ctl *reset_ctl) }
struct reset_ops meson_reset_ops = { - .request = meson_reset_request, - .free = meson_reset_free, .rst_assert = meson_reset_assert, .rst_deassert = meson_reset_deassert, };

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-bcm6345.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-)
diff --git a/drivers/reset/reset-bcm6345.c b/drivers/reset/reset-bcm6345.c index ebf6bee..b49a2f1 100644 --- a/drivers/reset/reset-bcm6345.c +++ b/drivers/reset/reset-bcm6345.c @@ -23,6 +23,9 @@ static int bcm6345_reset_assert(struct reset_ctl *rst) { struct bcm6345_reset_priv *priv = dev_get_priv(rst->dev);
+ if (rst->id >= MAX_RESETS) + return -EINVAL; + clrbits_be32(priv->regs, BIT(rst->id)); mdelay(20);
@@ -33,28 +36,16 @@ static int bcm6345_reset_deassert(struct reset_ctl *rst) { struct bcm6345_reset_priv *priv = dev_get_priv(rst->dev);
+ if (rst->id >= MAX_RESETS) + return -EINVAL; + setbits_be32(priv->regs, BIT(rst->id)); mdelay(20);
return 0; }
-static int bcm6345_reset_free(struct reset_ctl *rst) -{ - return 0; -} - -static int bcm6345_reset_request(struct reset_ctl *rst) -{ - if (rst->id >= MAX_RESETS) - return -EINVAL; - - return bcm6345_reset_assert(rst); -} - struct reset_ops bcm6345_reset_reset_ops = { - .free = bcm6345_reset_free, - .request = bcm6345_reset_request, .rst_assert = bcm6345_reset_assert, .rst_deassert = bcm6345_reset_deassert, };

The request reset function is not really used for any useful purpose except for debugging. We can safely remove it.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/ast2500-reset.c | 9 --------- 1 file changed, 9 deletions(-)
diff --git a/drivers/reset/ast2500-reset.c b/drivers/reset/ast2500-reset.c index b2c89e1..65708cf 100644 --- a/drivers/reset/ast2500-reset.c +++ b/drivers/reset/ast2500-reset.c @@ -68,14 +68,6 @@ static int ast2500_reset_assert(struct reset_ctl *reset_ctl) return ret; }
-static int ast2500_reset_request(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - static int ast2500_reset_probe(struct udevice *dev) { struct ast2500_reset_priv *priv = dev_get_priv(dev); @@ -92,7 +84,6 @@ static const struct udevice_id ast2500_reset_ids[] = {
struct reset_ops ast2500_reset_ops = { .rst_assert = ast2500_reset_assert, - .request = ast2500_reset_request, };
U_BOOT_DRIVER(ast2500_reset) = {

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-socfpga.c | 18 ------------------ 1 file changed, 18 deletions(-)
diff --git a/drivers/reset/reset-socfpga.c b/drivers/reset/reset-socfpga.c index 466455d..3d04132 100644 --- a/drivers/reset/reset-socfpga.c +++ b/drivers/reset/reset-socfpga.c @@ -52,25 +52,7 @@ static int socfpga_reset_deassert(struct reset_ctl *reset_ctl) return 0; }
-static int socfpga_reset_request(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, - reset_ctl, reset_ctl->dev, reset_ctl->id); - - return 0; -} - -static int socfpga_reset_free(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p) (dev=%p, id=%lu)\n", __func__, reset_ctl, - reset_ctl->dev, reset_ctl->id); - - return 0; -} - static const struct reset_ops socfpga_reset_ops = { - .request = socfpga_reset_request, - .free = socfpga_reset_free, .rst_assert = socfpga_reset_assert, .rst_deassert = socfpga_reset_deassert, };

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/sandbox-reset.c | 25 ++++++------------------- 1 file changed, 6 insertions(+), 19 deletions(-)
diff --git a/drivers/reset/sandbox-reset.c b/drivers/reset/sandbox-reset.c index c310749..a75143f 100644 --- a/drivers/reset/sandbox-reset.c +++ b/drivers/reset/sandbox-reset.c @@ -20,29 +20,15 @@ struct sandbox_reset { struct sandbox_reset_signal signals[SANDBOX_RESET_SIGNALS]; };
-static int sandbox_reset_request(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p)\n", __func__, reset_ctl); - - if (reset_ctl->id >= SANDBOX_RESET_SIGNALS) - return -EINVAL; - - return 0; -} - -static int sandbox_reset_free(struct reset_ctl *reset_ctl) -{ - debug("%s(reset_ctl=%p)\n", __func__, reset_ctl); - - return 0; -} - static int sandbox_reset_assert(struct reset_ctl *reset_ctl) { struct sandbox_reset *sbr = dev_get_priv(reset_ctl->dev);
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
+ if (reset_ctl->id >= SANDBOX_RESET_SIGNALS) + return -EINVAL; + sbr->signals[reset_ctl->id].asserted = true;
return 0; @@ -54,6 +40,9 @@ static int sandbox_reset_deassert(struct reset_ctl *reset_ctl)
debug("%s(reset_ctl=%p)\n", __func__, reset_ctl);
+ if (reset_ctl->id >= SANDBOX_RESET_SIGNALS) + return -EINVAL; + sbr->signals[reset_ctl->id].asserted = false;
return 0; @@ -79,8 +68,6 @@ static const struct udevice_id sandbox_reset_ids[] = { };
struct reset_ops sandbox_reset_reset_ops = { - .request = sandbox_reset_request, - .free = sandbox_reset_free, .rst_assert = sandbox_reset_assert, .rst_deassert = sandbox_reset_deassert, };

The call to free the reset control line is a deadend call that doesn't lead to any reset control functionality.
Also the reset_free() function will be remove in a subsequent patch, so remove it here.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/net/dwc_eth_qos.c | 4 ---- 1 file changed, 4 deletions(-)
diff --git a/drivers/net/dwc_eth_qos.c b/drivers/net/dwc_eth_qos.c index 232e803..a3f1b40 100644 --- a/drivers/net/dwc_eth_qos.c +++ b/drivers/net/dwc_eth_qos.c @@ -1371,7 +1371,6 @@ static int eqos_probe_resources_tegra186(struct udevice *dev) GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE); if (ret) { pr_err("gpio_request_by_name(phy reset) failed: %d", ret); - goto err_free_reset_eqos; }
ret = clk_get_by_name(dev, "slave_bus", &eqos->clk_slave_bus); @@ -1418,8 +1417,6 @@ err_free_clk_slave_bus: clk_free(&eqos->clk_slave_bus); err_free_gpio_phy_reset: dm_gpio_free(dev, &eqos->phy_reset_gpio); -err_free_reset_eqos: - reset_free(&eqos->reset_ctl);
debug("%s: returns %d\n", __func__, ret); return ret; @@ -1437,7 +1434,6 @@ static int eqos_remove_resources_tegra186(struct udevice *dev) clk_free(&eqos->clk_slave_bus); clk_free(&eqos->clk_master_bus); dm_gpio_free(dev, &eqos->phy_reset_gpio); - reset_free(&eqos->reset_ctl);
debug("%s: OK\n", __func__); return 0;

The call to free the reset control line is a deadend call that doesn't lead to any reset control functionality.
Also the reset_free() function will be remove in a subsequent patch, so remove it here.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/phy/bcm6318-usbh-phy.c | 4 ---- drivers/phy/bcm6348-usbh-phy.c | 4 ---- drivers/phy/bcm6358-usbh-phy.c | 4 ---- drivers/phy/bcm6368-usbh-phy.c | 4 ---- drivers/spi/bcm63xx_hsspi.c | 4 ---- drivers/spi/bcm63xx_spi.c | 4 ---- 6 files changed, 24 deletions(-)
diff --git a/drivers/phy/bcm6318-usbh-phy.c b/drivers/phy/bcm6318-usbh-phy.c index 6d54214..70907be 100644 --- a/drivers/phy/bcm6318-usbh-phy.c +++ b/drivers/phy/bcm6318-usbh-phy.c @@ -125,10 +125,6 @@ static int bcm6318_usbh_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - mdelay(100);
return 0; diff --git a/drivers/phy/bcm6348-usbh-phy.c b/drivers/phy/bcm6348-usbh-phy.c index 169ee0e..2cc04e1 100644 --- a/drivers/phy/bcm6348-usbh-phy.c +++ b/drivers/phy/bcm6348-usbh-phy.c @@ -77,10 +77,6 @@ static int bcm6348_usbh_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - return 0; }
diff --git a/drivers/phy/bcm6358-usbh-phy.c b/drivers/phy/bcm6358-usbh-phy.c index e000316..0440388 100644 --- a/drivers/phy/bcm6358-usbh-phy.c +++ b/drivers/phy/bcm6358-usbh-phy.c @@ -77,10 +77,6 @@ static int bcm6358_usbh_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - return 0; }
diff --git a/drivers/phy/bcm6368-usbh-phy.c b/drivers/phy/bcm6368-usbh-phy.c index 71abc0f..38dd5e0 100644 --- a/drivers/phy/bcm6368-usbh-phy.c +++ b/drivers/phy/bcm6368-usbh-phy.c @@ -165,10 +165,6 @@ static int bcm6368_usbh_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - /* enable usb_ref clock */ ret = clk_get_by_name(dev, "usb_ref", &clk); if (!ret) { diff --git a/drivers/spi/bcm63xx_hsspi.c b/drivers/spi/bcm63xx_hsspi.c index 3393166..ddf75f0 100644 --- a/drivers/spi/bcm63xx_hsspi.c +++ b/drivers/spi/bcm63xx_hsspi.c @@ -383,10 +383,6 @@ static int bcm63xx_hsspi_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - /* initialize hardware */ writel_be(0, priv->regs + SPI_IR_MASK_REG);
diff --git a/drivers/spi/bcm63xx_spi.c b/drivers/spi/bcm63xx_spi.c index f0df687..71bb07d 100644 --- a/drivers/spi/bcm63xx_spi.c +++ b/drivers/spi/bcm63xx_spi.c @@ -409,10 +409,6 @@ static int bcm63xx_spi_probe(struct udevice *dev) if (ret < 0) return ret;
- ret = reset_free(&rst_ctl); - if (ret < 0) - return ret; - /* initialize hardware */ writeb_be(0, priv->base + regs[SPI_IR_MASK]);

The call to free the reset control line is a deadend call that doesn't lead to any reset control functionality.
Also the reset_free() function will be remove in a subsequent patch, so remove it here.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/usb/host/ehci-generic.c | 1 - drivers/usb/host/ohci-generic.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index b012d86..8ed6a27 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -133,7 +133,6 @@ static int ehci_usb_probe(struct udevice *dev) if (reset_deassert(&priv->resets[i])) { dev_err(dev, "failed to deassert reset %d\n", i); - reset_free(&priv->resets[i]); goto reset_err; } priv->reset_count++; diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index 5bdd799..f61c0fc 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -125,7 +125,6 @@ static int ohci_usb_probe(struct udevice *dev) err = reset_deassert(&priv->resets[i]); if (err) { dev_err(dev, "failed to deassert reset %d\n", i); - reset_free(&priv->resets[i]); goto reset_err; } priv->reset_count++;

Hi Dinh
On 04/14/2018 08:51 PM, Dinh Nguyen wrote:
The call to free the reset control line is a deadend call that doesn't lead to any reset control functionality.
Also the reset_free() function will be remove in a subsequent patch, so remove it here.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org
drivers/usb/host/ehci-generic.c | 1 - drivers/usb/host/ohci-generic.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c index b012d86..8ed6a27 100644 --- a/drivers/usb/host/ehci-generic.c +++ b/drivers/usb/host/ehci-generic.c @@ -133,7 +133,6 @@ static int ehci_usb_probe(struct udevice *dev) if (reset_deassert(&priv->resets[i])) { dev_err(dev, "failed to deassert reset %d\n", i);
reset_free(&priv->resets[i]); goto reset_err; } priv->reset_count++;
diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c index 5bdd799..f61c0fc 100644 --- a/drivers/usb/host/ohci-generic.c +++ b/drivers/usb/host/ohci-generic.c @@ -125,7 +125,6 @@ static int ohci_usb_probe(struct udevice *dev) err = reset_deassert(&priv->resets[i]); if (err) { dev_err(dev, "failed to deassert reset %d\n", i);
reset_free(&priv->resets[i]); goto reset_err; } priv->reset_count++;
Reviewed-by: Patrice Chotard patrice.chotard@st.com

Remove sandbox_reset_test_free() because it calls reset_free, which is being removed.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- arch/sandbox/include/asm/reset.h | 1 - drivers/reset/sandbox-reset-test.c | 7 ------- test/dm/reset.c | 2 -- 3 files changed, 10 deletions(-)
diff --git a/arch/sandbox/include/asm/reset.h b/arch/sandbox/include/asm/reset.h index 0cd7702..c54b266 100644 --- a/arch/sandbox/include/asm/reset.h +++ b/arch/sandbox/include/asm/reset.h @@ -19,7 +19,6 @@ int sandbox_reset_test_assert(struct udevice *dev); int sandbox_reset_test_assert_bulk(struct udevice *dev); int sandbox_reset_test_deassert(struct udevice *dev); int sandbox_reset_test_deassert_bulk(struct udevice *dev); -int sandbox_reset_test_free(struct udevice *dev); int sandbox_reset_test_release_bulk(struct udevice *dev);
#endif diff --git a/drivers/reset/sandbox-reset-test.c b/drivers/reset/sandbox-reset-test.c index f0ceaa0..91a1f6e 100644 --- a/drivers/reset/sandbox-reset-test.c +++ b/drivers/reset/sandbox-reset-test.c @@ -57,13 +57,6 @@ int sandbox_reset_test_deassert_bulk(struct udevice *dev) return reset_deassert_bulk(&sbrt->bulk); }
-int sandbox_reset_test_free(struct udevice *dev) -{ - struct sandbox_reset_test *sbrt = dev_get_priv(dev); - - return reset_free(&sbrt->ctl); -} - int sandbox_reset_test_release_bulk(struct udevice *dev) { struct sandbox_reset_test *sbrt = dev_get_priv(dev); diff --git a/test/dm/reset.c b/test/dm/reset.c index 8dc0023..289693d 100644 --- a/test/dm/reset.c +++ b/test/dm/reset.c @@ -35,8 +35,6 @@ static int dm_test_reset(struct unit_test_state *uts) ut_assertok(sandbox_reset_test_deassert(dev_test)); ut_asserteq(0, sandbox_reset_query(dev_reset, TEST_RESET_ID));
- ut_assertok(sandbox_reset_test_free(dev_test)); - return 0; } DM_TEST(dm_test_reset, DM_TESTF_SCAN_FDT);

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
Signed-off-by: Dinh Nguyen dinguyen@kernel.org --- drivers/reset/reset-uclass.c | 28 ---------------------------- include/reset-uclass.h | 21 --------------------- include/reset.h | 23 ----------------------- 3 files changed, 72 deletions(-)
diff --git a/drivers/reset/reset-uclass.c b/drivers/reset/reset-uclass.c index 9a5c9c9..24dd48c 100644 --- a/drivers/reset/reset-uclass.c +++ b/drivers/reset/reset-uclass.c @@ -72,12 +72,6 @@ int reset_get_by_index(struct udevice *dev, int index, return ret; }
- ret = ops->request(reset_ctl); - if (ret) { - debug("ops->request() failed: %d\n", ret); - return ret; - } - return 0; }
@@ -133,24 +127,6 @@ int reset_get_by_name(struct udevice *dev, const char *name, return reset_get_by_index(dev, index, reset_ctl); }
-int reset_request(struct reset_ctl *reset_ctl) -{ - struct reset_ops *ops = reset_dev_ops(reset_ctl->dev); - - debug("%s(reset_ctl=%p)\n", __func__, reset_ctl); - - return ops->request(reset_ctl); -} - -int reset_free(struct reset_ctl *reset_ctl) -{ - struct reset_ops *ops = reset_dev_ops(reset_ctl->dev); - - debug("%s(reset_ctl=%p)\n", __func__, reset_ctl); - - return ops->free(reset_ctl); -} - int reset_assert(struct reset_ctl *reset_ctl) { struct reset_ops *ops = reset_dev_ops(reset_ctl->dev); @@ -209,10 +185,6 @@ int reset_release_all(struct reset_ctl *reset_ctl, int count) ret = reset_assert(&reset_ctl[i]); if (ret) return ret; - - ret = reset_free(&reset_ctl[i]); - if (ret) - return ret; }
return 0; diff --git a/include/reset-uclass.h b/include/reset-uclass.h index 50fbeb1..a6301cf 100644 --- a/include/reset-uclass.h +++ b/include/reset-uclass.h @@ -40,27 +40,6 @@ struct reset_ops { int (*of_xlate)(struct reset_ctl *reset_ctl, struct ofnode_phandle_args *args); /** - * request - Request a translated reset control. - * - * The reset core calls this function as the second step in - * implementing a client's reset_get_by_*() call, following a - * successful xxx_xlate() call. - * - * @reset_ctl: The reset control struct to request; this has been - * filled in by a previoux xxx_xlate() function call. - * @return 0 if OK, or a negative error code. - */ - int (*request)(struct reset_ctl *reset_ctl); - /** - * free - Free a previously requested reset control. - * - * This is the implementation of the client reset_free() API. - * - * @reset_ctl: The reset control to free. - * @return 0 if OK, or a negative error code. - */ - int (*free)(struct reset_ctl *reset_ctl); - /** * rst_assert - Assert a reset signal. * * Note: This function is named rst_assert not assert to avoid diff --git a/include/reset.h b/include/reset.h index d38f176..505de77 100644 --- a/include/reset.h +++ b/include/reset.h @@ -134,24 +134,6 @@ int reset_get_by_name(struct udevice *dev, const char *name, struct reset_ctl *reset_ctl);
/** - * reset_request - Request a reset signal. - * - * @reset_ctl: A reset control struct. - * - * @return 0 if OK, or a negative error code. - */ -int reset_request(struct reset_ctl *reset_ctl); - -/** - * reset_free - Free a previously requested reset signal. - * - * @reset_ctl: A reset control struct that was previously successfully - * requested by reset_get_by_*(). - * @return 0 if OK, or a negative error code. - */ -int reset_free(struct reset_ctl *reset_ctl); - -/** * reset_assert - Assert a reset signal. * * This function will assert the specified reset signal, thus resetting the @@ -254,11 +236,6 @@ static inline int reset_get_by_name(struct udevice *dev, const char *name, return -ENOTSUPP; }
-static inline int reset_free(struct reset_ctl *reset_ctl) -{ - return 0; -} - static inline int reset_assert(struct reset_ctl *reset_ctl) { return 0;

+Stephen for comment
Hi Dinh,
On 14 April 2018 at 12:51, Dinh Nguyen dinguyen@kernel.org wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
The API is set to line up with clocks. I think in general we do want to be able to request and free these devices, just as we do for GPIOs. What is the goal of removing these methods?
Regards, Simon

On 04/16/2018 12:43 PM, Simon Glass wrote:
+Stephen for comment
Hi Dinh,
On 14 April 2018 at 12:51, Dinh Nguyen dinguyen@kernel.org wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
The API is set to line up with clocks. I think in general we do want to be able to request and free these devices, just as we do for GPIOs. What is the goal of removing these methods?
Many of the request methods do in fact do something; they check the validity of the reset ID so that check doesn't need to be duplicated everywhere. Even ignoring that, any resource management API should have explicit request/free APIs so that lifetime can be tracked if needed.

On 04/16/2018 01:51 PM, Stephen Warren wrote:
On 04/16/2018 12:43 PM, Simon Glass wrote:
+Stephen for comment
Hi Dinh,
On 14 April 2018 at 12:51, Dinh Nguyen dinguyen@kernel.org wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
The API is set to line up with clocks. I think in general we do want to be able to request and free these devices, just as we do for GPIOs. What is the goal of removing these methods?
Many of the request methods do in fact do something; they check the validity of the reset ID so that check doesn't need to be duplicated everywhere. Even ignoring that, any resource management API should have explicit request/free APIs so that lifetime can be tracked if needed.
Agreed, that the checks were in some of the request functions, but the majority did not do any checks, just a debug() statement. All of the platforms that did the checks, I just moved them to reset_assert and reset_deassert.
Dinh

H Dinh,
On 16 April 2018 at 16:41, Dinh Nguyen dinguyen@kernel.org wrote:
On 04/16/2018 01:51 PM, Stephen Warren wrote:
On 04/16/2018 12:43 PM, Simon Glass wrote:
+Stephen for comment
Hi Dinh,
On 14 April 2018 at 12:51, Dinh Nguyen dinguyen@kernel.org wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
The API is set to line up with clocks. I think in general we do want to be able to request and free these devices, just as we do for GPIOs. What is the goal of removing these methods?
Many of the request methods do in fact do something; they check the validity of the reset ID so that check doesn't need to be duplicated everywhere. Even ignoring that, any resource management API should have explicit request/free APIs so that lifetime can be tracked if needed.
Agreed, that the checks were in some of the request functions, but the majority did not do any checks, just a debug() statement. All of the platforms that did the checks, I just moved them to reset_assert and reset_deassert.
OK. Please can resend the series without removing those methods?
Regards, Simon

On 04/16/2018 01:43 PM, Simon Glass wrote:
+Stephen for comment
Hi Dinh,
On 14 April 2018 at 12:51, Dinh Nguyen dinguyen@kernel.org wrote:
The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.
The API is set to line up with clocks. I think in general we do want to be able to request and free these devices, just as we do for GPIOs. What is the goal of removing these methods?
It was a suggestion from Marek. I just didn't see any useful code implemented in any of the request/free functions.
Dinh
participants (4)
-
Dinh Nguyen
-
Patrice CHOTARD
-
Simon Glass
-
Stephen Warren