[PATCH] Enable sysfs module symlink for more built-in drivers
From: Shashank Balaji
Date: Thu Apr 16 2026 - 03:38:10 EST
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 after analysis by Claude:
- 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 acpi patch. If we get the go-ahead
on that, we'll send the remaining ones.
Co-developed-by: Rahul Bukte <rahul.bukte@xxxxxxxx>
Signed-off-by: Rahul Bukte <rahul.bukte@xxxxxxxx>
Signed-off-by: Shashank Balaji <shashank.mahadasyam@xxxxxxxx>
---
Shashank Balaji (1):
ACPI: bus: set mod_name in driver registration
drivers/acpi/bus.c | 5 ++++-
include/acpi/acpi_bus.h | 5 +++--
2 files changed, 7 insertions(+), 3 deletions(-)
---
base-commit: 1d51b370a0f8f642f4fc84c795fbedac0fcdbbd2
change-id: 20260416-acpi_mod_name-f645a76e337b
Best regards,
--
Shashank Balaji <shashank.mahadasyam@xxxxxxxx>