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
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
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
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
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
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
© 2016 - 2026 Red Hat, Inc.