* [PATCH] iio/adc: Use of_device_get_match_data()
@ 2022-03-03 1:44 cgel.zte
2022-03-03 9:52 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2022-03-03 1:44 UTC (permalink / raw)
To: jic23; +Cc: lars, tangbin, linux-iio, linux-kernel, Minghao Chi, Zeal Robot
From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
Use of_device_get_match_data() to simplify the code.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
---
drivers/iio/adc/twl6030-gpadc.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
index afdb59e0b526..6a022e583658 100644
--- a/drivers/iio/adc/twl6030-gpadc.c
+++ b/drivers/iio/adc/twl6030-gpadc.c
@@ -867,16 +867,11 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct twl6030_gpadc_data *gpadc;
const struct twl6030_gpadc_platform_data *pdata;
- const struct of_device_id *match;
struct iio_dev *indio_dev;
int irq;
int ret;
- match = of_match_device(of_twl6030_match_tbl, dev);
- if (!match)
- return -EINVAL;
-
- pdata = match->data;
+ pdata = of_device_get_match_data(dev);
indio_dev = devm_iio_device_alloc(dev, sizeof(*gpadc));
if (!indio_dev)
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio/adc: Use of_device_get_match_data()
2022-03-03 1:44 [PATCH] iio/adc: Use of_device_get_match_data() cgel.zte
@ 2022-03-03 9:52 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-03-03 9:52 UTC (permalink / raw)
To: cgel.zte
Cc: jic23, lars, tangbin, linux-iio, linux-kernel, Minghao Chi, Zeal Robot
On Thu, 3 Mar 2022 01:44:45 +0000
cgel.zte@gmail.com wrote:
> From: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
>
> Use of_device_get_match_data() to simplify the code.
Hi
Thanks for the patch.
Please use the local naming convention for patches, so this should be:
iio: adc: twl6030: Use of_device_get_match_data()
However, we are in process of trying to move all of IIO over to generic
device properties (include/linux/properties.h) and so if we are going
to touch this driver, I'd like to see that change made.
Looks straight forwards with
device_get_match_data() being used here and dropping of_ specific headers
in favour of
linux/properties.h
linux/mod_devicetable.h
If you can make that change it would be great!
Thanks,
Jonathan
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Minghao Chi (CGEL ZTE) <chi.minghao@zte.com.cn>
> ---
> drivers/iio/adc/twl6030-gpadc.c | 7 +------
> 1 file changed, 1 insertion(+), 6 deletions(-)
>
> diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c
> index afdb59e0b526..6a022e583658 100644
> --- a/drivers/iio/adc/twl6030-gpadc.c
> +++ b/drivers/iio/adc/twl6030-gpadc.c
> @@ -867,16 +867,11 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
> struct device *dev = &pdev->dev;
> struct twl6030_gpadc_data *gpadc;
> const struct twl6030_gpadc_platform_data *pdata;
> - const struct of_device_id *match;
> struct iio_dev *indio_dev;
> int irq;
> int ret;
>
> - match = of_match_device(of_twl6030_match_tbl, dev);
> - if (!match)
> - return -EINVAL;
> -
> - pdata = match->data;
> + pdata = of_device_get_match_data(dev);
>
> indio_dev = devm_iio_device_alloc(dev, sizeof(*gpadc));
> if (!indio_dev)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-03 9:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-03 1:44 [PATCH] iio/adc: Use of_device_get_match_data() cgel.zte
2022-03-03 9:52 ` Jonathan Cameron
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.