[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <37f9c6bd-f3b2-4258-a455-c4b08023d8a9@gmail.com>
Date: Fri, 5 Sep 2025 08:47:44 +0300
From: Matti Vaittinen <mazziesaccount@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...el.com>
Cc: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>,
Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
Marcelo Schmitt <marcelo.schmitt@...log.com>,
Javier Carrasco <javier.carrasco.cruz@...il.com>,
Tobias Sperling <tobias.sperling@...ting.com>,
Antoniu Miclaus <antoniu.miclaus@...log.com>,
Trevor Gamblin <tgamblin@...libre.com>, Esteban Blanc <eblanc@...libre.com>,
Ramona Alexandra Nechita <ramona.nechita@...log.com>,
Thomas Bonnefille <thomas.bonnefille@...tlin.com>,
Hans de Goede <hansg@...nel.org>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-gpio@...r.kernel.org
Subject: Re: [PATCH 2/3] iio: adc: Support ROHM BD79112 ADC/GPIO
On 02/09/2025 17:15, Andy Shevchenko wrote:
>> + ret = devm_iio_adc_device_alloc_chaninfo_se(dev, &bd79112_chan_template,
>> + BD79112_MAX_NUM_CHANNELS - 1, &cs);
>
> Hmm... Indentation can be amended.
>
>> + if (ret < 0) {
>
> Why ' < 0' ?
>
>> + /* Register all pins as GPIOs if there are no ADC channels */
>> + if (ret == -ENOENT)
>> + goto register_gpios;
>> +
>> + return ret;
>> + }
>
> Assuming ret can't be positive this can be refactored as:
I returned back to this after reading your comment to v2.
ret can be positive.
>
> /* Register all pins as GPIOs if there are no ADC channels */
> if (ret == -ENOENT)
> goto register_gpios;
> else if (ret)
> return ret;
>
> I find it easier to follow.
I still kinda like your suggestion. I'll change this to something like
below for v3:
/* Register all pins as GPIOs if there are no ADC channels */
if (ret == -ENOENT)
goto register_gpios;
if (ret < 0)
return ret;
Thanks again!
Yours,
-- Matti
Powered by blists - more mailing lists