summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2017-03-23 11:12:53 -0700
committerMarcel Ziswiler <marcel.ziswiler@toradex.com>2018-12-09 23:11:14 +0100
commit6334def51af746c95def35b38fac71567798b568 (patch)
tree31328495e51748475167c4dcefa00c9d222b6e5a /drivers
parent489530cf9b412181e3142259a7b1a9fe4c4af67c (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> (cherry picked from commit 091594ee53e9f6ae330f40c3528bf93f181b4cd5)
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/iio/adc/stmpe-adc.c13
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 1bf09f887a6e..038d3c30d0e7 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;
@@ -378,10 +368,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;
}