devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Use functionality of irq_get_trigger_type()
@ 2024-09-04 16:02 Vasileios Amoiridis
  2024-09-04 16:02 ` [PATCH v2 1/2] of/irq: Make use " Vasileios Amoiridis
  2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
  0 siblings, 2 replies; 8+ messages in thread
From: Vasileios Amoiridis @ 2024-09-04 16:02 UTC (permalink / raw)
  To: robh, saravanak, devicetree, linux-kernel
  Cc: andriy.shevchenko, Vasileios Amoiridis

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

---
v1: https://lore.kernel.org/all/20240902225534.130383-1-vassilisamir@gmail.com/

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
-- 
2.25.1


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

* [PATCH v2 1/2] of/irq: Make use of irq_get_trigger_type()
  2024-09-04 16:02 [PATCH v2 0/2] Use functionality of irq_get_trigger_type() Vasileios Amoiridis
@ 2024-09-04 16:02 ` Vasileios Amoiridis
  2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
  1 sibling, 0 replies; 8+ messages in thread
From: Vasileios Amoiridis @ 2024-09-04 16:02 UTC (permalink / raw)
  To: robh, saravanak, devicetree, linux-kernel
  Cc: andriy.shevchenko, Vasileios Amoiridis, Krzysztof Kozlowski

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

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
---
 drivers/of/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 36351ad6115e..5d27b20634d3 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -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);
 	}
 
-- 
2.25.1


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

* [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-04 16:02 [PATCH v2 0/2] Use functionality of irq_get_trigger_type() Vasileios Amoiridis
  2024-09-04 16:02 ` [PATCH v2 1/2] of/irq: Make use " Vasileios Amoiridis
@ 2024-09-04 16:02 ` Vasileios Amoiridis
  2024-09-05  8:34   ` Andy Shevchenko
                     ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Vasileios Amoiridis @ 2024-09-04 16:02 UTC (permalink / raw)
  To: robh, saravanak, devicetree, linux-kernel
  Cc: andriy.shevchenko, Vasileios Amoiridis

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..b1bfa14e1c0a 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


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

* Re: [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
@ 2024-09-05  8:34   ` Andy Shevchenko
  2024-09-08  8:44     ` Krzysztof Kozlowski
  2024-09-07 19:22   ` kernel test robot
  2024-09-07 20:16   ` kernel test robot
  2 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2024-09-05  8:34 UTC (permalink / raw)
  To: Vasileios Amoiridis; +Cc: robh, saravanak, devicetree, linux-kernel

On Wed, Sep 04, 2024 at 06:02:38PM +0200, Vasileios Amoiridis wrote:
> Resources definition can become simpler and more organised by using the
> dedicated helpers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> +		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))

Just use Elvis to make this shorten.
Btw, have you ever compiled this?

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

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
  2024-09-05  8:34   ` Andy Shevchenko
@ 2024-09-07 19:22   ` kernel test robot
  2024-09-07 20:16   ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-09-07 19:22 UTC (permalink / raw)
  To: Vasileios Amoiridis, robh, saravanak, devicetree, linux-kernel
  Cc: oe-kbuild-all, andriy.shevchenko, Vasileios Amoiridis

Hi Vasileios,

kernel test robot noticed the following build errors:

[auto build test ERROR on ecc768a84f0b8e631986f9ade3118fa37852fef0]

url:    https://github.com/intel-lab-lkp/linux/commits/Vasileios-Amoiridis/of-irq-Make-use-of-irq_get_trigger_type/20240905-000607
base:   ecc768a84f0b8e631986f9ade3118fa37852fef0
patch link:    https://lore.kernel.org/r/20240904160239.121301-3-vassilisamir%40gmail.com
patch subject: [PATCH v2 2/2] of/irq: Use helper to define resources
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20240908/202409080202.QLS8E1DK-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409080202.QLS8E1DK-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409080202.QLS8E1DK-lkp@intel.com/

All errors (new ones prefixed by >>):

   drivers/of/irq.c: In function 'of_irq_to_resource':
>> drivers/of/irq.c:433:17: error: expected ';' before 'r'
     433 |                 r->flags |= irq_get_trigger_type(irq);
         |                 ^

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for OMAP2PLUS_MBOX
   Depends on [n]: MAILBOX [=y] && (ARCH_OMAP2PLUS || ARCH_K3)
   Selected by [y]:
   - TI_K3_M4_REMOTEPROC [=y] && REMOTEPROC [=y] && (ARCH_K3 || COMPILE_TEST [=y])


vim +433 drivers/of/irq.c

   405	
   406	/**
   407	 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
   408	 * @dev: pointer to device tree node
   409	 * @index: zero-based index of the irq
   410	 * @r: pointer to resource structure to return result into.
   411	 */
   412	int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
   413	{
   414		int irq = of_irq_get(dev, index);
   415	
   416		if (irq < 0)
   417			return irq;
   418	
   419		/* Only dereference the resource if both the
   420		 * resource and the irq are valid. */
   421		if (r && irq) {
   422			const char *name = NULL;
   423	
   424			memset(r, 0, sizeof(*r));
   425			/*
   426			 * Get optional "interrupt-names" property to add a name
   427			 * to the resource.
   428			 */
   429			of_property_read_string_index(dev, "interrupt-names", index,
   430						      &name);
   431	
   432			*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))
 > 433			r->flags |= irq_get_trigger_type(irq);
   434		}
   435	
   436		return irq;
   437	}
   438	EXPORT_SYMBOL_GPL(of_irq_to_resource);
   439	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
  2024-09-05  8:34   ` Andy Shevchenko
  2024-09-07 19:22   ` kernel test robot
@ 2024-09-07 20:16   ` kernel test robot
  2 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2024-09-07 20:16 UTC (permalink / raw)
  To: Vasileios Amoiridis, robh, saravanak, devicetree, linux-kernel
  Cc: llvm, oe-kbuild-all, andriy.shevchenko, Vasileios Amoiridis

Hi Vasileios,

kernel test robot noticed the following build errors:

[auto build test ERROR on ecc768a84f0b8e631986f9ade3118fa37852fef0]

url:    https://github.com/intel-lab-lkp/linux/commits/Vasileios-Amoiridis/of-irq-Make-use-of-irq_get_trigger_type/20240905-000607
base:   ecc768a84f0b8e631986f9ade3118fa37852fef0
patch link:    https://lore.kernel.org/r/20240904160239.121301-3-vassilisamir%40gmail.com
patch subject: [PATCH v2 2/2] of/irq: Use helper to define resources
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240908/202409080407.JLfgI8Fr-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409080407.JLfgI8Fr-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409080407.JLfgI8Fr-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/of/irq.c:432:71: error: expected ';' after expression
     432 |                 *r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))
         |                                                                                     ^
         |                                                                                     ;
   1 error generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for OMAP2PLUS_MBOX
   Depends on [n]: MAILBOX [=y] && (ARCH_OMAP2PLUS || ARCH_K3)
   Selected by [y]:
   - TI_K3_M4_REMOTEPROC [=y] && REMOTEPROC [=y] && (ARCH_K3 || COMPILE_TEST [=y])


vim +432 drivers/of/irq.c

   405	
   406	/**
   407	 * of_irq_to_resource - Decode a node's IRQ and return it as a resource
   408	 * @dev: pointer to device tree node
   409	 * @index: zero-based index of the irq
   410	 * @r: pointer to resource structure to return result into.
   411	 */
   412	int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
   413	{
   414		int irq = of_irq_get(dev, index);
   415	
   416		if (irq < 0)
   417			return irq;
   418	
   419		/* Only dereference the resource if both the
   420		 * resource and the irq are valid. */
   421		if (r && irq) {
   422			const char *name = NULL;
   423	
   424			memset(r, 0, sizeof(*r));
   425			/*
   426			 * Get optional "interrupt-names" property to add a name
   427			 * to the resource.
   428			 */
   429			of_property_read_string_index(dev, "interrupt-names", index,
   430						      &name);
   431	
 > 432			*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))
   433			r->flags |= irq_get_trigger_type(irq);
   434		}
   435	
   436		return irq;
   437	}
   438	EXPORT_SYMBOL_GPL(of_irq_to_resource);
   439	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

* Re: [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-05  8:34   ` Andy Shevchenko
@ 2024-09-08  8:44     ` Krzysztof Kozlowski
  2024-09-10 22:00       ` Vasileios Amoiridis
  0 siblings, 1 reply; 8+ messages in thread
From: Krzysztof Kozlowski @ 2024-09-08  8:44 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Vasileios Amoiridis, robh, saravanak, devicetree, linux-kernel

On Thu, Sep 05, 2024 at 11:34:54AM +0300, Andy Shevchenko wrote:
> On Wed, Sep 04, 2024 at 06:02:38PM +0200, Vasileios Amoiridis wrote:
> > Resources definition can become simpler and more organised by using the
> > dedicated helpers.
> 
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> ...
> 
> > +		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))
> 
> Just use Elvis to make this shorten.
> Btw, have you ever compiled this?

It wasn't ever built... and if not built, probably not tested, either.

Best regards,
Krzysztof


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

* Re: [PATCH v2 2/2] of/irq: Use helper to define resources
  2024-09-08  8:44     ` Krzysztof Kozlowski
@ 2024-09-10 22:00       ` Vasileios Amoiridis
  0 siblings, 0 replies; 8+ messages in thread
From: Vasileios Amoiridis @ 2024-09-10 22:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andy Shevchenko, Vasileios Amoiridis, robh, saravanak, devicetree,
	linux-kernel

On Sun, Sep 08, 2024 at 10:44:15AM +0200, Krzysztof Kozlowski wrote:
> On Thu, Sep 05, 2024 at 11:34:54AM +0300, Andy Shevchenko wrote:
> > On Wed, Sep 04, 2024 at 06:02:38PM +0200, Vasileios Amoiridis wrote:
> > > Resources definition can become simpler and more organised by using the
> > > dedicated helpers.
> > 
> > Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > ...
> > 
> > > +		*r = DEFINE_RES_IRQ_NAMED(irq, name ? name : of_node_full_name(dev))
> > 
> > Just use Elvis to make this shorten.
> > Btw, have you ever compiled this?
> 
> It wasn't ever built... and if not built, probably not tested, either.
> 
> Best regards,
> Krzysztof
> 

Hi Andy, Krzysztof,

That is a stupid mistake. I was sending around quite some patches and
lost concentration a bit. Will fix that.

Cheers,
Vasilis

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

end of thread, other threads:[~2024-09-10 22:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-04 16:02 [PATCH v2 0/2] Use functionality of irq_get_trigger_type() Vasileios Amoiridis
2024-09-04 16:02 ` [PATCH v2 1/2] of/irq: Make use " Vasileios Amoiridis
2024-09-04 16:02 ` [PATCH v2 2/2] of/irq: Use helper to define resources Vasileios Amoiridis
2024-09-05  8:34   ` Andy Shevchenko
2024-09-08  8:44     ` Krzysztof Kozlowski
2024-09-10 22:00       ` Vasileios Amoiridis
2024-09-07 19:22   ` kernel test robot
2024-09-07 20:16   ` kernel test robot

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).