mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 18:21:24 +02:00
iio: adc: ad7793: add dev variable
Add a local struct device pointer to simplify repeated &spi->dev dereferences throughout the probe function. Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
parent
cd256a392b
commit
b659f18def
|
|
@ -774,7 +774,8 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
|
|||
|
||||
static int ad7793_probe(struct spi_device *spi)
|
||||
{
|
||||
const struct ad7793_platform_data *pdata = dev_get_platdata(&spi->dev);
|
||||
struct device *dev = &spi->dev;
|
||||
const struct ad7793_platform_data *pdata = dev_get_platdata(dev);
|
||||
struct ad7793_state *st;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret, vref_mv = 0;
|
||||
|
|
@ -789,7 +790,7 @@ static int ad7793_probe(struct spi_device *spi)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st));
|
||||
indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
|
||||
if (indio_dev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -798,7 +799,7 @@ static int ad7793_probe(struct spi_device *spi)
|
|||
ad_sd_init(&st->sd, indio_dev, spi, &ad7793_sigma_delta_info);
|
||||
|
||||
if (pdata->refsel != AD7793_REFSEL_INTERNAL) {
|
||||
ret = devm_regulator_get_enable_read_voltage(&spi->dev, "refin");
|
||||
ret = devm_regulator_get_enable_read_voltage(dev, "refin");
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -816,7 +817,7 @@ static int ad7793_probe(struct spi_device *spi)
|
|||
indio_dev->num_channels = st->chip_info->num_channels;
|
||||
indio_dev->info = st->chip_info->iio_info;
|
||||
|
||||
ret = devm_ad_sd_setup_buffer_and_trigger(&spi->dev, indio_dev);
|
||||
ret = devm_ad_sd_setup_buffer_and_trigger(dev, indio_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
@ -824,7 +825,7 @@ static int ad7793_probe(struct spi_device *spi)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(&spi->dev, indio_dev);
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
}
|
||||
|
||||
static const struct spi_device_id ad7793_id[] = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user