public inbox for driver-core@lists.linux.dev
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>
Cc: driver-core@lists.linux.dev
Subject: [PATCH 1/3] driver core: constify group arrays arguments in driver_add_groups and driver_remove_groups
Date: Mon, 16 Mar 2026 23:09:37 +0100	[thread overview]
Message-ID: <21a1e5f1-c6a0-4f6f-aa86-1e6abd25f9c6@gmail.com> (raw)
In-Reply-To: <fae35d74-f1b9-4785-8d7b-e553c22387ce@gmail.com>

Constify the groups array argument in driver_add_groups and
driver_remove_groups. This allows to pass constant arrays as
arguments.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/base/base.h   | 6 ++++--
 drivers/base/driver.c | 4 ++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/base/base.h b/drivers/base/base.h
index 3bc8e6fd0..747530465 100644
--- a/drivers/base/base.h
+++ b/drivers/base/base.h
@@ -196,8 +196,10 @@ static inline void dev_sync_state(struct device *dev)
 		dev->driver->sync_state(dev);
 }
 
-int driver_add_groups(const struct device_driver *drv, const struct attribute_group **groups);
-void driver_remove_groups(const struct device_driver *drv, const struct attribute_group **groups);
+int driver_add_groups(const struct device_driver *drv,
+		      const struct attribute_group *const *groups);
+void driver_remove_groups(const struct device_driver *drv,
+			  const struct attribute_group *const *groups);
 void device_driver_detach(struct device *dev);
 
 static inline void device_set_driver(struct device *dev, const struct device_driver *drv)
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 8ab010ddf..c5ebf1fda 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -203,13 +203,13 @@ void driver_remove_file(const struct device_driver *drv,
 EXPORT_SYMBOL_GPL(driver_remove_file);
 
 int driver_add_groups(const struct device_driver *drv,
-		      const struct attribute_group **groups)
+		      const struct attribute_group *const *groups)
 {
 	return sysfs_create_groups(&drv->p->kobj, groups);
 }
 
 void driver_remove_groups(const struct device_driver *drv,
-			  const struct attribute_group **groups)
+			  const struct attribute_group *const *groups)
 {
 	sysfs_remove_groups(&drv->p->kobj, groups);
 }
-- 
2.53.0



  reply	other threads:[~2026-03-16 22:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-16 22:08 [PATCH 0/3] driver core: make struct device_driver and bus_type groups members constant arrays Heiner Kallweit
2026-03-16 22:09 ` Heiner Kallweit [this message]
2026-04-02 15:11   ` [PATCH 1/3] driver core: constify group arrays arguments in driver_add_groups and driver_remove_groups Greg Kroah-Hartman
2026-04-02 16:25     ` Heiner Kallweit
2026-03-16 22:10 ` [PATCH 2/3] driver core: make struct bus_type groups members constant arrays Heiner Kallweit
2026-03-16 22:11 ` [PATCH 3/3] device core: make struct device_driver " Heiner Kallweit

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=21a1e5f1-c6a0-4f6f-aa86-1e6abd25f9c6@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=rafael@kernel.org \
    /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