Skip to contentSkip to conversation

reset: remove request and free functions

PATCH New Dinh Nguyen 4 participants 22 messages Apr 14, 2018 – Apr 17, 2018

Subsystems (12)
lore
Share & tools
lore
#0 lore raw

cover 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(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/14 reset: tegra: remove request and free functions

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/tegra-car-reset.c | 24 +++++-------------------
 drivers/reset/tegra186-reset.c  | 18 ------------------
 2 files changed, 5 insertions(+), 37 deletions(-)
drivers/reset/tegra-car-reset.c +5 -19
index 3147a50..b776adf 100644
@@ -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,
 };
drivers/reset/tegra186-reset.c +0 -18
index 228adda..f83c50b 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/14 reset: sti: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/sti-reset.c   | 12 ------------
 drivers/reset/stm32-reset.c | 12 ------------
 2 files changed, 24 deletions(-)
drivers/reset/sti-reset.c +0 -12
index 0fc5a28..672dd97 100644
@@ -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,
 };
drivers/reset/stm32-reset.c +0 -12
index e98f34b..efde745 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#3 lore raw

PATCH 2/14 reset: sti: remove request and free functions

Hi Dinh

Quoted 62 lines · Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
  drivers/reset/sti-reset.c   | 12 ------------
  drivers/reset/stm32-reset.c | 12 ------------
  2 files changed, 24 deletions(-)
drivers/reset/sti-reset.c +0 -12
index 0fc5a28..672dd97 100644
@@ -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,
  };
drivers/reset/stm32-reset.c +0 -10
index e98f34b..efde745 100644
@@ -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);

drivers/reset/stm32-reset.c static int stm32_reset_deassert(struct reset_ctl *reset_ctl) · line 63

Quoted 8 lines
drivers/reset/stm32-reset.c +0 -2
@@ -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,
  };

Thanks

#4 lore raw

PATCH 3/14 reset: uniphier: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-uniphier.c | 12 ------------
 1 file changed, 12 deletions(-)
drivers/reset/reset-uniphier.c +0 -12
index a40cea5..5b1d923 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#5 lore raw

PATCH 4/14 reset: rockchip: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-rockchip.c | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)
drivers/reset/reset-rockchip.c +3 -23
index 01047a2..5eecd51 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#6 lore raw

PATCH 5/14 reset: meson: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-meson.c | 18 +++---------------
 1 file changed, 3 insertions(+), 15 deletions(-)
drivers/reset/reset-meson.c +3 -15
index 5324f86..8bbaa6c 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#7 lore raw

PATCH 6/14 reset: bcm6345: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-bcm6345.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)
drivers/reset/reset-bcm6345.c +6 -15
index ebf6bee..b49a2f1 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#8 lore raw

PATCH 7/14 reset: ast2500: remove request function

In reply to Dinh Nguyen

The request reset function is not really used for any useful purpose except for debugging. We can safely remove it.

---
 drivers/reset/ast2500-reset.c | 9 ---------
 1 file changed, 9 deletions(-)
drivers/reset/ast2500-reset.c +0 -9
index b2c89e1..65708cf 100644
@@ -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) = {
Signature · 1 line
2.7.4
#9 lore raw

PATCH 8/14 reset: socfpga: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-socfpga.c | 18 ------------------
 1 file changed, 18 deletions(-)
drivers/reset/reset-socfpga.c +0 -18
index 466455d..3d04132 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#10 lore raw

PATCH 9/14 reset: sandbox: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/sandbox-reset.c | 25 ++++++-------------------
 1 file changed, 6 insertions(+), 19 deletions(-)
drivers/reset/sandbox-reset.c +6 -19
index c310749..a75143f 100644
@@ -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,
 };
Signature · 1 line
2.7.4
#11 lore raw

PATCH 10/14 net: dwc_eth_qos: remove reset_free from driver

In reply to Dinh Nguyen

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.

---
 drivers/net/dwc_eth_qos.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/net/dwc_eth_qos.c +0 -4
index 232e803..a3f1b40 100644
@@ -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;
Signature · 1 line
2.7.4
#12 lore raw

PATCH 11/14 phy: bcm63xx: remove reset_free function

In reply to Dinh Nguyen

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.

---
 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(-)
drivers/phy/bcm6318-usbh-phy.c +0 -4
index 6d54214..70907be 100644
@@ -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;
drivers/phy/bcm6348-usbh-phy.c +0 -4
index 169ee0e..2cc04e1 100644
@@ -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;
 }
 
drivers/phy/bcm6358-usbh-phy.c +0 -4
index e000316..0440388 100644
@@ -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;
 }
 
drivers/phy/bcm6368-usbh-phy.c +0 -4
index 71abc0f..38dd5e0 100644
@@ -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) {
drivers/spi/bcm63xx_hsspi.c +0 -4
index 3393166..ddf75f0 100644
@@ -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);
 
drivers/spi/bcm63xx_spi.c +0 -4
index f0df687..71bb07d 100644
@@ -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]);
 
Signature · 1 line
2.7.4
#13 lore raw

PATCH 12/14 usb: ehci/ohci: remove reset_free function

In reply to Dinh Nguyen

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.

---
 drivers/usb/host/ehci-generic.c | 1 -
 drivers/usb/host/ohci-generic.c | 1 -
 2 files changed, 2 deletions(-)
drivers/usb/host/ehci-generic.c +0 -1
index b012d86..8ed6a27 100644
@@ -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++;
drivers/usb/host/ohci-generic.c +0 -1
index 5bdd799..f61c0fc 100644
@@ -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++;
Signature · 1 line
2.7.4
#14 lore raw

PATCH 12/14 usb: ehci/ohci: remove reset_free function

Hi Dinh

Quoted 30 lines · Dinh Nguyen

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.

---
  drivers/usb/host/ehci-generic.c | 1 -
  drivers/usb/host/ohci-generic.c | 1 -
  2 files changed, 2 deletions(-)
drivers/usb/host/ehci-generic.c +0 -1
index b012d86..8ed6a27 100644
@@ -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++;
drivers/usb/host/ohci-generic.c +0 -0
index 5bdd799..f61c0fc 100644

drivers/usb/host/ohci-generic.c static int ohci_usb_probe(struct udevice *dev) · line 130

Quoted 7 lines
drivers/usb/host/ohci-generic.c +0 -1
@@ -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++;
#15 lore raw

PATCH 13/14 reset: test: remove sandbox_reset_test_free function

In reply to Dinh Nguyen

Remove sandbox_reset_test_free() because it calls reset_free, which is being removed.

---
 arch/sandbox/include/asm/reset.h   | 1 -
 drivers/reset/sandbox-reset-test.c | 7 -------
 test/dm/reset.c                    | 2 --
 3 files changed, 10 deletions(-)
arch/sandbox/include/asm/reset.h +0 -1
index 0cd7702..c54b266 100644
@@ -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
drivers/reset/sandbox-reset-test.c +0 -7
index f0ceaa0..91a1f6e 100644
@@ -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);
test/dm/reset.c +0 -2
index 8dc0023..289693d 100644
@@ -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);
Signature · 1 line
2.7.4
#16 lore raw

PATCH 14/14 reset: remove request and free functions

In reply to Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

---
 drivers/reset/reset-uclass.c | 28 ----------------------------
 include/reset-uclass.h       | 21 ---------------------
 include/reset.h              | 23 -----------------------
 3 files changed, 72 deletions(-)
drivers/reset/reset-uclass.c +0 -28
index 9a5c9c9..24dd48c 100644
@@ -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;
include/reset-uclass.h +0 -21
index 50fbeb1..a6301cf 100644
@@ -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
include/reset.h +0 -23
index d38f176..505de77 100644
@@ -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;
Signature · 1 line
2.7.4
#17 lore raw

PATCH 14/14 reset: remove request and free functions

+Stephen for comment

Hi Dinh,

Quoted 2 lines · Dinh Nguyen

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

#18 lore raw

PATCH 14/14 reset: remove request and free functions

Quoted 11 lines · Simon Glass

+Stephen for comment

Hi Dinh,

Quoted 2 lines · Dinh Nguyen

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.

#19 lore raw

PATCH 14/14 reset: remove request and free functions

Quoted 9 lines · Stephen Warren
Quoted 8 lines · Simon Glass

+Stephen for comment

Hi Dinh,

Quoted 2 lines · Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

Quoted 8 lines
Quoted 3 lines

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

#20 lore raw

PATCH 14/14 reset: remove request and free functions

H Dinh,

Quoted 21 lines · Dinh Nguyen
Quoted 9 lines · Stephen Warren
Quoted 8 lines · Simon Glass

+Stephen for comment

Hi Dinh,

Quoted 2 lines · Dinh Nguyen

The request and free reset functions are not really used for any useful purpose but for debugging. We can safely remove them.

Quoted 8 lines
Quoted 3 lines

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.

Quoted 4 lines

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

#21 lore raw

PATCH 14/14 reset: remove request and free functions

In reply to Simon Glass
Quoted 4 lines · Simon Glass

+Stephen for comment

Hi Dinh,

Quoted 8 lines
Quoted 2 lines · Dinh Nguyen

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