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

Vasileios Amoiridis posted 2 patches 2 months, 2 weeks ago
[PATCH v3 2/2] of/irq: Use helper to define resources
Posted by Vasileios Amoiridis 2 months, 2 weeks ago
Resources definition can become simpler and more organised by using the
dedicated helpers.

Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 drivers/of/irq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 5d27b20634d3..64639f9da9fb 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -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;
-- 
2.25.1
Re: [PATCH v3 2/2] of/irq: Use helper to define resources
Posted by Andy Shevchenko 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 06:02:53PM +0200, Vasileios Amoiridis wrote:
> Resources definition can become simpler and more organised by using the
> dedicated helpers.

...

> -		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
Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> +		r->flags |= irq_get_trigger_type(irq);

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v3 2/2] of/irq: Use helper to define resources
Posted by Vasileios Amoiridis 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 07:15:33PM +0300, Andy Shevchenko wrote:
> On Wed, Sep 11, 2024 at 06:02:53PM +0200, Vasileios Amoiridis wrote:
> > Resources definition can become simpler and more organised by using the
> > dedicated helpers.
> 
> ...
> 
> > -		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
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> > +		r->flags |= irq_get_trigger_type(irq);
> 
> -- 
> 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
Re: [PATCH v3 2/2] of/irq: Use helper to define resources
Posted by Rob Herring 2 months, 2 weeks ago
On Wed, Sep 11, 2024 at 07:34:38PM +0200, Vasileios Amoiridis wrote:
> On Wed, Sep 11, 2024 at 07:15:33PM +0300, Andy Shevchenko wrote:
> > On Wed, Sep 11, 2024 at 06:02:53PM +0200, Vasileios Amoiridis wrote:
> > > Resources definition can become simpler and more organised by using the
> > > dedicated helpers.
> > 
> > ...
> > 
> > > -		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
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > > +		r->flags |= irq_get_trigger_type(irq);
> > 
> > -- 
> > 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.

No comments from me, please send with the updates.

Rob