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>
This commit is contained in:
parent
8f8b77bfdc
commit
c8c194d5c2
|
@ -44,7 +44,6 @@ struct ad7793_state {
|
||||||
struct iio_trigger *trig;
|
struct iio_trigger *trig;
|
||||||
const struct ad7793_chip_info *chip_info;
|
const struct ad7793_chip_info *chip_info;
|
||||||
struct regulator *reg;
|
struct regulator *reg;
|
||||||
struct ad7793_platform_data *pdata;
|
|
||||||
wait_queue_head_t wq_data_avail;
|
wait_queue_head_t wq_data_avail;
|
||||||
bool done;
|
bool done;
|
||||||
bool irq_dis;
|
bool irq_dis;
|
||||||
|
@ -253,7 +252,8 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ad7793_setup(struct ad7793_state *st)
|
static int ad7793_setup(struct ad7793_state *st,
|
||||||
|
const struct ad7793_platform_data *pdata)
|
||||||
{
|
{
|
||||||
int i, ret = -1;
|
int i, ret = -1;
|
||||||
unsigned long long scale_uv;
|
unsigned long long scale_uv;
|
||||||
|
@ -277,9 +277,9 @@ static int ad7793_setup(struct ad7793_state *st)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
st->mode = (st->pdata->mode & ~AD7793_MODE_SEL(-1)) |
|
st->mode = (pdata->mode & ~AD7793_MODE_SEL(-1)) |
|
||||||
AD7793_MODE_SEL(AD7793_MODE_IDLE);
|
AD7793_MODE_SEL(AD7793_MODE_IDLE);
|
||||||
st->conf = st->pdata->conf & ~AD7793_CONF_CHAN(-1);
|
st->conf = pdata->conf & ~AD7793_CONF_CHAN(-1);
|
||||||
|
|
||||||
ret = ad7793_write_reg(st, AD7793_REG_MODE, sizeof(st->mode), st->mode);
|
ret = ad7793_write_reg(st, AD7793_REG_MODE, sizeof(st->mode), st->mode);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -290,7 +290,7 @@ static int ad7793_setup(struct ad7793_state *st)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
ret = ad7793_write_reg(st, AD7793_REG_IO,
|
ret = ad7793_write_reg(st, AD7793_REG_IO,
|
||||||
sizeof(st->pdata->io), st->pdata->io);
|
sizeof(pdata->io), pdata->io);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
|
@ -882,7 +882,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
||||||
|
|
||||||
static int __devinit ad7793_probe(struct spi_device *spi)
|
static int __devinit ad7793_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct ad7793_platform_data *pdata = spi->dev.platform_data;
|
const struct ad7793_platform_data *pdata = spi->dev.platform_data;
|
||||||
struct ad7793_state *st;
|
struct ad7793_state *st;
|
||||||
struct iio_dev *indio_dev;
|
struct iio_dev *indio_dev;
|
||||||
int ret, voltage_uv = 0;
|
int ret, voltage_uv = 0;
|
||||||
|
@ -915,8 +915,6 @@ static int __devinit ad7793_probe(struct spi_device *spi)
|
||||||
st->chip_info =
|
st->chip_info =
|
||||||
&ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data];
|
&ad7793_chip_info_tbl[spi_get_device_id(spi)->driver_data];
|
||||||
|
|
||||||
st->pdata = pdata;
|
|
||||||
|
|
||||||
if (pdata && pdata->vref_mv)
|
if (pdata && pdata->vref_mv)
|
||||||
st->int_vref_mv = pdata->vref_mv;
|
st->int_vref_mv = pdata->vref_mv;
|
||||||
else if (voltage_uv)
|
else if (voltage_uv)
|
||||||
|
@ -944,7 +942,7 @@ static int __devinit ad7793_probe(struct spi_device *spi)
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_unreg_ring;
|
goto error_unreg_ring;
|
||||||
|
|
||||||
ret = ad7793_setup(st);
|
ret = ad7793_setup(st, pdata);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto error_remove_trigger;
|
goto error_remove_trigger;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue