Message ID | 20211115173819.22778-1-anand.ashok.dumbre@xilinx.com (mailing list archive) |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | device property: Add fwnode_iomap() | expand |
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
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
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
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
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
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
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
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,
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(+)