Commit a866058f authored by Lars-Peter Clausen's avatar Lars-Peter Clausen Committed by Jonathan Cameron

staging:iio:ad7606: Let common remove function take a struct device *

Currently the common remove function takes a struct iio_dev *. This
parameter is retrieved by the individual driver remove functions by calling
get_drvdata() on their device. To simplify the code let the common remove
function directly take a struct dev * and do the IIO device in retrieval
the common remove function.

This also aligns the interface with the common probe function.
Signed-off-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 71faca73
...@@ -81,7 +81,7 @@ struct ad7606_bus_ops { ...@@ -81,7 +81,7 @@ struct ad7606_bus_ops {
int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
const char *name, unsigned int id, const char *name, unsigned int id,
const struct ad7606_bus_ops *bops); const struct ad7606_bus_ops *bops);
int ad7606_remove(struct iio_dev *indio_dev, int irq); int ad7606_remove(struct device *dev, int irq);
int ad7606_reset(struct ad7606_state *st); int ad7606_reset(struct ad7606_state *st);
int ad7606_read_samples(struct ad7606_state *st); int ad7606_read_samples(struct ad7606_state *st);
......
...@@ -535,8 +535,9 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, ...@@ -535,8 +535,9 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address,
} }
EXPORT_SYMBOL_GPL(ad7606_probe); EXPORT_SYMBOL_GPL(ad7606_probe);
int ad7606_remove(struct iio_dev *indio_dev, int irq) int ad7606_remove(struct device *dev, int irq)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(dev);
struct ad7606_state *st = iio_priv(indio_dev); struct ad7606_state *st = iio_priv(indio_dev);
iio_device_unregister(indio_dev); iio_device_unregister(indio_dev);
......
...@@ -76,11 +76,7 @@ static int ad7606_par_probe(struct platform_device *pdev) ...@@ -76,11 +76,7 @@ static int ad7606_par_probe(struct platform_device *pdev)
static int ad7606_par_remove(struct platform_device *pdev) static int ad7606_par_remove(struct platform_device *pdev)
{ {
struct iio_dev *indio_dev = platform_get_drvdata(pdev); return ad7606_remove(&pdev->dev, platform_get_irq(pdev, 0));
ad7606_remove(indio_dev, platform_get_irq(pdev, 0));
return 0;
} }
static const struct platform_device_id ad7606_driver_ids[] = { static const struct platform_device_id ad7606_driver_ids[] = {
......
...@@ -51,9 +51,7 @@ static int ad7606_spi_probe(struct spi_device *spi) ...@@ -51,9 +51,7 @@ static int ad7606_spi_probe(struct spi_device *spi)
static int ad7606_spi_remove(struct spi_device *spi) static int ad7606_spi_remove(struct spi_device *spi)
{ {
struct iio_dev *indio_dev = dev_get_drvdata(&spi->dev); return ad7606_remove(&spi->dev, spi->irq);
return ad7606_remove(indio_dev, spi->irq);
} }
static const struct spi_device_id ad7606_id[] = { static const struct spi_device_id ad7606_id[] = {
......
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