mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] irqchip/mbigen: Don't use bus_get_dev_root() to find the parent
@ 2024-02-20 11:14 陈骏
  2024-02-21 17:47 ` [tip: irq/urgent] " tip-bot2 for Chen Jun
  0 siblings, 1 reply; 2+ messages in thread
From: 陈骏 @ 2024-02-20 11:14 UTC (permalink / raw)
  To: tglx, gregkh, linux-kernel; +Cc: xuqiang36, chenjun102

From: Chen Jun <chenjun102@huawei.com>

bus_get_dev_root() returns sp->dev_root set in subsys_register().
And subsys_register() is not called by platform_bus_init().

For platform_bus_type, bus_get_dev_root() always returns NULL.
This makes mbigen_of_create_domain() always return -ENODEV.

Don't try to retrieve the parent via bus_get_dev_root() and
unconditionally hand a NULL pointer to of_platform_device_create() to
fix this.

Fixes: fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Cc: stable@vger.kernel.org
---
v3: Modify change log

v2: Modify change log
    https://lore.kernel.org/all/20240219085314.85363-1-chenjun102@huawei.com/

v1: https://lore.kernel.org/all/20240129130003.18181-1-chenjun102@huawei.com/

 drivers/irqchip/irq-mbigen.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 5101a3fb11df..58881d313979 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {
 static int mbigen_of_create_domain(struct platform_device *pdev,
 				   struct mbigen_device *mgn_chip)
 {
-	struct device *parent;
 	struct platform_device *child;
 	struct irq_domain *domain;
 	struct device_node *np;
 	u32 num_pins;
 	int ret = 0;
 
-	parent = bus_get_dev_root(&platform_bus_type);
-	if (!parent)
-		return -ENODEV;
-
 	for_each_child_of_node(pdev->dev.of_node, np) {
 		if (!of_property_read_bool(np, "interrupt-controller"))
 			continue;
 
-		child = of_platform_device_create(np, NULL, parent);
+		child = of_platform_device_create(np, NULL, NULL);
 		if (!child) {
 			ret = -ENOMEM;
 			break;
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev,
 		}
 	}
 
-	put_device(parent);
 	if (ret)
 		of_node_put(np);
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [tip: irq/urgent] irqchip/mbigen: Don't use bus_get_dev_root() to find the parent
  2024-02-20 11:14 [PATCH v3] irqchip/mbigen: Don't use bus_get_dev_root() to find the parent 陈骏
@ 2024-02-21 17:47 ` tip-bot2 for Chen Jun
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot2 for Chen Jun @ 2024-02-21 17:47 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Chen Jun, Thomas Gleixner, stable, x86, linux-kernel, maz

The following commit has been merged into the irq/urgent branch of tip:

Commit-ID:     fb33a46cd75e18773dd5a414744507d84ae90870
Gitweb:        https://git.kernel.org/tip/fb33a46cd75e18773dd5a414744507d84ae90870
Author:        Chen Jun <chenjun102@huawei.com>
AuthorDate:    Tue, 20 Feb 2024 19:14:29 +08:00
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Wed, 21 Feb 2024 18:40:00 +01:00

irqchip/mbigen: Don't use bus_get_dev_root() to find the parent

bus_get_dev_root() returns sp->dev_root which is set in subsys_register(),
but subsys_register() is not called by platform_bus_init().

Therefor for the platform_bus_type, bus_get_dev_root() always returns NULL.
This makes mbigen_of_create_domain() always return -ENODEV.

Don't try to retrieve the parent via bus_get_dev_root() and
unconditionally hand a NULL pointer to of_platform_device_create() to
fix this.

Fixes: fea087fc291b ("irqchip/mbigen: move to use bus_get_dev_root()")
Signed-off-by: Chen Jun <chenjun102@huawei.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20240220111429.110666-1-chenjun102@huawei.com

---
 drivers/irqchip/irq-mbigen.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/irqchip/irq-mbigen.c b/drivers/irqchip/irq-mbigen.c
index 5101a3f..58881d3 100644
--- a/drivers/irqchip/irq-mbigen.c
+++ b/drivers/irqchip/irq-mbigen.c
@@ -235,22 +235,17 @@ static const struct irq_domain_ops mbigen_domain_ops = {
 static int mbigen_of_create_domain(struct platform_device *pdev,
 				   struct mbigen_device *mgn_chip)
 {
-	struct device *parent;
 	struct platform_device *child;
 	struct irq_domain *domain;
 	struct device_node *np;
 	u32 num_pins;
 	int ret = 0;
 
-	parent = bus_get_dev_root(&platform_bus_type);
-	if (!parent)
-		return -ENODEV;
-
 	for_each_child_of_node(pdev->dev.of_node, np) {
 		if (!of_property_read_bool(np, "interrupt-controller"))
 			continue;
 
-		child = of_platform_device_create(np, NULL, parent);
+		child = of_platform_device_create(np, NULL, NULL);
 		if (!child) {
 			ret = -ENOMEM;
 			break;
@@ -273,7 +268,6 @@ static int mbigen_of_create_domain(struct platform_device *pdev,
 		}
 	}
 
-	put_device(parent);
 	if (ret)
 		of_node_put(np);
 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-21 17:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-20 11:14 [PATCH v3] irqchip/mbigen: Don't use bus_get_dev_root() to find the parent 陈骏
2024-02-21 17:47 ` [tip: irq/urgent] " tip-bot2 for Chen Jun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®