public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Bengt Jönsson" <bengt.g.jonsson@stericsson.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Lee Jones <lee.jones@linaro.org>,
	Yvan FILLION <yvan.fillion@stericsson.com>,
	Liam Girdwood <lgirdwood@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 2/2] regulator: ab8500-ext: Remove enable() and disable() functions
Date: Wed, 17 Apr 2013 10:52:06 +0200	[thread overview]
Message-ID: <516E62B6.7050009@stericsson.com> (raw)
In-Reply-To: <1366126380.14735.4.camel@phoenix>

On 04/16/2013 05:33 PM, Axel Lin wrote:
> Both enable() and disable() functions have only one caller, thus remove them.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
Looks fine.

Acked-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
> ---
>   drivers/regulator/ab8500-ext.c |   64 +++++++++++++++-------------------------
>   1 file changed, 23 insertions(+), 41 deletions(-)
>
> diff --git a/drivers/regulator/ab8500-ext.c b/drivers/regulator/ab8500-ext.c
> index 03faf9c..b4d4547 100644
> --- a/drivers/regulator/ab8500-ext.c
> +++ b/drivers/regulator/ab8500-ext.c
> @@ -54,32 +54,44 @@ struct ab8500_ext_regulator_info {
>   	u8 update_val_hw;
>   };
>   
> -static int enable(struct ab8500_ext_regulator_info *info, u8 *regval)
> +static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
>   {
>   	int ret;
> +	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
> +	u8 regval;
>   
> -	*regval = info->update_val;
> +	if (info == NULL) {
> +		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
> +		return -EINVAL;
> +	}
>   
>   	/*
>   	 * To satisfy both HW high power request and SW request, the regulator
>   	 * must be on in high power.
>   	 */
>   	if (info->cfg && info->cfg->hwreq)
> -		*regval = info->update_val_hp;
> +		regval = info->update_val_hp;
> +	else
> +		regval = info->update_val;
>   
>   	ret = abx500_mask_and_set_register_interruptible(info->dev,
>   		info->update_bank, info->update_reg,
> -		info->update_mask, *regval);
> +		info->update_mask, regval);
>   	if (ret < 0) {
>   		dev_err(rdev_get_dev(info->rdev),
>   			"couldn't set enable bits for regulator\n");
>   		return ret;
>   	}
>   
> -	return ret;
> +	dev_dbg(rdev_get_dev(rdev),
> +		"%s-enable (bank, reg, mask, value): 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
> +		info->desc.name, info->update_bank, info->update_reg,
> +		info->update_mask, regval);
> +
> +	return 0;
>   }
>   
> -static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
> +static int ab8500_ext_regulator_disable(struct regulator_dev *rdev)
>   {
>   	int ret;
>   	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
> @@ -90,59 +102,29 @@ static int ab8500_ext_regulator_enable(struct regulator_dev *rdev)
>   		return -EINVAL;
>   	}
>   
> -	ret = enable(info, &regval);
> -
> -	dev_dbg(rdev_get_dev(rdev), "%s-enable (bank, reg, mask, value):"
> -		" 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
> -		info->desc.name, info->update_bank, info->update_reg,
> -		info->update_mask, regval);
> -
> -	return ret;
> -}
> -
> -static int disable(struct ab8500_ext_regulator_info *info, u8 *regval)
> -{
> -	int ret;
> -
> -	*regval = 0x0;
> -
>   	/*
>   	 * Set the regulator in HW request mode if configured
>   	 */
>   	if (info->cfg && info->cfg->hwreq)
> -		*regval = info->update_val_hw;
> +		regval = info->update_val_hw;
> +	else
> +		regval = 0;
>   
>   	ret = abx500_mask_and_set_register_interruptible(info->dev,
>   		info->update_bank, info->update_reg,
> -		info->update_mask, *regval);
> +		info->update_mask, regval);
>   	if (ret < 0) {
>   		dev_err(rdev_get_dev(info->rdev),
>   			"couldn't set disable bits for regulator\n");
>   		return ret;
>   	}
>   
> -	return ret;
> -}
> -
> -static int ab8500_ext_regulator_disable(struct regulator_dev *rdev)
> -{
> -	int ret;
> -	struct ab8500_ext_regulator_info *info = rdev_get_drvdata(rdev);
> -	u8 regval;
> -
> -	if (info == NULL) {
> -		dev_err(rdev_get_dev(rdev), "regulator info null pointer\n");
> -		return -EINVAL;
> -	}
> -
> -	ret = disable(info, &regval);
> -
>   	dev_dbg(rdev_get_dev(rdev), "%s-disable (bank, reg, mask, value):"
>   		" 0x%02x, 0x%02x, 0x%02x, 0x%02x\n",
>   		info->desc.name, info->update_bank, info->update_reg,
>   		info->update_mask, regval);
>   
> -	return ret;
> +	return 0;
>   }
>   
>   static int ab8500_ext_regulator_is_enabled(struct regulator_dev *rdev)


  reply	other threads:[~2013-04-17  8:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-16 15:29 [PATCH v2 1/2] regulator: ab8500-ext: Don't update info->update_val if set_mode() fails Axel Lin
2013-04-16 15:33 ` [PATCH v2 2/2] regulator: ab8500-ext: Remove enable() and disable() functions Axel Lin
2013-04-17  8:52   ` Bengt Jönsson [this message]
2013-04-17  8:51 ` [PATCH v2 1/2] regulator: ab8500-ext: Don't update info->update_val if set_mode() fails Bengt Jönsson
2013-04-17 14:10 ` Mark Brown

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=516E62B6.7050009@stericsson.com \
    --to=bengt.g.jonsson@stericsson.com \
    --cc=axel.lin@ingics.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yvan.fillion@stericsson.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox