linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh+dt@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Frank Rowand <frowand.list@gmail.com>,
	devicetree@vger.kernel.org,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	kernel test robot <lkp@intel.com>
Subject: Re: [PATCH v2] OF: of_address: clean up OF stub & extern functions
Date: Wed, 26 May 2021 14:06:44 -0500	[thread overview]
Message-ID: <CAL_JsqLCzFN81vbN=Y5hpvW_u=h9oWPSyK6zrO9kXr9pPArt1Q@mail.gmail.com> (raw)
In-Reply-To: <20210524190919.2616-1-rdunlap@infradead.org>

On Mon, May 24, 2021 at 2:09 PM Randy Dunlap <rdunlap@infradead.org> 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 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).

> 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>
> Reported-by: kernel test robot <lkp@intel.com>
> ---
> 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(-)
>
> --- linux-next-20210524.orig/include/linux/of_address.h
> +++ linux-next-20210524/include/linux/of_address.h
> @@ -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.

>  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)

  parent reply	other threads:[~2021-05-26 19:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-24 19:09 [PATCH v2] OF: of_address: clean up OF stub & extern functions Randy Dunlap
2021-05-24 23:02 ` kernel test robot
2021-05-25  1:56   ` Randy Dunlap
2021-05-26 19:06 ` Rob Herring [this message]
2021-05-27  1:53   ` Randy Dunlap

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='CAL_JsqLCzFN81vbN=Y5hpvW_u=h9oWPSyK6zrO9kXr9pPArt1Q@mail.gmail.com' \
    --to=robh+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=rdunlap@infradead.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).