[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240902222824.1145571-7-andy.shevchenko@gmail.com>
Date: Tue, 3 Sep 2024 01:16:51 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>,
David Lechner <dlechner@...libre.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Michael Hennerich <michael.hennerich@...log.com>,
Antoniu Miclaus <antoniu.miclaus@...log.com>,
Jinjie Ruan <ruanjinjie@...wei.com>,
Lorenzo Bianconi <lorenzo@...nel.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Basavaraj Natikar <Basavaraj.Natikar@....com>,
linux-input@...r.kernel.org,
linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Jiri Kosina <jikos@...nel.org>,
Jonathan Cameron <jic23@...nel.org>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Andy Shevchenko <andy.shevchenko@...il.com>
Subject: [PATCH v1 06/22] iio: adc: ltc2497: Get platform data via dev_get_platdata()
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
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@...il.com>
---
drivers/iio/adc/ltc2497-core.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
index 996f6cbbed3c..ad8ddf80310e 100644
--- a/drivers/iio/adc/ltc2497-core.c
+++ b/drivers/iio/adc/ltc2497-core.c
@@ -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;
--
2.46.0
Powered by blists - more mailing lists