All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH Resend 0/2] amba: irq cleanup
@ 2021-11-15 13:51 ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt, Kefeng Wang

As the v1 of "amba: Properly handle device probe without IRQ domain"
is merged, some comments[1] from Rob and Saravana is not included,
let's send them separately again.

patch1 has been ACKed by Rob[2].
patch2 is suggested by Saravana.

Resend:
- Rebase on v5.16-rc1
- Fix patch2's build error

[1] https://lore.kernel.org/lkml/20210816074619.177383-1-wangkefeng.wang@huawei.com/
[2] https://lore.kernel.org/linux-arm-kernel/20210827150600.78811-4-wangkefeng.wang@huawei.com/

Resend:
- fix mistakes about patch2

Kefeng Wang (2):
  amba: Kill sysfs attribute file of irq
  amba: Move of_amba_device_decode_irq() into amba_probe()

 drivers/amba/bus.c | 71 ++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 43 deletions(-)

-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH Resend 0/2] amba: irq cleanup
@ 2021-11-15 13:51 ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt, Kefeng Wang

As the v1 of "amba: Properly handle device probe without IRQ domain"
is merged, some comments[1] from Rob and Saravana is not included,
let's send them separately again.

patch1 has been ACKed by Rob[2].
patch2 is suggested by Saravana.

Resend:
- Rebase on v5.16-rc1
- Fix patch2's build error

[1] https://lore.kernel.org/lkml/20210816074619.177383-1-wangkefeng.wang@huawei.com/
[2] https://lore.kernel.org/linux-arm-kernel/20210827150600.78811-4-wangkefeng.wang@huawei.com/

Resend:
- fix mistakes about patch2

Kefeng Wang (2):
  amba: Kill sysfs attribute file of irq
  amba: Move of_amba_device_decode_irq() into amba_probe()

 drivers/amba/bus.c | 71 ++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 43 deletions(-)

-- 
2.26.2


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

* [PATCH Resend 1/2] amba: Kill sysfs attribute file of irq
  2021-11-15 13:51 ` Kefeng Wang
@ 2021-11-15 13:51   ` Kefeng Wang
  -1 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel
  Cc: saravanak, robh+dt, Kefeng Wang, Rob Herring

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

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 720aa6cdd402..16d3c009505b 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -21,8 +21,6 @@
 #include <linux/reset.h>
 #include <linux/of_irq.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. */
@@ -136,8 +134,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);
@@ -488,20 +484,9 @@ 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.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH Resend 1/2] amba: Kill sysfs attribute file of irq
@ 2021-11-15 13:51   ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel
  Cc: saravanak, robh+dt, Kefeng Wang, Rob Herring

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

Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
---
 drivers/amba/bus.c | 19 ++-----------------
 1 file changed, 2 insertions(+), 17 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 720aa6cdd402..16d3c009505b 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -21,8 +21,6 @@
 #include <linux/reset.h>
 #include <linux/of_irq.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. */
@@ -136,8 +134,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);
@@ -488,20 +484,9 @@ 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.26.2


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

* [PATCH Resend 2/2] amba: Move of_amba_device_decode_irq() into amba_probe()
  2021-11-15 13:51 ` Kefeng Wang
@ 2021-11-15 13:51   ` Kefeng Wang
  -1 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt, Kefeng Wang

Similar to other resources the AMBA bus "gets" for the device,
move irq obtain from amba_device_add() to amba_probe().

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

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 16d3c009505b..e1a5eca3ae3c 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -171,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 = 0;
+
+	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.
@@ -183,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;
@@ -368,38 +394,12 @@ static void amba_device_release(struct device *dev)
 	kfree(d);
 }
 
-static int of_amba_device_decode_irq(struct amba_device *dev)
-{
-	struct device_node *node = dev->dev.of_node;
-	int i, irq = 0;
-
-	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;
-}
-
 static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
 {
 	u32 size;
 	void __iomem *tmp;
 	int i, ret;
 
-	ret = of_amba_device_decode_irq(dev);
-	if (ret)
-		goto err_out;
-
 	ret = request_resource(parent, &dev->res);
 	if (ret)
 		goto err_out;
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH Resend 2/2] amba: Move of_amba_device_decode_irq() into amba_probe()
@ 2021-11-15 13:51   ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-15 13:51 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt, Kefeng Wang

Similar to other resources the AMBA bus "gets" for the device,
move irq obtain from amba_device_add() to amba_probe().

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

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index 16d3c009505b..e1a5eca3ae3c 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -171,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 = 0;
+
+	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.
@@ -183,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;
@@ -368,38 +394,12 @@ static void amba_device_release(struct device *dev)
 	kfree(d);
 }
 
-static int of_amba_device_decode_irq(struct amba_device *dev)
-{
-	struct device_node *node = dev->dev.of_node;
-	int i, irq = 0;
-
-	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;
-}
-
 static int amba_device_try_add(struct amba_device *dev, struct resource *parent)
 {
 	u32 size;
 	void __iomem *tmp;
 	int i, ret;
 
-	ret = of_amba_device_decode_irq(dev);
-	if (ret)
-		goto err_out;
-
 	ret = request_resource(parent, &dev->res);
 	if (ret)
 		goto err_out;
-- 
2.26.2


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

* Re: [PATCH Resend 0/2] amba: irq cleanup
  2021-11-15 13:51 ` Kefeng Wang
@ 2021-11-29 14:56   ` Kefeng Wang
  -1 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-29 14:56 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt

Hi Russell,same as the reply of kfence patch, kindly ping...

On 2021/11/15 21:51, Kefeng Wang wrote:
> As the v1 of "amba: Properly handle device probe without IRQ domain"
> is merged, some comments[1] from Rob and Saravana is not included,
> let's send them separately again.
>
> patch1 has been ACKed by Rob[2].
> patch2 is suggested by Saravana.
>
> Resend:
> - Rebase on v5.16-rc1
> - Fix patch2's build error
>
> [1] https://lore.kernel.org/lkml/20210816074619.177383-1-wangkefeng.wang@huawei.com/
> [2] https://lore.kernel.org/linux-arm-kernel/20210827150600.78811-4-wangkefeng.wang@huawei.com/
>
> Resend:
> - fix mistakes about patch2
>
> Kefeng Wang (2):
>    amba: Kill sysfs attribute file of irq
>    amba: Move of_amba_device_decode_irq() into amba_probe()
>
>   drivers/amba/bus.c | 71 ++++++++++++++++++----------------------------
>   1 file changed, 28 insertions(+), 43 deletions(-)
>

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

* Re: [PATCH Resend 0/2] amba: irq cleanup
@ 2021-11-29 14:56   ` Kefeng Wang
  0 siblings, 0 replies; 8+ messages in thread
From: Kefeng Wang @ 2021-11-29 14:56 UTC (permalink / raw)
  To: linux, linux-arm-kernel, linux-kernel; +Cc: saravanak, robh+dt

Hi Russell,same as the reply of kfence patch, kindly ping...

On 2021/11/15 21:51, Kefeng Wang wrote:
> As the v1 of "amba: Properly handle device probe without IRQ domain"
> is merged, some comments[1] from Rob and Saravana is not included,
> let's send them separately again.
>
> patch1 has been ACKed by Rob[2].
> patch2 is suggested by Saravana.
>
> Resend:
> - Rebase on v5.16-rc1
> - Fix patch2's build error
>
> [1] https://lore.kernel.org/lkml/20210816074619.177383-1-wangkefeng.wang@huawei.com/
> [2] https://lore.kernel.org/linux-arm-kernel/20210827150600.78811-4-wangkefeng.wang@huawei.com/
>
> Resend:
> - fix mistakes about patch2
>
> Kefeng Wang (2):
>    amba: Kill sysfs attribute file of irq
>    amba: Move of_amba_device_decode_irq() into amba_probe()
>
>   drivers/amba/bus.c | 71 ++++++++++++++++++----------------------------
>   1 file changed, 28 insertions(+), 43 deletions(-)
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2021-11-29 14:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 13:51 [PATCH Resend 0/2] amba: irq cleanup Kefeng Wang
2021-11-15 13:51 ` Kefeng Wang
2021-11-15 13:51 ` [PATCH Resend 1/2] amba: Kill sysfs attribute file of irq Kefeng Wang
2021-11-15 13:51   ` Kefeng Wang
2021-11-15 13:51 ` [PATCH Resend 2/2] amba: Move of_amba_device_decode_irq() into amba_probe() Kefeng Wang
2021-11-15 13:51   ` Kefeng Wang
2021-11-29 14:56 ` [PATCH Resend 0/2] amba: irq cleanup Kefeng Wang
2021-11-29 14:56   ` Kefeng Wang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.