aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2012-08-10 12:36:00 -0400
committerJonathan Cameron <jic23@kernel.org>2012-08-27 12:46:49 -0400
commitc8c194d5c21fc157c2329436e541bf8f33a2ee25 (patch)
tree16c059c79531dd0dcac3ae2a921467d60e31b0cf
parent8f8b77bfdce811acbcf2248219a7aab5f92de938 (diff)
staging:iio:ad7793: Remove unused platform_data from device state struct
The platform data for the device is only used from within the drivers probe callback, so there is no need to keep it around in the devices state struct. While we are at it mark the platform data struct as const. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
-rw-r--r--drivers/staging/iio/adc/ad7793.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/staging/iio/adc/ad7793.c b/drivers/staging/iio/adc/ad7793.c
index 112e2b7b5bc4..5c2fcd7d2def 100644
--- a/drivers/staging/iio/adc/ad7793.c
+++ b/drivers/staging/iio/adc/ad7793.c
@@ -44,7 +44,6 @@ struct ad7793_state {
44 struct iio_trigger *trig; 44 struct iio_trigger *trig;
45 const struct ad7793_chip_info *chip_info; 45 const struct ad7793_chip_info *chip_info;
46 struct regulator *reg; 46 struct regulator *reg;
47 struct ad7793_platform_data *pdata;
48 wait_queue_head_t wq_data_avail; 47 wait_queue_head_t wq_data_avail;
49 bool done; 48 bool done;
50 bool irq_dis; 49 bool irq_dis;
@@ -253,7 +252,8 @@ out:
253 return ret; 252 return ret;
254} 253}
255 254
256static int ad7793_setup(struct ad7793_state *st) 255static int ad7793_setup(struct ad7793_state *st,
256 const struct ad7793_platform_data *pdata)
257{ 257{
258 int i, ret = -1; 258 int i, ret = -1;
259 unsigned long long scale_uv; 259 unsigned long long scale_uv;
@@ -277,9 +277,9 @@ static int ad7793_setup(struct ad7793_state *st)
277 goto out; 277 goto out;
278 } 278 }
279 279
280 st->mode = (st->pdata->mode & ~AD7793_MODE_SEL(-1)) | 280 st->mode = (pdata->mode & ~AD7793_MODE_SEL(-1)) |
281 AD7793_MODE_SEL(AD7793_MODE_IDLE); 281 AD7793_MODE_SEL(AD7793_MODE_IDLE);
282 st->conf = st->pdata->conf & ~AD7793_CONF_CHAN(-1); 282 st->conf = pdata->conf & ~AD7793_CONF_CHAN(-1);
283 283
284 ret = ad7793_write_reg(st, AD7793_REG_MODE, sizeof(st->mode), st->mode); 284 ret = ad7793_write_reg(st, AD7793_REG_MODE, sizeof(st->mode), st->mode);
285 if (ret) 285 if (ret)
@@ -290,7 +290,7 @@ static int ad7793_setup(struct ad7793_state *st)
290 goto out; 290 goto out;
291 291
292 ret = ad7793_write_reg(st, AD7793_REG_IO, 292 ret = ad7793_write_reg(st, AD7793_REG_IO,
293 sizeof(st->pdata->io), st->pdata->io); 293 sizeof(pdata->io), pdata->io);
294 if (ret) 294 if (ret)
295 goto out; 295 goto out;
296 296
@@ -882,7 +882,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
882 882
883static int __devinit ad7793_probe(struct spi_device *spi) 883static int __devinit ad7793_probe(struct spi_device *spi)
884{ 884{
885 struct ad7793_platform_data *pdata = spi->dev.platform_data; 885 const struct ad7793_platform_data *pdata = spi->dev.platform_data;
886 struct ad7793_state *st; 886 struct ad7793_state *st;
887 struct iio_dev *indio_dev; 887 struct iio_dev *indio_dev;
888 int ret, voltage_uv = 0; 888 int ret, voltage_uv = 0;
@@ -915,8 +915,6 @@ static int __devinit ad7793_probe(struct spi_device *spi)
915 st->chip_info = 915 st->chip_info =
916 &ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data]; 916 &ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data];
917 917
918 st->pdata = pdata;
919
920 if (pdata && pdata->vref_mv) 918 if (pdata && pdata->vref_mv)
921 st->int_vref_mv = pdata->vref_mv; 919 st->int_vref_mv = pdata->vref_mv;
922 else if (voltage_uv) 920 else if (voltage_uv)
@@ -944,7 +942,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
944 if (ret) 942 if (ret)
945 goto error_unreg_ring; 943 goto error_unreg_ring;
946 944
947 ret = ad7793_setup(st); 945 ret = ad7793_setup(st, pdata);
948 if (ret) 946 if (ret)
949 goto error_remove_trigger; 947 goto error_remove_trigger;
950 948