lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20120801195947.GJ4483@opensource.wolfsonmicro.com>
Date:	Wed, 1 Aug 2012 20:59:48 +0100
From:	Mark Brown <broonie@...nsource.wolfsonmicro.com>
To:	Axel Lin <axel.lin@...il.com>
Cc:	Yong Shen <yong.shen@...aro.org>,
	Fabio Estevam <fabio.estevam@...escale.com>,
	Sascha Hauer <s.hauer@...gutronix.de>,
	Arnaud Patard <arnaud.patard@...-net.org>,
	Liam Girdwood <lrg@...com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] regulator: mc13783: Make mc13783_powermisc_rmw()
 lock protected

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@...il.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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ