diff mbox series

[v11,1/5] device property: Add fwnode_iomap()

Message ID 20211124225407.17793-2-anand.ashok.dumbre@xilinx.com (mailing list archive)
State Not Applicable, archived
Headers show
Series Add Xilinx AMS Driver | expand

Commit Message

Anand Ashok Dumbre Nov. 24, 2021, 10:54 p.m. UTC
This patch introduces a new helper routine - fwnode_iomap(), which
allows to map the memory mapped IO for a given device node.

This implementation does not cover the ACPI case and may be expanded
in the future. The main purpose here is to be able to develop resource
provider agnostic drivers.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/base/property.c  | 16 ++++++++++++++++
 include/linux/property.h |  2 ++
 2 files changed, 18 insertions(+)

Comments

Andy Shevchenko Nov. 25, 2021, 11:42 a.m. UTC | #1
On Wed, Nov 24, 2021 at 10:54:03PM +0000, Anand Ashok Dumbre wrote:
> This patch introduces a new helper routine - fwnode_iomap(), which
> allows to map the memory mapped IO for a given device node.
> 
> This implementation does not cover the ACPI case and may be expanded
> in the future. The main purpose here is to be able to develop resource
> provider agnostic drivers.

...

> +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
> +{

> +	if (is_of_node(fwnode))
> +		return of_iomap(to_of_node(fwnode), index);

It seems this part should be wrapped in some ifdeffery according to kbuild bot
report.

> +	return NULL;
> +}
> +EXPORT_SYMBOL(fwnode_iomap);
kernel test robot Nov. 27, 2021, 11:54 a.m. UTC | #2
Hi Anand,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on jic23-iio/togreg]
[also build test ERROR on xilinx-xlnx/master linux/master linus/master v5.16-rc2 next-20211126]
[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/Anand-Ashok-Dumbre/Add-Xilinx-AMS-Driver/20211125-065614
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: s390-randconfig-r044-20211126 (https://download.01.org/0day-ci/archive/20211127/202111271953.N5Nm1MIG-lkp@intel.com/config)
compiler: s390-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/b9acba7c202b47024781ea7a6f85b787df15f29b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anand-Ashok-Dumbre/Add-Xilinx-AMS-Driver/20211125-065614
        git checkout b9acba7c202b47024781ea7a6f85b787df15f29b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=s390 SHELL=/bin/bash

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

   s390-linux-ld: kernel/dma/coherent.o: in function `dma_init_coherent_memory':
   coherent.c:(.text+0x6c): undefined reference to `memremap'
   s390-linux-ld: coherent.c:(.text+0x106): undefined reference to `memunmap'
   s390-linux-ld: kernel/dma/coherent.o: in function `dma_declare_coherent_memory':
   coherent.c:(.text+0x436): undefined reference to `memunmap'
   s390-linux-ld: drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
   irq-al-fic.c:(.init.text+0x28): undefined reference to `of_iomap'
   s390-linux-ld: irq-al-fic.c:(.init.text+0x1f4): undefined reference to `iounmap'
   s390-linux-ld: drivers/dma/idma64.o: in function `idma64_platform_probe':
   idma64.c:(.text+0x14cc): undefined reference to `devm_ioremap_resource'
   s390-linux-ld: drivers/tty/ipwireless/main.o: in function `ipwireless_detach':
   main.c:(.text+0x8a): undefined reference to `iounmap'
   s390-linux-ld: main.c:(.text+0xd0): undefined reference to `iounmap'
   s390-linux-ld: drivers/tty/ipwireless/main.o: in function `ipwireless_probe':
   main.c:(.text+0x258): undefined reference to `ioremap'
   s390-linux-ld: main.c:(.text+0x30c): undefined reference to `ioremap'
   s390-linux-ld: main.c:(.text+0x35e): undefined reference to `iounmap'
   s390-linux-ld: main.c:(.text+0x3a0): undefined reference to `iounmap'
   s390-linux-ld: drivers/tty/ipwireless/main.o: in function `config_ipwireless':
   main.c:(.text+0x5a0): undefined reference to `iounmap'
   s390-linux-ld: main.c:(.text+0x5e0): undefined reference to `iounmap'
   s390-linux-ld: drivers/base/property.o: in function `fwnode_iomap':
>> property.c:(.text+0xf36): undefined reference to `of_iomap'
   s390-linux-ld: drivers/net/arcnet/arc-rimi.o: in function `arc_rimi_exit':
   arc-rimi.c:(.exit.text+0x34): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/arcnet/arc-rimi.o: in function `arcrimi_found':
   arc-rimi.c:(.init.text+0xce): undefined reference to `ioremap'
   s390-linux-ld: arc-rimi.c:(.init.text+0x14c): undefined reference to `iounmap'
   s390-linux-ld: arc-rimi.c:(.init.text+0x2b0): undefined reference to `iounmap'
   s390-linux-ld: arc-rimi.c:(.init.text+0x332): undefined reference to `ioremap'
   s390-linux-ld: arc-rimi.c:(.init.text+0x3f4): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/arcnet/arc-rimi.o: in function `check_mirror':
   arc-rimi.c:(.text.unlikely+0x4e): undefined reference to `ioremap'
   s390-linux-ld: arc-rimi.c:(.text.unlikely+0x74): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/ethernet/8390/pcnet_cs.o: in function `pcnet_release':
   pcnet_cs.c:(.text+0x6b8): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/ethernet/8390/pcnet_cs.o: in function `setup_shmem_window':
   pcnet_cs.c:(.text+0xb44): undefined reference to `ioremap'
   s390-linux-ld: pcnet_cs.c:(.text+0xbd8): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/ethernet/8390/pcnet_cs.o: in function `get_hwinfo':
   pcnet_cs.c:(.text+0x1558): undefined reference to `ioremap'
   s390-linux-ld: pcnet_cs.c:(.text+0x1656): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/ethernet/xircom/xirc2ps_cs.o: in function `xirc2ps_release':
   xirc2ps_cs.c:(.text+0x518): undefined reference to `iounmap'
   s390-linux-ld: drivers/net/ethernet/xircom/xirc2ps_cs.o: in function `xirc2ps_config':
   xirc2ps_cs.c:(.text+0x1584): undefined reference to `ioremap'
   s390-linux-ld: drivers/pcmcia/cistpl.o: in function `set_cis_map':
   cistpl.c:(.text+0x5c6): undefined reference to `ioremap'
   s390-linux-ld: cistpl.c:(.text+0x5fc): undefined reference to `iounmap'
   s390-linux-ld: cistpl.c:(.text+0x62a): undefined reference to `iounmap'
   s390-linux-ld: cistpl.c:(.text+0x63c): undefined reference to `ioremap'
   s390-linux-ld: drivers/pcmcia/cistpl.o: in function `release_cis_mem':
   cistpl.c:(.text+0xf80): undefined reference to `iounmap'

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Anand Ashok Dumbre Nov. 30, 2021, 9:58 p.m. UTC | #3
Hi Andy,

Thanks for the review.

> -----Original Message-----
> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Sent: Thursday 25 November 2021 11:42 AM
> To: Anand Ashok Dumbre <ANANDASH@xilinx.com>
> Cc: linux-kernel@vger.kernel.org; jic23@kernel.org; lars@metafoo.de; linux-
> iio@vger.kernel.org; git <git@xilinx.com>; Michal Simek
> <michals@xilinx.com>; gregkh@linuxfoundation.org; rafael@kernel.org;
> linux-acpi@vger.kernel.org; heikki.krogerus@linux.intel.com
> Subject: Re: [PATCH v11 1/5] device property: Add fwnode_iomap()
> 
> On Wed, Nov 24, 2021 at 10:54:03PM +0000, Anand Ashok Dumbre wrote:
> > This patch introduces a new helper routine - fwnode_iomap(), which
> > allows to map the memory mapped IO for a given device node.
> >
> > This implementation does not cover the ACPI case and may be expanded
> > in the future. The main purpose here is to be able to develop resource
> > provider agnostic drivers.
> 
> ...
> 
> > +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int
> index) {
> 
> > +	if (is_of_node(fwnode))
> > +		return of_iomap(to_of_node(fwnode), index);
> 
> It seems this part should be wrapped in some ifdeffery according to kbuild
> bot report.

I see that of_iomap is wrapped in #ifdef
I will fix that and send a new patch.

> 
> > +	return NULL;
> > +}
> > +EXPORT_SYMBOL(fwnode_iomap);
> 
> --
> With Best Regards,
> Andy Shevchenko
> 

Thanks,
Anand
Anand Ashok Dumbre Dec. 2, 2021, 9:10 a.m. UTC | #4
Hi Andy,

> -----Original Message-----
> From: Anand Ashok Dumbre <ANANDASH@xilinx.com>
> Sent: Tuesday 30 November 2021 9:58 PM
> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: linux-kernel@vger.kernel.org; jic23@kernel.org; lars@metafoo.de; linux-
> iio@vger.kernel.org; git <git@xilinx.com>; Michal Simek
> <michals@xilinx.com>; gregkh@linuxfoundation.org; rafael@kernel.org;
> linux-acpi@vger.kernel.org; heikki.krogerus@linux.intel.com
> Subject: RE: [PATCH v11 1/5] device property: Add fwnode_iomap()
> 
> Hi Andy,
> 
> Thanks for the review.
> 
> > -----Original Message-----
> > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Sent: Thursday 25 November 2021 11:42 AM
> > To: Anand Ashok Dumbre <ANANDASH@xilinx.com>
> > Cc: linux-kernel@vger.kernel.org; jic23@kernel.org; lars@metafoo.de;
> > linux- iio@vger.kernel.org; git <git@xilinx.com>; Michal Simek
> > <michals@xilinx.com>; gregkh@linuxfoundation.org; rafael@kernel.org;
> > linux-acpi@vger.kernel.org; heikki.krogerus@linux.intel.com
> > Subject: Re: [PATCH v11 1/5] device property: Add fwnode_iomap()
> >
> > On Wed, Nov 24, 2021 at 10:54:03PM +0000, Anand Ashok Dumbre wrote:
> > > This patch introduces a new helper routine - fwnode_iomap(), which
> > > allows to map the memory mapped IO for a given device node.
> > >
> > > This implementation does not cover the ACPI case and may be expanded
> > > in the future. The main purpose here is to be able to develop
> > > resource provider agnostic drivers.
> >
> > ...
> >
> > > +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int
> > index) {
> >
> > > +	if (is_of_node(fwnode))
> > > +		return of_iomap(to_of_node(fwnode), index);
> >
> > It seems this part should be wrapped in some ifdeffery according to
> > kbuild bot report.
> 
> I see that of_iomap is wrapped in #ifdef I will fix that and send a new patch.

I am unable to reproduce the conditions for the error shown by the kernel bot.
Not sure if I am doing something wrong. Any help/suggestion would be appreciated to fix this issue.

> 
> >
> > > +	return NULL;
> > > +}
> > > +EXPORT_SYMBOL(fwnode_iomap);
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> 
> Thanks,
> Anand

Thanks and Regards,
Anand
Andy Shevchenko Dec. 2, 2021, 9:37 a.m. UTC | #5
On Thu, Dec 02, 2021 at 09:10:02AM +0000, Anand Ashok Dumbre wrote:
> > From: Anand Ashok Dumbre <ANANDASH@xilinx.com>
> > Sent: Tuesday 30 November 2021 9:58 PM
> > > From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > > Sent: Thursday 25 November 2021 11:42 AM
> > > On Wed, Nov 24, 2021 at 10:54:03PM +0000, Anand Ashok Dumbre wrote:

...

> > > > +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int
> > > index) {
> > >
> > > > +	if (is_of_node(fwnode))
> > > > +		return of_iomap(to_of_node(fwnode), index);
> > >
> > > It seems this part should be wrapped in some ifdeffery according to
> > > kbuild bot report.
> > 
> > I see that of_iomap is wrapped in #ifdef I will fix that and send a new patch.
> 
> I am unable to reproduce the conditions for the error shown by the kernel bot.
> Not sure if I am doing something wrong. Any help/suggestion would be appreciated to fix this issue.

Kbuild bot gives you a config file and command line with which it tried to
build. It's quite rare that it gives you false positives (and here it's not
the case, because you need to have ifdeffery like other APIs in this category
have).

> > > > +	return NULL;
> > > > +}
Anand Ashok Dumbre Dec. 2, 2021, 11:46 a.m. UTC | #6
> ...
> 
> > > > > +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int
> > > > index) {
> > > >
> > > > > +	if (is_of_node(fwnode))
> > > > > +		return of_iomap(to_of_node(fwnode), index);
> > > >
> > > > It seems this part should be wrapped in some ifdeffery according
> > > > to kbuild bot report.
> > >
> > > I see that of_iomap is wrapped in #ifdef I will fix that and send a new
> patch.
> >
> > I am unable to reproduce the conditions for the error shown by the kernel
> bot.
> > Not sure if I am doing something wrong. Any help/suggestion would be
> appreciated to fix this issue.
> 
> Kbuild bot gives you a config file and command line with which it tried to
> build. It's quite rare that it gives you false positives (and here it's not the
> case, because you need to have ifdeffery like other APIs in this category
> have).
> 

The problem is at the config file itself. I am unable to point to compiler correctly while running,
make ARCH=s390 test_defconfig
s390-linux-gcc: unknown compiler
scripts/Kconfig.include:44: Sorry, this compiler is not supported.
scripts/kconfig/Makefile:94: recipe for target 'test_defconfig' failed
make[1]: *** [test_defconfig] Error 1
Makefile:619: recipe for target 'test_defconfig' failed
make: *** [test_defconfig] Error 2

I have added the compiler binaries to the patch and set CROSS_COMPILE=s390-linux-

> > > > > +	return NULL;
> > > > > +}
> 
> 
> --
> With Best Regards,
> Andy Shevchenko
> 	

Thanks,
Anand
Anand Ashok Dumbre Dec. 2, 2021, 12:34 p.m. UTC | #7
> -----Original Message-----
> From: Anand Ashok Dumbre <ANANDASH@xilinx.com>
> Sent: Thursday 2 December 2021 11:47 AM
> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: linux-kernel@vger.kernel.org; jic23@kernel.org; lars@metafoo.de; linux-
> iio@vger.kernel.org; git <git@xilinx.com>; Michal Simek
> <michals@xilinx.com>; gregkh@linuxfoundation.org; rafael@kernel.org;
> linux-acpi@vger.kernel.org; heikki.krogerus@linux.intel.com
> Subject: RE: [PATCH v11 1/5] device property: Add fwnode_iomap()
> 
> > ...
> >
> > > > > > +void __iomem *fwnode_iomap(struct fwnode_handle *fwnode,
> int
> > > > > index) {
> > > > >
> > > > > > +	if (is_of_node(fwnode))
> > > > > > +		return of_iomap(to_of_node(fwnode), index);
> > > > >
> > > > > It seems this part should be wrapped in some ifdeffery according
> > > > > to kbuild bot report.
> > > >
> > > > I see that of_iomap is wrapped in #ifdef I will fix that and send
> > > > a new
> > patch.
> > >
> > > I am unable to reproduce the conditions for the error shown by the
> > > kernel
> > bot.
> > > Not sure if I am doing something wrong. Any help/suggestion would be
> > appreciated to fix this issue.
> >
> > Kbuild bot gives you a config file and command line with which it
> > tried to build. It's quite rare that it gives you false positives (and
> > here it's not the case, because you need to have ifdeffery like other
> > APIs in this category have).
> >
> 
> The problem is at the config file itself. I am unable to point to compiler
> correctly while running, make ARCH=s390 test_defconfig
> s390-linux-gcc: unknown compiler
> scripts/Kconfig.include:44: Sorry, this compiler is not supported.
> scripts/kconfig/Makefile:94: recipe for target 'test_defconfig' failed
> make[1]: *** [test_defconfig] Error 1
> Makefile:619: recipe for target 'test_defconfig' failed
> make: *** [test_defconfig] Error 2
> 
> I have added the compiler binaries to the patch and set
> CROSS_COMPILE=s390-linux-

I am able to build now, one of the build options was causing the problems.

> 
> > > > > > +	return NULL;
> > > > > > +}
> >
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
> 
> Thanks,
> Anand
diff mbox series

Patch

diff --git a/drivers/base/property.c b/drivers/base/property.c
index f1f35b48ab8b..f2e38be3a999 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -958,6 +958,22 @@  int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index)
 }
 EXPORT_SYMBOL(fwnode_irq_get);
 
+/**
+ * fwnode_iomap - Maps the memory mapped IO for a given fwnode
+ * @fwnode:	Pointer to the firmware node
+ * @index:	Index of the IO range
+ *
+ * Returns a pointer to the mapped memory.
+ */
+void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index)
+{
+	if (is_of_node(fwnode))
+		return of_iomap(to_of_node(fwnode), index);
+
+	return NULL;
+}
+EXPORT_SYMBOL(fwnode_iomap);
+
 /**
  * fwnode_graph_get_next_endpoint - Get next endpoint firmware node
  * @fwnode: Pointer to the parent firmware node
diff --git a/include/linux/property.h b/include/linux/property.h
index 88fa726a76df..6670d5a1ec2a 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -122,6 +122,8 @@  void fwnode_handle_put(struct fwnode_handle *fwnode);
 
 int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index);
 
+void __iomem *fwnode_iomap(struct fwnode_handle *fwnode, int index);
+
 unsigned int device_get_child_node_count(struct device *dev);
 
 static inline bool device_property_read_bool(struct device *dev,