mbox series

[v2,0/4] amba: Properly handle device probe without IRQ domain

Message ID 20210827150600.78811-1-wangkefeng.wang@huawei.com
Headers show
Series amba: Properly handle device probe without IRQ domain | expand

Message

Kefeng Wang Aug. 27, 2021, 3:05 p.m. UTC
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(-)

Comments

Rob Herring (Arm) Aug. 31, 2021, 8:44 p.m. UTC | #1
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
> 
>