diff options
author | Stefan Agner <stefan.agner@toradex.com> | 2017-03-23 11:12:53 -0700 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-04-03 15:36:40 +0200 |
commit | 091594ee53e9f6ae330f40c3528bf93f181b4cd5 (patch) | |
tree | 38b88c524516a4529ade0f92b5f5f3daeae15ef9 | |
parent | 37cfc919ae8aa58511d91f06c825574a7b852e5e (diff) |
iio: adc: fix remove
Removing the device (e.g. using unbind) leads to a NULL pointer
dereference stack trace. There is no need to manually unregister
the platform device, so remove this obsolete code. This fixes
unbinding the device e.g. using:
# echo 2-0041 > /sys/bus/i2c/drivers/stmpe-i2c/unbind
Also make sure the respective block is disabled in case we only
unbind the ADC block:
# echo stmpe-adc > /sys/bus/platform/drivers/stmpe-adc/unbind
Signed-off-by: Stefan Agner <stefan.agner@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
-rw-r--r-- | drivers/staging/iio/adc/stmpe-adc.c | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/drivers/staging/iio/adc/stmpe-adc.c b/drivers/staging/iio/adc/stmpe-adc.c index 783297f09e65..e6c7b7550ed6 100644 --- a/drivers/staging/iio/adc/stmpe-adc.c +++ b/drivers/staging/iio/adc/stmpe-adc.c @@ -226,16 +226,6 @@ static const struct iio_chan_spec stmpe_adc_iio_channels[] = { } }; - -static int stmpe_adc_remove_devices(struct device *dev, void *c) -{ - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - - return 0; -} - static int stmpe_adc_init_hw(struct stmpe_adc *adc) { int ret; @@ -385,10 +375,9 @@ static int stmpe_adc_remove(struct platform_device *pdev) struct iio_dev *indio_dev = platform_get_drvdata(pdev); struct stmpe_adc *info = iio_priv(indio_dev); - device_for_each_child(&pdev->dev, NULL, - stmpe_adc_remove_devices); iio_device_unregister(indio_dev); free_irq(info->irq, info); + stmpe_disable(info->stmpe, STMPE_BLOCK_ADC); return 0; } |