* [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver @ 2020-06-30 7:05 David Gow 2020-06-30 10:06 ` Jonathan Cameron 0 siblings, 1 reply; 4+ messages in thread From: David Gow @ 2020-06-30 7:05 UTC (permalink / raw) To: Jonathan Cameron, Michael Hennerich, Lars-Peter Clausen, Alexandru Ardelean Cc: Brendan Higgins, linux-iio, linux-kernel, David Gow 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. Signed-off-by: David Gow <davidgow@google.com> --- drivers/iio/adc/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index ff3569635ce0..f5009b61b80c 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -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 -- 2.27.0.212.ge8ba1cc988-goog ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver 2020-06-30 7:05 [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver David Gow @ 2020-06-30 10:06 ` Jonathan Cameron 2020-07-01 3:04 ` David Gow 0 siblings, 1 reply; 4+ messages in thread From: Jonathan Cameron @ 2020-06-30 10:06 UTC (permalink / raw) To: David Gow Cc: Jonathan Cameron, Michael Hennerich, Lars-Peter Clausen, Alexandru Ardelean, Brendan Higgins, linux-iio, linux-kernel On Tue, 30 Jun 2020 00:05:52 -0700 David Gow <davidgow@google.com> wrote: > 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. > > Signed-off-by: David Gow <davidgow@google.com> 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 > --- > drivers/iio/adc/Kconfig | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig > index ff3569635ce0..f5009b61b80c 100644 > --- a/drivers/iio/adc/Kconfig > +++ b/drivers/iio/adc/Kconfig > @@ -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 ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver 2020-06-30 10:06 ` Jonathan Cameron @ 2020-07-01 3:04 ` David Gow 2020-07-01 9:54 ` Jonathan Cameron 0 siblings, 1 reply; 4+ messages in thread From: David Gow @ 2020-07-01 3:04 UTC (permalink / raw) To: Jonathan Cameron Cc: Jonathan Cameron, Michael Hennerich, Lars-Peter Clausen, Alexandru Ardelean, Brendan Higgins, linux-iio, Linux Kernel Mailing List On Tue, Jun 30, 2020 at 6:07 PM Jonathan Cameron <Jonathan.Cameron@huawei.com> wrote: > > On Tue, 30 Jun 2020 00:05:52 -0700 > David Gow <davidgow@google.com> wrote: > > > 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. > > > > Signed-off-by: David Gow <davidgow@google.com> > 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: diff --git a/drivers/base/platform.c b/drivers/base/platform.c index c0d0a5490ac6..b6f08c88e2b6 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -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 diff --git a/lib/Makefile b/lib/Makefile index b1c42c10073b..35c21af33b93 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -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 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver 2020-07-01 3:04 ` David Gow @ 2020-07-01 9:54 ` Jonathan Cameron 0 siblings, 0 replies; 4+ messages in thread From: Jonathan Cameron @ 2020-07-01 9:54 UTC (permalink / raw) To: David Gow Cc: Jonathan Cameron, Michael Hennerich, Lars-Peter Clausen, Alexandru Ardelean, Brendan Higgins, linux-iio, Linux Kernel Mailing List On Wed, 1 Jul 2020 11:04:42 +0800 David Gow <davidgow@google.com> wrote: > On Tue, Jun 30, 2020 at 6:07 PM Jonathan Cameron > <Jonathan.Cameron@huawei.com> wrote: > > > > On Tue, 30 Jun 2020 00:05:52 -0700 > > David Gow <davidgow@google.com> wrote: > > > > > 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. > > > > > > Signed-off-by: David Gow <davidgow@google.com> > > 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: > > diff --git a/drivers/base/platform.c b/drivers/base/platform.c > index c0d0a5490ac6..b6f08c88e2b6 100644 > --- a/drivers/base/platform.c > +++ b/drivers/base/platform.c > @@ -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 > diff --git a/lib/Makefile b/lib/Makefile > index b1c42c10073b..35c21af33b93 100644 > --- a/lib/Makefile > +++ b/lib/Makefile > @@ -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. Looks like a good approach to me! Jonathan > > Cheers, > -- David ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-01 9:55 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-06-30 7:05 [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver David Gow 2020-06-30 10:06 ` Jonathan Cameron 2020-07-01 3:04 ` David Gow 2020-07-01 9:54 ` Jonathan Cameron
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).