Re: [PATCH v4 1/3] iio: adc: Fix incorrect reading when datarate changed in single mode

From: Matti Vaittinen

Date: Tue Jun 30 2026 - 08:17:01 EST


On 30/06/2026 14:36, Andy Shevchenko wrote:
On Mon, Jun 29, 2026 at 11:51:18PM +0100, Jonathan Cameron wrote:

// snip


PM_RUNTIME_ACQUIRE_AUTOSUSPEND(&data->client->dev, pm);
ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
if (ret)
return ret;

//note that we 'could' do what some other users of ACQUIRE_ERR()
//have allowed
if ((ret = PM_RUNTIME_ACQUIRE_ERR(&pm)))
return ret;

I'm open to hear if people think we should allow this or not.

I'm against that. The style is prone for errors and readability issues.

I used to use assignments in conditions a lot, long long time ago, when I worked in another company, far far away :)

Andy, I promise you, you would get used to it ;)

But for now I agree with Andy. As long as assignments in conditions are a No No everywhere else, then doing an odd exception sounds, as exceptions sound, unexpected. So, even if I am not strongly against assignments in conditions overall, I believe that doing it just in one odd case, indeed brings us readability issues.

Just my random 5 (or so) cents.

-- Matti

--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~