* [PATCH] nvmem: use const APIs for legacy sysfs attributes
@ 2026-10-21 12:12 Bartosz Golaszewski
2026-10-21 12:24 ` Thomas Weißschuh
0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-10-21 12:12 UTC (permalink / raw)
To: Srinivas Kandagatla, Thomas Weißschuh
Cc: brgl, linux-kernel, Bartosz Golaszewski
Replace the deprecated non-const sysfs attribute APIs with modern const
variants.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
drivers/nvmem/core.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 7d4cce8e27424a032fff59a1189847adb1898168..f84f664deb84280871411c33f67ac846f7642161 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -193,24 +193,25 @@ static struct lock_class_key eeprom_lock_key;
#endif
static ssize_t type_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ const struct device_attribute *attr, char *buf)
{
struct nvmem_device *nvmem = to_nvmem_device(dev);
return sysfs_emit(buf, "%s\n", nvmem_type_str[nvmem->type]);
}
-static DEVICE_ATTR_RO(type);
+static const DEVICE_ATTR_RO(type);
-static ssize_t force_ro_show(struct device *dev, struct device_attribute *attr,
- char *buf)
+static ssize_t force_ro_show(struct device *dev,
+ const struct device_attribute *attr, char *buf)
{
struct nvmem_device *nvmem = to_nvmem_device(dev);
return sysfs_emit(buf, "%d\n", nvmem->read_only);
}
-static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr,
+static ssize_t force_ro_store(struct device *dev,
+ const struct device_attribute *attr,
const char *buf, size_t count)
{
struct nvmem_device *nvmem = to_nvmem_device(dev);
@@ -222,9 +223,9 @@ static ssize_t force_ro_store(struct device *dev, struct device_attribute *attr,
return count;
}
-static DEVICE_ATTR_RW(force_ro);
+static const DEVICE_ATTR_RW(force_ro);
-static struct attribute *nvmem_attrs[] = {
+static const struct attribute *const nvmem_attrs[] = {
&dev_attr_force_ro.attr,
&dev_attr_type.attr,
NULL,
@@ -339,7 +340,7 @@ static size_t nvmem_bin_attr_size(struct kobject *kobj,
}
static umode_t nvmem_attr_is_visible(struct kobject *kobj,
- struct attribute *attr, int i)
+ const struct attribute *attr, int i)
{
struct device *dev = kobj_to_dev(kobj);
struct nvmem_device *nvmem = to_nvmem_device(dev);
@@ -412,10 +413,10 @@ static const struct bin_attribute *const nvmem_bin_attributes[] = {
static const struct attribute_group nvmem_bin_group = {
.bin_attrs = nvmem_bin_attributes,
- .attrs = nvmem_attrs,
+ .attrs_const = nvmem_attrs,
.is_bin_visible = nvmem_bin_attr_is_visible,
.bin_size = nvmem_bin_attr_size,
- .is_visible = nvmem_attr_is_visible,
+ .is_visible_const = nvmem_attr_is_visible,
};
static const struct attribute_group *nvmem_dev_groups[] = {
---
base-commit: 8f7df005a7564bd7ffa75da9c3085d5b996f1e16
change-id: 20261021-nvmem-sysfs-const-4f5754263444
Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] nvmem: use const APIs for legacy sysfs attributes
2026-10-21 12:12 [PATCH] nvmem: use const APIs for legacy sysfs attributes Bartosz Golaszewski
@ 2026-10-21 12:24 ` Thomas Weißschuh
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Weißschuh @ 2026-10-21 12:24 UTC (permalink / raw)
To: Bartosz Golaszewski; +Cc: Srinivas Kandagatla, brgl, linux-kernel
On Wed, Oct 21, 2026 at 02:12:36PM +0200, Bartosz Golaszewski wrote:
> Replace the deprecated non-const sysfs attribute APIs with modern const
> variants.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
> ---
> drivers/nvmem/core.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
(...)
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-21 12:24 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-21 12:12 [PATCH] nvmem: use const APIs for legacy sysfs attributes Bartosz Golaszewski
2026-10-21 12:24 ` Thomas Weißschuh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®