iio: adc: Specify IOMEM dependency for adi-axi-adc driver
Subsystems (3)
PATCH 1/1 iio: adc: Specify IOMEM dependency for adi-axi-adc driver
The Analog Devices AXI ADC driver uses the devm_ioremap_resource function, but does not specify a dependency on IOMEM in Kconfig. This causes a build failure on architectures without IOMEM, for example, UML (notably with make allyesconfig).
Fix this by making CONFIG_ADI_AXI_ADC depend on CONFIG_IOMEM.
--- drivers/iio/adc/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/iio/adc/Kconfig +1 -0
@@ -263,6 +263,7 @@ config AD9467 config ADI_AXI_ADC tristate "Analog Devices Generic AXI ADC IP core driver" + depends on IOMEM select IIO_BUFFER select IIO_BUFFER_HW_CONSUMER select IIO_BUFFER_DMAENGINE
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog
Quoted 8 lines · On Tue, 30 Jun 2020 00:05:52 -0700 David Gow <[email protected]> wrote:
The Analog Devices AXI ADC driver uses the
devm_ioremap_resourcefunction, but does not specify a dependency on IOMEM inKconfig. This causes a build failure on architectures without IOMEM, for example, UML (notably with make allyesconfig).Fix this by making
CONFIG_ADI_AXI_ADCdepend onCONFIG_IOMEM.Signed-off-by David Gow <[email protected]>
Hi David,
Could you confirm what the build error is? I thought the stubs added in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1bcbfbfdeb
were meant to allow us to avoid having lots of depends on IOMEM lines for the few architectures who don't support it.
Jonathan
Quoted 16 lines
--- drivers/iio/adc/Kconfig | 1 + 1 file changed, 1 insertion(+)drivers/iio/adc/Kconfig +1
-0@@ -263,6 +263,7 @@ config AD9467 config ADI_AXI_ADC tristate "Analog Devices Generic AXI ADC IP core driver" + depends on IOMEM select IIO_BUFFER select IIO_BUFFER_HW_CONSUMER select IIO_BUFFER_DMAENGINE
Quoted 11 lines · Jonathan Cameron
Quoted 7 lines · On Tue, 30 Jun 2020 00:05:52 -0700 David Gow <[email protected]> wrote:
The Analog Devices AXI ADC driver uses the
devm_ioremap_resourcefunction, but does not specify a dependency on IOMEM inKconfig. This causes a build failure on architectures without IOMEM, for example, UML (notably with make allyesconfig).Fix this by making
CONFIG_ADI_AXI_ADCdepend onCONFIG_IOMEM.
Quoted 7 lines
Quoted 1 line
Signed-off-by David Gow <[email protected]>Hi David,
Could you confirm what the build error is? I thought the stubs added in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1bcbfbfdeb
were meant to allow us to avoid having lots of depends on IOMEM lines for the few architectures who don't support it.
No worries:/usr/bin/ld: drivers/iio/adc/adi-axi-adc.o: in function `adi_axi_adc_probe':torvalds-linux/drivers/iio/adc/adi-axi-adc.c:415: undefined reference to `devm_platform_ioremap_resource'
Alas, the devm_platform_ioremap_resource function isn't handled by the UML stubs: it all seems to be in drivers/base/platform.c and lib/devres.c, behind #ifdef HAS_IOMEM.
In any case, improving IOMEM support for UML (at least for the KUnit test case, which is my use case) is something I'd like to do. There are only three drivers[1,2] upstream at the moment which fail to build as-is, though, so it seemed worth trying to fix them in the meantime. That being said, I tried just getting rid of the few #ifdef HAS_IOMEMs around the various devm_*_ioremap functions, and everything seems to be working... So maybe that's a false dependency given the various stubs (at least on UML). I used this (hideously hacky) patch:
drivers/base/platform.c +0 -0
@@ -61,7 +61,7 @@ struct resource *platform_get_resource(struct
platform_device *dev,
}EXPORT_SYMBOL_GPL(platform_get_resource);
-#ifdef CONFIG_HAS_IOMEM
+#if 1//def CONFIG_HAS_IOMEM
/**
* devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a
* platform device and get resource
lib/Makefile +0 -0
@@ -115,7 +115,7 @@ obj-y += math/ crypto/
obj-$(CONFIG_GENERIC_IOMAP) += iomap.o obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.o -obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o +obj-y += iomap_copy.o devres.o obj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
---
If this seems to work more broadly, I may try to clean it up and post it for broader review.
Cheers,
-- David
Quoted 66 lines · On Wed, 1 Jul 2020 11:04:42 +0800 David Gow <[email protected]> wrote:
Quoted 11 lines · Jonathan Cameron
Quoted 7 lines · On Tue, 30 Jun 2020 00:05:52 -0700 David Gow <[email protected]> wrote:
The Analog Devices AXI ADC driver uses the
devm_ioremap_resourcefunction, but does not specify a dependency on IOMEM inKconfig. This causes a build failure on architectures without IOMEM, for example, UML (notably with make allyesconfig).Fix this by making
CONFIG_ADI_AXI_ADCdepend onCONFIG_IOMEM.Quoted 7 lines
Quoted 1 line
Signed-off-by David Gow <[email protected]>Hi David,
Could you confirm what the build error is? I thought the stubs added in
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1bcbfbfdeb
were meant to allow us to avoid having lots of depends on IOMEM lines for the few architectures who don't support it.No worries:
/usr/bin/ld:drivers/iio/adc/adi-axi-adc.o: in function `adi_axi_adc_probe':torvalds-linux/drivers/iio/adc/adi-axi-adc.c:415: undefined reference to `devm_platform_ioremap_resource'Alas, the
devm_platform_ioremap_resourcefunction isn't handled by the UML stubs: it all seems to be indrivers/base/platform.candlib/devres.c, behind #ifdefHAS_IOMEM.In any case, improving IOMEM support for UML (at least for the KUnit test case, which is my use case) is something I'd like to do. There are only three drivers[1,2] upstream at the moment which fail to build as-is, though, so it seemed worth trying to fix them in the meantime. That being said, I tried just getting rid of the few #ifdef
HAS_IOMEMsaround the various devm_*_ioremap functions, and everything seems to be working... So maybe that's a false dependency given the various stubs (at least on UML). I used this (hideously hacky) patch:drivers/base/platform.c +1
-1@@ -61,7 +61,7 @@ struct resource *platform_get_resource(structplatform_device *dev, }EXPORT_SYMBOL_GPL (platform_get_resource ); -#ifdef CONFIG_HAS_IOMEM +#if 1 //def CONFIG_HAS_IOMEM /** * devm_platform_get_and_ioremap_resource - call devm_ioremap_resource() for a * platform device and get resource
lib/Makefile +0
-0@@ -115,7 +115,7 @@ obj-y += math/ crypto/obj-$(CONFIG_GENERIC_IOMAP) += iomap.o
obj-$(CONFIG_GENERIC_PCI_IOMAP) += pci_iomap.olib/Makefile +1
-1-obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o +obj-y += iomap_copy.o devres.oobj-$(CONFIG_CHECK_SIGNATURE) += check_signature.o obj-$(CONFIG_DEBUG_LOCKING_API_SELFTESTS) += locking-selftest.o
Quoted 4 lines
---
If this seems to work more broadly, I may try to clean it up and post it for broader review.
Looks like a good approach to me!
Jonathan
Quoted 3 lines
Cheers,
-- David
kernel test robot
build botI love your patch! Yet something to improve:
Hi David,
I love your patch! Yet something to improve:
[auto build test ERROR on iio/togreg]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/David-Gow/iio-adc-Specify-IOMEM-dependency-for-adi-axi-adc-driver/20200630-151318 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg config: mips-allyesconfig (attached as .config) compiler: mips-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
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=mips
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
drivers/staging/rtl8723bs/include/ieee80211.h:753:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
753 | } __attribute__ ((packed));
| ^
In file included from drivers/staging/rtl8723bs/include/drv_types.h:25,
from drivers/staging/rtl8723bs/os_dep/recv_linux.c:9:
drivers/staging/rtl8723bs/include/ieee80211.h:746:1: warning: alignment 1 of 'struct ieee80211_assoc_request_frame' is less than 2 [-Wpacked-not-aligned]
746 | } __attribute__ ((packed));
| ^
drivers/staging/rtl8723bs/include/ieee80211.h:753:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
753 | } __attribute__ ((packed));
| ^
In file included from drivers/staging/rtl8723bs/include/drv_types.h:42,
from drivers/staging/rtl8723bs/os_dep/wifi_regd.c:8:
drivers/staging/rtl8723bs/include/rtw_security.h:374:28: warning: 'K' defined but not used [-Wunused-const-variable=]
374 | static const unsigned long K[64] = {
| ^
In file included from drivers/staging/rtl8723bs/include/drv_types.h:42,
from drivers/staging/rtl8723bs/os_dep/recv_linux.c:9:
drivers/staging/rtl8723bs/include/rtw_security.h:374:28: warning: 'K' defined but not used [-Wunused-const-variable=]
374 | static const unsigned long K[64] = {
| ^
drivers/iio/adc/ti-ads8688.c:506:34: warning: 'ads8688_of_match' defined but not used [-Wunused-const-variable=]
506 | static const struct of_device_id ads8688_of_match[] = {
| ^~~~~~~~~~~~~~~~
In file included from drivers/staging/rtl8723bs/include/drv_types.h:25,
from drivers/staging/rtl8723bs/os_dep/xmit_linux.c:9:
drivers/staging/rtl8723bs/include/ieee80211.h:746:1: warning: alignment 1 of 'struct ieee80211_assoc_request_frame' is less than 2 [-Wpacked-not-aligned]
746 | } __attribute__ ((packed));
| ^
drivers/staging/rtl8723bs/include/ieee80211.h:753:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
753 | } __attribute__ ((packed));
| ^
drivers/staging/comedi/drivers/ni_routes.c:253: warning: cannot understand function prototype: 'const int NI_CMD_DESTS[] = '
drivers/staging/comedi/drivers/ni_routes.c:399: warning: Function parameter or member 'routes' not described in 'ni_route_set_has_source'
drivers/staging/comedi/drivers/ni_routes.c:399: warning: Function parameter or member 'source' not described in 'ni_route_set_has_source'
drivers/staging/comedi/drivers/ni_routes.c:525: warning: Function parameter or member 'src_sel_reg_value' not described in 'ni_find_route_source'
drivers/staging/comedi/drivers/ni_routes.c:525: warning: Function parameter or member 'dest' not described in 'ni_find_route_source'
drivers/staging/comedi/drivers/ni_routes.c:525: warning: Function parameter or member 'tables' not described in 'ni_find_route_source'
In file included from drivers/staging/rtl8723bs/include/drv_types.h:42,
from drivers/staging/rtl8723bs/os_dep/xmit_linux.c:9:
drivers/staging/rtl8723bs/include/rtw_security.h:374:28: warning: 'K' defined but not used [-Wunused-const-variable=]
374 | static const unsigned long K[64] = {
| ^
In file included from drivers/staging/rtl8723bs/include/drv_types.h:25,
from drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c:9:
drivers/staging/rtl8723bs/include/ieee80211.h:746:1: warning: alignment 1 of 'struct ieee80211_assoc_request_frame' is less than 2 [-Wpacked-not-aligned]
746 | } __attribute__ ((packed));
| ^
drivers/staging/rtl8723bs/include/ieee80211.h:753:1: warning: alignment 1 of 'struct ieee80211_assoc_response_frame' is less than 2 [-Wpacked-not-aligned]
753 | } __attribute__ ((packed));
| ^
In file included from drivers/staging/rtl8723bs/include/drv_types.h:42,
from drivers/staging/rtl8723bs/os_dep/sdio_ops_linux.c:9:
drivers/staging/rtl8723bs/include/rtw_security.h:374:28: warning: 'K' defined but not used [-Wunused-const-variable=]
374 | static const unsigned long K[64] = {
| ^
drivers/staging/comedi/drivers/ni_tio.c:1515: warning: Function parameter or member 'counter_dev' not described in 'ni_tio_get_routing'
drivers/staging/comedi/drivers/ni_tio.c:1515: warning: Function parameter or member 'dest' not described in 'ni_tio_get_routing'
drivers/staging/comedi/drivers/ni_tio.c:1557: warning: Function parameter or member 'dest' not described in 'ni_tio_set_routing'
drivers/staging/comedi/drivers/ni_tio.c:1557: warning: Function parameter or member 'reg' not described in 'ni_tio_set_routing'
drivers/staging/comedi/drivers/ni_tio.c:1557: warning: Excess function parameter 'destination' description in 'ni_tio_set_routing'
drivers/staging/comedi/drivers/ni_tio.c:1557: warning: Excess function parameter 'register_value' description in 'ni_tio_set_routing'
drivers/staging/comedi/drivers/ni_tio.c:1589: warning: Function parameter or member 'counter_dev' not described in 'ni_tio_unset_routing'
drivers/staging/comedi/drivers/ni_tio.c:1589: warning: Function parameter or member 'dest' not described in 'ni_tio_unset_routing'
drivers/iio/adc/twl4030-madc.c: In function 'twl4030_madc_threaded_irq_handler':
drivers/iio/adc/twl4030-madc.c:475:9: warning: variable 'len' set but not used [-Wunused-but-set-variable]
475 | int i, len, ret;
| ^~~
drivers/iio/adc/twl4030-madc.c: In function 'twl4030_madc_conversion':
drivers/iio/adc/twl4030-madc.c:619:18: warning: comparison is always false due to limited range of data type [-Wtype-limits]
619 | if (req->method < TWL4030_MADC_RT || req->method > TWL4030_MADC_SW2) {
| ^
drivers/iio/adc/ti_am335x_adc.c: In function 'tiadc_buffer_preenable':
drivers/iio/adc/ti_am335x_adc.c:297:21: warning: variable 'read' set but not used [-Wunused-but-set-variable]
297 | int i, fifo1count, read;
| ^~~~
drivers/iio/adc/ti_am335x_adc.c: In function 'tiadc_buffer_predisable':
drivers/iio/adc/ti_am335x_adc.c:346:21: warning: variable 'read' set but not used [-Wunused-but-set-variable]
346 | int fifo1count, i, read;
| ^~~~
drivers/iio/adc/twl6030-gpadc.c:110: warning: Function parameter or member 'ideal' not described in 'twl6030_gpadc_platform_data'
drivers/iio/adc/twl6030-gpadc.c:110: warning: Function parameter or member 'channel_to_reg' not described in 'twl6030_gpadc_platform_data'
drivers/iio/adc/twl4030-madc.c:170: warning: Function parameter or member 'usb3v1' not described in 'twl4030_madc_data'
arch/mips/kernel/head.o: in function `dtb_found':
(.ref.text+0xc8): relocation truncated to fit: R_MIPS_26 against `start_kernel'
init/main.o: in function `set_reset_devices':
main.c:(.init.text+0x20): relocation truncated to fit: R_MIPS_26 against `_mcount'
main.c:(.init.text+0x30): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc'
init/main.o: in function `debug_kernel':
main.c:(.init.text+0x9c): relocation truncated to fit: R_MIPS_26 against `_mcount'
main.c:(.init.text+0xac): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc'
init/main.o: in function `quiet_kernel':
main.c:(.init.text+0x118): relocation truncated to fit: R_MIPS_26 against `_mcount'
main.c:(.init.text+0x128): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc'
init/main.o: in function `init_setup':
main.c:(.init.text+0x1a4): relocation truncated to fit: R_MIPS_26 against `_mcount'
main.c:(.init.text+0x1c8): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc'
main.c:(.init.text+0x1e8): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc'
main.c:(.init.text+0x1fc): additional relocation overflows omitted from the output
mips-linux-ld: drivers/iio/adc/adi-axi-adc.o: in function `adi_axi_adc_probe':
>> adi-axi-adc.c:(.text.adi_axi_adc_probe+0x464): undefined reference to `devm_iio_dmaengine_buffer_alloc' make[1]: *** [Makefile:1113: vmlinux] Error 1
make[1]: Target '_all' not remade because of errors.
--
arch/mips/kernel/head.o: in function `dtb_found':
(.ref.text+0xc8): relocation truncated to fit: R_MIPS_26 against start_kernel' init/main.o: in function set_reset_devices':
main.c:(.init.text+0x20): relocation truncated to fit: R_MIPS_26 against _mcount' main.c:(.init.text+0x30): relocation truncated to fit: R_MIPS_26 against __sanitizer_cov_trace_pc' init/main.o: in function `debug_kernel':
main.c:(.init.text+0x9c): relocation truncated to fit: R_MIPS_26 against _mcount' main.c:(.init.text+0xac): relocation truncated to fit: R_MIPS_26 against __sanitizer_cov_trace_pc' init/main.o: in function `quiet_kernel':
main.c:(.init.text+0x118): relocation truncated to fit: R_MIPS_26 against _mcount' main.c:(.init.text+0x128): relocation truncated to fit: R_MIPS_26 against __sanitizer_cov_trace_pc' init/main.o: in function `init_setup':
main.c:(.init.text+0x1a4): relocation truncated to fit: R_MIPS_26 against _mcount' main.c:(.init.text+0x1c8): relocation truncated to fit: R_MIPS_26 against __sanitizer_cov_trace_pc' main.c:(.init.text+0x1e8): relocation truncated to fit: R_MIPS_26 against `__sanitizer_cov_trace_pc' main.c:(.init.text+0x1fc): additional relocation overflows omitted from the output
mips-linux-ld: drivers/iio/adc/adi-axi-adc.o: in function `adi_axi_adc_probe':
>> adi-axi-adc.c:(.text.adi_axi_adc_probe+0x464): undefined reference to `devm_iio_dmaengine_buffer_alloc'
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org