[PATCH 0/5] driver core: Allow the constification of device attributes

Thomas Weißschuh posted 5 patches 2 months, 1 week ago
There is a newer version of this series
drivers/base/core.c    |  50 ++++++++++----------
include/linux/device.h | 122 +++++++++++++++++++++++++++++++++++++------------
2 files changed, 121 insertions(+), 51 deletions(-)
[PATCH 0/5] driver core: Allow the constification of device attributes
Posted by Thomas Weißschuh 2 months, 1 week ago
Allow device attribute to reside in read-only memory.
Both const and non-const attributes are handled by the utility macros
and attributes can be migrated one-by-one.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (5):
      driver core: Delete DEVICE_ATTR_PREALLOC()
      driver core: Add low-level macros for device attributes
      driver core: stop using generic sysfs macros for device attributes
      driver core: Allow the constification of device attributes
      driver core: Constify core device attributes

 drivers/base/core.c    |  50 ++++++++++----------
 include/linux/device.h | 122 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 121 insertions(+), 51 deletions(-)
---
base-commit: 6c8dfb0362732bf1e4829867a2a5239fedc592d0
change-id: 20260408-sysfs-const-attr-device_attr-prep-9971fb4439da

Best regards,
--  
Thomas Weißschuh <linux@weissschuh.net>

Re: [PATCH 0/5] driver core: Allow the constification of device attributes
Posted by Greg Kroah-Hartman 2 months, 1 week ago
On Wed, Apr 08, 2026 at 09:30:46PM +0200, Thomas Weißschuh wrote:
> Allow device attribute to reside in read-only memory.
> Both const and non-const attributes are handled by the utility macros
> and attributes can be migrated one-by-one.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Thomas Weißschuh (5):
>       driver core: Delete DEVICE_ATTR_PREALLOC()
>       driver core: Add low-level macros for device attributes
>       driver core: stop using generic sysfs macros for device attributes
>       driver core: Allow the constification of device attributes
>       driver core: Constify core device attributes
> 
>  drivers/base/core.c    |  50 ++++++++++----------
>  include/linux/device.h | 122 +++++++++++++++++++++++++++++++++++++------------
>  2 files changed, 121 insertions(+), 51 deletions(-)
> ---
> base-commit: 6c8dfb0362732bf1e4829867a2a5239fedc592d0
> change-id: 20260408-sysfs-const-attr-device_attr-prep-9971fb4439da
> 
> Best regards,
> --  
> Thomas Weißschuh <linux@weissschuh.net>
> 
> 

We still have the is_visible_const() stuff not finished yet, why not fix
that up first?

And this makes me worry, how many changes are going to be needed to move
everything over?  thousands?

thanks,

greg k-h
Re: [PATCH 0/5] driver core: Allow the constification of device attributes
Posted by Thomas Weißschuh 2 months ago
On 2026-04-09 07:36:09+0200, Greg Kroah-Hartman wrote:
> On Wed, Apr 08, 2026 at 09:30:46PM +0200, Thomas Weißschuh wrote:
> > Allow device attribute to reside in read-only memory.
> > Both const and non-const attributes are handled by the utility macros
> > and attributes can be migrated one-by-one.
> > 
> > Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> > ---
> > Thomas Weißschuh (5):
> >       driver core: Delete DEVICE_ATTR_PREALLOC()
> >       driver core: Add low-level macros for device attributes
> >       driver core: stop using generic sysfs macros for device attributes
> >       driver core: Allow the constification of device attributes
> >       driver core: Constify core device attributes
> > 
> >  drivers/base/core.c    |  50 ++++++++++----------
> >  include/linux/device.h | 122 +++++++++++++++++++++++++++++++++++++------------
> >  2 files changed, 121 insertions(+), 51 deletions(-)
> > ---
> > base-commit: 6c8dfb0362732bf1e4829867a2a5239fedc592d0
> > change-id: 20260408-sysfs-const-attr-device_attr-prep-9971fb4439da
> > 
> > Best regards,
> > --  
> > Thomas Weißschuh <linux@weissschuh.net>
> > 
> > 
> 
> We still have the is_visible_const() stuff not finished yet, why not fix
> that up first?

Because I want to touch each file or subsystem as few times as
possible. So before a subsystem is migrated, the prerequisites for
all of their used features need to be there.

Currently only the prerequisites for 'struct device_attribute' and
'struct kobj_attribute' are missing. So with this series in we can start
migrating everything that is *not* using 'struct kobj_attribute'.

> And this makes me worry, how many changes are going to be needed to move
> everything over?  thousands?

Depends on the granularity of the patches. I want to do as few as
possible, but still expect a few hundred patches.


Thomas