All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Axel Lin <axel.lin@gmail.com>
Cc: Yong Shen <yong.shen@linaro.org>,
	Fabio Estevam <fabio.estevam@freescale.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	Arnaud Patard <arnaud.patard@rtp-net.org>,
	Liam Girdwood <lrg@ti.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] regulator: mc13783: Make mc13783_powermisc_rmw() lock protected
Date: Wed, 1 Aug 2012 20:59:48 +0100	[thread overview]
Message-ID: <20120801195947.GJ4483@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1342667766.6294.2.camel@phoenix>

On Thu, Jul 19, 2012 at 11:16:06AM +0800, Axel Lin wrote:
> Then we can remove lock/unlock around the caller.

Applied both, thanks.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/mc13783-regulator.c |   22 ++++++++--------------
>  1 file changed, 8 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c
> index 4932e34..2587ea1 100644
> --- a/drivers/regulator/mc13783-regulator.c
> +++ b/drivers/regulator/mc13783-regulator.c
> @@ -238,9 +238,10 @@ static int mc13783_powermisc_rmw(struct mc13xxx_regulator_priv *priv, u32 mask,
>  
>  	BUG_ON(val & ~mask);
>  
> +	mc13xxx_lock(priv->mc13xxx);
>  	ret = mc13xxx_reg_read(mc13783, MC13783_REG_POWERMISC, &valread);
>  	if (ret)
> -		return ret;
> +		goto out;
>  
>  	/* Update the stored state for Power Gates. */
>  	priv->powermisc_pwgt_state =
> @@ -253,7 +254,10 @@ static int mc13783_powermisc_rmw(struct mc13xxx_regulator_priv *priv, u32 mask,
>  	valread = (valread & ~MC13783_REG_POWERMISC_PWGTSPI_M) |
>  						priv->powermisc_pwgt_state;
>  
> -	return mc13xxx_reg_write(mc13783, MC13783_REG_POWERMISC, valread);
> +	ret = mc13xxx_reg_write(mc13783, MC13783_REG_POWERMISC, valread);
> +out:
> +	mc13xxx_unlock(priv->mc13xxx);
> +	return ret;
>  }
>  
>  static int mc13783_gpo_regulator_enable(struct regulator_dev *rdev)
> @@ -261,7 +265,6 @@ static int mc13783_gpo_regulator_enable(struct regulator_dev *rdev)
>  	struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
>  	struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
>  	int id = rdev_get_id(rdev);
> -	int ret;
>  	u32 en_val = mc13xxx_regulators[id].enable_bit;
>  
>  	dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);
> @@ -271,12 +274,8 @@ static int mc13783_gpo_regulator_enable(struct regulator_dev *rdev)
>  	    id == MC13783_REG_PWGT2SPI)
>  		en_val = 0;
>  
> -	mc13xxx_lock(priv->mc13xxx);
> -	ret = mc13783_powermisc_rmw(priv, mc13xxx_regulators[id].enable_bit,
> +	return mc13783_powermisc_rmw(priv, mc13xxx_regulators[id].enable_bit,
>  					en_val);

      parent reply	other threads:[~2012-08-01 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-19  3:16 [PATCH 1/2] regulator: mc13783: Make mc13783_powermisc_rmw() lock protected Axel Lin
2012-07-19  3:17 ` [PATCH 2/2] regulator: mc13892: Make mc13892_powermisc_rmw() " Axel Lin
2012-08-01 19:59 ` Mark Brown [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120801195947.GJ4483@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=arnaud.patard@rtp-net.org \
    --cc=axel.lin@gmail.com \
    --cc=fabio.estevam@freescale.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=s.hauer@pengutronix.de \
    --cc=yong.shen@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.