Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599311

Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single SoC device

From Arnd Bergmann <arnd@arndb.de>
Newsgroups linux.kernel
Subject Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single SoC device
Date 2017-03-13 13:50 +0100
Message-ID <tkxAe-ys-31@gated-at.bofh.it> (permalink)
References <tjaPo-rT-19@gated-at.bofh.it> <tjaPo-rT-21@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Thu, Mar 9, 2017 at 7:18 PM, Geert Uytterhoeven
<geert+renesas@glider.be> wrote:
> commit 1da1b3628df34a2a ("base: soc: Early register bus when needed")
> added support for early registration of SoC devices from a
> core_initcall().  However, some drivers need to check the SoC revision
> from an early_initcall(), which is even earlier.
>
> While registering the SoC bus and device, and using soc_device_match(),
> from an early_initcall() do work, the "soc" directory and the "soc0"
> file end up wrongly in the sysfs root, as the "bus" resp. "devices"
> directories haven't been created yet.
>
> To fix this, allow to register a single SoC device early on.
> As long as the SoC bus isn't registered, soc_device_match() just
> matches against this early device.
> When the SoC bus is registered later, the early device is registered for
> real.
>
> Note that soc_device_register() returns NULL (no error, but also not a
> valid pointer) when registering an early device.  Hence platform devices
> cannot be instantiated as children of the "soc0" node representing an
> early SoC device.  This should not be an issue, as that practice has
> been deprecated for new platforms.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> Is there a better way to fix this?
> While I believe all current users register a single SoC device, we may
> want to register multiple SoC devices in the future?
>
> soc_device_match() itself is completely independent from sysfs, but the
> sysfs operations are tied intimately to the driver core.
>
> The "bus" and "devices" directories are created from do_basic_setup() ->
> driver_init() -> devices_init() / buses_init(), which runs in between
> do_pre_smp_initcalls() (early_initcall()) and do_initcalls().

I'd prefer to not have to do the early registration at all and have fewer
special cases. Can you list a specific example that requires this?

If we want to do early registration, then your implementation seems
fine to me.

     Arnd

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 2/2] [RFC] base: soc: Allow early registration of a single SoC device Geert Uytterhoeven <geert+renesas@glider.be> - 2017-03-09 19:20 +0100
  Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-13 13:50 +0100
    Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Arnd Bergmann <arnd@arndb.de> - 2017-03-13 14:10 +0100
      Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-13 14:20 +0100
        Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Arnd Bergmann <arnd@arndb.de> - 2017-03-13 14:30 +0100
          Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Geert Uytterhoeven <geert@linux-m68k.org> - 2017-03-13 14:50 +0100
  Re: [PATCH 2/2] [RFC] base: soc: Allow early registration of a single  SoC device Arnd Bergmann <arnd@arndb.de> - 2017-03-13 13:50 +0100

csiph-web