Message ID | 20210523022807.5193-1-rdunlap@infradead.org |
---|---|
State | Changes Requested, archived |
Headers | show |
Series | OF: of_address: clean up OF stub functions | expand |
Context | Check | Description |
---|---|---|
robh/checkpatch | warning | total: 0 errors, 1 warnings, 12 lines checked |
robh/checkpatch | warning | total: 0 errors, 1 warnings, 12 lines checked |
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-rc2 next-20210521] [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-functions/20210523-102857 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: sparc64-randconfig-p002-20210523 (attached as .config) compiler: sparc64-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/c304e793a2b36d66328db9c7899a4b1817063155 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-functions/20210523-102857 git checkout c304e793a2b36d66328db9c7899a4b1817063155 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=sparc64 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 >>): >> arch/sparc/kernel/of_device_common.c:27:5: error: redefinition of 'of_address_to_resource' 27 | int of_address_to_resource(struct device_node *node, int index, | ^~~~~~~~~~~~~~~~~~~~~~ In file included from arch/sparc/kernel/of_device_common.c:10: include/linux/of_address.h:110:19: note: previous definition of 'of_address_to_resource' was here 110 | static inline int of_address_to_resource(struct device_node *dev, int index, | ^~~~~~~~~~~~~~~~~~~~~~ >> arch/sparc/kernel/of_device_common.c:40:15: error: redefinition of 'of_iomap' 40 | void __iomem *of_iomap(struct device_node *node, int index) | ^~~~~~~~ In file included from arch/sparc/kernel/of_device_common.c:10: include/linux/of_address.h:116:29: note: previous definition of 'of_iomap' was here 116 | static inline void __iomem *of_iomap(struct device_node *device, int index) | ^~~~~~~~ Kconfig warnings: (for reference only) WARNING: unmet direct dependencies detected for LOCKDEP Depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT && (FRAME_POINTER || MIPS || PPC || S390 || MICROBLAZE || ARM || ARC || X86) Selected by - LOCK_STAT && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT - DEBUG_LOCK_ALLOC && DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT vim +/of_address_to_resource +27 arch/sparc/kernel/of_device_common.c c9f5b7e77c30da2 Robert Reif 2009-06-04 26 930952af15f8425 David S. Miller 2011-03-18 @27 int of_address_to_resource(struct device_node *node, int index, 930952af15f8425 David S. Miller 2011-03-18 28 struct resource *r) 930952af15f8425 David S. Miller 2011-03-18 29 { 930952af15f8425 David S. Miller 2011-03-18 30 struct platform_device *op = of_find_device_by_node(node); 930952af15f8425 David S. Miller 2011-03-18 31 930952af15f8425 David S. Miller 2011-03-18 32 if (!op || index >= op->num_resources) 930952af15f8425 David S. Miller 2011-03-18 33 return -EINVAL; 930952af15f8425 David S. Miller 2011-03-18 34 930952af15f8425 David S. Miller 2011-03-18 35 memcpy(r, &op->archdata.resource[index], sizeof(*r)); 930952af15f8425 David S. Miller 2011-03-18 36 return 0; 930952af15f8425 David S. Miller 2011-03-18 37 } 930952af15f8425 David S. Miller 2011-03-18 38 EXPORT_SYMBOL_GPL(of_address_to_resource); 930952af15f8425 David S. Miller 2011-03-18 39 9889376ab91f89a David S. Miller 2011-03-18 @40 void __iomem *of_iomap(struct device_node *node, int index) 9889376ab91f89a David S. Miller 2011-03-18 41 { 9889376ab91f89a David S. Miller 2011-03-18 42 struct platform_device *op = of_find_device_by_node(node); 9889376ab91f89a David S. Miller 2011-03-18 43 struct resource *r; 9889376ab91f89a David S. Miller 2011-03-18 44 9889376ab91f89a David S. Miller 2011-03-18 45 if (!op || index >= op->num_resources) 9889376ab91f89a David S. Miller 2011-03-18 46 return NULL; 9889376ab91f89a David S. Miller 2011-03-18 47 9889376ab91f89a David S. Miller 2011-03-18 48 r = &op->archdata.resource[index]; 9889376ab91f89a David S. Miller 2011-03-18 49 9889376ab91f89a David S. Miller 2011-03-18 50 return of_ioremap(r, 0, resource_size(r), (char *) r->name); 9889376ab91f89a David S. Miller 2011-03-18 51 } 9889376ab91f89a David S. Miller 2011-03-18 52 EXPORT_SYMBOL(of_iomap); 9889376ab91f89a David S. Miller 2011-03-18 53 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Hi Randy, Thank you for the patch. On Sat, May 22, 2021 at 07:28:07PM -0700, Randy Dunlap wrote: > 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 stubs. > > 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 <rdunlap@infradead.org> > Cc: Rob Herring <robh+dt@kernel.org> > Cc: Frank Rowand <frowand.list@gmail.com> > Cc: devicetree@vger.kernel.org > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > include/linux/of_address.h | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > --- linux-next-20210521.orig/include/linux/of_address.h > +++ linux-next-20210521/include/linux/of_address.h > @@ -106,11 +106,7 @@ static inline bool of_dma_is_coherent(st > } > #endif /* CONFIG_OF_ADDRESS */ > > -#ifdef CONFIG_OF > -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 > +#if defined(CONFIG_OF) && !defined(CONFIG_OF_ADDRESS) || !defined(CONFIG_OF) Parentheses would help making the precedence order clear. On sparc, CONFIG_OF is set, CONFIG_OF_ADDRESS isn't, and of_address_to_resource() is provided by arch code. You'll stub it out here, which doesn't seem correct to me. > static inline int of_address_to_resource(struct device_node *dev, int index, > struct resource *r) > {
--- linux-next-20210521.orig/include/linux/of_address.h +++ linux-next-20210521/include/linux/of_address.h @@ -106,11 +106,7 @@ static inline bool of_dma_is_coherent(st } #endif /* CONFIG_OF_ADDRESS */ -#ifdef CONFIG_OF -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 +#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) {
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 stubs. 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 <rdunlap@infradead.org> Cc: Rob Herring <robh+dt@kernel.org> Cc: Frank Rowand <frowand.list@gmail.com> Cc: devicetree@vger.kernel.org Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> --- include/linux/of_address.h | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)