Messages in this thread | | | Date | Tue, 26 Jan 2016 16:52:49 +0000 | From | Charles Keepax <> | Subject | Re: [PATCH] ASoC: wm2000: Use a signed return type for regmap_read |
| |
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
| |