diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-01-31 21:43:00 +0000 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2013-02-02 12:02:20 +0000 |
commit | 6cb2afd7c0abb93bd9dc6d36b858b1e312e2407d (patch) | |
tree | 3abec8f4f092e6e594f4ce57069987c5618f67ff /drivers/iio/adc | |
parent | ca7d98dbd7db6aa8bc4b08e26be1249436d21af3 (diff) |
iio: Simplify iio_map_array_unregister API
Instead of requiring the map to unregister, simply unregister all map entries
associated with the given iio device. This simplifies map removal and also works
for maps generated through devicetree.
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Diffstat (limited to 'drivers/iio/adc')
-rw-r--r-- | drivers/iio/adc/lp8788_adc.c | 11 | ||||
-rw-r--r-- | drivers/iio/adc/max1363.c | 4 |
2 files changed, 4 insertions, 11 deletions
diff --git a/drivers/iio/adc/lp8788_adc.c b/drivers/iio/adc/lp8788_adc.c index d02704ce009..763f57565ee 100644 --- a/drivers/iio/adc/lp8788_adc.c +++ b/drivers/iio/adc/lp8788_adc.c @@ -187,12 +187,6 @@ static int lp8788_iio_map_register(struct iio_dev *indio_dev, return 0; } -static inline void lp8788_iio_map_unregister(struct iio_dev *indio_dev, - struct lp8788_adc *adc) -{ - iio_map_array_unregister(indio_dev, adc->map); -} - static int lp8788_adc_probe(struct platform_device *pdev) { struct lp8788 *lp = dev_get_drvdata(pdev->dev.parent); @@ -231,7 +225,7 @@ static int lp8788_adc_probe(struct platform_device *pdev) return 0; err_iio_device: - lp8788_iio_map_unregister(indio_dev, adc); + iio_map_array_unregister(indio_dev); err_iio_map: iio_device_free(indio_dev); return ret; @@ -240,10 +234,9 @@ err_iio_map: static int lp8788_adc_remove(struct platform_device *pdev) { struct iio_dev *indio_dev = platform_get_drvdata(pdev); - struct lp8788_adc *adc = iio_priv(indio_dev); iio_device_unregister(indio_dev); - lp8788_iio_map_unregister(indio_dev, adc); + iio_map_array_unregister(indio_dev); iio_device_free(indio_dev); return 0; diff --git a/drivers/iio/adc/max1363.c b/drivers/iio/adc/max1363.c index 46732380566..ef868c9c17b 100644 --- a/drivers/iio/adc/max1363.c +++ b/drivers/iio/adc/max1363.c @@ -1611,7 +1611,7 @@ error_disable_reg: error_put_reg: regulator_put(st->reg); error_unregister_map: - iio_map_array_unregister(indio_dev, client->dev.platform_data); + iio_map_array_unregister(indio_dev); error_free_device: iio_device_free(indio_dev); error_out: @@ -1630,7 +1630,7 @@ static int max1363_remove(struct i2c_client *client) kfree(indio_dev->available_scan_masks); regulator_disable(st->reg); regulator_put(st->reg); - iio_map_array_unregister(indio_dev, client->dev.platform_data); + iio_map_array_unregister(indio_dev); iio_device_free(indio_dev); return 0; |