Skip to contentSkip to conversation

Use functionality of irq_get_trigger_type()

PATCH Superseded Vasileios Amoiridis 4 participants 8 messages Sep 4, 2024 – Sep 10, 2024 Device tree

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Use functionality of irq_get_trigger_type()

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 v2 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 v2 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..b1bfa14e1c0a 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 v2 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 1 line
drivers/of/irq.c +1 -0
+		*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?

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 v2 2/2] of/irq: Use helper to define resources

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

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

Quoted 8 lines

...

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

Quoted 1 line
drivers/of/irq.c +1 -0
+		*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

#5 lore raw

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

Quoted 14 lines · Krzysztof Kozlowski
Quoted 4 lines · Andy Shevchenko
Quoted 2 lines · Vasileios Amoiridis

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

Quoted 8 lines

...

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

Quoted 1 line
drivers/of/irq.c +1 -0
+		*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?

Quoted 5 lines

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

#6 lore raw

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

In reply to Vasileios Amoiridis
kernel test robot noticed the following build errors:

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
#7 lore raw

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

In reply to Vasileios Amoiridis
kernel test robot noticed the following build errors:

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/[email protected]/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/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

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

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