[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221028164120.2798-1-soha@lohu.info>
Date: Sat, 29 Oct 2022 00:41:20 +0800
From: Soha Jin <soha@...u.info>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@...nel.org>,
linux-kernel@...r.kernel.org, Wende Tan <twd2.me@...il.com>,
Soha Jin <soha@...u.info>
Subject: [PATCH v2] platform: use fwnode_irq_get_byname instead of of_irq_get_byname to get irq
Not only platform devices described by OF have named interrupts, but
devices described by ACPI also have named interrupts. The fwnode is an
abstraction to different standards, and using fwnode_irq_get_byname can
support more devices.
Moreover, when CONFIG_OF_IRQ is not enabled, there will be a stub method
always returning 0, the if statement can be removed safely.
Signed-off-by: Soha Jin <soha@...u.info>
Tested-by: Wende Tan <twd2.me@...il.com>
---
drivers/base/platform.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 51bb2289865c..6cd7fd478c5f 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -441,11 +441,9 @@ static int __platform_get_irq_byname(struct platform_device *dev,
struct resource *r;
int ret;
- if (IS_ENABLED(CONFIG_OF_IRQ) && dev->dev.of_node) {
- ret = of_irq_get_byname(dev->dev.of_node, name);
- if (ret > 0 || ret == -EPROBE_DEFER)
- return ret;
- }
+ ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), name);
+ if (ret > 0 || ret == -EPROBE_DEFER)
+ return ret;
r = platform_get_resource_byname(dev, IORESOURCE_IRQ, name);
if (r) {
--
2.30.2
Powered by blists - more mailing lists