mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
iio: adc: ad799x: use local device pointer in probe
Introduce a local device pointer 'dev' in ad799x_probe() and use it throughout the function instead of accessing &client->dev repeatedly. Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com> Reviewed-by: David Lechner <dlechner@baylibre.com> Signed-off-by: Archit Anant <architanant5@gmail.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
parent
d4c8667bc9
commit
fa2d96d289
|
|
@ -783,6 +783,7 @@ static const struct ad799x_chip_info ad799x_chip_info_tbl[] = {
|
|||
|
||||
static int ad799x_probe(struct i2c_client *client)
|
||||
{
|
||||
struct device *dev = &client->dev;
|
||||
const struct i2c_device_id *id = i2c_client_get_device_id(client);
|
||||
int ret;
|
||||
int extra_config = 0;
|
||||
|
|
@ -791,7 +792,7 @@ static int ad799x_probe(struct i2c_client *client)
|
|||
const struct ad799x_chip_info *chip_info =
|
||||
&ad799x_chip_info_tbl[id->driver_data];
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*st));
|
||||
indio_dev = devm_iio_device_alloc(dev, sizeof(*st));
|
||||
if (indio_dev == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
|
|
@ -807,7 +808,7 @@ static int ad799x_probe(struct i2c_client *client)
|
|||
|
||||
/* TODO: Add pdata options for filtering and bit delay */
|
||||
|
||||
st->reg = devm_regulator_get(&client->dev, "vcc");
|
||||
st->reg = devm_regulator_get(dev, "vcc");
|
||||
if (IS_ERR(st->reg))
|
||||
return PTR_ERR(st->reg);
|
||||
ret = regulator_enable(st->reg);
|
||||
|
|
@ -816,17 +817,17 @@ static int ad799x_probe(struct i2c_client *client)
|
|||
|
||||
/* check if an external reference is supplied */
|
||||
if (chip_info->has_vref) {
|
||||
st->vref = devm_regulator_get_optional(&client->dev, "vref");
|
||||
st->vref = devm_regulator_get_optional(dev, "vref");
|
||||
ret = PTR_ERR_OR_ZERO(st->vref);
|
||||
if (ret) {
|
||||
if (ret != -ENODEV)
|
||||
goto error_disable_reg;
|
||||
st->vref = NULL;
|
||||
dev_info(&client->dev, "Using VCC reference voltage\n");
|
||||
dev_info(dev, "Using VCC reference voltage\n");
|
||||
}
|
||||
|
||||
if (st->vref) {
|
||||
dev_info(&client->dev, "Using external reference voltage\n");
|
||||
dev_info(dev, "Using external reference voltage\n");
|
||||
extra_config |= AD7991_REF_SEL;
|
||||
ret = regulator_enable(st->vref);
|
||||
if (ret)
|
||||
|
|
@ -853,7 +854,7 @@ static int ad799x_probe(struct i2c_client *client)
|
|||
goto error_disable_vref;
|
||||
|
||||
if (client->irq > 0) {
|
||||
ret = devm_request_threaded_irq(&client->dev,
|
||||
ret = devm_request_threaded_irq(dev,
|
||||
client->irq,
|
||||
NULL,
|
||||
ad799x_event_handler,
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user