Commit 2080c8d3 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: light: tsl2563: Simplify with dev_err_probe

Code can be a bit simpler with dev_err_probe().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: default avatarFerry Toth <ftoth@exalondelft.nl>
Link: https://lore.kernel.org/r/20221207190348.9347-6-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent bbabf919
...@@ -695,12 +695,13 @@ static const struct iio_info tsl2563_info = { ...@@ -695,12 +695,13 @@ static const struct iio_info tsl2563_info = {
static int tsl2563_probe(struct i2c_client *client) static int tsl2563_probe(struct i2c_client *client)
{ {
struct device *dev = &client->dev;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct tsl2563_chip *chip; struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data; struct tsl2563_platform_data *pdata = client->dev.platform_data;
unsigned long irq_flags; unsigned long irq_flags;
int err = 0;
u8 id = 0; u8 id = 0;
int err;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip)); indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*chip));
if (!indio_dev) if (!indio_dev)
...@@ -712,16 +713,12 @@ static int tsl2563_probe(struct i2c_client *client) ...@@ -712,16 +713,12 @@ static int tsl2563_probe(struct i2c_client *client)
chip->client = client; chip->client = client;
err = tsl2563_detect(chip); err = tsl2563_detect(chip);
if (err) { if (err)
dev_err(&client->dev, "detect error %d\n", -err); return dev_err_probe(dev, err, "detect error\n");
return err;
}
err = tsl2563_read_id(chip, &id); err = tsl2563_read_id(chip, &id);
if (err) { if (err)
dev_err(&client->dev, "read id error %d\n", -err); return dev_err_probe(dev, err, "read id error\n");
return err;
}
mutex_init(&chip->lock); mutex_init(&chip->lock);
...@@ -765,17 +762,13 @@ static int tsl2563_probe(struct i2c_client *client) ...@@ -765,17 +762,13 @@ static int tsl2563_probe(struct i2c_client *client)
irq_flags, irq_flags,
"tsl2563_event", "tsl2563_event",
indio_dev); indio_dev);
if (err) { if (err)
dev_err(&client->dev, "irq request error %d\n", -err); return dev_err_probe(dev, err, "irq request error\n");
return err;
}
} }
err = tsl2563_configure(chip); err = tsl2563_configure(chip);
if (err) { if (err)
dev_err(&client->dev, "configure error %d\n", -err); return dev_err_probe(dev, err, "configure error\n");
return err;
}
INIT_DELAYED_WORK(&chip->poweroff_work, tsl2563_poweroff_work); INIT_DELAYED_WORK(&chip->poweroff_work, tsl2563_poweroff_work);
...@@ -784,7 +777,7 @@ static int tsl2563_probe(struct i2c_client *client) ...@@ -784,7 +777,7 @@ static int tsl2563_probe(struct i2c_client *client)
err = iio_device_register(indio_dev); err = iio_device_register(indio_dev);
if (err) { if (err) {
dev_err(&client->dev, "iio registration error %d\n", -err); dev_err_probe(dev, err, "iio registration error\n");
goto fail; goto fail;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment