Skip to contentSkip to conversation

mfd: twl6030-irq: Revert to use of_match_device()

PATCH Applied Peter Ujfalusi 4 participants 9 messages Oct 29, 2023 – Feb 26, 2024

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

PATCH 1/1 mfd: twl6030-irq: Revert to use of_match_device()

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")
---
 drivers/mfd/twl6030-irq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/twl6030-irq.c +5 -5
index f9fce8408c2c..3c03681c124c 100644
@@ -24,10 +24,10 @@
 #include <linux/kthread.h>
 #include <linux/mfd/twl.h>
 #include <linux/platform_device.h>
-#include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/of.h>
 #include <linux/irqdomain.h>
+#include <linux/of_device.h>
 
 #include "twl-core.h"
 
@@ -368,10 +368,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const int		*irq_tbl;
+	const struct of_device_id *of_id;
 
-	irq_tbl = device_get_match_data(dev);
-	if (!irq_tbl) {
+	of_id = of_match_device(twl6030_of_match, dev);
+	if (!of_id || !of_id->data) {
 		dev_err(dev, "Unknown TWL device model\n");
 		return -EINVAL;
 	}
@@ -409,7 +409,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 = irq_tbl;
+	twl6030_irq->irq_mapping_tbl = of_id->data;
 
 	twl6030_irq->irq_domain =
 		irq_domain_add_linear(node, nr_irqs,
Signature · 1 line
2.42.0
maintainer
#1 lore raw
Quoted 28 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")
---
 drivers/mfd/twl6030-irq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/twl6030-irq.c +1 -1
index f9fce8408c2c..3c03681c124c 100644
@@ -24,10 +24,10 @@
 #include <linux/kthread.h>
 #include <linux/mfd/twl.h>
 #include <linux/platform_device.h>
-#include <linux/property.h>
 #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 373

Quoted 9 lines
drivers/mfd/twl6030-irq.c +2 -3
@@ -368,10 +368,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const int		*irq_tbl;
+	const struct of_device_id *of_id;
 
-	irq_tbl = device_get_match_data(dev);
-	if (!irq_tbl) {
+	of_id = of_match_device(twl6030_of_match, dev);

I think you just dropped support for ACPI.

Rob, care to follow-up?

Quoted 16 lines
drivers/mfd/twl6030-irq.c +2 -1
+	if (!of_id || !of_id->data) {
 		dev_err(dev, "Unknown TWL device model\n");
 		return -EINVAL;
 	}
@@ -409,7 +409,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 = irq_tbl;
+	twl6030_irq->irq_mapping_tbl = of_id->data;
 
 	twl6030_irq->irq_domain =
 		irq_domain_add_linear(node, nr_irqs,
Signature · 1 line
2.42.0
Signature · 1 line
Lee Jones [李琼斯]
maintainer
#2 lore raw
Quoted 36 lines · Lee Jones
Quoted 34 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")
---
 drivers/mfd/twl6030-irq.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/mfd/twl6030-irq.c +2 -2
index f9fce8408c2c..3c03681c124c 100644
@@ -24,10 +24,10 @@
 #include <linux/kthread.h>
 #include <linux/mfd/twl.h>
 #include <linux/platform_device.h>
-#include <linux/property.h>
 #include <linux/suspend.h>
 #include <linux/of.h>
 #include <linux/irqdomain.h>
+#include <linux/of_device.h>
 
 #include "twl-core.h"
 
@@ -368,10 +368,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const int		*irq_tbl;
+	const struct of_device_id *of_id;
 
Quoted 5 lines

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

Quoted 3 lines
drivers/mfd/twl6030-irq.c +1 -2
-	irq_tbl = device_get_match_data(dev);
-	if (!irq_tbl) {
+	of_id = of_match_device(twl6030_of_match, dev);

I think you just dropped support for ACPI.

Ah, scrap that. I was looking at the wrong part of 1e0c866887f4.

So what about the other drivers changed in the aforementioned commit?

Ideally we'd have a call that covers all of the various probing APIs.

Quoted 1 line

Rob, care to follow-up?

I'd still like Rob to comment.

Signature · 1 line
Lee Jones [李琼斯]
#3 lore raw
Quoted 13 lines · Lee Jones
Quoted 7 lines
Quoted 7 lines
drivers/mfd/twl6030-irq.c +1 -1
@@ -368,10 +368,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const int		*irq_tbl;
+	const struct of_device_id *of_id;
 
Quoted 5 lines

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

Quoted 3 lines
drivers/mfd/twl6030-irq.c +1 -2
-	irq_tbl = device_get_match_data(dev);
-	if (!irq_tbl) {
+	of_id = of_match_device(twl6030_of_match, dev);

I think you just dropped support for ACPI.

Quoted 3 lines

Ah, scrap that. I was looking at the wrong part of 1e0c866887f4.

So what about the other drivers changed in the aforementioned commit?

Looking back at it again, I think only this patch is needed. This is not a real driver, it is using the twl core's device. The twl6030 is for sure broken, let me reply to the twl4030-power in a sec.

Quoted 6 lines

Ideally we'd have a call that covers all of the various probing APIs.

Quoted 1 line

Rob, care to follow-up?

I'd still like Rob to comment.

Signature · 1 line
Péter
maintainer
#4 lore raw
Quoted 16 lines · Péter Ujfalusi
Quoted 13 lines · Lee Jones
Quoted 12 lines

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

Quoted 10 lines
drivers/mfd/twl6030-irq.c +2 -3
@@ -368,10 +368,10 @@ int twl6030_init_irq(struct device *dev, int irq_num)
 	int			nr_irqs;
 	int			status;
 	u8			mask[3];
-	const int		*irq_tbl;
+	const struct of_device_id *of_id;
 
-	irq_tbl = device_get_match_data(dev);
-	if (!irq_tbl) {
+	of_id = of_match_device(twl6030_of_match, dev);

I think you just dropped support for ACPI.

Quoted 11 lines
Quoted 3 lines

Ah, scrap that. I was looking at the wrong part of 1e0c866887f4.

So what about the other drivers changed in the aforementioned commit?

Looking back at it again, I think only this patch is needed. This is not a real driver, it is using the twl core's device. The twl6030 is for sure broken, let me reply to the twl4030-power in a sec.

Quoted 3 lines

Ideally we'd have a call that covers all of the various probing APIs.

Quoted 1 line

Rob, care to follow-up?

Rob, last chance to state your case before I apply it.

Signature · 1 line
Lee Jones [李琼斯]
maintainer Applied
#5 lore raw

Re: (subset) [PATCH] mfd: twl6030-irq: Revert to use of_match_device()

In reply to Peter Ujfalusi
Quoted 6 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Applied, thanks!

[1/1] mfd: twl6030-irq: Revert to use of_match_device()

      commit: 6caa120c47c6f8ccb94c4a1d47e44c17de04057a

--
Lee Jones [李琼斯]

#6 lore raw
In reply to Peter Ujfalusi
Quoted 6 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")

That commit id does not exist, which is why it hasn't been picked up by stable. The correct commit id is 830fafce06e6f.

Signature · 3 lines
Andreas Schwab, SUSE Labs, [email protected]
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
maintainer
#7 lore raw
Quoted 11 lines · Andreas Schwab
Quoted 6 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")

That commit id does not exist, which is why it hasn't been picked up by stable. The correct commit id is 830fafce06e6f.

It hasn't been picked by Stable because no one sent it to Stable. :)

Signature · 1 line
Lee Jones [李琼斯]
maintainer
#8 lore raw
Quoted 7 lines · Lee Jones
Quoted 5 lines · Andreas Schwab
Quoted 3 lines · Peter Ujfalusi

The core twl chip is probed via i2c and the dev->driver->of_match_table is NULL, causing the driver to fail to probe.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

This partially reverts commit 1e0c866887f4.

Fixes 1e0c866887f4 ("mfd: Use device_get_match_data() in a bunch of drivers")

That commit id does not exist, which is why it hasn't been picked up by stable. The correct commit id is 830fafce06e6f.

It hasn't been picked by Stable because no one sent it to Stable. :)

Andreas, can you please send an email asking stable to pick it up?

See Documentation/process/stable-kernel-rules.rst for details.

Regards,

Tony