mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Arnd Bergmann" <arnd@kernel.org>
Cc: "Olivia Mackall" <olivia@selenic.com>,
	"Herbert Xu" <herbert@gondor.apana.org.au>,
	"Cai Huoqing" <cai.huoqing@linux.dev>,
	"Dragan Simic" <dsimic@manjaro.org>,
	"Francesco Dolcini" <francesco.dolcini@toradex.com>,
	"Daniel Golle" <daniel@makrotopia.org>,
	"Christian Marangi" <ansuelsmth@gmail.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>,
	"Markus Mayer" <mmayer@broadcom.com>,
	"Lukas Bulwahn" <lukas.bulwahn@redhat.com>,
	"Nicolas Frattaroli" <nicolas.frattaroli@collabora.com>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] hwrng: nomadik: add ARM_AMBA dependency
Date: Mon, 06 Oct 2025 11:06:22 +0200	[thread overview]
Message-ID: <80792144-66c3-46a7-a1a7-2e934a31ee2b@app.fastmail.com> (raw)
In-Reply-To: <CAMuHMdW6jCbB80JhUVjBPnMCAXn5Amdr6KM48jvnd+VnMR40gg@mail.gmail.com>

On Mon, Oct 6, 2025, at 10:23, Geert Uytterhoeven wrote:
> On Tue, 29 Jul 2025 at 17:28, Arnd Bergmann <arnd@kernel.org> wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>>
>> Compile-testing this driver is only possible when the AMBA bus driver is
>> available in the kernel:
>>
>> x86_64-linux-ld: drivers/char/hw_random/nomadik-rng.o: in function `nmk_rng_remove':
>> nomadik-rng.c:(.text+0x67): undefined reference to `amba_release_regions'
>> x86_64-linux-ld: drivers/char/hw_random/nomadik-rng.o: in function `nmk_rng_probe':
>> nomadik-rng.c:(.text+0xee): undefined reference to `amba_request_regions'
>> x86_64-linux-ld: nomadik-rng.c:(.text+0x18d): undefined reference to `amba_release_regions'
>>
>> The was previously implied by the 'depends on ARCH_NOMADIK', but needs to be
>> specified for the COMPILE_TEST case.
>>
>> Fixes: d5e93b3374e4 ("hwrng: Kconfig - Add helper dependency on COMPILE_TEST")
>> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Thanks for your patch, which is now commit efaa2d815a0e4d1c ("hwrng:
> nomadik - add ARM_AMBA dependency") upstream.
>
>> --- a/drivers/char/hw_random/Kconfig
>> +++ b/drivers/char/hw_random/Kconfig
>> @@ -312,6 +312,7 @@ config HW_RANDOM_INGENIC_TRNG
>>  config HW_RANDOM_NOMADIK
>>         tristate "ST-Ericsson Nomadik Random Number Generator support"
>>         depends on ARCH_NOMADIK || COMPILE_TEST
>> +       depends on ARM_AMBA
>>         default HW_RANDOM
>>         help
>>           This driver provides kernel-side support for the Random Number
>
> After seeing CONFIG_HW_RANDOM_NOMADIK disappear from m68k
> all{mod,yes}config, I became intrigued, as it did build fine before?
> If CONFIG_ARM_AMBA is not enabled, both __amba_driver_register() and
> amba_driver_unregister() become static inline dummies, and the rest
> of the code and data is not referenced, thus optimized away by the
> compiler.  I verified this is the case on amd64 allmodconfig, too.
> How come this failed for you?

I believe this was the result of new build options getting adding
to the randconfig test matrix. If for any reason the
__amba_driver_register() function does not get inlined, the caller
will still have a permanent reference to the amba_driver structure,
and the rest of the file does not get removed by dead-code elimination.

Most likely this change happens because the __init attribute on
the module_init function puts it into a separate section from
the __amba_driver_register() function, causing the compiler to
refuse inlining them. Marking __amba_driver_register() as
__always_inline, or changing the amba_driver_register() macro
to not pass the pointer should also work here.

     Arnd

      reply	other threads:[~2025-10-06  9:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 15:28 Arnd Bergmann
2025-08-16  9:34 ` Herbert Xu
2025-10-06  8:23 ` Geert Uytterhoeven
2025-10-06  9:06   ` Arnd Bergmann [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=80792144-66c3-46a7-a1a7-2e934a31ee2b@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=ansuelsmth@gmail.com \
    --cc=arnd@kernel.org \
    --cc=aurelien@aurel32.net \
    --cc=cai.huoqing@linux.dev \
    --cc=daniel@makrotopia.org \
    --cc=dsimic@manjaro.org \
    --cc=francesco.dolcini@toradex.com \
    --cc=geert@linux-m68k.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas.bulwahn@redhat.com \
    --cc=mmayer@broadcom.com \
    --cc=nicolas.frattaroli@collabora.com \
    --cc=olivia@selenic.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
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

all inboxes | Powered by JetHome®