All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] driver core: Allow the constification of device attributes
@ 2026-05-12 16:39 Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 1/5] driver core: Delete DEVICE_ATTR_PREALLOC() Thomas Weißschuh
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

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.

My goal is to migrate all sysfs attribute of a given driver or subsystem
at once to avoid code churn through. To do that all sysfs features the
subsystem uses need to be const-compatible. Which means that the
migration of device attributes and is_visible() are happening
concurrently.

After device attributes only kobject attributes are missing for a full
conversion.

---
Changes in v3:
- Also constify DEVICE_ATTR_RO(dev)
- Also handle DEVICE_ATTR_*_NAMED()
- Link to v2: https://patch.msgid.link/20260504-sysfs-const-attr-device_attr-prep-v2-0-79d291cb3071@weissschuh.net

Changes in v2:
- Rebase on v7.1-rc1
- Extend cover letter a bit
- Link to v1: https://patch.msgid.link/20260408-sysfs-const-attr-device_attr-prep-v1-0-232934f77b3c@weissschuh.net

To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: "Rafael J. Wysocki" <rafael@kernel.org>
To: Danilo Krummrich <dakr@kernel.org>
Cc: driver-core@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
Signed-of-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    |  54 +++++++++++----------
 include/linux/device.h | 129 +++++++++++++++++++++++++++++++++++++------------
 2 files changed, 126 insertions(+), 57 deletions(-)
---
base-commit: 254f49634ee16a731174d2ae34bc50bd5f45e731
change-id: 20260408-sysfs-const-attr-device_attr-prep-9971fb4439da

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH v3 1/5] driver core: Delete DEVICE_ATTR_PREALLOC()
  2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
@ 2026-05-12 16:39 ` Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 2/5] driver core: Add low-level macros for device attributes Thomas Weißschuh
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

This macro is unused and would create extra work during the upcoming
constification of device attributes. Remove it.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 include/linux/device.h | 13 -------------
 1 file changed, 13 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 9c8fde6a3d86..06ec4e27a1e1 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -157,19 +157,6 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 #define DEVICE_ATTR(_name, _mode, _show, _store) \
 	struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
 
-/**
- * DEVICE_ATTR_PREALLOC - Define a preallocated device attribute.
- * @_name: Attribute name.
- * @_mode: File mode.
- * @_show: Show handler. Optional, but mandatory if attribute is readable.
- * @_store: Store handler. Optional, but mandatory if attribute is writable.
- *
- * Like DEVICE_ATTR(), but ``SYSFS_PREALLOC`` is set on @_mode.
- */
-#define DEVICE_ATTR_PREALLOC(_name, _mode, _show, _store) \
-	struct device_attribute dev_attr_##_name = \
-		__ATTR_PREALLOC(_name, _mode, _show, _store)
-
 /**
  * DEVICE_ATTR_RW - Define a read-write device attribute.
  * @_name: Attribute name.

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 2/5] driver core: Add low-level macros for device attributes
  2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 1/5] driver core: Delete DEVICE_ATTR_PREALLOC() Thomas Weißschuh
@ 2026-05-12 16:39 ` Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 3/5] driver core: Stop using generic sysfs " Thomas Weißschuh
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

For the upcoming constification of device attributes the generic
__ATTR() macros are insufficient.

Prepare for a split by introducing new low-level macros specific to
device attributes.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 include/linux/device.h | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 06ec4e27a1e1..24ed3a6caad2 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -135,6 +135,27 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
 ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 			   char *buf);
 
+#define __DEVICE_ATTR(_name, _mode, _show, _store) \
+	__ATTR(_name, _mode, _show, _store)
+
+#define __DEVICE_ATTR_RO_MODE(_name, _mode) \
+	__ATTR_RO_MODE(_name, _mode)
+
+#define __DEVICE_ATTR_RO(_name) \
+	__ATTR_RO(_name)
+
+#define __DEVICE_ATTR_WO(_name) \
+	__ATTR_WO(_name)
+
+#define __DEVICE_ATTR_RW_MODE(_name, _mode) \
+	__ATTR_RW_MODE(_name, _mode)
+
+#define __DEVICE_ATTR_RW(_name) \
+	__ATTR_RW(_name)
+
+#define __DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
+	__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
+
 /**
  * DEVICE_ATTR - Define a device attribute.
  * @_name: Attribute name.
@@ -155,7 +176,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  *	};
  */
 #define DEVICE_ATTR(_name, _mode, _show, _store) \
-	struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR(_name, _mode, _show, _store)
 
 /**
  * DEVICE_ATTR_RW - Define a read-write device attribute.
@@ -165,7 +186,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  * and @_store is <_name>_store.
  */
 #define DEVICE_ATTR_RW(_name) \
-	struct device_attribute dev_attr_##_name = __ATTR_RW(_name)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR_RW(_name)
 
 /**
  * DEVICE_ATTR_ADMIN_RW - Define an admin-only read-write device attribute.
@@ -174,7 +195,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  * Like DEVICE_ATTR_RW(), but @_mode is 0600.
  */
 #define DEVICE_ATTR_ADMIN_RW(_name) \
-	struct device_attribute dev_attr_##_name = __ATTR_RW_MODE(_name, 0600)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR_RW_MODE(_name, 0600)
 
 /**
  * DEVICE_ATTR_RW_NAMED - Define a read-write device attribute with a sysfs name
@@ -199,7 +220,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  * Like DEVICE_ATTR(), but @_mode is 0444 and @_show is <_name>_show.
  */
 #define DEVICE_ATTR_RO(_name) \
-	struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR_RO(_name)
 
 /**
  * DEVICE_ATTR_ADMIN_RO - Define an admin-only readable device attribute.
@@ -208,7 +229,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  * Like DEVICE_ATTR_RO(), but @_mode is 0400.
  */
 #define DEVICE_ATTR_ADMIN_RO(_name) \
-	struct device_attribute dev_attr_##_name = __ATTR_RO_MODE(_name, 0400)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR_RO_MODE(_name, 0400)
 
 /**
  * DEVICE_ATTR_RO_NAMED - Define a read-only device attribute with a sysfs name
@@ -232,7 +253,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  * Like DEVICE_ATTR(), but @_mode is 0200 and @_store is <_name>_store.
  */
 #define DEVICE_ATTR_WO(_name) \
-	struct device_attribute dev_attr_##_name = __ATTR_WO(_name)
+	struct device_attribute dev_attr_##_name = __DEVICE_ATTR_WO(_name)
 
 /**
  * DEVICE_ATTR_WO_NAMED - Define a read-only device attribute with a sysfs name
@@ -260,7 +281,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  */
 #define DEVICE_ULONG_ATTR(_name, _mode, _var) \
 	struct dev_ext_attribute dev_attr_##_name = \
-		{ __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
+		{ __DEVICE_ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) }
 
 /**
  * DEVICE_INT_ATTR - Define a device attribute backed by an int.
@@ -272,7 +293,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  */
 #define DEVICE_INT_ATTR(_name, _mode, _var) \
 	struct dev_ext_attribute dev_attr_##_name = \
-		{ __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
+		{ __DEVICE_ATTR(_name, _mode, device_show_int, device_store_int), &(_var) }
 
 /**
  * DEVICE_BOOL_ATTR - Define a device attribute backed by a bool.
@@ -284,7 +305,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  */
 #define DEVICE_BOOL_ATTR(_name, _mode, _var) \
 	struct dev_ext_attribute dev_attr_##_name = \
-		{ __ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
+		{ __DEVICE_ATTR(_name, _mode, device_show_bool, device_store_bool), &(_var) }
 
 /**
  * DEVICE_STRING_ATTR_RO - Define a device attribute backed by a r/o string.
@@ -297,11 +318,11 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
  */
 #define DEVICE_STRING_ATTR_RO(_name, _mode, _var) \
 	struct dev_ext_attribute dev_attr_##_name = \
-		{ __ATTR(_name, (_mode) & ~0222, device_show_string, NULL), (_var) }
+		{ __DEVICE_ATTR(_name, (_mode) & ~0222, device_show_string, NULL), (_var) }
 
 #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
 	struct device_attribute dev_attr_##_name =		\
-		__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
+		__DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
 
 int device_create_file(struct device *device,
 		       const struct device_attribute *entry);

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 3/5] driver core: Stop using generic sysfs macros for device attributes
  2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 1/5] driver core: Delete DEVICE_ATTR_PREALLOC() Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 2/5] driver core: Add low-level macros for device attributes Thomas Weißschuh
@ 2026-05-12 16:39 ` Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 4/5] driver core: Allow the constification of " Thomas Weißschuh
  2026-05-12 16:39 ` [PATCH v3 5/5] driver core: Constify core " Thomas Weißschuh
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

The constification of device attributes will require a transition phase,
where 'struct device_attribute' contains a classic non-const and a new
const variant of the 'show' and 'store' callbacks.

As __ATTR() and friends can not handle this duplication stop using them.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 include/linux/device.h | 32 ++++++++++++++++++++++----------
 1 file changed, 22 insertions(+), 10 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 24ed3a6caad2..17150b0dfcd6 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -135,26 +135,38 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
 ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 			   char *buf);
 
-#define __DEVICE_ATTR(_name, _mode, _show, _store) \
-	__ATTR(_name, _mode, _show, _store)
+#define __DEVICE_ATTR(_name, _mode, _show, _store) {			\
+	.attr = {.name = __stringify(_name),				\
+		 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) },		\
+	.show	= _show,						\
+	.store	= _store,						\
+}
 
 #define __DEVICE_ATTR_RO_MODE(_name, _mode) \
-	__ATTR_RO_MODE(_name, _mode)
+	__DEVICE_ATTR(_name, _mode, _name##_show, NULL)
 
 #define __DEVICE_ATTR_RO(_name) \
-	__ATTR_RO(_name)
+	__DEVICE_ATTR_RO_MODE(_name, 0444)
 
 #define __DEVICE_ATTR_WO(_name) \
-	__ATTR_WO(_name)
+	__DEVICE_ATTR(_name, 0200, NULL, _name##_store)
 
 #define __DEVICE_ATTR_RW_MODE(_name, _mode) \
-	__ATTR_RW_MODE(_name, _mode)
+	__DEVICE_ATTR(_name, _mode, _name##_show, _name##_store)
 
 #define __DEVICE_ATTR_RW(_name) \
-	__ATTR_RW(_name)
-
-#define __DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \
-	__ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store)
+	__DEVICE_ATTR_RW_MODE(_name, 0644)
+
+#ifdef CONFIG_DEBUG_LOCK_ALLOC
+#define __DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) {	\
+	.attr = {.name = __stringify(_name), .mode = _mode,		\
+			.ignore_lockdep = true },			\
+	.show		= _show,					\
+	.store		= _store,					\
+}
+#else
+#define __DEVICE_ATTR_IGNORE_LOCKDEP	__DEVICE_ATTR
+#endif
 
 /**
  * DEVICE_ATTR - Define a device attribute.

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 4/5] driver core: Allow the constification of device attributes
  2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2026-05-12 16:39 ` [PATCH v3 3/5] driver core: Stop using generic sysfs " Thomas Weißschuh
@ 2026-05-12 16:39 ` Thomas Weißschuh
  2026-05-26 14:52   ` Mark Brown
  2026-05-12 16:39 ` [PATCH v3 5/5] driver core: Constify core " Thomas Weißschuh
  4 siblings, 1 reply; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

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>
---
 drivers/base/core.c    | 12 ++++++---
 include/linux/device.h | 69 +++++++++++++++++++++++++++++++++++++++++---------
 2 files changed, 65 insertions(+), 16 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index bd2ddf2aab50..6e2ee6d55a0b 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2419,9 +2419,11 @@ static ssize_t dev_attr_show(struct kobject *kobj, struct attribute *attr,
 
 	if (dev_attr->show)
 		ret = dev_attr->show(dev, dev_attr, buf);
+	else if (dev_attr->show_const)
+		ret = dev_attr->show_const(dev, dev_attr, buf);
 	if (ret >= (ssize_t)PAGE_SIZE) {
-		printk("dev_attr_show: %pS returned bad count\n",
-				dev_attr->show);
+		printk("dev_attr_show: %pS/%pS returned bad count\n",
+				dev_attr->show, dev_attr->show_const);
 	}
 	return ret;
 }
@@ -2435,6 +2437,8 @@ static ssize_t dev_attr_store(struct kobject *kobj, struct attribute *attr,
 
 	if (dev_attr->store)
 		ret = dev_attr->store(dev, dev_attr, buf, count);
+	else if (dev_attr->store_const)
+		ret = dev_attr->store_const(dev, dev_attr, buf, count);
 	return ret;
 }
 
@@ -3047,10 +3051,10 @@ int device_create_file(struct device *dev,
 	int error = 0;
 
 	if (dev) {
-		WARN(((attr->attr.mode & S_IWUGO) && !attr->store),
+		WARN(((attr->attr.mode & S_IWUGO) && !(attr->store || attr->store_const)),
 			"Attribute %s: write permission without 'store'\n",
 			attr->attr.name);
-		WARN(((attr->attr.mode & S_IRUGO) && !attr->show),
+		WARN(((attr->attr.mode & S_IRUGO) && !(attr->show || attr->show_const)),
 			"Attribute %s: read permission without 'show'\n",
 			attr->attr.name);
 		error = sysfs_create_file(&dev->kobj, &attr->attr);
diff --git a/include/linux/device.h b/include/linux/device.h
index 17150b0dfcd6..354f54be02b9 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -104,10 +104,18 @@ struct device_type {
  */
 struct device_attribute {
 	struct attribute	attr;
-	ssize_t (*show)(struct device *dev, struct device_attribute *attr,
-			char *buf);
-	ssize_t (*store)(struct device *dev, struct device_attribute *attr,
-			 const char *buf, size_t count);
+	__SYSFS_FUNCTION_ALTERNATIVE(
+		ssize_t (*show)(struct device *dev, struct device_attribute *attr,
+				char *buf);
+		ssize_t (*show_const)(struct device *dev, const struct device_attribute *attr,
+				      char *buf);
+	);
+	__SYSFS_FUNCTION_ALTERNATIVE(
+		ssize_t (*store)(struct device *dev, struct device_attribute *attr,
+				 const char *buf, size_t count);
+		ssize_t (*store_const)(struct device *dev, const struct device_attribute *attr,
+				       const char *buf, size_t count);
+	);
 };
 
 /**
@@ -135,11 +143,50 @@ ssize_t device_store_bool(struct device *dev, struct device_attribute *attr,
 ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 			   char *buf);
 
+typedef ssize_t __device_show_handler_const(struct device *dev, const struct device_attribute *attr,
+					    char *buf);
+typedef ssize_t __device_store_handler_const(struct device *dev, const struct device_attribute *attr,
+					     const char *buf, size_t count);
+
+#ifdef CONFIG_CFI
+
+#define __DEVICE_ATTR_SHOW_STORE(_show, _store)						\
+	.show		= _Generic(_show,						\
+			  __device_show_handler_const * : NULL,				\
+			  default : _show						\
+	),										\
+	.show_const	= _Generic(_show,						\
+			  __device_show_handler_const * : _show,			\
+			  default : NULL						\
+	),										\
+	.store		= _Generic(_store,						\
+			  __device_store_handler_const * : NULL,			\
+			  default : _store						\
+	),										\
+	.store_const	= _Generic(_store,						\
+			  __device_store_handler_const * : _store,			\
+			  default : NULL \
+	),
+
+#else
+
+#define __DEVICE_ATTR_SHOW_STORE(_show, _store)						\
+	.show		= _Generic(_show,						\
+			  __device_show_handler_const * : (void *)_show,		\
+			  default : _show						\
+	),										\
+	.store		= _Generic(_store,						\
+			  __device_store_handler_const * : (void *)_store,		\
+			  default : _store						\
+	),										\
+
+#endif
+
+
 #define __DEVICE_ATTR(_name, _mode, _show, _store) {			\
 	.attr = {.name = __stringify(_name),				\
 		 .mode = VERIFY_OCTAL_PERMISSIONS(_mode) },		\
-	.show	= _show,						\
-	.store	= _store,						\
+	__DEVICE_ATTR_SHOW_STORE(_show, _store)				\
 }
 
 #define __DEVICE_ATTR_RO_MODE(_name, _mode) \
@@ -161,8 +208,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 #define __DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) {	\
 	.attr = {.name = __stringify(_name), .mode = _mode,		\
 			.ignore_lockdep = true },			\
-	.show		= _show,					\
-	.store		= _store,					\
+	__DEVICE_ATTR_SHOW_STORE(_show, _store)				\
 }
 #else
 #define __DEVICE_ATTR_IGNORE_LOCKDEP	__DEVICE_ATTR
@@ -221,8 +267,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 #define DEVICE_ATTR_RW_NAMED(_name, _attrname)                            \
 	struct device_attribute dev_attr_##_name = {                      \
 		.attr = { .name = _attrname, .mode = 0644 }, \
-		.show = _name##_show,                                     \
-		.store = _name##_store,                                   \
+		__DEVICE_ATTR_SHOW_STORE(_name##_show, _name##_store)     \
 	}
 
 /**
@@ -255,7 +300,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 #define DEVICE_ATTR_RO_NAMED(_name, _attrname)                            \
 	struct device_attribute dev_attr_##_name = {                      \
 		.attr = { .name = _attrname, .mode = 0444 }, \
-		.show = _name##_show,                                     \
+		__DEVICE_ATTR_SHOW_STORE(_name##_show, NULL)              \
 	}
 
 /**
@@ -279,7 +324,7 @@ ssize_t device_show_string(struct device *dev, struct device_attribute *attr,
 #define DEVICE_ATTR_WO_NAMED(_name, _attrname)                            \
 	struct device_attribute dev_attr_##_name = {                      \
 		.attr = { .name = _attrname, .mode = 0200 }, \
-		.store = _name##_store,                                   \
+		__DEVICE_ATTR_SHOW_STORE(NULL, _name##_store)             \
 	}
 
 /**

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH v3 5/5] driver core: Constify core device attributes
  2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2026-05-12 16:39 ` [PATCH v3 4/5] driver core: Allow the constification of " Thomas Weißschuh
@ 2026-05-12 16:39 ` Thomas Weißschuh
  4 siblings, 0 replies; 10+ messages in thread
From: Thomas Weißschuh @ 2026-05-12 16:39 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich
  Cc: driver-core, linux-kernel, Thomas Weißschuh

To make sure these attributes are not modified by accident or by an
attacker, move them to read-only memory.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/base/core.c | 42 +++++++++++++++++++++---------------------
 1 file changed, 21 insertions(+), 21 deletions(-)

diff --git a/drivers/base/core.c b/drivers/base/core.c
index 6e2ee6d55a0b..57650f4c4dc9 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -422,7 +422,7 @@ void device_pm_move_to_tail(struct device *dev)
 #define to_devlink(dev)	container_of((dev), struct device_link, link_dev)
 
 static ssize_t status_show(struct device *dev,
-			   struct device_attribute *attr, char *buf)
+			   const struct device_attribute *attr, char *buf)
 {
 	const char *output;
 
@@ -452,10 +452,10 @@ static ssize_t status_show(struct device *dev,
 
 	return sysfs_emit(buf, "%s\n", output);
 }
-static DEVICE_ATTR_RO(status);
+static const DEVICE_ATTR_RO(status);
 
 static ssize_t auto_remove_on_show(struct device *dev,
-				   struct device_attribute *attr, char *buf)
+				   const struct device_attribute *attr, char *buf)
 {
 	struct device_link *link = to_devlink(dev);
 	const char *output;
@@ -469,27 +469,27 @@ static ssize_t auto_remove_on_show(struct device *dev,
 
 	return sysfs_emit(buf, "%s\n", output);
 }
-static DEVICE_ATTR_RO(auto_remove_on);
+static const DEVICE_ATTR_RO(auto_remove_on);
 
 static ssize_t runtime_pm_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+			       const struct device_attribute *attr, char *buf)
 {
 	struct device_link *link = to_devlink(dev);
 
 	return sysfs_emit(buf, "%d\n", device_link_test(link, DL_FLAG_PM_RUNTIME));
 }
-static DEVICE_ATTR_RO(runtime_pm);
+static const DEVICE_ATTR_RO(runtime_pm);
 
 static ssize_t sync_state_only_show(struct device *dev,
-				    struct device_attribute *attr, char *buf)
+				    const struct device_attribute *attr, char *buf)
 {
 	struct device_link *link = to_devlink(dev);
 
 	return sysfs_emit(buf, "%d\n", device_link_test(link, DL_FLAG_SYNC_STATE_ONLY));
 }
-static DEVICE_ATTR_RO(sync_state_only);
+static const DEVICE_ATTR_RO(sync_state_only);
 
-static struct attribute *devlink_attrs[] = {
+static const struct attribute *const devlink_attrs[] = {
 	&dev_attr_status.attr,
 	&dev_attr_auto_remove_on.attr,
 	&dev_attr_runtime_pm.attr,
@@ -1233,7 +1233,7 @@ static void device_link_drop_managed(struct device_link *link)
 }
 
 static ssize_t waiting_for_supplier_show(struct device *dev,
-					 struct device_attribute *attr,
+					 const struct device_attribute *attr,
 					 char *buf)
 {
 	bool val;
@@ -1244,7 +1244,7 @@ static ssize_t waiting_for_supplier_show(struct device *dev,
 	device_unlock(dev);
 	return sysfs_emit(buf, "%u\n", val);
 }
-static DEVICE_ATTR_RO(waiting_for_supplier);
+static const DEVICE_ATTR_RO(waiting_for_supplier);
 
 /**
  * device_links_force_bind - Prepares device to be force bound
@@ -2726,7 +2726,7 @@ static const struct kset_uevent_ops device_uevent_ops = {
 	.uevent =	dev_uevent,
 };
 
-static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,
+static ssize_t uevent_show(struct device *dev, const struct device_attribute *attr,
 			   char *buf)
 {
 	struct kobject *top_kobj;
@@ -2769,7 +2769,7 @@ static ssize_t uevent_show(struct device *dev, struct device_attribute *attr,
 	return len;
 }
 
-static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,
+static ssize_t uevent_store(struct device *dev, const struct device_attribute *attr,
 			    const char *buf, size_t count)
 {
 	int rc;
@@ -2783,9 +2783,9 @@ static ssize_t uevent_store(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
-static DEVICE_ATTR_RW(uevent);
+static const DEVICE_ATTR_RW(uevent);
 
-static ssize_t online_show(struct device *dev, struct device_attribute *attr,
+static ssize_t online_show(struct device *dev, const struct device_attribute *attr,
 			   char *buf)
 {
 	bool val;
@@ -2796,7 +2796,7 @@ static ssize_t online_show(struct device *dev, struct device_attribute *attr,
 	return sysfs_emit(buf, "%u\n", val);
 }
 
-static ssize_t online_store(struct device *dev, struct device_attribute *attr,
+static ssize_t online_store(struct device *dev, const struct device_attribute *attr,
 			    const char *buf, size_t count)
 {
 	bool val;
@@ -2814,9 +2814,9 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr,
 	unlock_device_hotplug();
 	return ret < 0 ? ret : count;
 }
-static DEVICE_ATTR_RW(online);
+static const DEVICE_ATTR_RW(online);
 
-static ssize_t removable_show(struct device *dev, struct device_attribute *attr,
+static ssize_t removable_show(struct device *dev, const struct device_attribute *attr,
 			      char *buf)
 {
 	const char *loc;
@@ -2833,7 +2833,7 @@ static ssize_t removable_show(struct device *dev, struct device_attribute *attr,
 	}
 	return sysfs_emit(buf, "%s\n", loc);
 }
-static DEVICE_ATTR_RO(removable);
+static const DEVICE_ATTR_RO(removable);
 
 int device_add_groups(struct device *dev,
 		      const struct attribute_group *const *groups)
@@ -2984,12 +2984,12 @@ static void device_remove_attrs(struct device *dev)
 		device_remove_groups(dev, class->dev_groups);
 }
 
-static ssize_t dev_show(struct device *dev, struct device_attribute *attr,
+static ssize_t dev_show(struct device *dev, const struct device_attribute *attr,
 			char *buf)
 {
 	return print_dev_t(buf, dev->devt);
 }
-static DEVICE_ATTR_RO(dev);
+static const DEVICE_ATTR_RO(dev);
 
 /* /sys/devices/ */
 struct kset *devices_kset;

-- 
2.54.0


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 4/5] driver core: Allow the constification of device attributes
  2026-05-12 16:39 ` [PATCH v3 4/5] driver core: Allow the constification of " Thomas Weißschuh
@ 2026-05-26 14:52   ` Mark Brown
  2026-05-26 15:25     ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2026-05-26 14:52 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	driver-core, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 6121 bytes --]

On Tue, May 12, 2026 at 06:39:14PM +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.

I'm seeing NFS boot breaks in -next on at least the libre.computer
tritium which bisect to this commit.  I don't immediately see what this
commit might have done to cause a boot break, but I did get two
different bisects going to the same commit which set off my alarm bells.
The boot grinds to a halt when it gets to the end of userspace bringup:

| getty@ttyS0.service;invocationid=c161395710bf441d8427be13d54aa849;type=service\P+q6E616D65\
| Debian GNU/Linux forky/sid debian-testing-arm64 ttyS0
| debian-testing-arm64 login: root (automatic login)
| Linux debian-testing-arm64 7.1.0-rc5-next-20260525 #1 SMP PREEMPT @1779724722 aarch64
| The programs included with the Debian GNU/Linux system are free software;
| the exact distribution terms for each program are described in the
| individual files in /usr/share/doc/*/copyright.
| Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
| permitted by applicable law.

then no prompt appears.

Full log:

   https://lava.sirena.org.uk/scheduler/job/2796935#L2638

Bisect log:

# bad: [d387b06f7c15b4639244ad66b4b0900c6a02b430] Add linux-next specific files for 20260525
# good: [c745c46074da99cdcef8c1fc6093030c6f9d7143] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
# good: [34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc] regmap-i2c: fix sparse warning in regmap_smbus_word_write_reg16
git bisect start 'd387b06f7c15b4639244ad66b4b0900c6a02b430' 'c745c46074da99cdcef8c1fc6093030c6f9d7143' '34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc'
# test job: [34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc] https://lava.sirena.org.uk/scheduler/job/2783529
# test job: [d387b06f7c15b4639244ad66b4b0900c6a02b430] https://lava.sirena.org.uk/scheduler/job/2796935
# bad: [d387b06f7c15b4639244ad66b4b0900c6a02b430] Add linux-next specific files for 20260525
git bisect bad d387b06f7c15b4639244ad66b4b0900c6a02b430
# test job: [4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b] https://lava.sirena.org.uk/scheduler/job/2796998
# good: [4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b] Merge branch 'libcrypto-next' of https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
git bisect good 4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b
# test job: [af3c2d822a4b67034aa47554c178b5ffcf973456] https://lava.sirena.org.uk/scheduler/job/2797090
# good: [af3c2d822a4b67034aa47554c178b5ffcf973456] Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
git bisect good af3c2d822a4b67034aa47554c178b5ffcf973456
# test job: [2f8df83b202ec7f8080a25b2e9da79c3361775fd] https://lava.sirena.org.uk/scheduler/job/2797983
# bad: [2f8df83b202ec7f8080a25b2e9da79c3361775fd] Merge branch 'char-misc-next' of https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git bisect bad 2f8df83b202ec7f8080a25b2e9da79c3361775fd
# test job: [6b55dddad1ed45d92eef8046156965f7709f0d52] https://lava.sirena.org.uk/scheduler/job/2798041
# good: [6b55dddad1ed45d92eef8046156965f7709f0d52] Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm.git
git bisect good 6b55dddad1ed45d92eef8046156965f7709f0d52
# test job: [6206468c5ba41e14b55d8dfd71af1611398a3399] https://lava.sirena.org.uk/scheduler/job/2798075
# good: [6206468c5ba41e14b55d8dfd71af1611398a3399] Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
git bisect good 6206468c5ba41e14b55d8dfd71af1611398a3399
# test job: [cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab] https://lava.sirena.org.uk/scheduler/job/2798512
# bad: [cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab] Merge branch 'driver-core-next' of https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
git bisect bad cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab
# test job: [3c15372851403012d068a6f388770ed98dbe684e] https://lava.sirena.org.uk/scheduler/job/2798558
# good: [3c15372851403012d068a6f388770ed98dbe684e] Merge branch 'for-firmware-next' of https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
git bisect good 3c15372851403012d068a6f388770ed98dbe684e
# test job: [a9c12b783cc711de3ac7f188bed07d529bb818af] https://lava.sirena.org.uk/scheduler/job/2798584
# good: [a9c12b783cc711de3ac7f188bed07d529bb818af] device core: make struct device_driver groups members constant arrays
git bisect good a9c12b783cc711de3ac7f188bed07d529bb818af
# test job: [25025253476a64c186592d952c27f24bc3490e42] https://lava.sirena.org.uk/scheduler/job/2798628
# good: [25025253476a64c186592d952c27f24bc3490e42] leds: Adjust documentation of brightness sysfs node
git bisect good 25025253476a64c186592d952c27f24bc3490e42
# test job: [13443fbf62414e42afb1675ab2d3b767c6466915] https://lava.sirena.org.uk/scheduler/job/2798847
# good: [13443fbf62414e42afb1675ab2d3b767c6466915] driver core: Stop using generic sysfs macros for device attributes
git bisect good 13443fbf62414e42afb1675ab2d3b767c6466915
# test job: [314537a0cd78d7a07f6e7ce7dcc0ce340e41fb2c] https://lava.sirena.org.uk/scheduler/job/2798892
# good: [314537a0cd78d7a07f6e7ce7dcc0ce340e41fb2c] Merge branch 'for-next' of https://github.com/cminyard/linux-ipmi.git
git bisect good 314537a0cd78d7a07f6e7ce7dcc0ce340e41fb2c
# test job: [024480bf8d75bd16894c5b0eb6082b6e6dae4970] https://lava.sirena.org.uk/scheduler/job/2799135
# bad: [024480bf8d75bd16894c5b0eb6082b6e6dae4970] driver core: Constify core device attributes
git bisect bad 024480bf8d75bd16894c5b0eb6082b6e6dae4970
# test job: [434506b86a6cde84a0ef19daa9e3b1926e2f96a9] https://lava.sirena.org.uk/scheduler/job/2799464
# bad: [434506b86a6cde84a0ef19daa9e3b1926e2f96a9] driver core: Allow the constification of device attributes
git bisect bad 434506b86a6cde84a0ef19daa9e3b1926e2f96a9
# first bad commit: [434506b86a6cde84a0ef19daa9e3b1926e2f96a9] driver core: Allow the constification of device attributes

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 4/5] driver core: Allow the constification of device attributes
  2026-05-26 14:52   ` Mark Brown
@ 2026-05-26 15:25     ` Mark Brown
  2026-05-26 15:32       ` Danilo Krummrich
  0 siblings, 1 reply; 10+ messages in thread
From: Mark Brown @ 2026-05-26 15:25 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Danilo Krummrich,
	driver-core, linux-kernel, Zhang Yuwei

[-- Attachment #1: Type: text/plain, Size: 5773 bytes --]

On Tue, May 26, 2026 at 03:52:24PM +0100, Mark Brown wrote:
> On Tue, May 12, 2026 at 06:39:14PM +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.
> 
> I'm seeing NFS boot breaks in -next on at least the libre.computer
> tritium which bisect to this commit.  I don't immediately see what this
> commit might have done to cause a boot break, but I did get two
> different bisects going to the same commit which set off my alarm bells.

I've now got another bisect which comes out to another driver core
commit 1137838865bf (driver core: Use mod_delayed_work to prevent lost
deferred probe work), I don't know that that is an accurate result
either but it does look like there's something fishy in this area.

Log for that bisect:

# bad: [d387b06f7c15b4639244ad66b4b0900c6a02b430] Add linux-next specific files for 20260525
# good: [c745c46074da99cdcef8c1fc6093030c6f9d7143] Merge branch 'for-linux-next-fixes' of https://gitlab.freedesktop.org/drm/misc/kernel.git
# good: [34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc] regmap-i2c: fix sparse warning in regmap_smbus_word_write_reg16
git bisect start 'd387b06f7c15b4639244ad66b4b0900c6a02b430' 'c745c46074da99cdcef8c1fc6093030c6f9d7143' '34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc'
# test job: [34808ac8ddafc3e2c2a59e84eaab0a410e7a0fdc] https://lava.sirena.org.uk/scheduler/job/2783502
# test job: [d387b06f7c15b4639244ad66b4b0900c6a02b430] https://lava.sirena.org.uk/scheduler/job/2796934
# bad: [d387b06f7c15b4639244ad66b4b0900c6a02b430] Add linux-next specific files for 20260525
git bisect bad d387b06f7c15b4639244ad66b4b0900c6a02b430
# test job: [4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b] https://lava.sirena.org.uk/scheduler/job/2796983
# good: [4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b] Merge branch 'libcrypto-next' of https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git
git bisect good 4c0ea14d8ec6f6fcb94b7ad9248679ffcf747e9b
# test job: [af3c2d822a4b67034aa47554c178b5ffcf973456] https://lava.sirena.org.uk/scheduler/job/2797058
# good: [af3c2d822a4b67034aa47554c178b5ffcf973456] Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git
git bisect good af3c2d822a4b67034aa47554c178b5ffcf973456
# test job: [2f8df83b202ec7f8080a25b2e9da79c3361775fd] https://lava.sirena.org.uk/scheduler/job/2797982
# bad: [2f8df83b202ec7f8080a25b2e9da79c3361775fd] Merge branch 'char-misc-next' of https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc.git
git bisect bad 2f8df83b202ec7f8080a25b2e9da79c3361775fd
# test job: [6b55dddad1ed45d92eef8046156965f7709f0d52] https://lava.sirena.org.uk/scheduler/job/2798010
# good: [6b55dddad1ed45d92eef8046156965f7709f0d52] Merge branch 'next' of git://git.kernel.org/pub/scm/virt/kvm/kvm.git
git bisect good 6b55dddad1ed45d92eef8046156965f7709f0d52
# test job: [6206468c5ba41e14b55d8dfd71af1611398a3399] https://lava.sirena.org.uk/scheduler/job/2798076
# good: [6206468c5ba41e14b55d8dfd71af1611398a3399] Merge branch 'for-next' of https://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext.git
git bisect good 6206468c5ba41e14b55d8dfd71af1611398a3399
# test job: [cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab] https://lava.sirena.org.uk/scheduler/job/2798520
# bad: [cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab] Merge branch 'driver-core-next' of https://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core.git
git bisect bad cbfc1fc9f6d2bd7364610b0077f55f16ff78cbab
# test job: [3c15372851403012d068a6f388770ed98dbe684e] https://lava.sirena.org.uk/scheduler/job/2798573
# good: [3c15372851403012d068a6f388770ed98dbe684e] Merge branch 'for-firmware-next' of https://git.kernel.org/pub/scm/linux/kernel/git/chrome-platform/linux.git
git bisect good 3c15372851403012d068a6f388770ed98dbe684e
# test job: [a9c12b783cc711de3ac7f188bed07d529bb818af] https://lava.sirena.org.uk/scheduler/job/2798622
# good: [a9c12b783cc711de3ac7f188bed07d529bb818af] device core: make struct device_driver groups members constant arrays
git bisect good a9c12b783cc711de3ac7f188bed07d529bb818af
# test job: [25025253476a64c186592d952c27f24bc3490e42] https://lava.sirena.org.uk/scheduler/job/2798651
# good: [25025253476a64c186592d952c27f24bc3490e42] leds: Adjust documentation of brightness sysfs node
git bisect good 25025253476a64c186592d952c27f24bc3490e42
# test job: [13443fbf62414e42afb1675ab2d3b767c6466915] https://lava.sirena.org.uk/scheduler/job/2798921
# bad: [13443fbf62414e42afb1675ab2d3b767c6466915] driver core: Stop using generic sysfs macros for device attributes
git bisect bad 13443fbf62414e42afb1675ab2d3b767c6466915
# test job: [81e7c6befa36cecdcbf7244393bd67e8f8c59bf5] https://lava.sirena.org.uk/scheduler/job/2799138
# bad: [81e7c6befa36cecdcbf7244393bd67e8f8c59bf5] of: dynamic: Fix overlayed devices not probing because of fw_devlink
git bisect bad 81e7c6befa36cecdcbf7244393bd67e8f8c59bf5
# test job: [1137838865bfc9a7cd5869c1dc5c22aa45ec12c8] https://lava.sirena.org.uk/scheduler/job/2799476
# bad: [1137838865bfc9a7cd5869c1dc5c22aa45ec12c8] driver core: Use mod_delayed_work to prevent lost deferred probe work
git bisect bad 1137838865bfc9a7cd5869c1dc5c22aa45ec12c8
# test job: [9582485a65eacfd7245ec7f0a9d7e2c34749d669] https://lava.sirena.org.uk/scheduler/job/2799512
# good: [9582485a65eacfd7245ec7f0a9d7e2c34749d669] device property: fix fwnode reference leak in fwnode_graph_get_endpoint_by_id()
git bisect good 9582485a65eacfd7245ec7f0a9d7e2c34749d669
# first bad commit: [1137838865bfc9a7cd5869c1dc5c22aa45ec12c8] driver core: Use mod_delayed_work to prevent lost deferred probe work

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 4/5] driver core: Allow the constification of device attributes
  2026-05-26 15:25     ` Mark Brown
@ 2026-05-26 15:32       ` Danilo Krummrich
  2026-05-26 15:38         ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Danilo Krummrich @ 2026-05-26 15:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: Thomas Weißschuh, Greg Kroah-Hartman, Rafael J. Wysocki,
	driver-core, linux-kernel, Zhang Yuwei

On Tue May 26, 2026 at 5:25 PM CEST, Mark Brown wrote:
> I've now got another bisect which comes out to another driver core
> commit 1137838865bf (driver core: Use mod_delayed_work to prevent lost
> deferred probe work), I don't know that that is an accurate result
> either but it does look like there's something fishy in this area.

When I saw your first mail I did already suspect that it might be this one, as
it is a race that might or might not trigger.

I applied [1] to driver-core-next today, so it should hopefully be fixed for
tomorrow's linux-next release.

[1] https://lore.kernel.org/driver-core/20260526145824.501263-1-dakr@kernel.org/T/#u

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH v3 4/5] driver core: Allow the constification of device attributes
  2026-05-26 15:32       ` Danilo Krummrich
@ 2026-05-26 15:38         ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2026-05-26 15:38 UTC (permalink / raw)
  To: Danilo Krummrich
  Cc: Thomas Weißschuh, Greg Kroah-Hartman, Rafael J. Wysocki,
	driver-core, linux-kernel, Zhang Yuwei

[-- Attachment #1: Type: text/plain, Size: 686 bytes --]

On Tue, May 26, 2026 at 05:32:22PM +0200, Danilo Krummrich wrote:
> On Tue May 26, 2026 at 5:25 PM CEST, Mark Brown wrote:

> > I've now got another bisect which comes out to another driver core
> > commit 1137838865bf (driver core: Use mod_delayed_work to prevent lost
> > deferred probe work), I don't know that that is an accurate result
> > either but it does look like there's something fishy in this area.

> When I saw your first mail I did already suspect that it might be this one, as
> it is a race that might or might not trigger.

> I applied [1] to driver-core-next today, so it should hopefully be fixed for
> tomorrow's linux-next release.

Ah, that does look plausible.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-05-26 15:38 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 16:39 [PATCH v3 0/5] driver core: Allow the constification of device attributes Thomas Weißschuh
2026-05-12 16:39 ` [PATCH v3 1/5] driver core: Delete DEVICE_ATTR_PREALLOC() Thomas Weißschuh
2026-05-12 16:39 ` [PATCH v3 2/5] driver core: Add low-level macros for device attributes Thomas Weißschuh
2026-05-12 16:39 ` [PATCH v3 3/5] driver core: Stop using generic sysfs " Thomas Weißschuh
2026-05-12 16:39 ` [PATCH v3 4/5] driver core: Allow the constification of " Thomas Weißschuh
2026-05-26 14:52   ` Mark Brown
2026-05-26 15:25     ` Mark Brown
2026-05-26 15:32       ` Danilo Krummrich
2026-05-26 15:38         ` Mark Brown
2026-05-12 16:39 ` [PATCH v3 5/5] driver core: Constify core " Thomas Weißschuh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.