[PATCH v5 4/4] driver core: platform: set mod_name in driver registration
Greg Kroah-Hartman
gregkh at linuxfoundation.org
Mon May 18 03:49:03 PDT 2026
On Mon, May 18, 2026 at 07:32:28PM +0900, Shashank Balaji wrote:
> On Mon, May 18, 2026 at 12:27:13PM +0200, Greg Kroah-Hartman wrote:
> > On Mon, May 18, 2026 at 07:20:00PM +0900, Shashank Balaji wrote:
> > > Pass KBUILD_MODNAME through the driver registration macro so that
> > > the driver core can create the module symlink in sysfs for built-in
> > > drivers, and fixup all callers.
> > >
> > > The Rust platform adapter is updated to pass the module name through to the new
> > > parameter.
> > >
> > > Tested on qemu with:
> > > - x86 defconfig + CONFIG_RUST
> > > - arm64 defconfig + CONFIG_RUST + CONFIG_CORESIGHT stuff
> > >
> > > Examples after this patch:
> > >
> > > /sys/bus/platform/drivers/...
> > > coresight-itnoc/module -> coresight_tnoc
> > > coresight-static-tpdm/module -> coresight_tpdm
> > > coresight-catu-platform/module -> coresight_catu
> > > serial8250/module -> 8250
> > > acpi-ged/module -> acpi
> > > vmclock/module -> ptp_vmclock
> > >
> > > Co-developed-by: Rahul Bukte <rahul.bukte at sony.com>
> > > Signed-off-by: Rahul Bukte <rahul.bukte at sony.com>
> > > Signed-off-by: Shashank Balaji <shashank.mahadasyam at sony.com>
> > > ---
> > > This patch depends on patches 1, 2, 3
> > > ---
> > > Documentation/driver-api/driver-model/platform.rst | 3 ++-
> > > drivers/base/platform.c | 21 ++++++++++++++-------
> > > drivers/hwtracing/coresight/coresight-core.c | 5 +++--
> > > include/linux/coresight.h | 5 +++--
> > > include/linux/platform_device.h | 17 +++++++++--------
> > > rust/kernel/platform.rs | 4 +++-
> > > 6 files changed, 34 insertions(+), 21 deletions(-)
> > >
> > > diff --git a/Documentation/driver-api/driver-model/platform.rst b/Documentation/driver-api/driver-model/platform.rst
> > > index cf5ff48d3115..9673470bded2 100644
> > > --- a/Documentation/driver-api/driver-model/platform.rst
> > > +++ b/Documentation/driver-api/driver-model/platform.rst
> > > @@ -70,7 +70,8 @@ Kernel modules can be composed of several platform drivers. The platform core
> > > provides helpers to register and unregister an array of drivers::
> > >
> > > int __platform_register_drivers(struct platform_driver * const *drivers,
> > > - unsigned int count, struct module *owner);
> > > + unsigned int count, struct module *owner,
> > > + const char *mod_name);
> >
> > Why can't you just use the owner->name value instead? They are always
> > the same here, right?
>
> owner is NULL for built-in modules.
Ah, sorry, forgot about that.
More information about the linux-arm-kernel
mailing list