OF: of_address: clean up OF stub & extern functions
PATCH v2 1/1 OF: of_address: clean up OF stub & extern functions
Adjust <linux/of_address.h> so that stubs are present when CONFIG_OF is not set *or* OF is set but OF_ADDRESS is not set.
This eliminates 2 build errors on arch/s390/ when HAS_IOMEM is not set (so OF_ADDRESS is not set).
I.e., it provides a stub for of_iomap() when one was previously not provided as well as removing some duplicate externs.
s390-linux-ld: drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
irq-al-fic.c:(.init.text+0x7a): undefined reference to `of_iomap'
s390-linux-ld: drivers/clocksource/timer-of.o: in function `timer_of_init':
timer-of.c:(.init.text+0xa4): undefined reference to `of_iomap'
Tested with many randconfig builds, but there could still be some hidden problem here.
---
v2: handle SPARC as a special case since it provides its own versions of
of_address_to_resource() and of_iomap();
fix build errors reported by lkp/ktr and address comments from Laurent;
do more randconfig build testing;include/linux/of_address.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/linux/of_address.h +7 -4
@@ -106,11 +106,12 @@ static inline bool of_dma_is_coherent(st }#endif /* CONFIG_OF_ADDRESS */ -#ifdef CONFIG_OF +#ifdef CONFIG_SPARC /* SPARC has its own versions of these */ extern int of_address_to_resource(struct device_node *dev, int index, struct resource *r); -void __iomem *of_iomap (struct device_node *node,int index); -#else +extern void __iomem *of_iomap(struct device_node *device, int index); +#else /* !CONFIG_SPARC */ +#if (defined(CONFIG_OF) && !defined(CONFIG_OF_ADDRESS)) || !defined(CONFIG_OF) static inline int of_address_to_resource(struct device_node *dev, int index, struct resource *r) {
@@ -121,7 +122,9 @@ static inline void __iomem *of_iomap(str {return NULL ; } -#endif +#endif /* (defined(CONFIG_OF) && !defined(CONFIG_OF_ADDRESS)) || !defined(CONFIG_OF) */ +#endif /* CONFIG_SPARC */ +#define of_range_parser_init of_pci_range_parser_init#if defined(CONFIG_OF_ADDRESS ) && defined(CONFIG_PCI )
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi Randy,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on linux/master linus/master v5.13-rc3 next-20210524] [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/Randy-Dunlap/OF-of_address-clean-up-OF-stub-extern-functions/20210525-031115 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: s390-randconfig-r001-20210524 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.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/8a9c54f1437e3af04c6de3b9606b46437ea69a12
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Randy-Dunlap/OF-of_address-clean-up-OF-stub-extern-functions/20210525-031115 git checkout 8a9c54f1437e3af04c6de3b9606b46437ea69a12
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>, old ones prefixed by <<):
ERROR: modpost: "devm_ioremap_resource" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "debugfs_create_regset32" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/media/rc/ir-hix5hd2.ko] undefined!
ERROR: modpost: "ioremap" [drivers/pcmcia/pcmcia.ko] undefined!
ERROR: modpost: "iounmap" [drivers/pcmcia/pcmcia.ko] undefined!
>> ERROR: modpost: "devm_platform_ioremap_resource" [drivers/char/xillybus/xillybus_of.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma_mgmt.ko] undefined!
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
Quoted 24 lines · kernel test robot
Hi Randy,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on robh/for-next]
[also build test ERROR on linux/master linus/master v5.13-rc3 next-20210524] [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/Randy-Dunlap/OF-of_address-clean-up-OF-stub-extern-functions/20210525-031115 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: s390-randconfig-r001-20210524 (attached as .config) compiler: s390-linux-gcc (GCC) 9.3.0reproduce (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/8a9c54f1437e3af04c6de3b9606b46437ea69a12
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Randy-Dunlap/OF-of_address-clean-up-OF-stub-extern-functions/20210525-031115 git checkout8a9c54f1437e3af04c6de3b9606b46437ea69a12
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=s390
Quoted 2 lines
If you fix the issue, kindly add following tag as appropriate
Reported-by kernel test robot <[email protected]>
Yes, this patch wasn't expected to fix all of these arch/s390/ build errors.
Before this patch: (9 undefined symbols)
ERROR: modpost: "devm_ioremap_resource" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "debugfs_create_regset32" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/media/rc/ir-hix5hd2.ko] undefined!
ERROR: modpost: "ioremap" [drivers/pcmcia/pcmcia.ko] undefined!
ERROR: modpost: "iounmap" [drivers/pcmcia/pcmcia.ko] undefined!
ERROR: modpost: "devm_platform_ioremap_resource" [drivers/char/xillybus/xillybus_of.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma_mgmt.ko] undefined!
ERROR: modpost: "of_address_to_resource" [drivers/dma/qcom/hdma_mgmt.ko] undefined!
This patch only affected the last symbol above. And it covers of_iomap() in my build testing as well.
After this patch: (8 undefined symbols)
Quoted 10 lines
All errors (new ones prefixed by >>, old ones prefixed by <<):
ERROR: modpost: "
devm_ioremap_resource" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "debugfs_create_regset32" [drivers/crypto/ccree/ccree.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/media/rc/ir-hix5hd2.ko] undefined!
ERROR: modpost: "ioremap" [drivers/pcmcia/pcmcia.ko] undefined!
ERROR: modpost: "iounmap" [drivers/pcmcia/pcmcia.ko] undefined!Quoted 1 line
Quoted 1 line
ERROR: modpost: "
devm_platform_ioremap_resource" [drivers/char/xillybus/xillybus_of.ko] undefined!ERROR: modpost: "
devm_ioremap_resource" [drivers/dma/qcom/hdma.ko] undefined!
ERROR: modpost: "devm_ioremap_resource" [drivers/dma/qcom/hdma_mgmt.ko] undefined!
I think that all of these arch/s390/ builds undefined symbols when CONFIG_HAS_IOMEM is not set are low priority (or no priority) for most people.
Signature · 1 line
~Randy
Quoted 8 lines · Randy Dunlap
Adjust <
linux/of_address.h> so that stubs are present whenCONFIG_OFis not set *or* OF is set butOF_ADDRESSis not set.This eliminates 2 build errors on
arch/s390/whenHAS_IOMEMis not set (soOF_ADDRESSis not set).
I.e., it provides a stub forof_iomap()when one was previously not provided as well as removing some duplicate externs.
Personally, I think we should get rid of HAS_IOMEM or at least most of its usage in kconfig. It has little purpose beyond hiding drivers in kconfig and mainly for UML though I think UML no longer needs that IIRC. (I'm not wild about 'depends on OF' either).
Quoted 27 lines
s390-linux-ld:
drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
irq-al-fic.c:(.init.text+0x7a): undefined reference to `of_iomap'
s390-linux-ld:drivers/clocksource/timer-of.o: in function `timer_of_init':
timer-of.c:(.init.text+0xa4): undefined reference to `of_iomap'Tested with many randconfig builds, but there could still be some hidden problem here.
Fixes 4acf4b9cd453 ("of: move of_address_to_resource and of_iomap declarations from sparc")Signed-off-by Randy Dunlap <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Cc Laurent Pinchart <[email protected]>Reported-by kernel test robot <[email protected]>---
v2: handle SPARC as a special case since it provides its own versions ofof_address_to_resource() and of_iomap(); fix build errors reported by lkp/ktr and address comments from Laurent; do more randconfig build testing;include/linux/of_address.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
include/linux/of_address.h static inline bool of_dma_is_coherent(st · line 109
Quoted 5 lines
include/linux/of_address.h +1
-1@@ -106,11 +106,12 @@ static inline bool of_dma_is_coherent(st }#endif /* CONFIG_OF_ADDRESS */ -#ifdef CONFIG_OF +#ifdef CONFIG_SPARC /* SPARC has its own versions of these */
The whole point of CONFIG_OF_ADDRESS is really just for SPARC. So I don't really like the mixture of the ifdefs here and in kconfig. It looks only more fragile.
Can we drop the HAS_IOMEM dependency from CONFIG_OF_ADDRESS and then fix the fallout from that? That would also remove all the other build time dependencies on HAS_IOMEM.
Quoted 21 lines
include/linux/of_address.h +6
-3extern int of_address_to_resource(struct device_node *dev, int index, struct resource *r); -void __iomem *of_iomap (struct device_node *node,int index); -#else +extern void __iomem *of_iomap(struct device_node *device, int index); +#else /* !CONFIG_SPARC */ +#if (defined(CONFIG_OF) && !defined(CONFIG_OF_ADDRESS)) || !defined(CONFIG_OF) static inline int of_address_to_resource(struct device_node *dev, int index, struct resource *r) {@@ -121,7 +122,9 @@ static inline void __iomem *of_iomap(str {return NULL ; } -#endif +#endif /* (defined(CONFIG_OF) && !defined(CONFIG_OF_ADDRESS)) || !defined(CONFIG_OF) */ +#endif /* CONFIG_SPARC */ +#define of_range_parser_init of_pci_range_parser_init#if defined(CONFIG_OF_ADDRESS ) && defined(CONFIG_PCI )
Quoted 10 lines · Rob Herring
Quoted 8 lines · Randy Dunlap
Adjust <
linux/of_address.h> so that stubs are present whenCONFIG_OFis not set *or* OF is set butOF_ADDRESSis not set.This eliminates 2 build errors on
arch/s390/whenHAS_IOMEMis not set (soOF_ADDRESSis not set).
I.e., it provides a stub forof_iomap()when one was previously not provided as well as removing some duplicate externs.
Quoted 4 lines
Personally, I think we should get rid of
HAS_IOMEMor at least most of its usage in kconfig. It has little purpose beyond hiding drivers in kconfig and mainly for UML though I think UML no longer needs that IIRC. (I'm not wild about 'depends on OF' either).
There are only over 800 of the latter.
Quoted 38 lines
Quoted 28 lines
s390-linux-ld:
drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
irq-al-fic.c:(.init.text+0x7a): undefined reference to `of_iomap'
s390-linux-ld:drivers/clocksource/timer-of.o: in function `timer_of_init':
timer-of.c:(.init.text+0xa4): undefined reference to `of_iomap'Tested with many randconfig builds, but there could still be some hidden problem here.
Fixes 4acf4b9cd453 ("of: move of_address_to_resource and of_iomap declarations from sparc")Signed-off-by Randy Dunlap <[email protected]>Cc Rob Herring <[email protected]>Cc Frank Rowand <[email protected]>Cc Laurent Pinchart <[email protected]>Reported-by kernel test robot <[email protected]>---
v2: handle SPARC as a special case since it provides its own versions ofof_address_to_resource() and of_iomap(); fix build errors reported by lkp/ktr and address comments from Laurent; do more randconfig build testing;include/linux/of_address.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)include/linux/of_address.h static inline bool of_dma_is_coherent(st · line 109
Quoted 5 lines
include/linux/of_address.h +1
-1@@ -106,11 +106,12 @@ static inline bool of_dma_is_coherent(st }#endif /* CONFIG_OF_ADDRESS */ -#ifdef CONFIG_OF +#ifdef CONFIG_SPARC /* SPARC has its own versions of these */ The whole point of
CONFIG_OF_ADDRESSis really just for SPARC. So I don't really like the mixture of the ifdefs here and in kconfig. It looks only more fragile.
Quoted 3 lines
Can we drop the
HAS_IOMEMdependency fromCONFIG_OF_ADDRESSand then fix the fallout from that? That would also remove all the other build time dependencies onHAS_IOMEM.
so change
config OF_ADDRESS
def_bool y depends on !SPARC && (HAS_IOMEM || UML)
to
config OF_ADDRESS
def_bool y
depends on !SPARC
I'll run some builds and see what all breaks.
thanks.
Signature · 1 line
~Randy