linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO()
@ 2024-12-02 19:00 Thomas Weißschuh
  2024-12-02 19:00 ` [PATCH 1/5] sysfs: add " Thomas Weißschuh
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

For the bin_attribute constification effort it is useful to have
BIN_ATTR_ADMIN_WO() macro.
Introduce it and switch over all places in the tree which can make use
of it.

While at it also constify the bin_attribute callback parameters.

This series is meant to be applied through the driver core tree.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
Thomas Weißschuh (5):
      sysfs: add macro BIN_ATTR_ADMIN_WO()
      s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition
      powerpc/powernv/flash: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
      firmware: google: gsmi: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
      scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions

 arch/powerpc/platforms/powernv/opal-flash.c | 14 ++----
 drivers/firmware/google/gsmi.c              | 17 +++----
 drivers/s390/char/sclp_config.c             | 16 ++-----
 drivers/scsi/arcmsr/arcmsr_attr.c           | 73 ++++++++++-------------------
 include/linux/sysfs.h                       |  6 +++
 5 files changed, 49 insertions(+), 77 deletions(-)
---
base-commit: e70140ba0d2b1a30467d4af6bcfe761327b9ec95
change-id: 20241125-sysfs-const-bin_attr-admin_wo-9d466ff7eb42

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



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

* [PATCH 1/5] sysfs: add macro BIN_ATTR_ADMIN_WO()
  2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
@ 2024-12-02 19:00 ` Thomas Weißschuh
  2024-12-05  9:20   ` Tzung-Bi Shih
  2024-12-02 19:00 ` [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition Thomas Weißschuh
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

The macros BIN_ATTR_RO/BIN_ATTR_WO/BIN_ATTR_WR and
BIN_ATTR_ADMIN_RO/BIN_ATTR_ADMIN_RW already exist.
To complete the collection also add BIN_ATTR_ADMIN_WO.

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

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 0f2fcd244523f050c5286f19d4fe1846506f9214..bcae49105e54a79b7d8a610f17212cb5920c205a 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -385,12 +385,18 @@ struct bin_attribute bin_attr_##_name = __BIN_ATTR_RW(_name, _size)
 #define __BIN_ATTR_ADMIN_RO(_name, _size)				\
 	__BIN_ATTR(_name, 0400, _name##_read, NULL, _size)
 
+#define __BIN_ATTR_ADMIN_WO(_name, _size)				\
+	__BIN_ATTR(_name, 0200, NULL, _name##_write, _size)
+
 #define __BIN_ATTR_ADMIN_RW(_name, _size)					\
 	__BIN_ATTR(_name, 0600, _name##_read, _name##_write, _size)
 
 #define BIN_ATTR_ADMIN_RO(_name, _size)					\
 struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RO(_name, _size)
 
+#define BIN_ATTR_ADMIN_WO(_name, _size)					\
+struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_WO(_name, _size)
+
 #define BIN_ATTR_ADMIN_RW(_name, _size)					\
 struct bin_attribute bin_attr_##_name = __BIN_ATTR_ADMIN_RW(_name, _size)
 

-- 
2.47.1



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

* [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
  2024-12-02 19:00 ` [PATCH 1/5] sysfs: add " Thomas Weißschuh
@ 2024-12-02 19:00 ` Thomas Weißschuh
  2024-12-05  9:20   ` Tzung-Bi Shih
  2024-12-02 19:00 ` [PATCH 3/5] powerpc/powernv/flash: Use " Thomas Weißschuh
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

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@weissschuh.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



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

* [PATCH 3/5] powerpc/powernv/flash: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
  2024-12-02 19:00 ` [PATCH 1/5] sysfs: add " Thomas Weißschuh
  2024-12-02 19:00 ` [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition Thomas Weißschuh
@ 2024-12-02 19:00 ` Thomas Weißschuh
  2024-12-05  9:20   ` Tzung-Bi Shih
  2024-12-02 19:00 ` [PATCH 4/5] firmware: google: gsmi: " Thomas Weißschuh
  2024-12-02 19:00 ` [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions Thomas Weißschuh
  4 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

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@weissschuh.net>
---
 arch/powerpc/platforms/powernv/opal-flash.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index d5ea04e8e4c526b99ca8f1ab613266b385362d82..76e3818601e5610f48bb8a6fd325239d6ad39723 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -431,9 +431,9 @@ static int alloc_image_buf(char *buffer, size_t count)
  * Parse candidate image header to get total image size
  * and pre-allocate required memory.
  */
-static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
-				struct bin_attribute *bin_attr,
-				char *buffer, loff_t pos, size_t count)
+static ssize_t image_write(struct file *filp, struct kobject *kobj,
+			   const struct bin_attribute *bin_attr,
+			   char *buffer, loff_t pos, size_t count)
 {
 	int rc;
 
@@ -490,11 +490,7 @@ static ssize_t image_data_write(struct file *filp, struct kobject *kobj,
  *   update_flash	: Flash new firmware image
  *
  */
-static const struct bin_attribute image_data_attr = {
-	.attr = {.name = "image", .mode = 0200},
-	.size = MAX_IMAGE_SIZE,	/* Limit image size */
-	.write = image_data_write,
-};
+static const BIN_ATTR_ADMIN_WO(image, MAX_IMAGE_SIZE);
 
 static struct kobj_attribute validate_attribute =
 	__ATTR(validate_flash, 0600, validate_show, validate_store);
@@ -544,7 +540,7 @@ void __init opal_flash_update_init(void)
 		goto nokobj;
 	}
 
-	ret = sysfs_create_bin_file(opal_kobj, &image_data_attr);
+	ret = sysfs_create_bin_file(opal_kobj, &bin_attr_image);
 	if (ret) {
 		pr_warn("FLASH: Failed to create sysfs files\n");
 		goto nosysfs_file;

-- 
2.47.1



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

* [PATCH 4/5] firmware: google: gsmi: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
                   ` (2 preceding siblings ...)
  2024-12-02 19:00 ` [PATCH 3/5] powerpc/powernv/flash: Use " Thomas Weißschuh
@ 2024-12-02 19:00 ` Thomas Weißschuh
  2024-12-05  9:21   ` Tzung-Bi Shih
  2024-12-02 19:00 ` [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions Thomas Weißschuh
  4 siblings, 1 reply; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

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@weissschuh.net>
---
 drivers/firmware/google/gsmi.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/drivers/firmware/google/gsmi.c b/drivers/firmware/google/gsmi.c
index 24e666d5c3d1a231d611ad3c20816c1d223a0dc5..cd946633ef727e826449a7b307a15a2c9f07d655 100644
--- a/drivers/firmware/google/gsmi.c
+++ b/drivers/firmware/google/gsmi.c
@@ -487,9 +487,9 @@ static const struct efivar_operations efivar_ops = {
 
 #endif /* CONFIG_EFI */
 
-static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
-			       struct bin_attribute *bin_attr,
-			       char *buf, loff_t pos, size_t count)
+static ssize_t append_to_eventlog_write(struct file *filp, struct kobject *kobj,
+					const struct bin_attribute *bin_attr,
+					char *buf, loff_t pos, size_t count)
 {
 	struct gsmi_set_eventlog_param param = {
 		.data_ptr = gsmi_dev.data_buf->address,
@@ -528,10 +528,7 @@ static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
 
 }
 
-static struct bin_attribute eventlog_bin_attr = {
-	.attr = {.name = "append_to_eventlog", .mode = 0200},
-	.write = eventlog_write,
-};
+static const BIN_ATTR_ADMIN_WO(append_to_eventlog, 0);
 
 static ssize_t gsmi_clear_eventlog_store(struct kobject *kobj,
 					 struct kobj_attribute *attr,
@@ -1017,7 +1014,7 @@ static __init int gsmi_init(void)
 	}
 
 	/* Setup eventlog access */
-	ret = sysfs_create_bin_file(gsmi_kobj, &eventlog_bin_attr);
+	ret = sysfs_create_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
 	if (ret) {
 		printk(KERN_INFO "gsmi: Failed to setup eventlog");
 		goto out_err;
@@ -1049,7 +1046,7 @@ static __init int gsmi_init(void)
 	return 0;
 
 out_remove_bin_file:
-	sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
+	sysfs_remove_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
 out_err:
 	kobject_put(gsmi_kobj);
 	gsmi_buf_free(gsmi_dev.param_buf);
@@ -1076,7 +1073,7 @@ static void __exit gsmi_exit(void)
 #endif
 
 	sysfs_remove_files(gsmi_kobj, gsmi_attrs);
-	sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
+	sysfs_remove_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
 	kobject_put(gsmi_kobj);
 	gsmi_buf_free(gsmi_dev.param_buf);
 	gsmi_buf_free(gsmi_dev.data_buf);

-- 
2.47.1



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

* [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions
  2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
                   ` (3 preceding siblings ...)
  2024-12-02 19:00 ` [PATCH 4/5] firmware: google: gsmi: " Thomas Weißschuh
@ 2024-12-02 19:00 ` Thomas Weißschuh
  2024-12-04 19:56   ` Martin K. Petersen
  2024-12-05  9:21   ` Tzung-Bi Shih
  4 siblings, 2 replies; 12+ messages in thread
From: Thomas Weißschuh @ 2024-12-02 19:00 UTC (permalink / raw)
  To: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen
  Cc: linux-kernel, linux-s390, linuxppc-dev, chrome-platform,
	linux-scsi, Thomas Weißschuh

Using the macro saves some lines of code and prepares the attributes for
the general constifications of struct bin_attributes.

While at it also constify the callback parameters.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/scsi/arcmsr/arcmsr_attr.c | 73 ++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 47 deletions(-)

diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index baeb5e79569026f1af6612705689219bb4a7052f..af7750b551910b06254e443c25bebf323e29f162 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -58,11 +58,11 @@
 #include <scsi/scsi_transport.h>
 #include "arcmsr.h"
 
-static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp,
-					     struct kobject *kobj,
-					     struct bin_attribute *bin,
-					     char *buf, loff_t off,
-					     size_t count)
+static ssize_t mu_read_read(struct file *filp,
+			    struct kobject *kobj,
+			    const struct bin_attribute *bin,
+			    char *buf, loff_t off,
+			    size_t count)
 {
 	struct device *dev = container_of(kobj,struct device,kobj);
 	struct Scsi_Host *host = class_to_shost(dev);
@@ -105,11 +105,11 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct file *filp,
 	return allxfer_len;
 }
 
-static ssize_t arcmsr_sysfs_iop_message_write(struct file *filp,
-					      struct kobject *kobj,
-					      struct bin_attribute *bin,
-					      char *buf, loff_t off,
-					      size_t count)
+static ssize_t mu_write_write(struct file *filp,
+			      struct kobject *kobj,
+			      const struct bin_attribute *bin,
+			      char *buf, loff_t off,
+			      size_t count)
 {
 	struct device *dev = container_of(kobj,struct device,kobj);
 	struct Scsi_Host *host = class_to_shost(dev);
@@ -153,11 +153,11 @@ static ssize_t arcmsr_sysfs_iop_message_write(struct file *filp,
 	}
 }
 
-static ssize_t arcmsr_sysfs_iop_message_clear(struct file *filp,
-					      struct kobject *kobj,
-					      struct bin_attribute *bin,
-					      char *buf, loff_t off,
-					      size_t count)
+static ssize_t mu_clear_write(struct file *filp,
+			      struct kobject *kobj,
+			      const struct bin_attribute *bin,
+			      char *buf, loff_t off,
+			      size_t count)
 {
 	struct device *dev = container_of(kobj,struct device,kobj);
 	struct Scsi_Host *host = class_to_shost(dev);
@@ -188,58 +188,37 @@ static ssize_t arcmsr_sysfs_iop_message_clear(struct file *filp,
 	return 1;
 }
 
-static const struct bin_attribute arcmsr_sysfs_message_read_attr = {
-	.attr = {
-		.name = "mu_read",
-		.mode = S_IRUSR ,
-	},
-	.size = ARCMSR_API_DATA_BUFLEN,
-	.read = arcmsr_sysfs_iop_message_read,
-};
+static const BIN_ATTR_ADMIN_RO(mu_read, ARCMSR_API_DATA_BUFLEN);
 
-static const struct bin_attribute arcmsr_sysfs_message_write_attr = {
-	.attr = {
-		.name = "mu_write",
-		.mode = S_IWUSR,
-	},
-	.size = ARCMSR_API_DATA_BUFLEN,
-	.write = arcmsr_sysfs_iop_message_write,
-};
+static const BIN_ATTR_ADMIN_WO(mu_write, ARCMSR_API_DATA_BUFLEN);
 
-static const struct bin_attribute arcmsr_sysfs_message_clear_attr = {
-	.attr = {
-		.name = "mu_clear",
-		.mode = S_IWUSR,
-	},
-	.size = 1,
-	.write = arcmsr_sysfs_iop_message_clear,
-};
+static const BIN_ATTR_ADMIN_WO(mu_clear, 1);
 
 int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *acb)
 {
 	struct Scsi_Host *host = acb->host;
 	int error;
 
-	error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
+	error = sysfs_create_bin_file(&host->shost_dev.kobj, &bin_attr_mu_read);
 	if (error) {
 		printk(KERN_ERR "arcmsr: alloc sysfs mu_read failed\n");
 		goto error_bin_file_message_read;
 	}
-	error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
+	error = sysfs_create_bin_file(&host->shost_dev.kobj, &bin_attr_mu_write);
 	if (error) {
 		printk(KERN_ERR "arcmsr: alloc sysfs mu_write failed\n");
 		goto error_bin_file_message_write;
 	}
-	error = sysfs_create_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr);
+	error = sysfs_create_bin_file(&host->shost_dev.kobj, &bin_attr_mu_clear);
 	if (error) {
 		printk(KERN_ERR "arcmsr: alloc sysfs mu_clear failed\n");
 		goto error_bin_file_message_clear;
 	}
 	return 0;
 error_bin_file_message_clear:
-	sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
+	sysfs_remove_bin_file(&host->shost_dev.kobj, &bin_attr_mu_write);
 error_bin_file_message_write:
-	sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
+	sysfs_remove_bin_file(&host->shost_dev.kobj, &bin_attr_mu_read);
 error_bin_file_message_read:
 	return error;
 }
@@ -248,9 +227,9 @@ void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb)
 {
 	struct Scsi_Host *host = acb->host;
 
-	sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_clear_attr);
-	sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_write_attr);
-	sysfs_remove_bin_file(&host->shost_dev.kobj, &arcmsr_sysfs_message_read_attr);
+	sysfs_remove_bin_file(&host->shost_dev.kobj, &bin_attr_mu_clear);
+	sysfs_remove_bin_file(&host->shost_dev.kobj, &bin_attr_mu_write);
+	sysfs_remove_bin_file(&host->shost_dev.kobj, &bin_attr_mu_read);
 }
 
 

-- 
2.47.1



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

* Re: [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions
  2024-12-02 19:00 ` [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions Thomas Weißschuh
@ 2024-12-04 19:56   ` Martin K. Petersen
  2024-12-05  9:21   ` Tzung-Bi Shih
  1 sibling, 0 replies; 12+ messages in thread
From: Martin K. Petersen @ 2024-12-04 19:56 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Tzung-Bi Shih, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi


Thomas,

> Using the macro saves some lines of code and prepares the attributes for
> the general constifications of struct bin_attributes.
>
> While at it also constify the callback parameters.

Looks OK to me.

Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>

-- 
Martin K. Petersen	Oracle Linux Engineering


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

* Re: [PATCH 1/5] sysfs: add macro BIN_ATTR_ADMIN_WO()
  2024-12-02 19:00 ` [PATCH 1/5] sysfs: add " Thomas Weißschuh
@ 2024-12-05  9:20   ` Tzung-Bi Shih
  0 siblings, 0 replies; 12+ messages in thread
From: Tzung-Bi Shih @ 2024-12-05  9:20 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi

On Mon, Dec 02, 2024 at 08:00:36PM +0100, Thomas Weißschuh wrote:
> The macros BIN_ATTR_RO/BIN_ATTR_WO/BIN_ATTR_WR and
> BIN_ATTR_ADMIN_RO/BIN_ATTR_ADMIN_RW already exist.
> To complete the collection also add BIN_ATTR_ADMIN_WO.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>


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

* Re: [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 ` [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition Thomas Weißschuh
@ 2024-12-05  9:20   ` Tzung-Bi Shih
  0 siblings, 0 replies; 12+ messages in thread
From: Tzung-Bi Shih @ 2024-12-05  9:20 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi

On Mon, Dec 02, 2024 at 08:00:37PM +0100, Thomas Weißschuh wrote:
> 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@weissschuh.net>

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>


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

* Re: [PATCH 3/5] powerpc/powernv/flash: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 ` [PATCH 3/5] powerpc/powernv/flash: Use " Thomas Weißschuh
@ 2024-12-05  9:20   ` Tzung-Bi Shih
  0 siblings, 0 replies; 12+ messages in thread
From: Tzung-Bi Shih @ 2024-12-05  9:20 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi

On Mon, Dec 02, 2024 at 08:00:38PM +0100, Thomas Weißschuh wrote:
> 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@weissschuh.net>

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>


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

* Re: [PATCH 4/5] firmware: google: gsmi: Use BIN_ATTR_ADMIN_WO() for bin_attribute definition
  2024-12-02 19:00 ` [PATCH 4/5] firmware: google: gsmi: " Thomas Weißschuh
@ 2024-12-05  9:21   ` Tzung-Bi Shih
  0 siblings, 0 replies; 12+ messages in thread
From: Tzung-Bi Shih @ 2024-12-05  9:21 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi

On Mon, Dec 02, 2024 at 08:00:39PM +0100, Thomas Weißschuh wrote:
> 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@weissschuh.net>

Acked-by: Tzung-Bi Shih <tzungbi@kernel.org>


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

* Re: [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions
  2024-12-02 19:00 ` [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions Thomas Weißschuh
  2024-12-04 19:56   ` Martin K. Petersen
@ 2024-12-05  9:21   ` Tzung-Bi Shih
  1 sibling, 0 replies; 12+ messages in thread
From: Tzung-Bi Shih @ 2024-12-05  9:21 UTC (permalink / raw)
  To: Thomas Weißschuh
  Cc: Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger, Sven Schnelle, Michael Ellerman,
	Nicholas Piggin, Christophe Leroy, Naveen N Rao,
	Madhavan Srinivasan, Brian Norris, Julius Werner,
	James E.J. Bottomley, Martin K. Petersen, linux-kernel,
	linux-s390, linuxppc-dev, chrome-platform, linux-scsi

On Mon, Dec 02, 2024 at 08:00:40PM +0100, Thomas Weißschuh wrote:
> Using the macro saves some lines of code and prepares the attributes for
> the general constifications of struct bin_attributes.
> 
> While at it also constify the callback parameters.
> 
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>

Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org>


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

end of thread, other threads:[~2024-12-05  9:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-02 19:00 [PATCH 0/5] sysfs: introduce and use macro BIN_ATTR_ADMIN_WO() Thomas Weißschuh
2024-12-02 19:00 ` [PATCH 1/5] sysfs: add " Thomas Weißschuh
2024-12-05  9:20   ` Tzung-Bi Shih
2024-12-02 19:00 ` [PATCH 2/5] s390/sclp_config: use BIN_ATTR_ADMIN_WO() for bin_attribute definition Thomas Weißschuh
2024-12-05  9:20   ` Tzung-Bi Shih
2024-12-02 19:00 ` [PATCH 3/5] powerpc/powernv/flash: Use " Thomas Weißschuh
2024-12-05  9:20   ` Tzung-Bi Shih
2024-12-02 19:00 ` [PATCH 4/5] firmware: google: gsmi: " Thomas Weißschuh
2024-12-05  9:21   ` Tzung-Bi Shih
2024-12-02 19:00 ` [PATCH 5/5] scsi: arcmsr: Use BIN_ATTR_ADMIN_WO() for bin_attribute definitions Thomas Weißschuh
2024-12-04 19:56   ` Martin K. Petersen
2024-12-05  9:21   ` Tzung-Bi Shih

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).