When CONFIG_OF_IRQ is not enabled, there will be a stub method that always
returns 0 when getting IRQ. Thus, the if-branch can be removed safely.
Fixes: d4ad017d6345 ("platform: use fwnode_irq_get_byname instead of of_irq_get_byname to get irq")
Signed-off-by: Soha Jin <[email protected]>
---
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 968f3d71eeab..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 (!dev->dev.of_node || IS_ENABLED(CONFIG_OF_IRQ)) {
- ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), 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
> -----Original Message-----
> From: Soha Jin <[email protected]>
> Sent: Friday, November 11, 2022 5:46 PM
>
> When CONFIG_OF_IRQ is not enabled, there will be a stub method that always
> returns 0 when getting IRQ. Thus, the if-branch can be removed safely.
>
> Fixes: d4ad017d6345 ("platform: use fwnode_irq_get_byname instead of
> of_irq_get_byname to get irq")
> Signed-off-by: Soha Jin <[email protected]>
> ---
> 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
> 968f3d71eeab..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 (!dev->dev.of_node || IS_ENABLED(CONFIG_OF_IRQ)) {
> - ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), 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
>
PING.
Regards,
Soha
On Fri, Nov 11, 2022 at 05:45:42PM +0800, Soha Jin wrote:
> When CONFIG_OF_IRQ is not enabled, there will be a stub method that always
> returns 0 when getting IRQ. Thus, the if-branch can be removed safely.
>
> Fixes: d4ad017d6345 ("platform: use fwnode_irq_get_byname instead of of_irq_get_byname to get irq")
> Signed-off-by: Soha Jin <[email protected]>
> ---
> 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 968f3d71eeab..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 (!dev->dev.of_node || IS_ENABLED(CONFIG_OF_IRQ)) {
> - ret = fwnode_irq_get_byname(dev_fwnode(&dev->dev), 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;
It's not really a "fix", so I'll be dropping that tag here.
thanks,
greg k-h