The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: srini@kernel.org
To: gregkh@linuxfoundation.org
Cc: linux-kernel@vger.kernel.org,
	"Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	"Srinivas Kandagatla" <srini@kernel.org>
Subject: [PATCH 7/8] nvmem: use const APIs for legacy sysfs attributes
Date: Tue,  1 Dec 2026 23:27:35 +0000	[thread overview]
Message-ID: <20261201232736.537847-8-srini@kernel.org> (raw)
In-Reply-To: <20261201232736.537847-1-srini@kernel.org>

From: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>

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>
Signed-off-by: Srinivas Kandagatla <srini@kernel.org>
---
 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 afe9d3d66914..cce034865085 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[] = {
-- 
2.53.0


  parent reply	other threads:[~2026-12-01 23:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 23:27 [PATCH 0/8] nvmem: patches for v7.5 srini
2026-12-01 23:27 ` [PATCH 1/8] dt-bindings: nvmem: Add compatible for MSM8952 srini
2026-12-01 23:27 ` [PATCH 2/8] dt-bindings: nvmem: qfprom: Add SM8350 compatible srini
2026-12-01 23:27 ` [PATCH 3/8] nvmem: qfprom: Add the SM8350 keepout regions srini
2026-12-01 23:27 ` [PATCH 4/8] nvmem: m24lr: Remove use of i2c_match_id() srini
2026-12-01 23:27 ` [PATCH 5/8] dt-bindings: nvmem: st,stm32-romem: align patternProperties regex on nvmem-deprecated-cells.yaml srini
2026-12-01 23:27 ` [PATCH 6/8] nvmem: don't use devres in subsystem code srini
2026-12-01 23:27 ` srini [this message]
2026-12-01 23:27 ` [PATCH 8/8] dt-bindings: nvmem: SID: Add binding for A733 SID controller srini

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=20261201232736.537847-8-srini@kernel.org \
    --to=srini@kernel.org \
    --cc=bartosz.golaszewski@oss.qualcomm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    /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