struct device_driver's mod_name is not set by a number of bus' driver 
registration
functions. Without that, built-in drivers don't have the module symlink in 
sysfs.
We want this to go from unbound driver name -> module name -> kernel config 
name.
This is useful on embedded platforms to minimize kernel config, reduce kernel 
size,
and reduce boot time.

In order to achieve this, mod_name has to be set to KBUILD_MODNAME, and this has
to be done for all buses which don't yet do this.

Here are some treewide stats:
- 110 registration functions across all bus types
- 20 of them set mod_name
- Remaining 90 do not set mod_name:
    1. 36 functions under pattern 1:
        They have a __register function + register macro. KBUILD_MODNAME needs 
to
        be passed and the function needs to take mod_name as input.
    2. 42 functions under pattern 2:
        These have no macro wrapper. They need a double-underscore rename + 
macro
        wrapper to make them similar to pattern 1.
    3. Remaining 12 do not have such a clean registration interface. More 
analysis
       is required.

We plan to start with pattern 1, since it's the easiest category of changes.
Within that, for now we're only sending the platform patch. If we get the 
go-ahead
on that, we'll send the remaining ones.

Patch 3 depends on patches 1 and 2.

Co-developed-by: Rahul Bukte <[email protected]>
Signed-off-by: Rahul Bukte <[email protected]>
Signed-off-by: Shashank Balaji <[email protected]>
---
Changes in v4:
- Initialize module_kset in do_basic_setup() before do_initcalls() (Gary)
- Add commit body to the documentation patch (Greg)
- Link to v3: 
https://patch.msgid.link/[email protected]

Changes in v3:
- Initialize module_kset on-demand (Greg)
- Make coresight driver registration happen through a macro (Greg)
- Split up the patch adding mod_name to platform driver registrations (Greg)
- Link to v2: 
https://patch.msgid.link/[email protected]

Changes in v2:
- Drop acpi patch, send platform instead (Rafael)
- Link to v1: 
https://patch.msgid.link/[email protected]

To: Suzuki K Poulose <[email protected]>
To: Mike Leach <[email protected]>
To: James Clark <[email protected]>
To: Alexander Shishkin <[email protected]>
To: Maxime Coquelin <[email protected]>
To: Alexandre Torgue <[email protected]>
To: Greg Kroah-Hartman <[email protected]>
To: "Rafael J. Wysocki" <[email protected]>
To: Danilo Krummrich <[email protected]>
To: Miguel Ojeda <[email protected]>
To: Boqun Feng <[email protected]>
To: Gary Guo <[email protected]>
To: Björn Roy Baron <[email protected]>
To: Benno Lossin <[email protected]>
To: Andreas Hindborg <[email protected]>
To: Alice Ryhl <[email protected]>
To: Trevor Gross <[email protected]>
To: Richard Cochran <[email protected]>
To: Jonathan Corbet <[email protected]>
To: Shuah Khan <[email protected]>
To: Luis Chamberlain <[email protected]>
To: Petr Pavlu <[email protected]>
To: Daniel Gomez <[email protected]>
To: Sami Tolvanen <[email protected]>
To: Aaron Tomlin <[email protected]>
To: Mike Leach <[email protected]>
To: Leo Yan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: Shashank Balaji <[email protected]>
Cc: Rahul Bukte <[email protected]>
Cc: Daniel Palmer <[email protected]>
Cc: Tim Bird <[email protected]>
Cc: [email protected]

---
Shashank Balaji (4):
      kernel: param: initialize module_kset before do_initcalls()
      coresight: pass THIS_MODULE implicitly through a macro
      driver core: platform: set mod_name in driver registration
      docs: driver-api: add mod_name argument to __platform_register_drivers()

 Documentation/driver-api/driver-model/platform.rst |  3 ++-
 drivers/base/platform.c                            | 21 ++++++++++++++-------
 drivers/hwtracing/coresight/coresight-catu.c       |  2 +-
 drivers/hwtracing/coresight/coresight-core.c       |  9 +++++----
 drivers/hwtracing/coresight/coresight-cpu-debug.c  |  3 +--
 drivers/hwtracing/coresight/coresight-funnel.c     |  3 +--
 drivers/hwtracing/coresight/coresight-replicator.c |  3 +--
 drivers/hwtracing/coresight/coresight-stm.c        |  2 +-
 drivers/hwtracing/coresight/coresight-tmc-core.c   |  2 +-
 drivers/hwtracing/coresight/coresight-tnoc.c       |  2 +-
 drivers/hwtracing/coresight/coresight-tpdm.c       |  3 +--
 drivers/hwtracing/coresight/coresight-tpiu.c       |  2 +-
 include/linux/coresight.h                          |  7 +++++--
 include/linux/module.h                             |  4 ++++
 include/linux/platform_device.h                    | 17 +++++++++--------
 init/main.c                                        |  1 +
 kernel/params.c                                    | 21 +++++++++------------
 rust/kernel/platform.rs                            |  4 +++-
 18 files changed, 61 insertions(+), 48 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260416-acpi_mod_name-f645a76e337b

Best regards,
--  
Shashank Balaji <[email protected]>


Reply via email to