Skip to contentSkip to conversation

SCSI: fcoe: convert to use BUS_ATTR_WO

PATCH Applied Greg Kroah-Hartman 3 participants 5 messages Jan 22, 2019 – Jan 29, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 SCSI: fcoe: convert to use BUS_ATTR_WO

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe driver can be trivially converted to use BUS_ATTR_WO(), so use that instead.

Cc Johannes Thumshirn <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>

---
v2: Made simpler with wrapper functions to call the "real" show/store
functions, thanks to James for the idea.
Removed the EXPORT_SYMBOL() removal line, that belongs in a separate patch

 drivers/scsi/fcoe/fcoe_sysfs.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe_sysfs.c +13 -2
index 5c8310bade61..c3dcbdc3aa64 100644
@@ -671,8 +671,19 @@ static const struct device_type fcoe_fcf_device_type = {
 	.release = fcoe_fcf_device_release,
 };
 
-static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store);
-static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store);
+static ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
+				 size_t count)
+{
+	return fcoe_ctlr_create_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_create);
+
+static ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
+				  size_t count)
+{
+	return fcoe_ctlr_destroy_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_destroy);
 
 static struct attribute *fcoe_bus_attrs[] = {
 	&bus_attr_ctlr_create.attr,
Signature · 1 line
2.20.1
maintainer
#1 lore raw
Quoted 34 lines · Greg Kroah-Hartman

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe driver can be trivially converted to use BUS_ATTR_WO(), so use that instead.

Cc Johannes Thumshirn <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>

---
v2: Made simpler with wrapper functions to call the "real" show/store
functions, thanks to James for the idea.
Removed the EXPORT_SYMBOL() removal line, that belongs in a separate patch

  drivers/scsi/fcoe/fcoe_sysfs.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe_sysfs.c +6 -2
index 5c8310bade61..c3dcbdc3aa64 100644
@@ -671,8 +671,19 @@ static const struct device_type fcoe_fcf_device_type = {
  	.release = fcoe_fcf_device_release,
  };
 
-static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store);
-static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store);
+static ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
+				 size_t count)
+{
+	return fcoe_ctlr_create_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_create);

drivers/scsi/fcoe/fcoe_sysfs.c static const struct device_type fcoe_fcf_device_type = { · line 689

Quoted 10 lines
drivers/scsi/fcoe/fcoe_sysfs.c +7 -0
+
+static ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
+				  size_t count)
+{
+	return fcoe_ctlr_destroy_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_destroy);
 
  static struct attribute *fcoe_bus_attrs[] = {
  	&bus_attr_ctlr_create.attr,

Why not renaming the functions and drop the wrapper?

Cheers,

Hannes

#2 lore raw
Quoted 36 lines · Hannes Reinecke
Quoted 35 lines · Greg Kroah-Hartman

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe driver can be trivially converted to use BUS_ATTR_WO(), so use that instead.

Cc Johannes Thumshirn <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>

---
v2: Made simpler with wrapper functions to call the "real" show/store
functions, thanks to James for the idea.
Removed the EXPORT_SYMBOL() removal line, that belongs in a separate patch

  drivers/scsi/fcoe/fcoe_sysfs.c | 15 +++++++++++++--
  1 file changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe_sysfs.c +9 -2
index 5c8310bade61..c3dcbdc3aa64 100644
@@ -671,8 +671,19 @@ static const struct device_type fcoe_fcf_device_type = {
  	.release = fcoe_fcf_device_release,
  };
-static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store);
-static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store);
+static ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
+				 size_t count)
+{
+	return fcoe_ctlr_create_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_create);
+
+static ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
+				  size_t count)
Quoted 8 lines

drivers/scsi/fcoe/fcoe_sysfs.c static const struct device_type fcoe_fcf_device_type = {

Quoted 7 lines
drivers/scsi/fcoe/fcoe_sysfs.c +4 -0
+{
+	return fcoe_ctlr_destroy_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_destroy);
  static struct attribute *fcoe_bus_attrs[] = {
  	&bus_attr_ctlr_create.attr,
 

Why not renaming the functions and drop the wrapper?

I did that in v1 of this patch, but people complained I was messing up their function namespace :)

thanks,

greg k-h

maintainer Reviewed-by
#3 lore raw
Quoted 46 lines · Greg Kroah-Hartman
Quoted 36 lines · Hannes Reinecke
Quoted 35 lines · Greg Kroah-Hartman

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe driver can be trivially converted to use BUS_ATTR_WO(), so use that instead.

Cc Johannes Thumshirn <[email protected]>
Cc "James E.J. Bottomley" <[email protected]>
Cc "Martin K. Petersen" <[email protected]>

---
v2: Made simpler with wrapper functions to call the "real" show/store
functions, thanks to James for the idea.
Removed the EXPORT_SYMBOL() removal line, that belongs in a separate patch

   drivers/scsi/fcoe/fcoe_sysfs.c | 15 +++++++++++++--
   1 file changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/fcoe/fcoe_sysfs.c +9 -2
index 5c8310bade61..c3dcbdc3aa64 100644
@@ -671,8 +671,19 @@ static const struct device_type fcoe_fcf_device_type = {
   	.release = fcoe_fcf_device_release,
   };
-static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store);
-static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store);
+static ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
+				 size_t count)
+{
+	return fcoe_ctlr_create_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_create);
+
+static ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
+				  size_t count)
Quoted 8 lines

drivers/scsi/fcoe/fcoe_sysfs.c static const struct device_type fcoe_fcf_device_type = {

Quoted 7 lines
drivers/scsi/fcoe/fcoe_sysfs.c +4 -0
+{
+	return fcoe_ctlr_destroy_store(bus, buf, count);
+}
+static BUS_ATTR_WO(ctlr_destroy);
   static struct attribute *fcoe_bus_attrs[] = {
   	&bus_attr_ctlr_create.attr,
 

Why not renaming the functions and drop the wrapper?

Quoted 3 lines

I did that in v1 of this patch, but people complained I was messing up their function namespace :)

Sigh.

Okay, then.

Cheers,

Hannes

#4 lore raw
In reply to Greg Kroah-Hartman

Greg,

Quoted 3 lines

We are trying to get rid of BUS_ATTR() and the usage of that in the fcoe driver can be trivially converted to use BUS_ATTR_WO(), so use that instead.

Applied to 5.1/scsi-queue, thanks!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering