LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] device property: Add fwnode_iomap()
@ 2021-11-15 17:38 Anand Ashok Dumbre
  2021-11-15 18:08 ` Greg KH
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Anand Ashok Dumbre @ 2021-11-15 17:38 UTC (permalink / raw)
  To: linux-kernel, jic23, lars, linux-iio, git, michal.simek, gregkh,
	rafael, linux-acpi, andriy.shevchenko, heikki.krogerus
  Cc: Anand Ashok Dumbre

This patch introduces a new helper routine - fwnode_iomap(),
which allows to map the memory mapped IO for a given device node.

Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
---
 drivers/base/property.c  | 15 +++++++++++++++
 include/linux/property.h |  2 ++
 2 files changed, 17 insertions(+)

diff --git a/drivers/base/property.c b/drivers/base/property.c
index 453918eb7390..9323e9b5de02 100644
--- a/drivers/base/property.c
+++ b/drivers/base/property.c
@@ -1021,6 +1021,21 @@ 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 357513a977e5..9bb0b0155402 100644
--- a/include/linux/property.h
+++ b/include/linux/property.h
@@ -121,6 +121,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,
-- 
2.17.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
@ 2021-11-15 18:08 ` Greg KH
  2021-11-15 18:08 ` Greg KH
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Greg KH @ 2021-11-15 18:08 UTC (permalink / raw)
  To: Anand Ashok Dumbre
  Cc: linux-kernel, jic23, lars, linux-iio, git, michal.simek, rafael,
	linux-acpi, andriy.shevchenko, heikki.krogerus

On Mon, Nov 15, 2021 at 05:38:19PM +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.
> 
> Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
> ---
>  drivers/base/property.c  | 15 +++++++++++++++
>  include/linux/property.h |  2 ++
>  2 files changed, 17 insertions(+)

We can not add new api calls with no users, as there is no way to
determine how the calls are being used.

So please submit this as part of a patch series that shows it being
used.

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
  2021-11-15 18:08 ` Greg KH
@ 2021-11-15 18:08 ` Greg KH
  2021-11-16  9:23   ` Anand Ashok Dumbre
  2021-11-16 10:09 ` Andy Shevchenko
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Greg KH @ 2021-11-15 18:08 UTC (permalink / raw)
  To: Anand Ashok Dumbre
  Cc: linux-kernel, jic23, lars, linux-iio, git, michal.simek, rafael,
	linux-acpi, andriy.shevchenko, heikki.krogerus

On Mon, Nov 15, 2021 at 05:38:19PM +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.
> 
> Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
> ---
>  drivers/base/property.c  | 15 +++++++++++++++
>  include/linux/property.h |  2 ++
>  2 files changed, 17 insertions(+)
> 
> diff --git a/drivers/base/property.c b/drivers/base/property.c
> index 453918eb7390..9323e9b5de02 100644
> --- a/drivers/base/property.c
> +++ b/drivers/base/property.c
> @@ -1021,6 +1021,21 @@ 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 357513a977e5..9bb0b0155402 100644
> --- a/include/linux/property.h
> +++ b/include/linux/property.h
> @@ -121,6 +121,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,
> -- 
> 2.17.1
> 

Also, always run scripts/checkpatch.pl before sending patches out so you
do not get grumpy maintainers telling you to run scripts/checkpatch.pl
on your patches :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 18:08 ` Greg KH
@ 2021-11-16  9:23   ` Anand Ashok Dumbre
  0 siblings, 0 replies; 8+ messages in thread
From: Anand Ashok Dumbre @ 2021-11-16  9:23 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, jic23, lars, linux-iio, git, Michal Simek, rafael,
	linux-acpi, andriy.shevchenko, heikki.krogerus

Hi Greg,

Thanks for the review.

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Monday 15 November 2021 6:09 PM
> 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>; rafael@kernel.org; linux-acpi@vger.kernel.org;
> andriy.shevchenko@linux.intel.com; heikki.krogerus@linux.intel.com
> Subject: Re: [PATCH] device property: Add fwnode_iomap()
> 
> On Mon, Nov 15, 2021 at 05:38:19PM +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.
> >
> > Signed-off-by: Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>
> > ---
> >  drivers/base/property.c  | 15 +++++++++++++++
> > include/linux/property.h |  2 ++
> >  2 files changed, 17 insertions(+)
> >
> > diff --git a/drivers/base/property.c b/drivers/base/property.c index
> > 453918eb7390..9323e9b5de02 100644
> > --- a/drivers/base/property.c
> > +++ b/drivers/base/property.c
> > @@ -1021,6 +1021,21 @@ 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
> > 357513a977e5..9bb0b0155402 100644
> > --- a/include/linux/property.h
> > +++ b/include/linux/property.h
> > @@ -121,6 +121,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,
> > --
> > 2.17.1
> >
> 
> Also, always run scripts/checkpatch.pl before sending patches out so you
> do not get grumpy maintainers telling you to run scripts/checkpatch.pl
> on your patches :)
> 

Sorry. Will do and also will send it as a part of my other driver series.

> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
  2021-11-15 18:08 ` Greg KH
  2021-11-15 18:08 ` Greg KH
@ 2021-11-16 10:09 ` Andy Shevchenko
  2021-11-16 13:16   ` Anand Ashok Dumbre
  2021-11-25 10:30 ` kernel test robot
  2021-11-25 10:51 ` kernel test robot
  4 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2021-11-16 10:09 UTC (permalink / raw)
  To: Anand Ashok Dumbre
  Cc: linux-kernel, jic23, lars, linux-iio, git, michal.simek, gregkh,
	rafael, linux-acpi, heikki.krogerus

On Mon, Nov 15, 2021 at 05:38:19PM +0000, Anand Ashok Dumbre wrote:

Sorry that I was probably not clear about how to sent this and Greg is
absolutely right. Make this the first patch in your series.

> This patch introduces a new helper routine - fwnode_iomap(),
> which allows to map the memory mapped IO for a given device node.

This needs additional things:

- explanation that for now it doesn't cover ACPI case and it may be expanded
  to cover it in the future, hence the main purpose is to get possible to
  develop resource provider agnostic drivers

- Suggested-by tag

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] device property: Add fwnode_iomap()
  2021-11-16 10:09 ` Andy Shevchenko
@ 2021-11-16 13:16   ` Anand Ashok Dumbre
  0 siblings, 0 replies; 8+ messages in thread
From: Anand Ashok Dumbre @ 2021-11-16 13:16 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-kernel, jic23, lars, linux-iio, git, Michal Simek, gregkh,
	rafael, linux-acpi, heikki.krogerus

Hi Andy,

> On Mon, Nov 15, 2021 at 05:38:19PM +0000, Anand Ashok Dumbre wrote:
> 
> Sorry that I was probably not clear about how to sent this and Greg is
> absolutely right. Make this the first patch in your series.
> 
> > This patch introduces a new helper routine - fwnode_iomap(), which
> > allows to map the memory mapped IO for a given device node.
> 
> This needs additional things:
> 
> - explanation that for now it doesn't cover ACPI case and it may be expanded
>   to cover it in the future, hence the main purpose is to get possible to
>   develop resource provider agnostic drivers
> 
> - Suggested-by tag
> 
Will add all the suggestions.

> --
> With Best Regards,
> Andy Shevchenko
>

Thanks,
Anand


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
                   ` (2 preceding siblings ...)
  2021-11-16 10:09 ` Andy Shevchenko
@ 2021-11-25 10:30 ` kernel test robot
  2021-11-25 10:51 ` kernel test robot
  4 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-11-25 10:30 UTC (permalink / raw)
  To: Anand Ashok Dumbre, linux-kernel, jic23, lars, linux-iio, git,
	michal.simek, gregkh, rafael, linux-acpi, andriy.shevchenko
  Cc: kbuild-all

Hi Anand,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.16-rc2]
[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/device-property-Add-fwnode_iomap/20211116-014240
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git debe436e77c72fcee804fb867f275e6d31aa999c
config: s390-randconfig-r005-20211115 (https://download.01.org/0day-ci/archive/20211125/202111251848.snM0nERG-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/057b01427afce16994b109c1f32a95bc46973e39
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anand-Ashok-Dumbre/device-property-Add-fwnode_iomap/20211116-014240
        git checkout 057b01427afce16994b109c1f32a95bc46973e39
        # 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+0x128): undefined reference to `memremap'
   s390-linux-ld: coherent.c:(.text+0x31e): undefined reference to `memunmap'
   s390-linux-ld: kernel/dma/coherent.o: in function `dma_declare_coherent_memory':
   coherent.c:(.text+0xab6): undefined reference to `memunmap'
   s390-linux-ld: drivers/base/property.o: in function `fwnode_iomap':
>> (.text+0x1dfc): undefined reference to `of_iomap'

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] device property: Add fwnode_iomap()
  2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
                   ` (3 preceding siblings ...)
  2021-11-25 10:30 ` kernel test robot
@ 2021-11-25 10:51 ` kernel test robot
  4 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-11-25 10:51 UTC (permalink / raw)
  To: Anand Ashok Dumbre, linux-kernel, jic23, lars, linux-iio, git,
	michal.simek, gregkh, rafael, linux-acpi, andriy.shevchenko
  Cc: kbuild-all

Hi Anand,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linux/master]
[also build test ERROR on driver-core/driver-core-testing linus/master v5.16-rc2 next-20211125]
[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/device-property-Add-fwnode_iomap/20211116-014240
base:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git debe436e77c72fcee804fb867f275e6d31aa999c
config: s390-randconfig-m031-20211115 (https://download.01.org/0day-ci/archive/20211125/202111251817.YgUIj6sh-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/057b01427afce16994b109c1f32a95bc46973e39
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Anand-Ashok-Dumbre/device-property-Add-fwnode_iomap/20211116-014240
        git checkout 057b01427afce16994b109c1f32a95bc46973e39
        # 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: drivers/dma/idma64.o: in function `idma64_platform_probe':
   idma64.c:(.text+0x463e): undefined reference to `devm_ioremap_resource'
   s390-linux-ld: drivers/dma/qcom/hidma.o: in function `hidma_probe':
   hidma.c:(.text+0x1cde): undefined reference to `devm_ioremap_resource'
   s390-linux-ld: hidma.c:(.text+0x1da8): undefined reference to `devm_ioremap_resource'
   s390-linux-ld: drivers/base/property.o: in function `fwnode_iomap':
>> property.c:(.text+0x4f34): undefined reference to `of_iomap'
   s390-linux-ld: drivers/pcmcia/cistpl.o: in function `set_cis_map':
   cistpl.c:(.text+0x19fc): undefined reference to `ioremap'
   s390-linux-ld: cistpl.c:(.text+0x1ad6): undefined reference to `iounmap'
   s390-linux-ld: cistpl.c:(.text+0x1bbe): undefined reference to `iounmap'
   s390-linux-ld: cistpl.c:(.text+0x1c18): undefined reference to `ioremap'
   s390-linux-ld: drivers/pcmcia/cistpl.o: in function `release_cis_mem':
   cistpl.c:(.text+0x371e): undefined reference to `iounmap'
   s390-linux-ld: drivers/firmware/google/coreboot_table.o: in function `coreboot_table_probe':
   coreboot_table.c:(.text+0x98e): undefined reference to `memremap'
   s390-linux-ld: coreboot_table.c:(.text+0xa46): undefined reference to `memunmap'
   s390-linux-ld: coreboot_table.c:(.text+0xad2): undefined reference to `memremap'
   s390-linux-ld: coreboot_table.c:(.text+0xc70): undefined reference to `memunmap'
   s390-linux-ld: drivers/firmware/google/memconsole-coreboot.o: in function `memconsole_probe':
   memconsole-coreboot.c:(.text+0x3be): undefined reference to `memremap'
   s390-linux-ld: memconsole-coreboot.c:(.text+0x47a): undefined reference to `devm_memremap'
   s390-linux-ld: memconsole-coreboot.c:(.text+0x4c4): undefined reference to `memunmap'
   s390-linux-ld: drivers/firmware/google/vpd.o: in function `vpd_section_destroy.isra.0':
   vpd.c:(.text+0xaee): undefined reference to `memunmap'
   s390-linux-ld: drivers/firmware/google/vpd.o: in function `vpd_section_init':
   vpd.c:(.text+0xcce): undefined reference to `memremap'
   s390-linux-ld: vpd.c:(.text+0x1178): undefined reference to `memunmap'
   s390-linux-ld: drivers/firmware/google/vpd.o: in function `vpd_sections_init':
   vpd.c:(.text+0x122e): undefined reference to `memremap'
   s390-linux-ld: vpd.c:(.text+0x12c4): undefined reference to `memunmap'

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-11-25 10:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15 17:38 [PATCH] device property: Add fwnode_iomap() Anand Ashok Dumbre
2021-11-15 18:08 ` Greg KH
2021-11-15 18:08 ` Greg KH
2021-11-16  9:23   ` Anand Ashok Dumbre
2021-11-16 10:09 ` Andy Shevchenko
2021-11-16 13:16   ` Anand Ashok Dumbre
2021-11-25 10:30 ` kernel test robot
2021-11-25 10:51 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).