Linux driver-core infrastructure
 help / color / mirror / Atom feed
From: Shashank Balaji <shashank.mahadasyam@sony.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Danilo Krummrich <dakr@kernel.org>, Len Brown <lenb@kernel.org>,
	 Saket Dumbre <saket.dumbre@intel.com>,
	 Krzysztof Kozlowski <krzk@kernel.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	 acpica-devel@lists.linux.dev, driver-core@lists.linux.dev,
	 Shashank Balaji <shashank.mahadasyam@sony.com>,
	 Rahul Bukte <rahul.bukte@sony.com>,
	Daniel Palmer <daniel.palmer@sony.com>,
	 Tim Bird <tim.bird@sony.com>
Subject: [PATCH] ACPI: bus: set mod_name in driver registration
Date: Thu, 16 Apr 2026 16:26:16 +0900	[thread overview]
Message-ID: <20260416-acpi_mod_name-v1-1-1a4d96fd86c9@sony.com> (raw)
In-Reply-To: <20260416-acpi_mod_name-v1-0-1a4d96fd86c9@sony.com>

Pass KBUILD_MODNAME through the driver registration macro so that
the driver core can create the module symlink in sysfs for built-in
drivers.

Fixes: 48b9c4862bd3 ("ACPI: store owner from modules with acpi_bus_register_driver()")
Assisted-by: Claude:claude-4.6-opus
Co-developed-by: Rahul Bukte <rahul.bukte@sony.com>
Signed-off-by: Rahul Bukte <rahul.bukte@sony.com>
Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
---
 drivers/acpi/bus.c      | 5 ++++-
 include/acpi/acpi_bus.h | 5 +++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2ec095e2009e..152ef49e5970 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1062,18 +1062,21 @@ EXPORT_SYMBOL_GPL(acpi_driver_match_device);
  * __acpi_bus_register_driver - register a driver with the ACPI bus
  * @driver: driver being registered
  * @owner: owning module/driver
+ * @mod_name: module name string
  *
  * Registers a driver with the ACPI bus.  Searches the namespace for all
  * devices that match the driver's criteria and binds.  Returns zero for
  * success or a negative error status for failure.
  */
-int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner)
+int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner,
+			       const char *mod_name)
 {
 	if (acpi_disabled)
 		return -ENODEV;
 	driver->drv.name = driver->name;
 	driver->drv.bus = &acpi_bus_type;
 	driver->drv.owner = owner;
+	driver->drv.mod_name = mod_name;
 
 	return driver_register(&driver->drv);
 }
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index b701b5f972cb..53952ec544e6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -672,8 +672,9 @@ int acpi_scan_add_handler(struct acpi_scan_handler *handler);
  * use a macro to avoid include chaining to get THIS_MODULE
  */
 #define acpi_bus_register_driver(drv) \
-	__acpi_bus_register_driver(drv, THIS_MODULE)
-int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner);
+	__acpi_bus_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
+int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner,
+			       const char *mod_name);
 void acpi_bus_unregister_driver(struct acpi_driver *driver);
 int acpi_bus_scan(acpi_handle handle);
 void acpi_bus_trim(struct acpi_device *start);

-- 
2.43.0


  reply	other threads:[~2026-04-16  7:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16  7:26 [PATCH] Enable sysfs module symlink for more built-in drivers Shashank Balaji
2026-04-16  7:26 ` Shashank Balaji [this message]
2026-04-20  9:59   ` [PATCH] ACPI: bus: set mod_name in driver registration Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260416-acpi_mod_name-v1-1-1a4d96fd86c9@sony.com \
    --to=shashank.mahadasyam@sony.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=dakr@kernel.org \
    --cc=daniel.palmer@sony.com \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=krzk@kernel.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rahul.bukte@sony.com \
    --cc=saket.dumbre@intel.com \
    --cc=tim.bird@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox