diff mbox series

[RFC,v2,2/6] i2c: aspeed: Use platform_get_irq() instead of opencoding

Message ID 20230530145601.2592-3-Jonathan.Cameron@huawei.com
State Superseded
Headers show
Series i2c: Enabling use of aspeed-i2c with ACPI | expand

Commit Message

Jonathan Cameron May 30, 2023, 2:55 p.m. UTC
A cleanup in it's own right.
This has the handy side effect of working for ACPI FW as well
(unlike fwnode_irq_get() which works for ARM64 but not x86 ACPI)

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
v2: Andy Schevchenko review.
Added check on whether we have an IRQ from platform_get_irq()
---
 drivers/i2c/busses/i2c-aspeed.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Andy Shevchenko May 30, 2023, 7:45 p.m. UTC | #1
On Tue, May 30, 2023 at 5:57 PM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:
>
> A cleanup in it's own right.

its ?

> This has the handy side effect of working for ACPI FW as well
> (unlike fwnode_irq_get() which works for ARM64 but not x86 ACPI)

...

>  #include <linux/of_address.h>

>  #include <linux/of_platform.h>

With your commit message I'm wondering why these are still there. Do
we have some OF calls that are optional and do not affect
functionality (in ACPI case)?
Jonathan Cameron May 31, 2023, 9:36 a.m. UTC | #2
On Tue, 30 May 2023 22:45:30 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Tue, May 30, 2023 at 5:57 PM Jonathan Cameron
> <Jonathan.Cameron@huawei.com> wrote:
> >
> > A cleanup in it's own right.  
> 
> its ?

Pah. English - a language that I can't write in despite it being
my native tongue ;)

> 
> > This has the handy side effect of working for ACPI FW as well
> > (unlike fwnode_irq_get() which works for ARM64 but not x86 ACPI)  
> 
> ...
> 
> >  #include <linux/of_address.h>  
> 
> >  #include <linux/of_platform.h>  
> 
> With your commit message I'm wondering why these are still there. Do
> we have some OF calls that are optional and do not affect
> functionality (in ACPI case)?
> 
>
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-aspeed.c b/drivers/i2c/busses/i2c-aspeed.c
index d3c99c5b3247..21a2f139f445 100644
--- a/drivers/i2c/busses/i2c-aspeed.c
+++ b/drivers/i2c/busses/i2c-aspeed.c
@@ -19,7 +19,6 @@ 
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_irq.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
@@ -1043,7 +1042,10 @@  static int aspeed_i2c_probe_bus(struct platform_device *pdev)
 	if (ret < 0)
 		return ret;
 
-	irq = irq_of_parse_and_map(pdev->dev.of_node, 0);
+	irq = platform_get_irq(pdev, 0);
+	if (irq < 0)
+		return irq;
+
 	ret = devm_request_irq(&pdev->dev, irq, aspeed_i2c_bus_irq,
 			       0, dev_name(&pdev->dev), bus);
 	if (ret < 0)