LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: David Gow <davidgow@google.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Michael Hennerich <michael.hennerich@analog.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Alexandru Ardelean <alexandru.ardelean@analog.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	<linux-iio@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] iio: adc: Specify IOMEM dependency for adi-axi-adc driver
Date: Wed, 1 Jul 2020 10:54:54 +0100
Message-ID: <20200701105454.00002ca0@Huawei.com> (raw)
In-Reply-To: <CABVgOSnOo4iauOBGpJUZ4NRihCUU-1vue8hajZTCKAcH98_Lrw@mail.gmail.com>

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



      reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  7:05 David Gow
2020-06-30 10:06 ` Jonathan Cameron
2020-07-01  3:04   ` David Gow
2020-07-01  9:54     ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200701105454.00002ca0@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=alexandru.ardelean@analog.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lkml.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lkml.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lkml.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lkml.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lkml.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lkml.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lkml.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lkml.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lkml.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lkml.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git