[PATCH v2 2/2] driver core: platform: set mod_name in driver registration

Greg Kroah-Hartman gregkh at linuxfoundation.org
Mon Apr 20 23:24:08 PDT 2026


On Tue, Apr 21, 2026 at 03:02:35PM +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
> 
> 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>
> ---
> Depends on the previous patch, without which the kernel fails to boot on arm64
> defconfig.
> ---
>  Documentation/driver-api/driver-model/platform.rst |  3 ++-
>  drivers/base/platform.c                            | 21 ++++++++++++++-------
>  drivers/hwtracing/coresight/coresight-catu.c       |  3 ++-
>  drivers/hwtracing/coresight/coresight-core.c       |  5 +++--
>  drivers/hwtracing/coresight/coresight-cpu-debug.c  |  2 +-
>  drivers/hwtracing/coresight/coresight-funnel.c     |  2 +-
>  drivers/hwtracing/coresight/coresight-replicator.c |  2 +-
>  drivers/hwtracing/coresight/coresight-stm.c        |  3 ++-
>  drivers/hwtracing/coresight/coresight-tmc-core.c   |  3 ++-
>  drivers/hwtracing/coresight/coresight-tnoc.c       |  3 ++-
>  drivers/hwtracing/coresight/coresight-tpdm.c       |  2 +-
>  drivers/hwtracing/coresight/coresight-tpiu.c       |  3 ++-
>  include/linux/coresight.h                          |  3 ++-
>  include/linux/platform_device.h                    | 17 +++++++++--------
>  rust/kernel/platform.rs                            |  4 +++-
>  15 files changed, 47 insertions(+), 29 deletions(-)

That's a lot of different things all in one change, please break this up
into smaller bits, this is not going to work.

Especially as the coresight changes are incorrect, no individual module
should EVER have to list THIS_MODULE or KBUILD_MODNAME in a function, it
should happen automatically by the compiler using a helper #define, like
is done for other busses.

Please fix that up first, then you can worry about the other ones.

thanks,

greg k-h



More information about the linux-arm-kernel mailing list