[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241202-sysfs-const-bin_attr-admin_wo-v1-2-f489116210bf@weissschuh.net>
Date: Mon, 02 Dec 2024 20:00:37 +0100
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Heiko Carstens <hca@...ux.ibm.com>, Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, Michael Ellerman <mpe@...erman.id.au>,
Nicholas Piggin <npiggin@...il.com>,
Christophe Leroy <christophe.leroy@...roup.eu>,
Naveen N Rao <naveen@...nel.org>, Madhavan Srinivasan <maddy@...ux.ibm.com>,
Tzung-Bi Shih <tzungbi@...nel.org>, Brian Norris <briannorris@...omium.org>,
Julius Werner <jwerner@...omium.org>,
"James E.J. Bottomley" <James.Bottomley@...senPartnership.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>
Cc: linux-kernel@...r.kernel.org, linux-s390@...r.kernel.org,
linuxppc-dev@...ts.ozlabs.org, chrome-platform@...ts.linux.dev,
linux-scsi@...r.kernel.org,
Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for
bin_attribute definition
Using the macro saves some lines of code and prepares the attribute for
the general constifications of struct bin_attributes.
While at it also constify the callback parameter.
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
drivers/s390/char/sclp_config.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c
index f56ea9b60e08e817652a9b7d19d420e9977c6552..0fe0782ccd325c1c3907e5d6272f770477e9ea46 100644
--- a/drivers/s390/char/sclp_config.c
+++ b/drivers/s390/char/sclp_config.c
@@ -127,9 +127,9 @@ static int sclp_ofb_send_req(char *ev_data, size_t len)
return rc;
}
-static ssize_t sysfs_ofb_data_write(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
- char *buf, loff_t off, size_t count)
+static ssize_t event_data_write(struct file *filp, struct kobject *kobj,
+ const struct bin_attribute *bin_attr,
+ char *buf, loff_t off, size_t count)
{
int rc;
@@ -137,13 +137,7 @@ static ssize_t sysfs_ofb_data_write(struct file *filp, struct kobject *kobj,
return rc ?: count;
}
-static const struct bin_attribute ofb_bin_attr = {
- .attr = {
- .name = "event_data",
- .mode = S_IWUSR,
- },
- .write = sysfs_ofb_data_write,
-};
+static const BIN_ATTR_ADMIN_WO(event_data, 0);
#endif
static int __init sclp_ofb_setup(void)
@@ -155,7 +149,7 @@ static int __init sclp_ofb_setup(void)
ofb_kset = kset_create_and_add("ofb", NULL, firmware_kobj);
if (!ofb_kset)
return -ENOMEM;
- rc = sysfs_create_bin_file(&ofb_kset->kobj, &ofb_bin_attr);
+ rc = sysfs_create_bin_file(&ofb_kset->kobj, &bin_attr_event_data);
if (rc) {
kset_unregister(ofb_kset);
return rc;
--
2.47.1
Powered by blists - more mailing lists