[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <522A000D-C2B7-4D61-A21C-D44026A4A3CC@jic23.retrosnub.co.uk>
Date: Mon, 01 May 2017 21:18:07 +0100
From: Jonathan Cameron <jic23@...23.retrosnub.co.uk>
To: Andy Shevchenko <andy.shevchenko@...il.com>
CC: Jonathan Cameron <jic23@...nel.org>,
Eva Rachel Retuya <eraretuya@...il.com>,
linux-iio@...r.kernel.org, Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald <pmeerw@...erw.net>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Michael Hennerich <michael.hennerich@...log.com>,
Daniel Baluta <daniel.baluta@...il.com>,
Alison Schofield <amsfield22@...il.com>,
Florian Vaussard <florian.vaussard@...g-vd.ch>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 2/4] iio: accel: adxl345_core: Introduce set_mode and data_ready functions
On 1 May 2017 21:07:44 BST, Andy Shevchenko <andy.shevchenko@...il.com> wrote:
>On Mon, May 1, 2017 at 10:48 PM, Jonathan Cameron
><jic23@...23.retrosnub.co.uk> wrote:
>> On 1 May 2017 20:42:08 BST, Andy Shevchenko
><andy.shevchenko@...il.com> wrote:
>>>On Mon, May 1, 2017 at 3:22 AM, Jonathan Cameron <jic23@...nel.org>
>>>wrote:
>>>> On 29/04/17 08:48, Eva Rachel Retuya wrote:
>>>
>>>>> +static int adxl345_set_mode(struct adxl345_data *data, u8 mode)
>>>>> +{
>>>>> + struct device *dev = regmap_get_device(data->regmap);
>>>>> + int ret;
>>>>> +
>>>>> + ret = regmap_write(data->regmap, ADXL345_REG_POWER_CTL,
>mode);
>>>>> + if (ret < 0) {
>>>>> + dev_err(dev, "Failed to set power mode, %d\n", ret);
>>>>> + return ret;
>>>> drop the return ret here and just return ret at the end of the
>>>function.
>>>> One of the static checkers will probably moan about this otherwise.
>>>
>>>But this will be not equivalent!
>> Why? Regmap_write returns 0 for success.
>
>If there is a qurantee that regmap_write() doesn't return any positive
>values, I'm okay with replacement.
Kernel doc says so.
>http://lxr.free-electrons.com/source/drivers/base/regmap/regmap.c#L1693
>>>
>>>>> + }
>>>>> +
>>>>> + return 0;
>>>>> +}
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Powered by blists - more mailing lists