diff options
author | Shrirang Bagul <shrirang.bagul@canonical.com> | 2017-04-19 16:05:00 +0200 |
---|---|---|
committer | Jonathan Cameron <jic23@kernel.org> | 2017-04-26 07:37:53 +0200 |
commit | 7383d44b84c94aaca4bf695a6bd8a69f2295ef1a (patch) | |
tree | 52b9ea999e3af0d98d3afa4b1a2bb9b550d7ac11 /drivers/iio/accel | |
parent | staging: iio: isl29028: move out of staging (diff) | |
download | linux-7383d44b84c94aaca4bf695a6bd8a69f2295ef1a.tar.xz linux-7383d44b84c94aaca4bf695a6bd8a69f2295ef1a.zip |
iio: st_pressure: st_accel: Initialise sensor platform data properly
This patch fixes the sensor platform data initialisation for st_pressure
and st_accel device drivers. Without this patch, the driver fails to
register the sensors when the user removes and re-loads the driver.
1. Unload the kernel modules for st_pressure
$ sudo rmmod st_pressure_i2c
$ sudo rmmod st_pressure
2. Re-load the driver
$ sudo insmod st_pressure
$ sudo insmod st_pressure_i2c
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/iio/accel')
-rw-r--r-- | drivers/iio/accel/st_accel_core.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c index 784670e2736b..07d1489cd457 100644 --- a/drivers/iio/accel/st_accel_core.c +++ b/drivers/iio/accel/st_accel_core.c @@ -710,6 +710,8 @@ static const struct iio_trigger_ops st_accel_trigger_ops = { int st_accel_common_probe(struct iio_dev *indio_dev) { struct st_sensor_data *adata = iio_priv(indio_dev); + struct st_sensors_platform_data *pdata = + (struct st_sensors_platform_data *)adata->dev->platform_data; int irq = adata->get_irq_data_ready(indio_dev); int err; @@ -736,9 +738,8 @@ int st_accel_common_probe(struct iio_dev *indio_dev) &adata->sensor_settings->fs.fs_avl[0]; adata->odr = adata->sensor_settings->odr.odr_avl[0].hz; - if (!adata->dev->platform_data) - adata->dev->platform_data = - (struct st_sensors_platform_data *)&default_accel_pdata; + if (!pdata) + pdata = (struct st_sensors_platform_data *)&default_accel_pdata; err = st_sensors_init_sensor(indio_dev, adata->dev->platform_data); if (err < 0) |