[PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item

Herve Codina (Schneider Electric) posted 8 patches 3 weeks, 2 days ago
There is a newer version of this series
[PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item
Posted by Herve Codina (Schneider Electric) 3 weeks, 2 days ago
for_each_of_imap_item is an iterator designed to help a driver to parse
an interrupt-map property.

Indeed some drivers need to know details about the interrupt mapping
described in the device-tree in order to set internal registers
accordingly.

Signed-off-by: Herve Codina (Schneider Electric) <herve.codina@bootlin.com>
---
 drivers/of/irq.c       | 70 ++++++++++++++++++++++++++++++++++++++++++
 include/linux/of_irq.h | 41 ++++++++++++++++++++++++-
 2 files changed, 110 insertions(+), 1 deletion(-)

diff --git a/drivers/of/irq.c b/drivers/of/irq.c
index 74aaea61de13..0723ae4153a0 100644
--- a/drivers/of/irq.c
+++ b/drivers/of/irq.c
@@ -157,6 +157,76 @@ const __be32 *of_irq_parse_imap_parent(const __be32 *imap, int len, struct of_ph
 	return imap;
 }
 
+int of_imap_parser_init(struct of_imap_parser *parser, struct device_node *node,
+			struct of_imap_item *item)
+{
+	int imaplen;
+	u32 tmp;
+	int ret;
+
+	/*
+	 * parent_offset is the offset where the parent part is starting.
+	 * In other words, the offset where the parent interrupt controller
+	 * phandle is present.
+	 *
+	 * Compute this offset (child #interrupt-cells + child #address-cells)
+	 */
+	parser->parent_offset = of_bus_n_addr_cells(node);
+
+	ret = of_property_read_u32(node, "#interrupt-cells", &tmp);
+	if (ret)
+		return ret;
+
+	parser->parent_offset += tmp;
+
+	if (WARN(parser->parent_offset > ARRAY_SIZE(item->child_imap),
+		 "child part size = %u, cannot fit in array of %zu items",
+		 parser->parent_offset, ARRAY_SIZE(item->child_imap)))
+		return -EINVAL;
+
+	parser->imap = of_get_property(node, "interrupt-map", &imaplen);
+	if (!parser->imap)
+		return -ENOENT;
+
+	imaplen /= sizeof(*parser->imap);
+	parser->imap_end = parser->imap + imaplen;
+
+	memset(item, 0, sizeof(*item));
+	item->child_imap_count = parser->parent_offset;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_imap_parser_init);
+
+struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
+					struct of_imap_item *item)
+{
+	const __be32 *imap_parent, *imap_next;
+	int i;
+
+	/* Release previously get parent node */
+	of_node_put(item->parent_args.np);
+
+	if (parser->imap + parser->parent_offset + 1 >= parser->imap_end)
+		return NULL;
+
+	imap_parent = parser->imap + parser->parent_offset;
+
+	imap_next = of_irq_parse_imap_parent(imap_parent,
+					     parser->imap_end - imap_parent,
+					     &item->parent_args);
+	if (!imap_next)
+		return NULL;
+
+	for (i = 0; i < parser->parent_offset; i++)
+		item->child_imap[i] = be32_to_cpu(*(parser->imap + i));
+
+	parser->imap = imap_next;
+
+	return item;
+}
+EXPORT_SYMBOL_GPL(of_imap_parser_one);
+
 /**
  * of_irq_parse_raw - Low level interrupt tree parsing
  * @addr:	address specifier (start of "reg" property of the device) in be32 format
diff --git a/include/linux/of_irq.h b/include/linux/of_irq.h
index a480063c9cb1..f42757b245c4 100644
--- a/include/linux/of_irq.h
+++ b/include/linux/of_irq.h
@@ -11,6 +11,30 @@
 
 typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
 
+struct of_imap_parser {
+	struct device_node *node;
+	const __be32 *imap;
+	const __be32 *imap_end;
+	u32 parent_offset;
+};
+
+struct of_imap_item {
+	struct of_phandle_args parent_args;
+	u32 child_imap_count;
+	u32 child_imap[16]; /* Arbitrary size.
+			     * Should be #address-cells + #interrupt-cells but
+			     * avoid using allocation and so, expect that 16
+			     * should be enough
+			     */
+};
+
+/*
+ * If the iterator is exited prematurely (break, goto, return) of_node_put() has
+ * to be called on item.parent_args.np
+ */
+#define for_each_of_imap_item(parser, item) \
+	for (; of_imap_parser_one(parser, item);)
+
 /*
  * Workarounds only applied to 32bit powermac machines
  */
@@ -47,6 +71,11 @@ extern int of_irq_get_byname(struct device_node *dev, const char *name);
 extern int of_irq_to_resource_table(struct device_node *dev,
 		struct resource *res, int nr_irqs);
 extern struct device_node *of_irq_find_parent(struct device_node *child);
+extern int of_imap_parser_init(struct of_imap_parser *parser,
+			       struct device_node *node,
+			       struct of_imap_item *item);
+extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
+					       struct of_imap_item *item);
 extern struct irq_domain *of_msi_get_domain(struct device *dev,
 					    const struct device_node *np,
 					    enum irq_domain_bus_token token);
@@ -86,7 +115,17 @@ static inline void *of_irq_find_parent(struct device_node *child)
 {
 	return NULL;
 }
-
+static inline int of_imap_parser_init(struct of_imap_parser *parser,
+				      struct device_node *node,
+				      struct of_imap_item *item)
+{
+	return -ENOSYS;
+}
+extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
+					       struct of_imap_item *item)
+{
+	return NULL;
+}
 static inline struct irq_domain *of_msi_get_domain(struct device *dev,
 						   struct device_node *np,
 						   enum irq_domain_bus_token token)
-- 
2.51.0
Re: [PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item
Posted by kernel test robot 3 weeks, 1 day ago
Hi Herve,

kernel test robot noticed the following build warnings:

[auto build test WARNING on robh/for-next]
[also build test WARNING on tip/irq/core linus/master v6.17-rc5 next-20250910]
[cannot apply to geert-renesas-devel/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Herve-Codina-Schneider-Electric/ARM-dts-r9a06g032-Add-GPIO-controllers/20250909-200642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20250909120041.154459-4-herve.codina%40bootlin.com
patch subject: [PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item
config: x86_64-allnoconfig (https://download.01.org/0day-ci/archive/20250911/202509110402.OHHgtxRA-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250911/202509110402.OHHgtxRA-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/202509110402.OHHgtxRA-lkp@intel.com/

All warnings (new ones prefixed by >>):

   In file included from drivers/base/platform.c:15:
>> include/linux/of_irq.h:123:29: warning: no previous prototype for function 'of_imap_parser_one' [-Wmissing-prototypes]
     123 | extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
         |                             ^
   include/linux/of_irq.h:123:8: note: declare 'static' if the function is not intended to be used outside of this translation unit
     123 | extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
         |        ^
   1 warning generated.


vim +/of_imap_parser_one +123 include/linux/of_irq.h

    58	
    59	extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
    60	extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
    61	extern int of_irq_to_resource(struct device_node *dev, int index,
    62				      struct resource *r);
    63	
    64	#ifdef CONFIG_OF_IRQ
    65	extern void of_irq_init(const struct of_device_id *matches);
    66	extern int of_irq_parse_one(struct device_node *device, int index,
    67				  struct of_phandle_args *out_irq);
    68	extern int of_irq_count(struct device_node *dev);
    69	extern int of_irq_get(struct device_node *dev, int index);
    70	extern int of_irq_get_byname(struct device_node *dev, const char *name);
    71	extern int of_irq_to_resource_table(struct device_node *dev,
    72			struct resource *res, int nr_irqs);
    73	extern struct device_node *of_irq_find_parent(struct device_node *child);
    74	extern int of_imap_parser_init(struct of_imap_parser *parser,
    75				       struct device_node *node,
    76				       struct of_imap_item *item);
    77	extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
    78						       struct of_imap_item *item);
    79	extern struct irq_domain *of_msi_get_domain(struct device *dev,
    80						    const struct device_node *np,
    81						    enum irq_domain_bus_token token);
    82	extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
    83								u32 id,
    84								u32 bus_token);
    85	extern void of_msi_configure(struct device *dev, const struct device_node *np);
    86	extern u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in);
    87	#else
    88	static inline void of_irq_init(const struct of_device_id *matches)
    89	{
    90	}
    91	static inline int of_irq_parse_one(struct device_node *device, int index,
    92					   struct of_phandle_args *out_irq)
    93	{
    94		return -EINVAL;
    95	}
    96	static inline int of_irq_count(struct device_node *dev)
    97	{
    98		return 0;
    99	}
   100	static inline int of_irq_get(struct device_node *dev, int index)
   101	{
   102		return 0;
   103	}
   104	static inline int of_irq_get_byname(struct device_node *dev, const char *name)
   105	{
   106		return 0;
   107	}
   108	static inline int of_irq_to_resource_table(struct device_node *dev,
   109						   struct resource *res, int nr_irqs)
   110	{
   111		return 0;
   112	}
   113	static inline void *of_irq_find_parent(struct device_node *child)
   114	{
   115		return NULL;
   116	}
   117	static inline int of_imap_parser_init(struct of_imap_parser *parser,
   118					      struct device_node *node,
   119					      struct of_imap_item *item)
   120	{
   121		return -ENOSYS;
   122	}
 > 123	extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
   124						       struct of_imap_item *item)
   125	{
   126		return NULL;
   127	}
   128	static inline struct irq_domain *of_msi_get_domain(struct device *dev,
   129							   struct device_node *np,
   130							   enum irq_domain_bus_token token)
   131	{
   132		return NULL;
   133	}
   134	static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
   135							u32 id, u32 bus_token)
   136	{
   137		return NULL;
   138	}
   139	static inline void of_msi_configure(struct device *dev, struct device_node *np)
   140	{
   141	}
   142	static inline u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in)
   143	{
   144		return id_in;
   145	}
   146	#endif
   147	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
Re: [PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item
Posted by kernel test robot 3 weeks, 1 day ago
Hi Herve,

kernel test robot noticed the following build errors:

[auto build test ERROR on robh/for-next]
[also build test ERROR on tip/irq/core linus/master v6.17-rc5]
[cannot apply to geert-renesas-devel/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Herve-Codina-Schneider-Electric/ARM-dts-r9a06g032-Add-GPIO-controllers/20250909-200642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next
patch link:    https://lore.kernel.org/r/20250909120041.154459-4-herve.codina%40bootlin.com
patch subject: [PATCH v2 3/8] of/irq: Introduce for_each_of_imap_item
config: x86_64-buildonly-randconfig-005-20250910 (https://download.01.org/0day-ci/archive/20250911/202509110852.9fhL9uHp-lkp@intel.com/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250911/202509110852.9fhL9uHp-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/202509110852.9fhL9uHp-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

   In file included from drivers/bluetooth/hci_bcm.c:16:
>> include/linux/of_irq.h:123:29: warning: no previous prototype for 'of_imap_parser_one' [-Wmissing-prototypes]
     123 | extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
         |                             ^~~~~~~~~~~~~~~~~~
--
   In file included from drivers/spi/spi-pic32.c:20:
>> include/linux/of_irq.h:123:29: warning: no previous prototype for 'of_imap_parser_one' [-Wmissing-prototypes]
     123 | extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
         |                             ^~~~~~~~~~~~~~~~~~
   drivers/spi/spi-pic32.c:850:34: warning: 'pic32_spi_of_match' defined but not used [-Wunused-const-variable=]
     850 | static const struct of_device_id pic32_spi_of_match[] = {
         |                                  ^~~~~~~~~~~~~~~~~~
--
   ld: drivers/irqchip/irq-renesas-rzv2h.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-ingenic-tcu.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-stm32mp-exti.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-meson-gpio.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-starfive-jh8100-intc.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-imx-irqsteer.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-imx-intmux.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-lan966x-oic.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-ti-sci-intr.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-mst-intc.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-mchp-eic.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/irqchip/irq-sp7021-intc.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/gpio/gpio-msc313.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/gpio/gpio-rockchip.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/gpio/gpio-rtd.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/soc/mediatek/mtk-devapc.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/regulator/qcom-labibb-regulator.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/tty/serial/8250/8250_mtk.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/tty/serial/arc_uart.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/tty/serial/omap-serial.o: in function `of_imap_parser_one':
>> include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/iommu/mtk_iommu.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/iommu/mtk_iommu_v1.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/gpu/drm/bridge/analogix/analogix-anx78xx.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/base/platform.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/mfd/wcd934x.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/nfc/nfcmrvl/i2c.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/nfc/nfcmrvl/spi.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/nfc/s3fwrn5/i2c.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/ata/sata_fsl.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/mtd/nand/raw/atmel/nand-controller.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/mtd/nand/raw/atmel/pmecc.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/spi/spi.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/spi/spi-bcm2835.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/spi/spi-cadence.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/spi/spi-microchip-core-qspi.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/spi/spi-pic32.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/usb/mtu3/mtu3_plat.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/usb/mtu3/mtu3_core.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/usb/gadget/udc/max3420_udc.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/input/keyboard/gpio_keys.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/i2c/busses/i2c-stm32f4.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/i2c/busses/i2c-viai2c-wmt.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/i2c/busses/i2c-viai2c-common.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/power/reset/brcmstb-reboot.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/hwmon/npcm750-pwm-fan.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/thermal/rockchip_thermal.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/thermal/ti-soc-thermal/ti-bandgap.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/watchdog/at91sam9_wdt.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/watchdog/rzn1_wdt.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/bluetooth/hci_bcm.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/bluetooth/btusb.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/firmware/qcom/qcom_scm.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-of.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-atmel-st.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-davinci.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-digicolor.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-econet-en751221.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-fttmr010.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-ixp4xx.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/bcm2835_timer.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-meson6.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-zevio.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-stm32-lp.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-fsl-ftm.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-owl.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-integrator-ap.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-msc313e.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-ralink.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/clocksource/timer-nxp-stm.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here
   ld: drivers/bcma/main.o: in function `of_imap_parser_one':
   include/linux/of_irq.h:125: multiple definition of `of_imap_parser_one'; kernel/irq/irqdomain.o:include/linux/of_irq.h:125: first defined here


vim +125 include/linux/of_irq.h

    58	
    59	extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
    60	extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
    61	extern int of_irq_to_resource(struct device_node *dev, int index,
    62				      struct resource *r);
    63	
    64	#ifdef CONFIG_OF_IRQ
    65	extern void of_irq_init(const struct of_device_id *matches);
    66	extern int of_irq_parse_one(struct device_node *device, int index,
    67				  struct of_phandle_args *out_irq);
    68	extern int of_irq_count(struct device_node *dev);
    69	extern int of_irq_get(struct device_node *dev, int index);
    70	extern int of_irq_get_byname(struct device_node *dev, const char *name);
    71	extern int of_irq_to_resource_table(struct device_node *dev,
    72			struct resource *res, int nr_irqs);
    73	extern struct device_node *of_irq_find_parent(struct device_node *child);
    74	extern int of_imap_parser_init(struct of_imap_parser *parser,
    75				       struct device_node *node,
    76				       struct of_imap_item *item);
    77	extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
    78						       struct of_imap_item *item);
    79	extern struct irq_domain *of_msi_get_domain(struct device *dev,
    80						    const struct device_node *np,
    81						    enum irq_domain_bus_token token);
    82	extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
    83								u32 id,
    84								u32 bus_token);
    85	extern void of_msi_configure(struct device *dev, const struct device_node *np);
    86	extern u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in);
    87	#else
    88	static inline void of_irq_init(const struct of_device_id *matches)
    89	{
    90	}
    91	static inline int of_irq_parse_one(struct device_node *device, int index,
    92					   struct of_phandle_args *out_irq)
    93	{
    94		return -EINVAL;
    95	}
    96	static inline int of_irq_count(struct device_node *dev)
    97	{
    98		return 0;
    99	}
   100	static inline int of_irq_get(struct device_node *dev, int index)
   101	{
   102		return 0;
   103	}
   104	static inline int of_irq_get_byname(struct device_node *dev, const char *name)
   105	{
   106		return 0;
   107	}
   108	static inline int of_irq_to_resource_table(struct device_node *dev,
   109						   struct resource *res, int nr_irqs)
   110	{
   111		return 0;
   112	}
   113	static inline void *of_irq_find_parent(struct device_node *child)
   114	{
   115		return NULL;
   116	}
   117	static inline int of_imap_parser_init(struct of_imap_parser *parser,
   118					      struct device_node *node,
   119					      struct of_imap_item *item)
   120	{
   121		return -ENOSYS;
   122	}
 > 123	extern struct of_imap_item *of_imap_parser_one(struct of_imap_parser *parser,
   124						       struct of_imap_item *item)
 > 125	{
   126		return NULL;
   127	}
   128	static inline struct irq_domain *of_msi_get_domain(struct device *dev,
   129							   struct device_node *np,
   130							   enum irq_domain_bus_token token)
   131	{
   132		return NULL;
   133	}
   134	static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
   135							u32 id, u32 bus_token)
   136	{
   137		return NULL;
   138	}
   139	static inline void of_msi_configure(struct device *dev, struct device_node *np)
   140	{
   141	}
   142	static inline u32 of_msi_xlate(struct device *dev, struct device_node **msi_np, u32 id_in)
   143	{
   144		return id_in;
   145	}
   146	#endif
   147	

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