diff mbox series

[02/23] iio:adc:axp20x: Convert from OF to generic fw / device properties

Message ID 20200628123654.32830-3-jic23@kernel.org (mailing list archive)
State New, archived
Headers show
Series iio:adc more of_match_ptr and similar removal | expand

Commit Message

Jonathan Cameron June 28, 2020, 12:36 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Whilst fairly unlikely anyone will ever use this driver with anything
other than DT, we are trying to move IIO over to the generic interfaces
where easy to do so.

In this case this involved moving to generic check on presence
of fw_node, generic device_get_match_data and dropping the of_match_ptr
protection.  Also relevant header changes to have property.h and
mod_devicetable.h only.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Quentin Schulz <quentin.schulz@bootlin.com>
---
 drivers/iio/adc/axp20x_adc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Andy Shevchenko June 28, 2020, 5:43 p.m. UTC | #1
On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:

> Whilst fairly unlikely anyone will ever use this driver with anything
> other than DT, we are trying to move IIO over to the generic interfaces
> where easy to do so.
>
> In this case this involved moving to generic check on presence
> of fw_node, generic device_get_match_data and dropping the of_match_ptr
> protection.  Also relevant header changes to have property.h and
> mod_devicetable.h only.

...

> -               info->data = (struct axp_data *)of_device_get_match_data(dev);
> +               info->data = (struct axp_data *)device_get_match_data(dev);

Casting is not needed, but if you remove it it reveals a hidden const
qualifier drop.
Jonathan Cameron June 28, 2020, 7:16 p.m. UTC | #2
On Sun, 28 Jun 2020 20:43:50 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Sun, Jun 28, 2020 at 3:39 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > Whilst fairly unlikely anyone will ever use this driver with anything
> > other than DT, we are trying to move IIO over to the generic interfaces
> > where easy to do so.
> >
> > In this case this involved moving to generic check on presence
> > of fw_node, generic device_get_match_data and dropping the of_match_ptr
> > protection.  Also relevant header changes to have property.h and
> > mod_devicetable.h only.  
> 
> ...
> 
> > -               info->data = (struct axp_data *)of_device_get_match_data(dev);
> > +               info->data = (struct axp_data *)device_get_match_data(dev);  
> 
> Casting is not needed, but if you remove it it reveals a hidden const
> qualifier drop.
> 

Doh.  I should have noticed the odd cast..

Will fix up.  Making info->data a const as well will tidy that up.

Thanks,

Jonathan
diff mbox series

Patch

diff --git a/drivers/iio/adc/axp20x_adc.c b/drivers/iio/adc/axp20x_adc.c
index 798ff2d89691..b678f897d983 100644
--- a/drivers/iio/adc/axp20x_adc.c
+++ b/drivers/iio/adc/axp20x_adc.c
@@ -9,10 +9,10 @@ 
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/pm_runtime.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 #include <linux/thermal.h>
 
@@ -670,7 +670,7 @@  static int axp20x_probe(struct platform_device *pdev)
 	info->regmap = axp20x_dev->regmap;
 	indio_dev->modes = INDIO_DIRECT_MODE;
 
-	if (!pdev->dev.of_node) {
+	if (!dev_fwnode(&pdev->dev)) {
 		const struct platform_device_id *id;
 
 		id = platform_get_device_id(pdev);
@@ -678,7 +678,7 @@  static int axp20x_probe(struct platform_device *pdev)
 	} else {
 		struct device *dev = &pdev->dev;
 
-		info->data = (struct axp_data *)of_device_get_match_data(dev);
+		info->data = (struct axp_data *)device_get_match_data(dev);
 	}
 
 	indio_dev->name = platform_get_device_id(pdev)->name;
@@ -742,7 +742,7 @@  static int axp20x_remove(struct platform_device *pdev)
 static struct platform_driver axp20x_adc_driver = {
 	.driver = {
 		.name = "axp20x-adc",
-		.of_match_table = of_match_ptr(axp20x_adc_of_match),
+		.of_match_table = axp20x_adc_of_match,
 	},
 	.id_table = axp20x_adc_id_match,
 	.probe = axp20x_probe,