mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-02-21 22:19:22 -05:00
iio: adc: ltc2497: Get platform data via dev_get_platdata()
Access to platform data via dev_get_platdata() getter to make code cleaner. While at it, drop duplicate NULL check that iio_map_array_register() already has. Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://patch.msgid.link/20240902222824.1145571-7-andy.shevchenko@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
b144b6f760
commit
d29ac01249
@@ -168,6 +168,7 @@ static const struct iio_info ltc2497core_info = {
|
||||
int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
|
||||
{
|
||||
struct ltc2497core_driverdata *ddata = iio_priv(indio_dev);
|
||||
struct iio_map *plat_data = dev_get_platdata(dev);
|
||||
int ret;
|
||||
|
||||
/*
|
||||
@@ -200,16 +201,10 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (dev->platform_data) {
|
||||
struct iio_map *plat_data;
|
||||
|
||||
plat_data = (struct iio_map *)dev->platform_data;
|
||||
|
||||
ret = iio_map_array_register(indio_dev, plat_data);
|
||||
if (ret) {
|
||||
dev_err(&indio_dev->dev, "iio map err: %d\n", ret);
|
||||
goto err_regulator_disable;
|
||||
}
|
||||
ret = iio_map_array_register(indio_dev, plat_data);
|
||||
if (ret) {
|
||||
dev_err(&indio_dev->dev, "iio map err: %d\n", ret);
|
||||
goto err_regulator_disable;
|
||||
}
|
||||
|
||||
ddata->addr_prev = LTC2497_CONFIG_DEFAULT;
|
||||
|
||||
Reference in New Issue
Block a user