mirror of
https://github.com/torvalds/linux.git
synced 2026-05-27 16:44:58 +02:00
iio: sca3000: stop interrupts via devm_add_action_or_reset()
Used devm_add_action_or_reset() for shutting down the interrupts. Make sca3000_stop_all_interrupts() return void now that it always hooks into devm cleanup. No functional change intended. Suggested-by: David Lechner <dlechner@baylibre.com> Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
31ac64108d
commit
71d0d6a6ca
|
|
@ -1428,8 +1428,10 @@ static const struct iio_info sca3000_info = {
|
|||
.write_event_config = &sca3000_write_event_config,
|
||||
};
|
||||
|
||||
static void sca3000_stop_all_interrupts(struct sca3000_state *st)
|
||||
static void sca3000_stop_all_interrupts(void *data)
|
||||
{
|
||||
struct iio_dev *indio_dev = data;
|
||||
struct sca3000_state *st = iio_priv(indio_dev);
|
||||
int ret;
|
||||
|
||||
guard(mutex)(&st->lock);
|
||||
|
|
@ -1495,6 +1497,10 @@ static int sca3000_probe(struct spi_device *spi)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = devm_add_action_or_reset(dev, sca3000_stop_all_interrupts, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = iio_device_register(indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -1505,12 +1511,8 @@ static int sca3000_probe(struct spi_device *spi)
|
|||
static void sca3000_remove(struct spi_device *spi)
|
||||
{
|
||||
struct iio_dev *indio_dev = spi_get_drvdata(spi);
|
||||
struct sca3000_state *st = iio_priv(indio_dev);
|
||||
|
||||
iio_device_unregister(indio_dev);
|
||||
|
||||
/* Must ensure no interrupts can be generated after this! */
|
||||
sca3000_stop_all_interrupts(st);
|
||||
}
|
||||
|
||||
static const struct spi_device_id sca3000_id[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user