Skip to contentSkip to conversation

Use functionality of irq_get_trigger_type() and DEFINE_*

PATCH Superseded Vasileios Amoiridis 3 participants 6 messages Sep 11, 2024 – Sep 12, 2024 Device tree

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover Use functionality of irq_get_trigger_type() and DEFINE_*

The series is compile tested.

Changes in v3:
- Fix syntax error in patch no.2

---
v2: https://lore.kernel.org/linux-devicetree/[email protected]/

Changes in v2:
- Split patches to subsystems
- Use DEFINE_* helpers to define resources

---
v1: https://lore.kernel.org/all/[email protected]/

Vasileios Amoiridis (2):
of/irq: Make use of irq_get_trigger_type()
of/irq: Use helper to define resources

 drivers/of/irq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

base-commit: ecc768a84f0b8e631986f9ade3118fa37852fef0

Signature · 1 line
2.25.1
#1 lore raw

PATCH v3 1/2 of/irq: Make use of irq_get_trigger_type()

Convert irqd_get_trigger_type(irq_get_irq_data(irq)) cases to the more simple irq_get_trigger_type(irq).

---
 drivers/of/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/of/irq.c +1 -1
index 36351ad6115e..5d27b20634d3 100644
@@ -430,7 +430,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 					      &name);
 
 		r->start = r->end = irq;
-		r->flags = IORESOURCE_IRQ | irqd_get_trigger_type(irq_get_irq_data(irq));
+		r->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
 		r->name = name ? name : of_node_full_name(dev);
 	}
 
Signature · 1 line
2.25.1
#2 lore raw

PATCH v3 2/2 of/irq: Use helper to define resources

In reply to Vasileios Amoiridis

Resources definition can become simpler and more organised by using the dedicated helpers.

---
 drivers/of/irq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/of/irq.c +2 -3
index 5d27b20634d3..64639f9da9fb 100644
@@ -429,9 +429,8 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 		of_property_read_string_index(dev, "interrupt-names", index,
 					      &name);
 
-		r->start = r->end = irq;
-		r->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
-		r->name = name ? name : of_node_full_name(dev);
+		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev));
+		r->flags |= irq_get_trigger_type(irq);
 	}
 
 	return irq;
Signature · 1 line
2.25.1
#3 lore raw

Re: [PATCH v3 2/2] of/irq: Use helper to define resources

Quoted 2 lines · Vasileios Amoiridis

Resources definition can become simpler and more organised by using the dedicated helpers.

...

drivers/of/irq.c int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) · line 432

Quoted 4 lines
drivers/of/irq.c +1 -3
-		r->start = r->end = irq;
-		r->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
-		r->name = name ? name : of_node_full_name(dev);
+		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev));

Hmm... It seems you haven't replied to me why you avoid using Elvis here, while at it.

Also for both patches you probably want

Quoted 1 line
drivers/of/irq.c +1 -0
+		r->flags |= irq_get_trigger_type(irq);
Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Re: [PATCH v3 2/2] of/irq: Use helper to define resources

Quoted 14 lines · Andy Shevchenko
Quoted 2 lines · Vasileios Amoiridis

Resources definition can become simpler and more organised by using the dedicated helpers.

...

drivers/of/irq.c int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) · line 432

Quoted 4 lines
drivers/of/irq.c +1 -3
-		r->start = r->end = irq;
-		r->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
-		r->name = name ? name : of_node_full_name(dev);
+		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev));

Hmm... It seems you haven't replied to me why you avoid using Elvis here, while at it.

Quoted 10 lines

Also for both patches you probably want

Quoted 1 line
drivers/of/irq.c +1 -0
+		r->flags |= irq_get_trigger_type(irq);
Signature · 2 lines
With Best Regards,
Andy Shevchenko

Hi Andy,

Thanks for your message once again!!

I honestly didn't know this operator, I just found out about it. Looks like it fits here, I can definitely use it.

I am going to leave it for a while to see if Krzysztof or Rob have any other comments and then I can send as you proposed.

As for the tag, of course I can add it! I just wasn't sure if that was the case for here.

Cheers,
Vasilis

maintainer
#5 lore raw

Re: [PATCH v3 2/2] of/irq: Use helper to define resources

Quoted 29 lines · Vasileios Amoiridis
Quoted 14 lines · Andy Shevchenko
Quoted 2 lines · Vasileios Amoiridis

Resources definition can become simpler and more organised by using the dedicated helpers.

...

drivers/of/irq.c int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) · line 432

Quoted 4 lines
drivers/of/irq.c +1 -3
-		r->start = r->end = irq;
-		r->flags = IORESOURCE_IRQ | irq_get_trigger_type(irq);
-		r->name = name ? name : of_node_full_name(dev);
+		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev));

Hmm... It seems you haven't replied to me why you avoid using Elvis here, while at it.

Quoted 10 lines

Also for both patches you probably want

Quoted 1 line
drivers/of/irq.c +1 -0
+		r->flags |= irq_get_trigger_type(irq);
Signature · 2 lines
With Best Regards,
Andy Shevchenko

Hi Andy,

Quoted 7 lines

Thanks for your message once again!!

I honestly didn't know this operator, I just found out about it. Looks like it fits here, I can definitely use it.

I am going to leave it for a while to see if Krzysztof or Rob have any other comments and then I can send as you proposed.

No comments from me, please send with the updates.

Rob