Commit ef19ee60 authored by Andrey Smirnov's avatar Andrey Smirnov Committed by Jonathan Cameron

iio: hi8435: Drop hi8435_remove() by using devres for remaining elements

Convert the remainder of hi8435_probe() to use devres and get rid of
hi8435_remove().
Signed-off-by: default avatarAndrey Smirnov <andrew.smirnov@gmail.com>
Cc: linux-kernel@vger.kernel.org
Cc: linux-iio@vger.kernel.org
Cc: Chris Healy <cphealy@gmail.com>
Signed-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 6822dc9d
...@@ -456,6 +456,11 @@ static irqreturn_t hi8435_trigger_handler(int irq, void *private) ...@@ -456,6 +456,11 @@ static irqreturn_t hi8435_trigger_handler(int irq, void *private)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static void hi8435_triggered_event_cleanup(void *data)
{
iio_triggered_event_cleanup(data);
}
static int hi8435_probe(struct spi_device *spi) static int hi8435_probe(struct spi_device *spi)
{ {
struct iio_dev *idev; struct iio_dev *idev;
...@@ -513,27 +518,13 @@ static int hi8435_probe(struct spi_device *spi) ...@@ -513,27 +518,13 @@ static int hi8435_probe(struct spi_device *spi)
if (ret) if (ret)
return ret; return ret;
ret = iio_device_register(idev); ret = devm_add_action_or_reset(&spi->dev,
if (ret < 0) { hi8435_triggered_event_cleanup,
dev_err(&spi->dev, "unable to register device\n"); idev);
goto unregister_triggered_event; if (ret)
}
return 0;
unregister_triggered_event:
iio_triggered_event_cleanup(idev);
return ret; return ret;
}
static int hi8435_remove(struct spi_device *spi) return devm_iio_device_register(&spi->dev, idev);
{
struct iio_dev *idev = spi_get_drvdata(spi);
iio_device_unregister(idev);
iio_triggered_event_cleanup(idev);
return 0;
} }
static const struct of_device_id hi8435_dt_ids[] = { static const struct of_device_id hi8435_dt_ids[] = {
...@@ -554,7 +545,6 @@ static struct spi_driver hi8435_driver = { ...@@ -554,7 +545,6 @@ static struct spi_driver hi8435_driver = {
.of_match_table = of_match_ptr(hi8435_dt_ids), .of_match_table = of_match_ptr(hi8435_dt_ids),
}, },
.probe = hi8435_probe, .probe = hi8435_probe,
.remove = hi8435_remove,
.id_table = hi8435_id, .id_table = hi8435_id,
}; };
module_spi_driver(hi8435_driver); module_spi_driver(hi8435_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment