2021-11-15 19:04:19

by Anand Ashok Dumbre

[permalink] [raw]
Subject: [PATCH] device property: Add fwnode_iomap()

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 <[email protected]>
---
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



2021-11-16 00:03:42

by Greg Kroah-Hartman

[permalink] [raw]
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 <[email protected]>
> ---
> 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


2021-11-16 00:03:54

by Greg Kroah-Hartman

[permalink] [raw]
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 <[email protected]>
> ---
> 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

2021-11-16 09:23:17

by Anand Ashok Dumbre

[permalink] [raw]
Subject: RE: [PATCH] device property: Add fwnode_iomap()

Hi Greg,

Thanks for the review.

> -----Original Message-----
> From: Greg KH <[email protected]>
> Sent: Monday 15 November 2021 6:09 PM
> To: Anand Ashok Dumbre <[email protected]>
> Cc: [email protected]; [email protected]; [email protected]; linux-
> [email protected]; git <[email protected]>; Michal Simek
> <[email protected]>; [email protected]; [email protected];
> [email protected]; [email protected]
> 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 <[email protected]>
> > ---
> > 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

2021-11-16 10:10:03

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] device property: Add fwnode_iomap()

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



2021-11-16 13:16:21

by Anand Ashok Dumbre

[permalink] [raw]
Subject: RE: [PATCH] device property: Add fwnode_iomap()

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


2021-11-25 10:33:47

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] device property: Add fwnode_iomap()

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/[email protected]/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 <[email protected]>

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/[email protected]

2021-11-25 10:54:46

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] device property: Add fwnode_iomap()

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/[email protected]/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 <[email protected]>

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/[email protected]