* [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data
@ 2024-09-02 22:16 Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 01/22] iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata() Andy Shevchenko
` (22 more replies)
0 siblings, 23 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
Unify how IIO drivers access platform_data field of struct device.
In simple and straightforward cases constify the local variables.
(Not tested)
Andy Shevchenko (22):
iio: accel: hid-sensor-accel-3d: Get platform data via
dev_get_platdata()
iio: adc: ad7266: Get platform data via dev_get_platdata()
iio: adc: ad7791: Get platform data via dev_get_platdata()
iio: adc: ad7887: Get platform data via dev_get_platdata()
iio: adc: ad7793: Get platform data via dev_get_platdata()
iio: adc: ltc2497: Get platform data via dev_get_platdata()
iio: dac: ad5504: Get platform data via dev_get_platdata()
iio: dac: ad5791: Get platform data via dev_get_platdata()
iio: dac: m62332: Get platform data via dev_get_platdata()
iio: dac: max517: Get platform data via dev_get_platdata()
iio: frequency: ad9523: Get platform data via dev_get_platdata()
iio: frequency: adf4350: Get platform data via dev_get_platdata()
iio: gyro: hid-sensor-gyro-3d: Get platform data via
dev_get_platdata()
iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
iio: light: hid-sensor-als: Get platform data via dev_get_platdata()
iio: light: hid-sensor-prox: Get platform data via dev_get_platdata()
iio: light: lm3533-als: Get platform data via dev_get_platdata()
iio: magnetometer: hid-sensor-magn-3d: Get platform data via
dev_get_platdata()
iio: orientation: hid-sensor-incl-3d: Get platform data via
dev_get_platdata()
iio: orientation: hid-sensor-rotation: Get platform data via
dev_get_platdata()
iio: position: hid-sensor-custom-intel-hinge: Get platform data via
dev_get_platdata()
iio: pressure: hid-sensor-press: Get platform data via
dev_get_platdata()
drivers/iio/accel/hid-sensor-accel-3d.c | 5 ++---
drivers/iio/adc/ad7266.c | 2 +-
drivers/iio/adc/ad7791.c | 4 ++--
drivers/iio/adc/ad7793.c | 2 +-
drivers/iio/adc/ad7887.c | 2 +-
drivers/iio/adc/ltc2497-core.c | 15 +++++----------
drivers/iio/dac/ad5504.c | 2 +-
drivers/iio/dac/ad5791.c | 2 +-
drivers/iio/dac/m62332.c | 2 +-
drivers/iio/dac/max517.c | 4 ++--
drivers/iio/frequency/ad9523.c | 2 +-
drivers/iio/frequency/adf4350.c | 2 +-
drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++--
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 15 +++++----------
drivers/iio/light/hid-sensor-als.c | 4 ++--
drivers/iio/light/hid-sensor-prox.c | 4 ++--
drivers/iio/light/lm3533-als.c | 6 +++---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 ++--
drivers/iio/orientation/hid-sensor-incl-3d.c | 4 ++--
drivers/iio/orientation/hid-sensor-rotation.c | 4 ++--
.../iio/position/hid-sensor-custom-intel-hinge.c | 4 ++--
drivers/iio/pressure/hid-sensor-press.c | 4 ++--
22 files changed, 43 insertions(+), 54 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 31+ messages in thread
* [PATCH v1 01/22] iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 02/22] iio: adc: ad7266: " Andy Shevchenko
` (21 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/accel/hid-sensor-accel-3d.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c
index 9b7a73a4c48a..caa183637422 100644
--- a/drivers/iio/accel/hid-sensor-accel-3d.c
+++ b/drivers/iio/accel/hid-sensor-accel-3d.c
@@ -328,6 +328,7 @@ static int accel_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_accel_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
const char *name;
struct iio_dev *indio_dev;
@@ -335,8 +336,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
const struct iio_chan_spec *channel_spec;
int channel_size;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
-
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct accel_3d_state));
if (indio_dev == NULL)
@@ -424,7 +423,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_accel_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct accel_3d_state *accel_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 02/22] iio: adc: ad7266: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 01/22] iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata() Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 03/22] iio: adc: ad7791: " Andy Shevchenko
` (20 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ad7266.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7266.c b/drivers/iio/adc/ad7266.c
index 7949b076fb87..858c8be2ff1a 100644
--- a/drivers/iio/adc/ad7266.c
+++ b/drivers/iio/adc/ad7266.c
@@ -383,7 +383,7 @@ static const char * const ad7266_gpio_labels[] = {
static int ad7266_probe(struct spi_device *spi)
{
- struct ad7266_platform_data *pdata = spi->dev.platform_data;
+ const struct ad7266_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad7266_state *st;
unsigned int i;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 03/22] iio: adc: ad7791: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 01/22] iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata() Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 02/22] iio: adc: ad7266: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 04/22] iio: adc: ad7887: " Andy Shevchenko
` (19 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ad7791.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/adc/ad7791.c b/drivers/iio/adc/ad7791.c
index 86effe8501b4..5d2ad3dd6caa 100644
--- a/drivers/iio/adc/ad7791.c
+++ b/drivers/iio/adc/ad7791.c
@@ -371,7 +371,7 @@ static const struct iio_info ad7791_no_filter_info = {
};
static int ad7791_setup(struct ad7791_state *st,
- struct ad7791_platform_data *pdata)
+ const struct ad7791_platform_data *pdata)
{
/* Set to poweron-reset default values */
st->mode = AD7791_MODE_BUFFER;
@@ -401,7 +401,7 @@ static void ad7791_reg_disable(void *reg)
static int ad7791_probe(struct spi_device *spi)
{
- struct ad7791_platform_data *pdata = spi->dev.platform_data;
+ const struct ad7791_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad7791_state *st;
int ret;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 04/22] iio: adc: ad7887: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (2 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 03/22] iio: adc: ad7791: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 05/22] iio: adc: ad7793: " Andy Shevchenko
` (18 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ad7887.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7887.c b/drivers/iio/adc/ad7887.c
index 6265ce7df703..b301da9b88b1 100644
--- a/drivers/iio/adc/ad7887.c
+++ b/drivers/iio/adc/ad7887.c
@@ -234,7 +234,7 @@ static void ad7887_reg_disable(void *data)
static int ad7887_probe(struct spi_device *spi)
{
- struct ad7887_platform_data *pdata = spi->dev.platform_data;
+ const struct ad7887_platform_data *pdata = dev_get_platdata(&spi->dev);
struct ad7887_state *st;
struct iio_dev *indio_dev;
uint8_t mode;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 05/22] iio: adc: ad7793: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (3 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 04/22] iio: adc: ad7887: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 06/22] iio: adc: ltc2497: " Andy Shevchenko
` (17 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/adc/ad7793.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/adc/ad7793.c b/drivers/iio/adc/ad7793.c
index abebd519cafa..b86e89370e0d 100644
--- a/drivers/iio/adc/ad7793.c
+++ b/drivers/iio/adc/ad7793.c
@@ -770,7 +770,7 @@ static const struct ad7793_chip_info ad7793_chip_info_tbl[] = {
static int ad7793_probe(struct spi_device *spi)
{
- const struct ad7793_platform_data *pdata = spi->dev.platform_data;
+ const struct ad7793_platform_data *pdata = dev_get_platdata(&spi->dev);
struct ad7793_state *st;
struct iio_dev *indio_dev;
int ret, vref_mv = 0;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 06/22] iio: adc: ltc2497: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (4 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 05/22] iio: adc: ad7793: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 07/22] iio: dac: ad5504: " Andy Shevchenko
` (16 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.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@gmail.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
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 07/22] iio: dac: ad5504: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (5 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 06/22] iio: adc: ltc2497: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 08/22] iio: dac: ad5791: " Andy Shevchenko
` (15 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/ad5504.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5504.c b/drivers/iio/dac/ad5504.c
index e6c5be728bb2..305cd58cd257 100644
--- a/drivers/iio/dac/ad5504.c
+++ b/drivers/iio/dac/ad5504.c
@@ -270,7 +270,7 @@ static const struct iio_chan_spec ad5504_channels[] = {
static int ad5504_probe(struct spi_device *spi)
{
- struct ad5504_platform_data *pdata = spi->dev.platform_data;
+ const struct ad5504_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad5504_state *st;
struct regulator *reg;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 08/22] iio: dac: ad5791: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (6 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 07/22] iio: dac: ad5504: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 09/22] iio: dac: m62332: " Andy Shevchenko
` (14 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/ad5791.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5791.c b/drivers/iio/dac/ad5791.c
index 75b549827e15..553431bf0232 100644
--- a/drivers/iio/dac/ad5791.c
+++ b/drivers/iio/dac/ad5791.c
@@ -341,7 +341,7 @@ static const struct iio_info ad5791_info = {
static int ad5791_probe(struct spi_device *spi)
{
- struct ad5791_platform_data *pdata = spi->dev.platform_data;
+ const struct ad5791_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad5791_state *st;
int ret, pos_voltage_uv = 0, neg_voltage_uv = 0;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 09/22] iio: dac: m62332: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (7 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 08/22] iio: dac: ad5791: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 10/22] iio: dac: max517: " Andy Shevchenko
` (13 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/m62332.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/dac/m62332.c b/drivers/iio/dac/m62332.c
index ae53baccec91..3497513854d7 100644
--- a/drivers/iio/dac/m62332.c
+++ b/drivers/iio/dac/m62332.c
@@ -201,7 +201,7 @@ static int m62332_probe(struct i2c_client *client)
indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->info = &m62332_info;
- ret = iio_map_array_register(indio_dev, client->dev.platform_data);
+ ret = iio_map_array_register(indio_dev, dev_get_platdata(&client->dev));
if (ret < 0)
return ret;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 10/22] iio: dac: max517: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (8 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 09/22] iio: dac: m62332: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-03 19:47 ` Jonathan Cameron
2024-09-02 22:16 ` [PATCH v1 11/22] iio: frequency: ad9523: " Andy Shevchenko
` (12 subsequent siblings)
22 siblings, 1 reply; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/dac/max517.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
index 685980184d3c..96781ae04f9d 100644
--- a/drivers/iio/dac/max517.c
+++ b/drivers/iio/dac/max517.c
@@ -143,10 +143,10 @@ static const struct iio_chan_spec max517_channels[] = {
static int max517_probe(struct i2c_client *client)
{
+ const struct max517_platform_data *platform_data = dev_get_platdata(&client->dev);
const struct i2c_device_id *id = i2c_client_get_device_id(client);
struct max517_data *data;
struct iio_dev *indio_dev;
- struct max517_platform_data *platform_data = client->dev.platform_data;
int chan;
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
@@ -176,7 +176,7 @@ static int max517_probe(struct i2c_client *client)
/*
* Reference voltage on MAX518 and default is 5V, else take vref_mv
- * from platform_data
+ * from platform_data.
*/
for (chan = 0; chan < indio_dev->num_channels; chan++) {
if (id->driver_data == ID_MAX518 || !platform_data)
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 11/22] iio: frequency: ad9523: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (9 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 10/22] iio: dac: max517: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 12/22] iio: frequency: adf4350: " Andy Shevchenko
` (11 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/frequency/ad9523.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/frequency/ad9523.c b/drivers/iio/frequency/ad9523.c
index b391c6e27ab0..b1554ced7a26 100644
--- a/drivers/iio/frequency/ad9523.c
+++ b/drivers/iio/frequency/ad9523.c
@@ -970,7 +970,7 @@ static int ad9523_setup(struct iio_dev *indio_dev)
static int ad9523_probe(struct spi_device *spi)
{
- struct ad9523_platform_data *pdata = spi->dev.platform_data;
+ struct ad9523_platform_data *pdata = dev_get_platdata(&spi->dev);
struct iio_dev *indio_dev;
struct ad9523_state *st;
int ret;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 12/22] iio: frequency: adf4350: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (10 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 11/22] iio: frequency: ad9523: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 13/22] iio: gyro: hid-sensor-gyro-3d: " Andy Shevchenko
` (10 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/frequency/adf4350.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/frequency/adf4350.c b/drivers/iio/frequency/adf4350.c
index e13e64a5164c..61828e61e275 100644
--- a/drivers/iio/frequency/adf4350.c
+++ b/drivers/iio/frequency/adf4350.c
@@ -603,7 +603,7 @@ static int adf4350_probe(struct spi_device *spi)
if (pdata == NULL)
return -EINVAL;
} else {
- pdata = spi->dev.platform_data;
+ pdata = dev_get_platdata(&spi->dev);
}
if (!pdata) {
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 13/22] iio: gyro: hid-sensor-gyro-3d: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (11 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 12/22] iio: frequency: adf4350: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 14/22] iio: imu: st_lsm6dsx: " Andy Shevchenko
` (9 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c
index 59a38bf9459b..490c325897bd 100644
--- a/drivers/iio/gyro/hid-sensor-gyro-3d.c
+++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c
@@ -279,11 +279,11 @@ static int gyro_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_gyro_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "gyro_3d";
struct iio_dev *indio_dev;
struct gyro_3d_state *gyro_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*gyro_state));
if (!indio_dev)
@@ -361,7 +361,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_gyro_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct gyro_3d_state *gyro_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (12 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 13/22] iio: gyro: hid-sensor-gyro-3d: " Andy Shevchenko
@ 2024-09-02 22:16 ` Andy Shevchenko
2024-09-03 7:10 ` Lorenzo Bianconi
2024-09-02 22:17 ` [PATCH v1 15/22] iio: light: hid-sensor-als: " Andy Shevchenko
` (8 subsequent siblings)
22 siblings, 1 reply; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:16 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
index ed0267929725..3958b5e1a3f6 100644
--- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
+++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
@@ -2132,14 +2132,11 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
const struct st_lsm6dsx_reg **drdy_reg)
{
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
int err = 0, drdy_pin;
- if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
- struct st_sensors_platform_data *pdata;
-
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
+ if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
drdy_pin = pdata ? pdata->drdy_int_pin : 1;
- }
switch (drdy_pin) {
case 1:
@@ -2162,14 +2159,13 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
{
const struct st_lsm6dsx_shub_settings *hub_settings;
- struct st_sensors_platform_data *pdata;
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
unsigned int data;
int err = 0;
hub_settings = &hw->settings->shub_settings;
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
if (device_property_read_bool(dev, "st,pullups") ||
(pdata && pdata->pullups)) {
if (hub_settings->pullup_en.sec_page) {
@@ -2524,9 +2520,9 @@ static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
{
- struct st_sensors_platform_data *pdata;
const struct st_lsm6dsx_reg *reg;
struct device *dev = hw->dev;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
unsigned long irq_type;
bool irq_active_low;
int err;
@@ -2554,7 +2550,6 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
if (err < 0)
return err;
- pdata = (struct st_sensors_platform_data *)dev->platform_data;
if (device_property_read_bool(dev, "drive-open-drain") ||
(pdata && pdata->open_drain)) {
reg = &hw->settings->irq_config.od;
@@ -2639,7 +2634,7 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
struct regmap *regmap)
{
- struct st_sensors_platform_data *pdata = dev->platform_data;
+ const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
const struct st_lsm6dsx_shub_settings *hub_settings;
struct st_lsm6dsx_hw *hw;
const char *name = NULL;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 15/22] iio: light: hid-sensor-als: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (13 preceding siblings ...)
2024-09-02 22:16 ` [PATCH v1 14/22] iio: imu: st_lsm6dsx: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 16/22] iio: light: hid-sensor-prox: " Andy Shevchenko
` (7 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/light/hid-sensor-als.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c
index 260281194f61..0d995bc7877e 100644
--- a/drivers/iio/light/hid-sensor-als.c
+++ b/drivers/iio/light/hid-sensor-als.c
@@ -356,11 +356,11 @@ static int als_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_als_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "als";
struct iio_dev *indio_dev;
struct als_state *als_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(struct als_state));
if (!indio_dev)
@@ -438,7 +438,7 @@ static int hid_als_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_als_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct als_state *als_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 16/22] iio: light: hid-sensor-prox: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (14 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 15/22] iio: light: hid-sensor-als: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 17/22] iio: light: lm3533-als: " Andy Shevchenko
` (6 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/light/hid-sensor-prox.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c
index 26c481d2998c..5343ebd404bf 100644
--- a/drivers/iio/light/hid-sensor-prox.c
+++ b/drivers/iio/light/hid-sensor-prox.c
@@ -233,11 +233,11 @@ static int prox_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_prox_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "prox";
struct iio_dev *indio_dev;
struct prox_state *prox_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct prox_state));
@@ -315,7 +315,7 @@ static int hid_prox_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_prox_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct prox_state *prox_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 17/22] iio: light: lm3533-als: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (15 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 16/22] iio: light: hid-sensor-prox: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-03 6:33 ` Johan Hovold
2024-09-02 22:17 ` [PATCH v1 18/22] iio: magnetometer: hid-sensor-magn-3d: " Andy Shevchenko
` (5 subsequent siblings)
22 siblings, 1 reply; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/light/lm3533-als.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/light/lm3533-als.c b/drivers/iio/light/lm3533-als.c
index 7800f7fa51b7..6429d951ce7f 100644
--- a/drivers/iio/light/lm3533-als.c
+++ b/drivers/iio/light/lm3533-als.c
@@ -754,7 +754,7 @@ static int lm3533_als_set_resistor(struct lm3533_als *als, u8 val)
}
static int lm3533_als_setup(struct lm3533_als *als,
- struct lm3533_als_platform_data *pdata)
+ const struct lm3533_als_platform_data *pdata)
{
int ret;
@@ -828,8 +828,8 @@ static const struct iio_info lm3533_als_info = {
static int lm3533_als_probe(struct platform_device *pdev)
{
+ const struct lm3533_als_platform_data *pdata;
struct lm3533 *lm3533;
- struct lm3533_als_platform_data *pdata;
struct lm3533_als *als;
struct iio_dev *indio_dev;
int ret;
@@ -838,7 +838,7 @@ static int lm3533_als_probe(struct platform_device *pdev)
if (!lm3533)
return -EINVAL;
- pdata = pdev->dev.platform_data;
+ pdata = dev_get_platdata(&pdev->dev);
if (!pdata) {
dev_err(&pdev->dev, "no platform data\n");
return -EINVAL;
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 18/22] iio: magnetometer: hid-sensor-magn-3d: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (16 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 17/22] iio: light: lm3533-als: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 19/22] iio: orientation: hid-sensor-incl-3d: " Andy Shevchenko
` (4 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
index 5c795a430d09..ae10db87d1e1 100644
--- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c
+++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c
@@ -466,11 +466,11 @@ static int magn_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_magn_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static char *name = "magn_3d";
struct iio_dev *indio_dev;
struct magn_3d_state *magn_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
struct iio_chan_spec *channels;
int chan_count = 0;
@@ -549,7 +549,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_magn_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct magn_3d_state *magn_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 19/22] iio: orientation: hid-sensor-incl-3d: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (17 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 18/22] iio: magnetometer: hid-sensor-magn-3d: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 20/22] iio: orientation: hid-sensor-rotation: " Andy Shevchenko
` (3 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/orientation/hid-sensor-incl-3d.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c
index 8943d5c78bc0..21664563b565 100644
--- a/drivers/iio/orientation/hid-sensor-incl-3d.c
+++ b/drivers/iio/orientation/hid-sensor-incl-3d.c
@@ -299,11 +299,11 @@ static int incl_3d_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_incl_3d_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret;
static char *name = "incli_3d";
struct iio_dev *indio_dev;
struct incl_3d_state *incl_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct incl_3d_state));
@@ -385,7 +385,7 @@ static int hid_incl_3d_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_incl_3d_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct incl_3d_state *incl_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 20/22] iio: orientation: hid-sensor-rotation: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (18 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 19/22] iio: orientation: hid-sensor-incl-3d: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 21/22] iio: position: hid-sensor-custom-intel-hinge: " Andy Shevchenko
` (2 subsequent siblings)
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/orientation/hid-sensor-rotation.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c
index 5e8cadd5177a..107adadf7711 100644
--- a/drivers/iio/orientation/hid-sensor-rotation.c
+++ b/drivers/iio/orientation/hid-sensor-rotation.c
@@ -230,11 +230,11 @@ static int dev_rot_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_dev_rot_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret;
char *name;
struct iio_dev *indio_dev;
struct dev_rot_state *rot_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct dev_rot_state));
@@ -329,7 +329,7 @@ static int hid_dev_rot_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_dev_rot_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct dev_rot_state *rot_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 21/22] iio: position: hid-sensor-custom-intel-hinge: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (19 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 20/22] iio: orientation: hid-sensor-rotation: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 22/22] iio: pressure: hid-sensor-press: " Andy Shevchenko
2024-09-03 17:57 ` [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/position/hid-sensor-custom-intel-hinge.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
index 76e173850a35..63a9f2fcada7 100644
--- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c
+++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c
@@ -263,9 +263,9 @@ static int hinge_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_hinge_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct hinge_state *st;
struct iio_dev *indio_dev;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
int ret;
int i;
@@ -344,7 +344,7 @@ static int hid_hinge_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_hinge_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct hinge_state *st = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* [PATCH v1 22/22] iio: pressure: hid-sensor-press: Get platform data via dev_get_platdata()
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (20 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 21/22] iio: position: hid-sensor-custom-intel-hinge: " Andy Shevchenko
@ 2024-09-02 22:17 ` Andy Shevchenko
2024-09-03 17:57 ` [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
22 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-02 22:17 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen,
Michael Hennerich, Andy Shevchenko
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Access to platform data via dev_get_platdata() getter to make code cleaner.
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
drivers/iio/pressure/hid-sensor-press.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c
index 956045e2db29..b7e9a085f0cc 100644
--- a/drivers/iio/pressure/hid-sensor-press.c
+++ b/drivers/iio/pressure/hid-sensor-press.c
@@ -241,11 +241,11 @@ static int press_parse_report(struct platform_device *pdev,
/* Function to initialize the processing for usage id */
static int hid_press_probe(struct platform_device *pdev)
{
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
int ret = 0;
static const char *name = "press";
struct iio_dev *indio_dev;
struct press_state *press_state;
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
indio_dev = devm_iio_device_alloc(&pdev->dev,
sizeof(struct press_state));
@@ -325,7 +325,7 @@ static int hid_press_probe(struct platform_device *pdev)
/* Function to deinitialize the processing for usage id */
static void hid_press_remove(struct platform_device *pdev)
{
- struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+ struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
struct iio_dev *indio_dev = platform_get_drvdata(pdev);
struct press_state *press_state = iio_priv(indio_dev);
--
2.46.0
^ permalink raw reply related [flat|nested] 31+ messages in thread
* Re: [PATCH v1 17/22] iio: light: lm3533-als: Get platform data via dev_get_platdata()
2024-09-02 22:17 ` [PATCH v1 17/22] iio: light: lm3533-als: " Andy Shevchenko
@ 2024-09-03 6:33 ` Johan Hovold
0 siblings, 0 replies; 31+ messages in thread
From: Johan Hovold @ 2024-09-03 6:33 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
On Tue, Sep 03, 2024 at 01:17:02AM +0300, Andy Shevchenko wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Johan Hovold <johan@kernel.org>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
2024-09-02 22:16 ` [PATCH v1 14/22] iio: imu: st_lsm6dsx: " Andy Shevchenko
@ 2024-09-03 7:10 ` Lorenzo Bianconi
2024-09-03 10:38 ` Andy Shevchenko
0 siblings, 1 reply; 31+ messages in thread
From: Lorenzo Bianconi @ 2024-09-03 7:10 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
[-- Attachment #1: Type: text/plain, Size: 3263 bytes --]
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> index ed0267929725..3958b5e1a3f6 100644
> --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
> @@ -2132,14 +2132,11 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
> const struct st_lsm6dsx_reg **drdy_reg)
> {
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
nit: I guess you can move pdata pointer in the 'if' block, since it is just
used there.
Regards,
Lorenzo
> int err = 0, drdy_pin;
>
> - if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
> - struct st_sensors_platform_data *pdata;
> -
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
> drdy_pin = pdata ? pdata->drdy_int_pin : 1;
> - }
>
> switch (drdy_pin) {
> case 1:
> @@ -2162,14 +2159,13 @@ st_lsm6dsx_get_drdy_reg(struct st_lsm6dsx_hw *hw,
> static int st_lsm6dsx_init_shub(struct st_lsm6dsx_hw *hw)
> {
> const struct st_lsm6dsx_shub_settings *hub_settings;
> - struct st_sensors_platform_data *pdata;
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> unsigned int data;
> int err = 0;
>
> hub_settings = &hw->settings->shub_settings;
>
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> if (device_property_read_bool(dev, "st,pullups") ||
> (pdata && pdata->pullups)) {
> if (hub_settings->pullup_en.sec_page) {
> @@ -2524,9 +2520,9 @@ static irqreturn_t st_lsm6dsx_sw_trigger_handler_thread(int irq,
>
> static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
> {
> - struct st_sensors_platform_data *pdata;
> const struct st_lsm6dsx_reg *reg;
> struct device *dev = hw->dev;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> unsigned long irq_type;
> bool irq_active_low;
> int err;
> @@ -2554,7 +2550,6 @@ static int st_lsm6dsx_irq_setup(struct st_lsm6dsx_hw *hw)
> if (err < 0)
> return err;
>
> - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> if (device_property_read_bool(dev, "drive-open-drain") ||
> (pdata && pdata->open_drain)) {
> reg = &hw->settings->irq_config.od;
> @@ -2639,7 +2634,7 @@ static int st_lsm6dsx_init_regulators(struct device *dev)
> int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
> struct regmap *regmap)
> {
> - struct st_sensors_platform_data *pdata = dev->platform_data;
> + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
> const struct st_lsm6dsx_shub_settings *hub_settings;
> struct st_lsm6dsx_hw *hw;
> const char *name = NULL;
> --
> 2.46.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 14/22] iio: imu: st_lsm6dsx: Get platform data via dev_get_platdata()
2024-09-03 7:10 ` Lorenzo Bianconi
@ 2024-09-03 10:38 ` Andy Shevchenko
0 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-03 10:38 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
On Tue, Sep 3, 2024 at 10:11 AM Lorenzo Bianconi <lorenzo@kernel.org> wrote:
...
> > struct device *dev = hw->dev;
> > + const struct st_sensors_platform_data *pdata = dev_get_platdata(dev);
>
> nit: I guess you can move pdata pointer in the 'if' block, since it is just
> used there.
Yes, but it will increase the LoCs number by 3 for no benefit for each
of such cases.
> > int err = 0, drdy_pin;
> >
> > - if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0) {
> > - struct st_sensors_platform_data *pdata;
> > -
> > - pdata = (struct st_sensors_platform_data *)dev->platform_data;
> > + if (device_property_read_u32(dev, "st,drdy-int-pin", &drdy_pin) < 0)
> > drdy_pin = pdata ? pdata->drdy_int_pin : 1;
> > - }
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
` (21 preceding siblings ...)
2024-09-02 22:17 ` [PATCH v1 22/22] iio: pressure: hid-sensor-press: " Andy Shevchenko
@ 2024-09-03 17:57 ` Andy Shevchenko
2024-09-07 15:42 ` Jonathan Cameron
22 siblings, 1 reply; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-03 17:57 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Michael Hennerich,
Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel
Cc: Jiri Kosina, Jonathan Cameron, Lars-Peter Clausen
On Tue, Sep 03, 2024 at 01:16:45AM +0300, Andy Shevchenko wrote:
> Unify how IIO drivers access platform_data field of struct device.
> In simple and straightforward cases constify the local variables.
>
> (Not tested)
Jonathan, in case you are fine with the series, feel free to squash, e.g.,
changes against hid-sensor drivers.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 10/22] iio: dac: max517: Get platform data via dev_get_platdata()
2024-09-02 22:16 ` [PATCH v1 10/22] iio: dac: max517: " Andy Shevchenko
@ 2024-09-03 19:47 ` Jonathan Cameron
2024-09-03 20:02 ` Andy Shevchenko
0 siblings, 1 reply; 31+ messages in thread
From: Jonathan Cameron @ 2024-09-03 19:47 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Andy Shevchenko,
Michael Hennerich, Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Lars-Peter Clausen
On Tue, 3 Sep 2024 01:16:55 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
> drivers/iio/dac/max517.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
> index 685980184d3c..96781ae04f9d 100644
> --- a/drivers/iio/dac/max517.c
> +++ b/drivers/iio/dac/max517.c
> @@ -143,10 +143,10 @@ static const struct iio_chan_spec max517_channels[] = {
>
> static int max517_probe(struct i2c_client *client)
> {
> + const struct max517_platform_data *platform_data = dev_get_platdata(&client->dev);
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> struct max517_data *data;
> struct iio_dev *indio_dev;
> - struct max517_platform_data *platform_data = client->dev.platform_data;
> int chan;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> @@ -176,7 +176,7 @@ static int max517_probe(struct i2c_client *client)
>
> /*
> * Reference voltage on MAX518 and default is 5V, else take vref_mv
> - * from platform_data
> + * from platform_data.
I guess this is accidental?
J
> */
> for (chan = 0; chan < indio_dev->num_channels; chan++) {
> if (id->driver_data == ID_MAX518 || !platform_data)
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 10/22] iio: dac: max517: Get platform data via dev_get_platdata()
2024-09-03 19:47 ` Jonathan Cameron
@ 2024-09-03 20:02 ` Andy Shevchenko
0 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-03 20:02 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, David Lechner, Michael Hennerich,
Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Lars-Peter Clausen
On Tue, Sep 03, 2024 at 08:47:37PM +0100, Jonathan Cameron wrote:
> On Tue, 3 Sep 2024 01:16:55 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
...
> > * Reference voltage on MAX518 and default is 5V, else take vref_mv
> > - * from platform_data
> > + * from platform_data.
>
> I guess this is accidental?
It can be dropped.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data
2024-09-03 17:57 ` [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
@ 2024-09-07 15:42 ` Jonathan Cameron
2024-09-09 9:17 ` Andy Shevchenko
0 siblings, 1 reply; 31+ messages in thread
From: Jonathan Cameron @ 2024-09-07 15:42 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Jonathan Cameron, David Lechner, Michael Hennerich,
Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Lars-Peter Clausen
On Tue, 3 Sep 2024 20:57:27 +0300
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> On Tue, Sep 03, 2024 at 01:16:45AM +0300, Andy Shevchenko wrote:
> > Unify how IIO drivers access platform_data field of struct device.
> > In simple and straightforward cases constify the local variables.
> >
> > (Not tested)
>
> Jonathan, in case you are fine with the series, feel free to squash, e.g.,
> changes against hid-sensor drivers.
I don't follow, but maybe that will become clear once I've looked
at rest of the stuff I haven't read yet.
Anyhow, applied to the togreg branch of iio.git and pushed out as testing
for all the normal reasons. Another series that will probably be 6.13 material.
Thanks,
Jonathan
>
^ permalink raw reply [flat|nested] 31+ messages in thread
* Re: [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data
2024-09-07 15:42 ` Jonathan Cameron
@ 2024-09-09 9:17 ` Andy Shevchenko
0 siblings, 0 replies; 31+ messages in thread
From: Andy Shevchenko @ 2024-09-09 9:17 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Jonathan Cameron, David Lechner, Michael Hennerich,
Antoniu Miclaus, Jinjie Ruan, Lorenzo Bianconi,
Srinivas Pandruvada, Basavaraj Natikar, linux-input, linux-iio,
linux-kernel, Jiri Kosina, Lars-Peter Clausen
On Sat, Sep 07, 2024 at 04:42:58PM +0100, Jonathan Cameron wrote:
> On Tue, 3 Sep 2024 20:57:27 +0300
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> > On Tue, Sep 03, 2024 at 01:16:45AM +0300, Andy Shevchenko wrote:
> > > Unify how IIO drivers access platform_data field of struct device.
> > > In simple and straightforward cases constify the local variables.
> > >
> > > (Not tested)
> >
> > Jonathan, in case you are fine with the series, feel free to squash, e.g.,
> > changes against hid-sensor drivers.
> I don't follow, but maybe that will become clear once I've looked
> at rest of the stuff I haven't read yet.
I mean all the patches that starts with "iio: *: hid-sensor-*:" can be squashed
into one with "iio: hid-sensor:"
> Anyhow, applied to the togreg branch of iio.git and pushed out as testing
> for all the normal reasons. Another series that will probably be 6.13 material.
Thank you!
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 31+ messages in thread
end of thread, other threads:[~2024-09-09 9:18 UTC | newest]
Thread overview: 31+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-02 22:16 [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 01/22] iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata() Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 02/22] iio: adc: ad7266: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 03/22] iio: adc: ad7791: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 04/22] iio: adc: ad7887: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 05/22] iio: adc: ad7793: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 06/22] iio: adc: ltc2497: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 07/22] iio: dac: ad5504: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 08/22] iio: dac: ad5791: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 09/22] iio: dac: m62332: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 10/22] iio: dac: max517: " Andy Shevchenko
2024-09-03 19:47 ` Jonathan Cameron
2024-09-03 20:02 ` Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 11/22] iio: frequency: ad9523: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 12/22] iio: frequency: adf4350: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 13/22] iio: gyro: hid-sensor-gyro-3d: " Andy Shevchenko
2024-09-02 22:16 ` [PATCH v1 14/22] iio: imu: st_lsm6dsx: " Andy Shevchenko
2024-09-03 7:10 ` Lorenzo Bianconi
2024-09-03 10:38 ` Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 15/22] iio: light: hid-sensor-als: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 16/22] iio: light: hid-sensor-prox: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 17/22] iio: light: lm3533-als: " Andy Shevchenko
2024-09-03 6:33 ` Johan Hovold
2024-09-02 22:17 ` [PATCH v1 18/22] iio: magnetometer: hid-sensor-magn-3d: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 19/22] iio: orientation: hid-sensor-incl-3d: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 20/22] iio: orientation: hid-sensor-rotation: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 21/22] iio: position: hid-sensor-custom-intel-hinge: " Andy Shevchenko
2024-09-02 22:17 ` [PATCH v1 22/22] iio: pressure: hid-sensor-press: " Andy Shevchenko
2024-09-03 17:57 ` [PATCH v1 00/22] iio: use dev_get_platdata() to access platform_data Andy Shevchenko
2024-09-07 15:42 ` Jonathan Cameron
2024-09-09 9:17 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).