LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain
@ 2021-08-27 15:05 Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 1/4] amba: Drop unused functions about APB/AHB devices add Kefeng Wang
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Kefeng Wang @ 2021-08-27 15:05 UTC (permalink / raw)
  To: linux-kernel, robh+dt, frowand.list, linux, linux-arm-kernel
  Cc: saravanak, linus.walleij, devicetree, Kefeng Wang

Patch 1~3 make some cleanup, and patch 4 use of_irq_get() instead of 
irq_of_parse_and_map() to get irq number, return -EPROBE_DEFER if the irq
domain is not yet created, and move irq obtain into amba_probe, the driver 
defer probe will properly to handle this error.

V2:
- add new patch to kill irq sysfs file, suggested by Rob.
- move irq obtain from amba_device_add() to amba_probe(), suggested by Saravana.
  (As Saravana said, it will use a new mechanism to deal with the defer probe
   when amba device add and drop the amba specific deferring code, see[1])
- add Rob Reviewed-by to patch 1/2, no patch4 due to patch4 is changed

[1] https://lore.kernel.org/lkml/20210304195101.3843496-1-saravanak@google.com/

Kefeng Wang (4):
  amba: Drop unused functions about APB/AHB devices add
  Revert "ARM: amba: make use of -1 IRQs warn"
  amba: Kill sysfs attribute file of irq
  amba: Properly handle device probe without IRQ domain

 drivers/amba/bus.c       | 120 ++++++++++-----------------------------
 drivers/of/platform.c    |   6 +-
 include/linux/amba/bus.h |  18 ------
 3 files changed, 30 insertions(+), 114 deletions(-)

-- 
2.18.0.huawei.25


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

* [PATCH v2 1/4] amba: Drop unused functions about APB/AHB devices add
  2021-08-27 15:05 [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
@ 2021-08-27 15:05 ` Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 2/4] Revert "ARM: amba: make use of -1 IRQs warn" Kefeng Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Kefeng Wang @ 2021-08-27 15:05 UTC (permalink / raw)
  To: linux-kernel, robh+dt, frowand.list, linux, linux-arm-kernel
  Cc: saravanak, linus.walleij, devicetree, Kefeng Wang, Rob Herring

No one use the following functions, kill them.

  amba_aphb_device_add()
  amba_apb_device_add()
  amba_apb_device_add_res()
  amba_ahb_device_add()
  amba_ahb_device_add_res()

Cc: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c       | 72 ----------------------------------------
 include/linux/amba/bus.h | 18 ----------
 2 files changed, 90 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 939ca220bf78..c96fdef92fe1 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -581,78 +581,6 @@ int amba_device_add(struct amba_device *dev, struct resource *parent)
 }
 EXPORT_SYMBOL_GPL(amba_device_add);
 
-static struct amba_device *
-amba_aphb_device_add(struct device *parent, const char *name,
-		     resource_size_t base, size_t size, int irq1, int irq2,
-		     void *pdata, unsigned int periphid, u64 dma_mask,
-		     struct resource *resbase)
-{
-	struct amba_device *dev;
-	int ret;
-
-	dev = amba_device_alloc(name, base, size);
-	if (!dev)
-		return ERR_PTR(-ENOMEM);
-
-	dev->dev.coherent_dma_mask = dma_mask;
-	dev->irq[0] = irq1;
-	dev->irq[1] = irq2;
-	dev->periphid = periphid;
-	dev->dev.platform_data = pdata;
-	dev->dev.parent = parent;
-
-	ret = amba_device_add(dev, resbase);
-	if (ret) {
-		amba_device_put(dev);
-		return ERR_PTR(ret);
-	}
-
-	return dev;
-}
-
-struct amba_device *
-amba_apb_device_add(struct device *parent, const char *name,
-		    resource_size_t base, size_t size, int irq1, int irq2,
-		    void *pdata, unsigned int periphid)
-{
-	return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
-				    periphid, 0, &iomem_resource);
-}
-EXPORT_SYMBOL_GPL(amba_apb_device_add);
-
-struct amba_device *
-amba_ahb_device_add(struct device *parent, const char *name,
-		    resource_size_t base, size_t size, int irq1, int irq2,
-		    void *pdata, unsigned int periphid)
-{
-	return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
-				    periphid, ~0ULL, &iomem_resource);
-}
-EXPORT_SYMBOL_GPL(amba_ahb_device_add);
-
-struct amba_device *
-amba_apb_device_add_res(struct device *parent, const char *name,
-			resource_size_t base, size_t size, int irq1,
-			int irq2, void *pdata, unsigned int periphid,
-			struct resource *resbase)
-{
-	return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
-				    periphid, 0, resbase);
-}
-EXPORT_SYMBOL_GPL(amba_apb_device_add_res);
-
-struct amba_device *
-amba_ahb_device_add_res(struct device *parent, const char *name,
-			resource_size_t base, size_t size, int irq1,
-			int irq2, void *pdata, unsigned int periphid,
-			struct resource *resbase)
-{
-	return amba_aphb_device_add(parent, name, base, size, irq1, irq2, pdata,
-				    periphid, ~0ULL, resbase);
-}
-EXPORT_SYMBOL_GPL(amba_ahb_device_add_res);
-
-
 static void amba_device_initialize(struct amba_device *dev, const char *name)
 {
 	device_initialize(&dev->dev);
diff --git a/include/linux/amba/bus.h b/include/linux/amba/bus.h
index c68d87b87283..edfcf7a14dcd 100644
--- a/include/linux/amba/bus.h
+++ b/include/linux/amba/bus.h
@@ -122,24 +122,6 @@ struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);
 void amba_device_put(struct amba_device *);
 int amba_device_add(struct amba_device *, struct resource *);
 int amba_device_register(struct amba_device *, struct resource *);
-struct amba_device *amba_apb_device_add(struct device *parent, const char *name,
-					resource_size_t base, size_t size,
-					int irq1, int irq2, void *pdata,
-					unsigned int periphid);
-struct amba_device *amba_ahb_device_add(struct device *parent, const char *name,
-					resource_size_t base, size_t size,
-					int irq1, int irq2, void *pdata,
-					unsigned int periphid);
-struct amba_device *
-amba_apb_device_add_res(struct device *parent, const char *name,
-			resource_size_t base, size_t size, int irq1,
-			int irq2, void *pdata, unsigned int periphid,
-			struct resource *resbase);
-struct amba_device *
-amba_ahb_device_add_res(struct device *parent, const char *name,
-			resource_size_t base, size_t size, int irq1,
-			int irq2, void *pdata, unsigned int periphid,
-			struct resource *resbase);
 void amba_device_unregister(struct amba_device *);
 struct amba_device *amba_find_device(const char *, struct device *, unsigned int, unsigned int);
 int amba_request_regions(struct amba_device *, const char *);
-- 
2.18.0.huawei.25


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

* [PATCH v2 2/4] Revert "ARM: amba: make use of -1 IRQs warn"
  2021-08-27 15:05 [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 1/4] amba: Drop unused functions about APB/AHB devices add Kefeng Wang
@ 2021-08-27 15:05 ` Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 3/4] amba: Kill sysfs attribute file of irq Kefeng Wang
  2021-08-27 15:06 ` [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
  3 siblings, 0 replies; 7+ messages in thread
From: Kefeng Wang @ 2021-08-27 15:05 UTC (permalink / raw)
  To: linux-kernel, robh+dt, frowand.list, linux, linux-arm-kernel
  Cc: saravanak, linus.walleij, devicetree, Kefeng Wang, Rob Herring

After commit 77a7300abad7 ("of/irq: Get rid of NO_IRQ usage"),
no irq case has been removed, irq_of_parse_and_map() will return
0 in all cases when get error from parse and map an interrupt into
linux virq space.

amba_device_register() is only used on no-DT initialization, see
  s3c64xx_pl080_init()		arch/arm/mach-s3c/pl080.c
  ep93xx_init_devices()		arch/arm/mach-ep93xx/core.c

They won't set -1 to irq[0], so no need the warn.

This reverts commit 2eac58d5026e4ec8b17ff8b62877fea9e1d2f1b3.

Cc: Russell King <linux@armlinux.org.uk>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index c96fdef92fe1..37fcd5592c6f 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -379,9 +379,6 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
 	void __iomem *tmp;
 	int i, ret;
 
-	WARN_ON(dev->irq[0] == (unsigned int)-1);
-	WARN_ON(dev->irq[1] == (unsigned int)-1);
-
 	ret = request_resource(parent, &dev->res);
 	if (ret)
 		goto err_out;
-- 
2.18.0.huawei.25


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

* [PATCH v2 3/4] amba: Kill sysfs attribute file of irq
  2021-08-27 15:05 [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 1/4] amba: Drop unused functions about APB/AHB devices add Kefeng Wang
  2021-08-27 15:05 ` [PATCH v2 2/4] Revert "ARM: amba: make use of -1 IRQs warn" Kefeng Wang
@ 2021-08-27 15:05 ` Kefeng Wang
  2021-08-31 20:44   ` Rob Herring
  2021-08-27 15:06 ` [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
  3 siblings, 1 reply; 7+ messages in thread
From: Kefeng Wang @ 2021-08-27 15:05 UTC (permalink / raw)
  To: linux-kernel, robh+dt, frowand.list, linux, linux-arm-kernel
  Cc: saravanak, linus.walleij, devicetree, Kefeng Wang

As Rob said[1], there doesn't seem to be any users about the sysfs
attribute file of irq[0] and irq[1]. And we don't need to include
<asm/irq.h> as NO_IRQ has gone. Let's kill both of them.

[1] https://lkml.org/lkml/2021/8/25/461

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c | 18 ++----------------
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 37fcd5592c6f..4d3a565ca079 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -20,8 +20,6 @@
 #include <linux/platform_device.h>
 #include <linux/reset.h>
 
-#include <asm/irq.h>
-
 #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
 
 /* called on periphid match and class 0x9 coresight device. */
@@ -135,8 +133,6 @@ static ssize_t name##_show(struct device *_dev,				\
 static DEVICE_ATTR_RO(name)
 
 amba_attr_func(id, "%08x\n", dev->periphid);
-amba_attr_func(irq0, "%u\n", dev->irq[0]);
-amba_attr_func(irq1, "%u\n", dev->irq[1]);
 amba_attr_func(resource, "\t%016llx\t%016llx\t%016lx\n",
 	 (unsigned long long)dev->res.start, (unsigned long long)dev->res.end,
 	 dev->res.flags);
@@ -463,20 +459,10 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
 
  skip_probe:
 	ret = device_add(&dev->dev);
-	if (ret)
-		goto err_release;
-
-	if (dev->irq[0])
-		ret = device_create_file(&dev->dev, &dev_attr_irq0);
-	if (ret == 0 && dev->irq[1])
-		ret = device_create_file(&dev->dev, &dev_attr_irq1);
-	if (ret == 0)
-		return ret;
-
-	device_unregister(&dev->dev);
 
  err_release:
-	release_resource(&dev->res);
+	if (ret)
+		release_resource(&dev->res);
  err_out:
 	return ret;
 
-- 
2.18.0.huawei.25


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

* [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain
  2021-08-27 15:05 [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
                   ` (2 preceding siblings ...)
  2021-08-27 15:05 ` [PATCH v2 3/4] amba: Kill sysfs attribute file of irq Kefeng Wang
@ 2021-08-27 15:06 ` Kefeng Wang
  2021-08-31 20:48   ` Rob Herring
  3 siblings, 1 reply; 7+ messages in thread
From: Kefeng Wang @ 2021-08-27 15:06 UTC (permalink / raw)
  To: linux-kernel, robh+dt, frowand.list, linux, linux-arm-kernel
  Cc: saravanak, linus.walleij, devicetree, Kefeng Wang, Ruizhe Lin

of_amba_device_create() uses irq_of_parse_and_map() to translate
a DT interrupt specification into a Linux virtual interrupt number.

But it doesn't properly handle the case where the interrupt controller
is not yet available, eg, when pl011 interrupt is connected to MBIGEN
interrupt controller, because the mbigen initialization is too late,
which will lead to no IRQ due to no IRQ domain found, log is shown below,
  "irq: no irq domain found for uart0 !"

use of_irq_get() to return -EPROBE_DEFER as above, and in the driver
deferred probe, it will properly handle in such case, also return 0
in other fail cases to be consistent as before.

Cc: Russell King <linux@armlinux.org.uk>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Frank Rowand <frowand.list@gmail.com>
Reported-by: Ruizhe Lin <linruizhe@huawei.com>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c    | 27 +++++++++++++++++++++++++++
 drivers/of/platform.c |  6 +-----
 2 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 4d3a565ca079..96e84ce66e9a 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -19,6 +19,7 @@
 #include <linux/clk/clk-conf.h>
 #include <linux/platform_device.h>
 #include <linux/reset.h>
+#include <linux/of_irq.h>
 
 #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
 
@@ -170,6 +171,28 @@ static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
 	return retval;
 }
 
+static int of_amba_device_decode_irq(struct amba_device *dev)
+{
+	struct device_node *node = dev->dev.of_node;
+	int i, irq;
+
+	if (IS_ENABLED(CONFIG_OF_IRQ) && node) {
+		/* Decode the IRQs and address ranges */
+		for (i = 0; i < AMBA_NR_IRQS; i++) {
+			irq = of_irq_get(node, i);
+			if (irq < 0) {
+				if (irq == -EPROBE_DEFER)
+					return irq;
+				irq = 0;
+			}
+
+			dev->irq[i] = irq;
+		}
+	}
+
+	return 0;
+}
+
 /*
  * These are the device model conversion veneers; they convert the
  * device model structures to our more specific structures.
@@ -182,6 +205,10 @@ static int amba_probe(struct device *dev)
 	int ret;
 
 	do {
+		ret = of_amba_device_decode_irq(pcdev);
+		if (ret)
+			break;
+
 		ret = of_clk_set_defaults(dev->of_node, false);
 		if (ret < 0)
 			break;
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 74afbb7a4f5e..32d5ff8df747 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -222,7 +222,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 {
 	struct amba_device *dev;
 	const void *prop;
-	int i, ret;
+	int ret;
 
 	pr_debug("Creating amba device %pOF\n", node);
 
@@ -253,10 +253,6 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
 	if (prop)
 		dev->periphid = of_read_ulong(prop, 1);
 
-	/* Decode the IRQs and address ranges */
-	for (i = 0; i < AMBA_NR_IRQS; i++)
-		dev->irq[i] = irq_of_parse_and_map(node, i);
-
 	ret = of_address_to_resource(node, 0, &dev->res);
 	if (ret) {
 		pr_err("amba: of_address_to_resource() failed (%d) for %pOF\n",
-- 
2.18.0.huawei.25


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

* Re: [PATCH v2 3/4] amba: Kill sysfs attribute file of irq
  2021-08-27 15:05 ` [PATCH v2 3/4] amba: Kill sysfs attribute file of irq Kefeng Wang
@ 2021-08-31 20:44   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2021-08-31 20:44 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, frowand.list, linux, linux-arm-kernel, saravanak,
	linus.walleij, devicetree

On Fri, Aug 27, 2021 at 11:05:59PM +0800, Kefeng Wang wrote:
> As Rob said[1], there doesn't seem to be any users about the sysfs
> attribute file of irq[0] and irq[1]. And we don't need to include
> <asm/irq.h> as NO_IRQ has gone. Let's kill both of them.
>
> [1] https://lkml.org/lkml/2021/8/25/461
> 
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/amba/bus.c | 18 ++----------------
>  1 file changed, 2 insertions(+), 16 deletions(-)

Acked-by: Rob Herring <robh@kernel.org>

 
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 37fcd5592c6f..4d3a565ca079 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -20,8 +20,6 @@
>  #include <linux/platform_device.h>
>  #include <linux/reset.h>
>  
> -#include <asm/irq.h>
> -
>  #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
>  
>  /* called on periphid match and class 0x9 coresight device. */
> @@ -135,8 +133,6 @@ static ssize_t name##_show(struct device *_dev,				\
>  static DEVICE_ATTR_RO(name)
>  
>  amba_attr_func(id, "%08x\n", dev->periphid);
> -amba_attr_func(irq0, "%u\n", dev->irq[0]);
> -amba_attr_func(irq1, "%u\n", dev->irq[1]);
>  amba_attr_func(resource, "\t%016llx\t%016llx\t%016lx\n",

Might want to get rid of this too. It's available thru other means (DT). 
That can be another patch.

>  	 (unsigned long long)dev->res.start, (unsigned long long)dev->res.end,
>  	 dev->res.flags);
> @@ -463,20 +459,10 @@ static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
>  
>   skip_probe:
>  	ret = device_add(&dev->dev);
> -	if (ret)
> -		goto err_release;
> -
> -	if (dev->irq[0])
> -		ret = device_create_file(&dev->dev, &dev_attr_irq0);
> -	if (ret == 0 && dev->irq[1])
> -		ret = device_create_file(&dev->dev, &dev_attr_irq1);
> -	if (ret == 0)
> -		return ret;
> -
> -	device_unregister(&dev->dev);
>  
>   err_release:
> -	release_resource(&dev->res);
> +	if (ret)
> +		release_resource(&dev->res);
>   err_out:
>  	return ret;
>  
> -- 
> 2.18.0.huawei.25
> 
> 

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

* Re: [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain
  2021-08-27 15:06 ` [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
@ 2021-08-31 20:48   ` Rob Herring
  0 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2021-08-31 20:48 UTC (permalink / raw)
  To: Kefeng Wang
  Cc: linux-kernel, frowand.list, linux, linux-arm-kernel, saravanak,
	linus.walleij, devicetree, Ruizhe Lin

On Fri, Aug 27, 2021 at 11:06:00PM +0800, Kefeng Wang wrote:
> of_amba_device_create() uses irq_of_parse_and_map() to translate
> a DT interrupt specification into a Linux virtual interrupt number.
> 
> But it doesn't properly handle the case where the interrupt controller
> is not yet available, eg, when pl011 interrupt is connected to MBIGEN
> interrupt controller, because the mbigen initialization is too late,
> which will lead to no IRQ due to no IRQ domain found, log is shown below,
>   "irq: no irq domain found for uart0 !"
> 
> use of_irq_get() to return -EPROBE_DEFER as above, and in the driver
> deferred probe, it will properly handle in such case, also return 0
> in other fail cases to be consistent as before.
> 
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Frank Rowand <frowand.list@gmail.com>
> Reported-by: Ruizhe Lin <linruizhe@huawei.com>
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
>  drivers/amba/bus.c    | 27 +++++++++++++++++++++++++++
>  drivers/of/platform.c |  6 +-----
>  2 files changed, 28 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
> index 4d3a565ca079..96e84ce66e9a 100644
> --- a/drivers/amba/bus.c
> +++ b/drivers/amba/bus.c
> @@ -19,6 +19,7 @@
>  #include <linux/clk/clk-conf.h>
>  #include <linux/platform_device.h>
>  #include <linux/reset.h>
> +#include <linux/of_irq.h>
>  
>  #define to_amba_driver(d)	container_of(d, struct amba_driver, drv)
>  
> @@ -170,6 +171,28 @@ static int amba_uevent(struct device *dev, struct kobj_uevent_env *env)
>  	return retval;
>  }
>  
> +static int of_amba_device_decode_irq(struct amba_device *dev)
> +{
> +	struct device_node *node = dev->dev.of_node;
> +	int i, irq;
> +
> +	if (IS_ENABLED(CONFIG_OF_IRQ) && node) {

I don't think this check is needed. If either is false, we should return 
an errno from of_irq_get().

> +		/* Decode the IRQs and address ranges */
> +		for (i = 0; i < AMBA_NR_IRQS; i++) {
> +			irq = of_irq_get(node, i);
> +			if (irq < 0) {
> +				if (irq == -EPROBE_DEFER)
> +					return irq;
> +				irq = 0;
> +			}
> +
> +			dev->irq[i] = irq;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  /*
>   * These are the device model conversion veneers; they convert the
>   * device model structures to our more specific structures.
> @@ -182,6 +205,10 @@ static int amba_probe(struct device *dev)
>  	int ret;
>  
>  	do {
> +		ret = of_amba_device_decode_irq(pcdev);
> +		if (ret)
> +			break;
> +
>  		ret = of_clk_set_defaults(dev->of_node, false);
>  		if (ret < 0)
>  			break;
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 74afbb7a4f5e..32d5ff8df747 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -222,7 +222,7 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
>  {
>  	struct amba_device *dev;
>  	const void *prop;
> -	int i, ret;
> +	int ret;
>  
>  	pr_debug("Creating amba device %pOF\n", node);
>  
> @@ -253,10 +253,6 @@ static struct amba_device *of_amba_device_create(struct device_node *node,
>  	if (prop)
>  		dev->periphid = of_read_ulong(prop, 1);
>  
> -	/* Decode the IRQs and address ranges */
> -	for (i = 0; i < AMBA_NR_IRQS; i++)
> -		dev->irq[i] = irq_of_parse_and_map(node, i);
> -
>  	ret = of_address_to_resource(node, 0, &dev->res);
>  	if (ret) {
>  		pr_err("amba: of_address_to_resource() failed (%d) for %pOF\n",
> -- 
> 2.18.0.huawei.25
> 
> 

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

end of thread, other threads:[~2021-08-31 20:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-27 15:05 [PATCH v2 0/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
2021-08-27 15:05 ` [PATCH v2 1/4] amba: Drop unused functions about APB/AHB devices add Kefeng Wang
2021-08-27 15:05 ` [PATCH v2 2/4] Revert "ARM: amba: make use of -1 IRQs warn" Kefeng Wang
2021-08-27 15:05 ` [PATCH v2 3/4] amba: Kill sysfs attribute file of irq Kefeng Wang
2021-08-31 20:44   ` Rob Herring
2021-08-27 15:06 ` [PATCH v2 4/4] amba: Properly handle device probe without IRQ domain Kefeng Wang
2021-08-31 20:48   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).