public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
To: Lucas Tanure <tanure@linux.com>
Cc: Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.wolfsonmicro.com>,
	Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH] ASoC: wm2000: Use a signed return type for regmap_read
Date: Tue, 26 Jan 2016 16:52:49 +0000	[thread overview]
Message-ID: <20160126165249.GN1490@localhost.localdomain> (raw)
In-Reply-To: <1453751293-28246-1-git-send-email-tanure@linux.com>

On Mon, Jan 25, 2016 at 05:48:13PM -0200, Lucas Tanure wrote:
> The return type "unsigned int" was used by the regmap_read() function despite
> of the aspect that it will eventually return a negative error code. So, change
> to signed int and get reg by reference in the parameters
> 
> Signed-off-by: Lucas Tanure <tanure@linux.com>
> ---
>  sound/soc/codecs/wm2000.c | 25 +++++++++----------------
>  1 file changed, 9 insertions(+), 16 deletions(-)
> 
> diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
> index a67ea10..990d710 100644
> --- a/sound/soc/codecs/wm2000.c
> +++ b/sound/soc/codecs/wm2000.c
> @@ -88,17 +88,11 @@ static int wm2000_write(struct i2c_client *i2c, unsigned int reg,
>  	return regmap_write(wm2000->regmap, reg, value);
>  }
>  
> -static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r)
> +static int wm2000_read(struct i2c_client *i2c, unsigned int reg,
> +			unsigned int *value)
>  {
>  	struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c);
> -	unsigned int val;
> -	int ret;
> -
> -	ret = regmap_read(wm2000->regmap, r, &val);
> -	if (ret < 0)
> -		return -1;
> -
> -	return val;
> +	return regmap_read(wm2000->regmap, reg, value);

At this point the wm2000_read function is not really adding
anything feels like we should just remove it and use regmap_read
directly.

Thanks,
Charles

      reply	other threads:[~2016-01-26 16:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-25 19:48 [PATCH] ASoC: wm2000: Use a signed return type for regmap_read Lucas Tanure
2016-01-26 16:52 ` Charles Keepax [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=20160126165249.GN1490@localhost.localdomain \
    --to=ckeepax@opensource.wolfsonmicro.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.wolfsonmicro.com \
    --cc=perex@perex.cz \
    --cc=tanure@linux.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