[1/2] iio: dac: stm32-dac: use reset controller only at probe time
diff mbox series

Message ID 1578921266-6025-2-git-send-email-fabrice.gasnier@st.com
State Accepted
Commit 4a001c96b1c6d39831be3ef957968404be96d75e
Headers show
Series
  • iio: dac: stm32-dac: improve reset controller use
Related show

Commit Message

Fabrice Gasnier Jan. 13, 2020, 1:14 p.m. UTC
From: Etienne Carriere <etienne.carriere@st.com>

This change removes the reset controller reference from the local
DAC instance since it is used only at probe time.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
---
 drivers/iio/dac/stm32-dac-core.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

Comments

Jonathan Cameron Jan. 18, 2020, 2:30 p.m. UTC | #1
On Mon, 13 Jan 2020 14:14:25 +0100
Fabrice Gasnier <fabrice.gasnier@st.com> wrote:

> From: Etienne Carriere <etienne.carriere@st.com>
> 
> This change removes the reset controller reference from the local
> DAC instance since it is used only at probe time.
> 
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Makes sense.

Applied to the togreg branch of iio.git and pushed out as testing
to let those autobuilders poke at it for a few hours.

Thanks,

Jonathan

> ---
>  drivers/iio/dac/stm32-dac-core.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
> index 9e6b4cd..4d93446 100644
> --- a/drivers/iio/dac/stm32-dac-core.c
> +++ b/drivers/iio/dac/stm32-dac-core.c
> @@ -20,13 +20,11 @@
>  /**
>   * struct stm32_dac_priv - stm32 DAC core private data
>   * @pclk:		peripheral clock common for all DACs
> - * @rst:		peripheral reset control
>   * @vref:		regulator reference
>   * @common:		Common data for all DAC instances
>   */
>  struct stm32_dac_priv {
>  	struct clk *pclk;
> -	struct reset_control *rst;
>  	struct regulator *vref;
>  	struct stm32_dac_common common;
>  };
> @@ -94,6 +92,7 @@ static int stm32_dac_probe(struct platform_device *pdev)
>  	struct regmap *regmap;
>  	struct resource *res;
>  	void __iomem *mmio;
> +	struct reset_control *rst;
>  	int ret;
>  
>  	if (!dev->of_node)
> @@ -148,11 +147,11 @@ static int stm32_dac_probe(struct platform_device *pdev)
>  	priv->common.vref_mv = ret / 1000;
>  	dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv);
>  
> -	priv->rst = devm_reset_control_get_exclusive(dev, NULL);
> -	if (!IS_ERR(priv->rst)) {
> -		reset_control_assert(priv->rst);
> +	rst = devm_reset_control_get_exclusive(dev, NULL);
> +	if (!IS_ERR(rst)) {
> +		reset_control_assert(rst);
>  		udelay(2);
> -		reset_control_deassert(priv->rst);
> +		reset_control_deassert(rst);
>  	}
>  
>  	if (cfg && cfg->has_hfsel) {

Patch
diff mbox series

diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
index 9e6b4cd..4d93446 100644
--- a/drivers/iio/dac/stm32-dac-core.c
+++ b/drivers/iio/dac/stm32-dac-core.c
@@ -20,13 +20,11 @@ 
 /**
  * struct stm32_dac_priv - stm32 DAC core private data
  * @pclk:		peripheral clock common for all DACs
- * @rst:		peripheral reset control
  * @vref:		regulator reference
  * @common:		Common data for all DAC instances
  */
 struct stm32_dac_priv {
 	struct clk *pclk;
-	struct reset_control *rst;
 	struct regulator *vref;
 	struct stm32_dac_common common;
 };
@@ -94,6 +92,7 @@  static int stm32_dac_probe(struct platform_device *pdev)
 	struct regmap *regmap;
 	struct resource *res;
 	void __iomem *mmio;
+	struct reset_control *rst;
 	int ret;
 
 	if (!dev->of_node)
@@ -148,11 +147,11 @@  static int stm32_dac_probe(struct platform_device *pdev)
 	priv->common.vref_mv = ret / 1000;
 	dev_dbg(dev, "vref+=%dmV\n", priv->common.vref_mv);
 
-	priv->rst = devm_reset_control_get_exclusive(dev, NULL);
-	if (!IS_ERR(priv->rst)) {
-		reset_control_assert(priv->rst);
+	rst = devm_reset_control_get_exclusive(dev, NULL);
+	if (!IS_ERR(rst)) {
+		reset_control_assert(rst);
 		udelay(2);
-		reset_control_deassert(priv->rst);
+		reset_control_deassert(rst);
 	}
 
 	if (cfg && cfg->has_hfsel) {