diff mbox series

[1/1] device property: Add fwnode_irq_get_by_name

Message ID 20211106173909.34255-2-puranjay12@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series device property: Adding fwnode_irq_get_by_name() | expand

Commit Message

Puranjay Mohan Nov. 6, 2021, 5:39 p.m. UTC
The fwnode framework did not have means to obtain the IRQ number from
the name of a node.
Add that now, in form of the fwnode_irq_get_by_name() function.

Signed-off-by: Puranjay Mohan <puranjay12@gmail.com>
---
 drivers/base/property.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

kernel test robot Nov. 7, 2021, 1:33 a.m. UTC | #1
Hi Puranjay,

I love your patch! Perhaps something to improve:

[auto build test WARNING on driver-core/driver-core-testing]
[also build test WARNING on v5.15 next-20211106]
[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]

url:    https://github.com/0day-ci/linux/commits/Puranjay-Mohan/device-property-Adding-fwnode_irq_get_by_name/20211107-014150
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 27e0bcd02990f7291adb0f111e300f06c495d509
config: ia64-defconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3dc64f4a6e40482f1d4313e5cb664a60cf5eb13
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Puranjay-Mohan/device-property-Adding-fwnode_irq_get_by_name/20211107-014150
        git checkout b3dc64f4a6e40482f1d4313e5cb664a60cf5eb13
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=ia64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/base/property.c:1032:5: warning: no previous prototype for 'fwnode_irq_get_by_name' [-Wmissing-prototypes]
    1032 | int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name)
         |     ^~~~~~~~~~~~~~~~~~~~~~


vim +/fwnode_irq_get_by_name +1032 drivers/base/property.c

  1023	
  1024	/**
  1025	 * fwnode_irq_get_by_name - Get IRQ directly from its name.
  1026	 * @fwnode:    Pointer to the firmware node
  1027	 * @name:      IRQ Name
  1028	 *
  1029	 * Returns Linux IRQ number on success. Other values are determined
  1030	 * accordingly to acpi_/of_ irq_get() operation.
  1031	 */
> 1032	int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name)
  1033	{
  1034		int index;
  1035	
  1036		if (unlikely(!name))
  1037			return -EINVAL;
  1038	
  1039		index = of_property_match_string(to_of_node(fwnode), "interrupt-names",
  1040						 name);
  1041		if (index < 0)
  1042			return index;
  1043	
  1044		return fwnode_irq_get(fwnode, index);
  1045	}
  1046	EXPORT_SYMBOL(fwnode_irq_get_by_name);
  1047	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
kernel test robot Nov. 7, 2021, 12:37 p.m. UTC | #2
Hi Puranjay,

I love your patch! Yet something to improve:

[auto build test ERROR on driver-core/driver-core-testing]
[also build test ERROR on v5.15 next-20211106]
[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]

url:    https://github.com/0day-ci/linux/commits/Puranjay-Mohan/device-property-Adding-fwnode_irq_get_by_name/20211107-014150
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git 27e0bcd02990f7291adb0f111e300f06c495d509
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/b3dc64f4a6e40482f1d4313e5cb664a60cf5eb13
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Puranjay-Mohan/device-property-Adding-fwnode_irq_get_by_name/20211107-014150
        git checkout b3dc64f4a6e40482f1d4313e5cb664a60cf5eb13
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/base/property.c:1032:5: error: no previous prototype for 'fwnode_irq_get_by_name' [-Werror=missing-prototypes]
    1032 | int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name)
         |     ^~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors


vim +/fwnode_irq_get_by_name +1032 drivers/base/property.c

  1023	
  1024	/**
  1025	 * fwnode_irq_get_by_name - Get IRQ directly from its name.
  1026	 * @fwnode:    Pointer to the firmware node
  1027	 * @name:      IRQ Name
  1028	 *
  1029	 * Returns Linux IRQ number on success. Other values are determined
  1030	 * accordingly to acpi_/of_ irq_get() operation.
  1031	 */
> 1032	int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name)
  1033	{
  1034		int index;
  1035	
  1036		if (unlikely(!name))
  1037			return -EINVAL;
  1038	
  1039		index = of_property_match_string(to_of_node(fwnode), "interrupt-names",
  1040						 name);
  1041		if (index < 0)
  1042			return index;
  1043	
  1044		return fwnode_irq_get(fwnode, index);
  1045	}
  1046	EXPORT_SYMBOL(fwnode_irq_get_by_name);
  1047	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
diff mbox series

Patch

diff --git a/drivers/base/property.c b/drivers/base/property.c
index f1f35b48ab8b..627e4e6d3ebd 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -958,6 +958,30 @@  int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
 }
 EXPORT_SYMBOL(fwnode_irq_get);
 
+/**
+ * fwnode_irq_get_by_name - Get IRQ directly from its name.
+ * @fwnode:    Pointer to the firmware node
+ * @name:      IRQ Name
+ *
+ * Returns Linux IRQ number on success. Other values are determined
+ * accordingly to acpi_/of_ irq_get() operation.
+ */
+int fwnode_irq_get_by_name(const struct fwnode_handle *fwnode, const char *name)
+{
+	int index;
+
+	if (unlikely(!name))
+		return -EINVAL;
+
+	index = of_property_match_string(to_of_node(fwnode), "interrupt-names",
+					 name);
+	if (index < 0)
+		return index;
+
+	return fwnode_irq_get(fwnode, index);
+}
+EXPORT_SYMBOL(fwnode_irq_get_by_name);
+
 /**
  * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
  * @fwnode: Pointer to the parent firmware node