Skip to contentSkip to conversation

iio: proximity: mb1232: Switch to use fwnode_irq_get()

PATCH In review Andy Shevchenko 3 participants 4 messages Apr 13, 2022 – Apr 28, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: proximity: mb1232: Switch to use fwnode_irq_get()

We have OF-centric variant of fwnode_irq_get() in the driver. Replace it with a call to an agnostic implementation.

---
 drivers/iio/proximity/mb1232.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/proximity/mb1232.c +5 -3
index ad4b1fb2607a..0bca5f74de68 100644
@@ -10,12 +10,14 @@
  * https://www.maxbotix.com/documents/I2CXL-MaxSonar-EZ_Datasheet.pdf
  */
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/of_irq.h>
 #include <linux/delay.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
+#include <linux/property.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
@@ -209,7 +211,7 @@ static int mb1232_probe(struct i2c_client *client,
 
 	init_completion(&data->ranging);
 
-	data->irqnr = irq_of_parse_and_map(dev->of_node, 0);
+	data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
 	if (data->irqnr <= 0) {
 		/* usage of interrupt is optional */
 		data->irqnr = -1;
Signature · 1 line
2.35.1
maintainer
#1 lore raw
Quoted 4 lines · On Wed, 13 Apr 2022 21:31:23 +0300 Andy Shevchenko…

We have OF-centric variant of fwnode_irq_get() in the driver. Replace it with a call to an agnostic implementation.

Whilst I 'think' this ends up being functionally identical I'd like to leave it a little longer to see if Andreas has time to take a look and verify this change is fine.

There seem to be subtle differences in the irq setup as the new code does a sanity check on the domain being available and defers if not which I don't think happens with the existing code.

Thanks,

Jonathan

Quoted 34 lines
---
 drivers/iio/proximity/mb1232.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/proximity/mb1232.c +5 -3
index ad4b1fb2607a..0bca5f74de68 100644
@@ -10,12 +10,14 @@
  * https://www.maxbotix.com/documents/I2CXL-MaxSonar-EZ_Datasheet.pdf
  */
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/of_irq.h>
 #include <linux/delay.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
+#include <linux/property.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
@@ -209,7 +211,7 @@ static int mb1232_probe(struct i2c_client *client,
 
 	init_completion(&data->ranging);
 
-	data->irqnr = irq_of_parse_and_map(dev->of_node, 0);
+	data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
 	if (data->irqnr <= 0) {
 		/* usage of interrupt is optional */
 		data->irqnr = -1;
maintainer Acked-by
#2 lore raw

Jonathan Cameron <[email protected]> schrieb am Sa, 16. Apr 12:07:

Quoted 8 lines
Quoted 4 lines · On Wed, 13 Apr 2022 21:31:23 +0300 Andy Shevchenko…

We have OF-centric variant of fwnode_irq_get() in the driver. Replace it with a call to an agnostic implementation.

Quoted 8 lines

Whilst I 'think' this ends up being functionally identical I'd like to leave it a little longer to see if Andreas has time to take a look and verify this change is fine.

There seem to be subtle differences in the irq setup as the new code does a sanity check on the domain being available and defers if not which I don't think happens with the existing code.

Anyway interrupts are optional and the driver will work without i don't see any issue here.

Quoted 41 lines

Thanks,

Jonathan

Quoted 34 lines
---
 drivers/iio/proximity/mb1232.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/proximity/mb1232.c +5 -3
index ad4b1fb2607a..0bca5f74de68 100644
@@ -10,12 +10,14 @@
  * https://www.maxbotix.com/documents/I2CXL-MaxSonar-EZ_Datasheet.pdf
  */
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/of_irq.h>
 #include <linux/delay.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
+#include <linux/property.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
@@ -209,7 +211,7 @@ static int mb1232_probe(struct i2c_client *client,
 
 	init_completion(&data->ranging);
 
-	data->irqnr = irq_of_parse_and_map(dev->of_node, 0);
+	data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
 	if (data->irqnr <= 0) {
 		/* usage of interrupt is optional */
 		data->irqnr = -1;
Signature · 7 lines
Andreas Klinger
Grabenreith 27
84508 Burgkirchen
+49 8623 919966
[email protected]
www.it-klinger.de
www.grabenreith.de
maintainer
#3 lore raw
Quoted 18 lines · On Tue, 19 Apr 2022 12:24:26 +0200 Andreas Klinger <[email protected]> wrote:

Jonathan Cameron <[email protected]> schrieb am Sa, 16. Apr 12:07:

Quoted 8 lines
Quoted 4 lines · On Wed, 13 Apr 2022 21:31:23 +0300 Andy Shevchenko…

We have OF-centric variant of fwnode_irq_get() in the driver. Replace it with a call to an agnostic implementation.

Quoted 8 lines

Whilst I 'think' this ends up being functionally identical I'd like to leave it a little longer to see if Andreas has time to take a look and verify this change is fine.

There seem to be subtle differences in the irq setup as the new code does a sanity check on the domain being available and defers if not which I don't think happens with the existing code.

Quoted 4 lines

Anyway interrupts are optional and the driver will work without i don't see any issue here.

Applied to the togreg branch of iio.git and pushed out as testing to see if 0-day can find anything we missed.

Thanks,

Jonathan

Quoted 43 lines
Quoted 42 lines

Thanks,

Jonathan

Quoted 34 lines
---
 drivers/iio/proximity/mb1232.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/iio/proximity/mb1232.c +5 -3
index ad4b1fb2607a..0bca5f74de68 100644
@@ -10,12 +10,14 @@
  * https://www.maxbotix.com/documents/I2CXL-MaxSonar-EZ_Datasheet.pdf
  */
 
+#include <linux/bitops.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/of_irq.h>
 #include <linux/delay.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/bitops.h>
+#include <linux/property.h>
+
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
 #include <linux/iio/buffer.h>
@@ -209,7 +211,7 @@ static int mb1232_probe(struct i2c_client *client,
 
 	init_completion(&data->ranging);
 
-	data->irqnr = irq_of_parse_and_map(dev->of_node, 0);
+	data->irqnr = fwnode_irq_get(dev_fwnode(&client->dev), 0);
 	if (data->irqnr <= 0) {
 		/* usage of interrupt is optional */
 		data->irqnr = -1;