mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-08 16:22:41 -04:00
iio: light: al3320a: Abstract device reference in the probe function
Introduce a local variable reducing redundancy and improving readability. No functional changes. Signed-off-by: David Heidelberg <david@ixit.cz> Link: https://patch.msgid.link/20250319-al3010-iio-regmap-v2-6-1310729d0543@ixit.cz Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
861cc66854
commit
26763a3481
@@ -188,10 +188,11 @@ static const struct iio_info al3320a_info = {
|
||||
static int al3320a_probe(struct i2c_client *client)
|
||||
{
|
||||
struct al3320a_data *data;
|
||||
struct device *dev = &client->dev;
|
||||
struct iio_dev *indio_dev;
|
||||
int ret;
|
||||
|
||||
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
|
||||
indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
|
||||
if (!indio_dev)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -207,17 +208,15 @@ static int al3320a_probe(struct i2c_client *client)
|
||||
|
||||
ret = al3320a_init(data);
|
||||
if (ret < 0) {
|
||||
dev_err(&client->dev, "al3320a chip init failed\n");
|
||||
dev_err(dev, "al3320a chip init failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_add_action_or_reset(&client->dev,
|
||||
al3320a_set_pwr_off,
|
||||
data);
|
||||
ret = devm_add_action_or_reset(dev, al3320a_set_pwr_off, data);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return devm_iio_device_register(&client->dev, indio_dev);
|
||||
return devm_iio_device_register(dev, indio_dev);
|
||||
}
|
||||
|
||||
static int al3320a_suspend(struct device *dev)
|
||||
|
||||
Reference in New Issue
Block a user