diff mbox series

[6/8] iio: accel: mma8452: Switch from of specific to fwnode property handling.

Message ID 20240218172731.1023367-7-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>

In this case only use was to get an irq so easily converted.
Also include linux/mod_devicetable.h for struct of_device_id definition.

Using the generic firmware handling, this driver may be used with other
firmware types. This also removes an example that might get copied into
other drivers leaving them unable to be used with alternative firmware
types.

Cc: Haibo Chen <haibo.chen@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/iio/accel/mma8452.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Bough Chen Feb. 23, 2024, 11:10 a.m. UTC | #1
> -----Original Message-----
> From: Jonathan Cameron <jic23@kernel.org>
> Sent: 2024年2月19日 1:27
> To: linux-iio@vger.kernel.org; Andy Shevchenko
> <andriy.shevchenko@linux.intel.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>; Michael Hennerich
> <Michael.Hennerich@analog.com>; Nuno Sá <nuno.sa@analog.com>;
> Alisa-Dariana Roman <alisa.roman@analog.com>; Bough Chen
> <haibo.chen@nxp.com>; Sean Nyekjaer <sean@geanix.com>; Andreas Klinger
> <ak@it-klinger.de>; Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Subject: [PATCH 6/8] iio: accel: mma8452: Switch from of specific to fwnode
> property handling.
> 
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> In this case only use was to get an irq so easily converted.
> Also include linux/mod_devicetable.h for struct of_device_id definition.
> 
> Using the generic firmware handling, this driver may be used with other
> firmware types. This also removes an example that might get copied into other
> drivers leaving them unable to be used with alternative firmware types.
> 
> Cc: Haibo Chen <haibo.chen@nxp.com>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Reviewed-and-tested-by: Haibo Chen <haibo.chen@nxp.com>

> ---
>  drivers/iio/accel/mma8452.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c index
> d3fd0318e47b..62e6369e2269 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -19,6 +19,8 @@
>   */
> 
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/property.h>
>  #include <linux/i2c.h>
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>
> @@ -28,8 +30,6 @@
>  #include <linux/iio/triggered_buffer.h>  #include <linux/iio/events.h>
> #include <linux/delay.h> -#include <linux/of.h> -#include <linux/of_irq.h>
> #include <linux/pm_runtime.h>  #include <linux/regulator/consumer.h>
> 
> @@ -1642,7 +1642,7 @@ static int mma8452_probe(struct i2c_client *client)
>  	if (client->irq) {
>  		int irq2;
> 
> -		irq2 = of_irq_get_byname(client->dev.of_node, "INT2");
> +		irq2 = fwnode_irq_get_byname(dev_fwnode(&client->dev), "INT2");
> 
>  		if (irq2 == client->irq) {
>  			dev_dbg(&client->dev, "using interrupt line INT2\n");
> --
> 2.43.2
diff mbox series

Patch

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index d3fd0318e47b..62e6369e2269 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -19,6 +19,8 @@ 
  */
 
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/property.h>
 #include <linux/i2c.h>
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
@@ -28,8 +30,6 @@ 
 #include <linux/iio/triggered_buffer.h>
 #include <linux/iio/events.h>
 #include <linux/delay.h>
-#include <linux/of.h>
-#include <linux/of_irq.h>
 #include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 
@@ -1642,7 +1642,7 @@  static int mma8452_probe(struct i2c_client *client)
 	if (client->irq) {
 		int irq2;
 
-		irq2 = of_irq_get_byname(client->dev.of_node, "INT2");
+		irq2 = fwnode_irq_get_byname(dev_fwnode(&client->dev), "INT2");
 
 		if (irq2 == client->irq) {
 			dev_dbg(&client->dev, "using interrupt line INT2\n");