public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
To: "David Lechner" <dlechner@baylibre.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andrew Ijano" <andrew.ijano@gmail.com>,
	"Antoniu Miclaus" <antoniu.miclaus@analog.com>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, error27@gmail.com,
	andriy.shevchenko@intel.com
Subject: Re: [PATCH v2 next 3/5] iio: sca3000: stop interrupts via devm_add_action_or_reset()
Date: Tue, 3 Feb 2026 15:57:18 +0530	[thread overview]
Message-ID: <2c106b65-7fae-433f-9a44-4b295a43e2f0@oracle.com> (raw)
In-Reply-To: <59105c6f-67b1-435c-aa08-5f440745b1b4@baylibre.com>

Hi David,


On 03/02/26 04:34, David Lechner wrote:
> On 2/2/26 1:40 PM, Harshit Mogalapalli wrote:
>> sca3000_stop_all_interrupts() is moved above the probe routine so the
>> new function sca3000_disable_interrupts() used in probe can directly
>> call it without additional declaration.
>>
>> Used devm_add_action_or_reset() for shutting down the interrupts.
>>
>> No functional change intended.
>>
>> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
>> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
>> ---
>> v1->v2: Jonathan found a broken tear down sequence that was introduced
>> by my ptach 3 in v1: https://lore.kernel.org/all/20260131163218.2a4b93e5@jic23-huawei/
>>
>> So first converted the interrupt disabling task to devm based call,
>> order of tear down is as follows after this patch: iio_unregister_device
>> is called in the remove() callback, post which any interrupts will be
>> disabled with devm_add_action_or_reset() call.
>> ---
>>   drivers/iio/accel/sca3000.c | 53 ++++++++++++++++++++++---------------
>>   1 file changed, 31 insertions(+), 22 deletions(-)
>>
>> diff --git a/drivers/iio/accel/sca3000.c b/drivers/iio/accel/sca3000.c
>> index 37ef724d5dc5..4faffeea328c 100644
>> --- a/drivers/iio/accel/sca3000.c
>> +++ b/drivers/iio/accel/sca3000.c
>> @@ -1437,6 +1437,33 @@ static const struct iio_info sca3000_info = {
>>   	.write_event_config = &sca3000_write_event_config,
>>   };
>>   
>> +static int sca3000_stop_all_interrupts(struct sca3000_state *st)
> 
> Return value is ignored now, so we can make this void and not return.
> 
>> +{
>> +	int ret;
>> +
>> +	mutex_lock(&st->lock);
>> +	ret = sca3000_read_data_short(st, SCA3000_REG_INT_MASK_ADDR, 1);
>> +	if (ret)
>> +		goto error_ret;
>> +	ret = sca3000_write_reg(st, SCA3000_REG_INT_MASK_ADDR,
>> +				(st->rx[0] &
>> +				 ~(SCA3000_REG_INT_MASK_RING_THREE_QUARTER |
>> +				   SCA3000_REG_INT_MASK_RING_HALF |
>> +				   SCA3000_REG_INT_MASK_ALL_INTS)));
>> +error_ret:
>> +	mutex_unlock(&st->lock);
>> +	return ret;
>> +}
>> +
>> +static void sca3000_disable_interrupts(void *data)
>> +{
>> +	struct iio_dev *indio_dev = data;
>> +	struct sca3000_state *st = iio_priv(indio_dev);
>> +
>> +	/* Must ensure no interrupts can be generated after this! */
>> +	sca3000_stop_all_interrupts(st);
>> +}
> 
> This wrapper doesn't seem necessary. We can combine to two functions
> above into one.

Thanks for the review, Sure, will remove this extra wrapper and add the 
needed things in the same sca3000_stop_all_interrupts() function.

Regards,
Harshit
> 


  reply	other threads:[~2026-02-03 10:27 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 19:40 [PATCH v2 next 0/5] IIO: sca3000: devm resource management Harshit Mogalapalli
2026-02-02 19:40 ` [PATCH v2 next 1/5] iio: sca3000: cache SPI device ID in probe Harshit Mogalapalli
2026-02-02 23:01   ` David Lechner
2026-02-03 10:24     ` Harshit Mogalapalli
2026-02-03 15:26       ` David Lechner
2026-02-02 19:40 ` [PATCH v2 next 2/5] iio: sca3000: switch IRQ handling to devm helpers Harshit Mogalapalli
2026-02-02 23:06   ` David Lechner
2026-02-02 19:40 ` [PATCH v2 next 3/5] iio: sca3000: stop interrupts via devm_add_action_or_reset() Harshit Mogalapalli
2026-02-02 23:04   ` David Lechner
2026-02-03 10:27     ` Harshit Mogalapalli [this message]
2026-02-02 19:40 ` [PATCH v2 next 4/5] iio: sca3000: manage device registration with devm helper Harshit Mogalapalli
2026-02-02 23:07   ` David Lechner
2026-02-03 12:29     ` Harshit Mogalapalli
2026-02-02 19:40 ` [PATCH v2 next 5/5] iio: sca3000: use guard(mutex) to simplify return paths Harshit Mogalapalli
2026-02-02 23:09   ` David Lechner
2026-02-03  9:48 ` [PATCH v2 next 0/5] IIO: sca3000: devm resource management Andy Shevchenko
2026-02-03 10:29   ` Harshit Mogalapalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c106b65-7fae-433f-9a44-4b295a43e2f0@oracle.com \
    --to=harshit.m.mogalapalli@oracle.com \
    --cc=andrew.ijano@gmail.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=antoniu.miclaus@analog.com \
    --cc=dlechner@baylibre.com \
    --cc=error27@gmail.com \
    --cc=jic23@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox