From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S966847AbcAZQxD (ORCPT ); Tue, 26 Jan 2016 11:53:03 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:39464 "EHLO mx0a-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965442AbcAZQw6 (ORCPT ); Tue, 26 Jan 2016 11:52:58 -0500 Authentication-Results: ppops.net; spf=none smtp.mail=ckeepax@opensource.wolfsonmicro.com Date: Tue, 26 Jan 2016 16:52:49 +0000 From: Charles Keepax To: Lucas Tanure CC: Liam Girdwood , Mark Brown , , , Jaroslav Kysela Subject: Re: [PATCH] ASoC: wm2000: Use a signed return type for regmap_read Message-ID: <20160126165249.GN1490@localhost.localdomain> References: <1453751293-28246-1-git-send-email-tanure@linux.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1453751293-28246-1-git-send-email-tanure@linux.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310008 definitions=main-1601260286 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > --- > 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