Skip to contentSkip to conversation

mfd: twl6030-irq: Use of_device_get_match_data()

PATCH In review Rosen Penev 2 participants 3 messages May 18

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

PATCH 1/1 mfd: twl6030-irq: Use of_device_get_match_data()

Use of_device_get_match_data() to fetch the IRQ mapping table directly instead of open-coding an of_match_device() lookup.

This also lets the driver drop the of_device.h include.

Assisted-by Codex:GPT-5.5
---
 drivers/mfd/twl6030-irq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mfd/twl6030-irq.c +4 -6
index 0ca00f618d4d..8831c81a1f90 100644
@@ -27,7 +27,6 @@
 #include <linux/suspend.h>
 #include <linux/of.h>
 #include <linux/irqdomain.h>
-#include <linux/of_device.h>
 
 #include "twl-core.h"
 
@@ -293,10 +292,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const struct of_device_id *of_id;
+	const int *irq_mapping_tbl;
 
-	of_id = of_match_device(twl6030_of_match, dev);
-	if (!of_id || !of_id->data) {
+	irq_mapping_tbl = of_device_get_match_data(dev);
+	if (!irq_mapping_tbl) {
 		dev_err(dev, "Unknown TWL device model\n");
 		return -EINVAL;
 	}
@@ -334,7 +333,7 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 
 	twl6030_irq->pm_nb.notifier_call = twl6030_irq_pm_notifier;
 	atomic_set(&twl6030_irq->wakeirqs, 0);
-	twl6030_irq->irq_mapping_tbl = of_id->data;
+	twl6030_irq->irq_mapping_tbl = irq_mapping_tbl;
 
 	twl6030_irq->irq_domain = irq_domain_create_linear(dev_fwnode(dev), nr_irqs,
 							   &twl6030_irq_domain_ops, twl6030_irq);
@@ -378,4 +377,3 @@ void twl6030_exit_irq(void)
 		 */
 	}
 }
-
Signature · 1 line
2.54.0
maintainer
#1 lore raw
Quoted 23 lines · On Sun, 17 May 2026 21:15:58 -0700 Rosen Penev <[email protected]> wrote:

Use of_device_get_match_data() to fetch the IRQ mapping table directly instead of open-coding an of_match_device() lookup.

This also lets the driver drop the of_device.h include.

Assisted-by Codex:GPT-5.5
---
 drivers/mfd/twl6030-irq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mfd/twl6030-irq.c +0 -1
index 0ca00f618d4d..8831c81a1f90 100644
@@ -27,7 +27,6 @@
 #include <linux/suspend.h>
 #include <linux/of.h>
 #include <linux/irqdomain.h>
-#include <linux/of_device.h>
 
 #include "twl-core.h"
 

drivers/mfd/twl6030-irq.c int twl6030_init_irq(struct device *dev, int irq_num) · line 298

Quoted 7 lines
drivers/mfd/twl6030-irq.c +1 -2
@@ -293,10 +292,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const struct of_device_id *of_id;
+	const int *irq_mapping_tbl;
 
-	of_id = of_match_device(twl6030_of_match, dev);

twl6030_of_match is used only here.

drivers/mfd/twl6030-irq.c int twl6030_init_irq(struct device *dev, int irq_num) · line 297

Quoted 2 lines
drivers/mfd/twl6030-irq.c +1 -1
-	if (!of_id || !of_id->data) {
+	irq_mapping_tbl = of_device_get_match_data(dev);

so how should of_device_get_match_data() know about it?

Regards,
Andreas

#2 lore raw
Quoted 32 lines · Andreas Kemnade
Quoted 29 lines · On Sun, 17 May 2026 21:15:58 -0700 Rosen Penev <[email protected]> wrote:

Use of_device_get_match_data() to fetch the IRQ mapping table directly instead of open-coding an of_match_device() lookup.

This also lets the driver drop the of_device.h include.

Assisted-by Codex:GPT-5.5
---
 drivers/mfd/twl6030-irq.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/mfd/twl6030-irq.c +1 -2
index 0ca00f618d4d..8831c81a1f90 100644
@@ -27,7 +27,6 @@
 #include <linux/suspend.h>
 #include <linux/of.h>
 #include <linux/irqdomain.h>
-#include <linux/of_device.h>
 
 #include "twl-core.h"
 
@@ -293,10 +292,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const struct of_device_id *of_id;
+	const int *irq_mapping_tbl;
 
Quoted 8 lines

drivers/mfd/twl6030-irq.c int twl6030_init_irq(struct device *dev, int irq_num) · line 298

Quoted 1 line
drivers/mfd/twl6030-irq.c +0 -1
-	of_id = of_match_device(twl6030_of_match, dev);

twl6030_of_match is used only here.

drivers/mfd/twl6030-irq.c int twl6030_init_irq(struct device *dev, int irq_num) · line 297

Quoted 2 lines
drivers/mfd/twl6030-irq.c +1 -1
-	if (!of_id || !of_id->data) {
+	irq_mapping_tbl = of_device_get_match_data(dev);

so how should of_device_get_match_data() know about it?

Ah looks like this is wrong.

Quoted 3 lines

Regards,
Andreas