public inbox for linux-rtc@vger.kernel.org
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkall@kernel.org>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"Rafael J. Wysocki" <rafael@kernel.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	driver-core@lists.linux.dev,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-rdma@vger.kernel.org, linux-rtc@vger.kernel.org
Subject: Re: [PATCH RFC 10/10] kobject: make struct kobject member default_groups a constant array
Date: Sat, 21 Feb 2026 15:04:18 +0100	[thread overview]
Message-ID: <f0286fcc-0408-4e65-9a2b-85aa1c21fdb8@kernel.org> (raw)
In-Reply-To: <f18e8c2f-28b0-4905-87c2-a16dd54c53d1@t-8ch.de>

On 21.02.2026 14:27, Thomas Weißschuh wrote:
> Hello Heiner,
> 
> On 2026-02-17 23:32:46+0100, Heiner Kallweit wrote:
>> Constify the default_groups array, allowing to assign constant arrays.
>>
>> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> 
> (The patch author/From header and Signed-off-by line do not match)
> 
Right, have to fix this once series is out of RFC state.

>> ---
>>  include/linux/kobject.h | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/include/linux/kobject.h b/include/linux/kobject.h
>> index c8219505a79..e45ee843931 100644
>> --- a/include/linux/kobject.h
>> +++ b/include/linux/kobject.h
>> @@ -116,7 +116,7 @@ char *kobject_get_path(const struct kobject *kobj, gfp_t flag);
>>  struct kobj_type {
>>  	void (*release)(struct kobject *kobj);
>>  	const struct sysfs_ops *sysfs_ops;
>> -	const struct attribute_group **default_groups;
>> +	const struct attribute_group *const *default_groups;
> 
> Thanks for working on this!
> 
> Personally I try to constify the attribute structures together with
> their corresponding callbacks. This ensures that no structure is
> constified which its callback then tries to modify.
> Currently there is no support for const arguments to the callbacks of
> 'struct kobj_attribute' and 'struct device_attribute'. I am wondering
> if the changes to kobject and device groups should be kept out for now
> and be added together with the support for their const callback arguments.
> 

I think we have to be precise what exactly gets constified:
In the series here it's about arrays of pointers to attribute groups.
Just these arrays can't be modified any longer. This includes no change
to whether data in the attribute groups and attributes can be modified.

These arrays of pointers to attribute groups are used in calls to
sysfs_create_groups() and device_add_groups(), e.g. from create_dir()
for kobject's, and from device_add_attrs().
And sysfs_create_groups() and device_add_groups() are changed accordingly
in this series.

Does this answer your question?

> 
> Thomas
> 
>>  	const struct kobj_ns_type_operations *(*child_ns_type)(const struct kobject *kobj);
>>  	const void *(*namespace)(const struct kobject *kobj);
>>  	void (*get_ownership)(const struct kobject *kobj, kuid_t *uid, kgid_t *gid);


      reply	other threads:[~2026-02-21 14:04 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-17 22:24 [PATCH RFC 00/10] driver core: constify groups arrays in several structs Heiner Kallweit
2026-02-17 22:25 ` [PATCH RFC 01/10] IB/core: Prepare for immutable device groups Heiner Kallweit
2026-02-18  8:54   ` Leon Romanovsky
2026-02-17 22:26 ` [PATCH RFC 02/10] rtc: prepare for struct device member groups becoming a constant array Heiner Kallweit
2026-02-19  0:53   ` yanjun.zhu
2026-02-20 14:38     ` Alexandre Belloni
2026-02-17 22:27 ` [PATCH RFC 03/10] sysfs: constify group arrays in function arguments Heiner Kallweit
2026-02-17 22:28 ` [PATCH RFC 04/10] driver: core: constify groups array argument in device_add_groups and device_remove_groups Heiner Kallweit
2026-02-17 22:28 ` [PATCH RFC 05/10] driver core: make struct device member groups a constant array Heiner Kallweit
2026-02-17 22:29 ` [PATCH RFC 06/10] driver core: make struct device_type " Heiner Kallweit
2026-02-17 22:30 ` [PATCH RFC 07/10] driver core: make struct bus_type groups members constant arrays Heiner Kallweit
2026-02-17 22:30 ` [PATCH RFC 08/10] driver core: make struct class " Heiner Kallweit
2026-02-17 22:31 ` [PATCH RFC 09/10] driver core: make struct device_driver groups members contact arrays Heiner Kallweit
2026-02-17 22:32 ` [PATCH RFC 10/10] kobject: make struct kobject member default_groups a constant array Heiner Kallweit
2026-02-21 13:27   ` Thomas Weißschuh
2026-02-21 14:04     ` Heiner Kallweit [this message]

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=f0286fcc-0408-4e65-9a2b-85aa1c21fdb8@kernel.org \
    --to=hkall@kernel.org \
    --cc=alexandre.belloni@bootlin.com \
    --cc=dakr@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --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