diff mbox series

[8/8] iio: adc: hx711: Switch from of specific to fwnode property handling.

Message ID 20240218172731.1023367-9-jic23@kernel.org (mailing list archive)
State Accepted
Headers show
Series IIO: Convert DT specific handling over to fwnode | expand

Commit Message

Jonathan Cameron Feb. 18, 2024, 5:27 p.m. UTC
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Allows driver to be used with other firmware types and removes an
example that might be copied into new IIO drivers.

Cc: Andreas Klinger <ak@it-klinger.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/adc/hx711.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Andy Shevchenko Feb. 19, 2024, 12:06 p.m. UTC | #1
On Sun, Feb 18, 2024 at 05:27:31PM +0000, Jonathan Cameron wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Allows driver to be used with other firmware types and removes an
> example that might be copied into new IIO drivers.

...

>  	struct device *dev = &pdev->dev;

...

> -	ret = of_property_read_u32(np, "clock-frequency",
> +	ret = device_property_read_u32(&pdev->dev, "clock-frequency",
>  					&hx711_data->clock_frequency);

You have dev, use it!

	ret = device_property_read_u32(dev, "clock-frequency",
					&hx711_data->clock_frequency);

Also seems the indentation of the second line is broken.
diff mbox series

Patch

diff --git a/drivers/iio/adc/hx711.c b/drivers/iio/adc/hx711.c
index c80c55fb8c6c..fef97c1d226a 100644
--- a/drivers/iio/adc/hx711.c
+++ b/drivers/iio/adc/hx711.c
@@ -7,7 +7,7 @@ 
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/of.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
 #include <linux/property.h>
 #include <linux/slab.h>
@@ -459,7 +459,6 @@  static const struct iio_chan_spec hx711_chan_spec[] = {
 static int hx711_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
 	struct hx711_data *hx711_data;
 	struct iio_dev *indio_dev;
 	int ret;
@@ -533,7 +532,7 @@  static int hx711_probe(struct platform_device *pdev)
 	hx711_data->gain_chan_a = 128;
 
 	hx711_data->clock_frequency = 400000;
-	ret = of_property_read_u32(np, "clock-frequency",
+	ret = device_property_read_u32(&pdev->dev, "clock-frequency",
 					&hx711_data->clock_frequency);
 
 	/*