linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] Driver core: remove BUS_ATTR()
@ 2018-12-21  7:54 Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 01/10] PCI: pci.c: convert to use BUS_ATTR_RW Greg Kroah-Hartman
                   ` (9 more replies)
  0 siblings, 10 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, James E.J. Bottomley, Martin K. Petersen,
	Rafael J. Wysocki, Alex Elder, Alexandre Bounine,
	Benjamin Herrenschmidt, Bjorn Helgaas, Ilya Dryomov, Jens Axboe,
	Johannes Thumshirn, Matt Porter, Michael Ellerman,
	Paul Mackerras, Sage Weil, Tyrel Datwyler

In the quest to get rid of the need to specify any sysfs mode
attributes, let's get rid of BUS_ATTR() and move the few remaining users
of it over to use the "read write" and "write only" versions of the
macro.

Greg Kroah-Hartman (10):
  PCI: pci.c: convert to use BUS_ATTR_RW
  PCI: pci-sysfs.c: convert to use BUS_ATTR_WO
  SCSI: fcoe: convert to use BUS_ATTR_WO
  pseries: ibmebus.c: convert to use BUS_ATTR_WO
  rapidio: rio-sysfs.c: convert to use BUS_ATTR_WO
  block: rbd: convert to use BUS_ATTR_WO and RO
  driver core: bus: convert to use BUS_ATTR_WO and RW
  Documentation: driver core: remove use of BUS_ATTR
  driver core: drop use of BUS_ATTR()
  driver core: remove BUS_ATTR()

 Documentation/driver-model/bus.txt       |  8 ++---
 Documentation/filesystems/sysfs.txt      |  4 ++-
 arch/powerpc/platforms/pseries/ibmebus.c | 10 +++---
 drivers/base/bus.c                       | 20 +++++++----
 drivers/block/rbd.c                      | 45 ++++++++++--------------
 drivers/pci/pci-sysfs.c                  |  5 ++-
 drivers/pci/pci.c                        |  7 ++--
 drivers/rapidio/rio-sysfs.c              |  5 ++-
 drivers/scsi/fcoe/fcoe_sysfs.c           |  4 +--
 drivers/scsi/fcoe/fcoe_transport.c       |  7 ++--
 include/linux/device.h                   |  2 --
 include/scsi/libfcoe.h                   |  6 ++--
 12 files changed, 56 insertions(+), 67 deletions(-)

-- 
2.20.1


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

* [PATCH 01/10] PCI: pci.c: convert to use BUS_ATTR_RW
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 02/10] PCI: pci-sysfs.c: convert to use BUS_ATTR_WO Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bjorn Helgaas

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

Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/pci.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index c9d8e3c837de..fda84538de79 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -6034,19 +6034,18 @@ static ssize_t pci_get_resource_alignment_param(char *buf, size_t size)
 	return count;
 }
 
-static ssize_t pci_resource_alignment_show(struct bus_type *bus, char *buf)
+static ssize_t resource_alignment_show(struct bus_type *bus, char *buf)
 {
 	return pci_get_resource_alignment_param(buf, PAGE_SIZE);
 }
 
-static ssize_t pci_resource_alignment_store(struct bus_type *bus,
+static ssize_t resource_alignment_store(struct bus_type *bus,
 					const char *buf, size_t count)
 {
 	return pci_set_resource_alignment_param(buf, count);
 }
 
-static BUS_ATTR(resource_alignment, 0644, pci_resource_alignment_show,
-					pci_resource_alignment_store);
+static BUS_ATTR_RW(resource_alignment);
 
 static int __init pci_resource_alignment_sysfs_init(void)
 {
-- 
2.20.1


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

* [PATCH 02/10] PCI: pci-sysfs.c: convert to use BUS_ATTR_WO
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 01/10] PCI: pci.c: convert to use BUS_ATTR_RW Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 03/10] SCSI: fcoe: " Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bjorn Helgaas

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

Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pci/pci-sysfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 9ecfe13157c0..25794c27c7a4 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -412,8 +412,7 @@ static ssize_t msi_bus_store(struct device *dev, struct device_attribute *attr,
 }
 static DEVICE_ATTR_RW(msi_bus);
 
-static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
-				size_t count)
+static ssize_t rescan_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	unsigned long val;
 	struct pci_bus *b = NULL;
@@ -429,7 +428,7 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
 	}
 	return count;
 }
-static BUS_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store);
+static BUS_ATTR_WO(rescan);
 
 static struct attribute *pci_bus_attrs[] = {
 	&bus_attr_rescan.attr,
-- 
2.20.1


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

* [PATCH 03/10] SCSI: fcoe: convert to use BUS_ATTR_WO
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 01/10] PCI: pci.c: convert to use BUS_ATTR_RW Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 02/10] PCI: pci-sysfs.c: convert to use BUS_ATTR_WO Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  8:00   ` Johannes Thumshirn
  2018-12-21 15:29   ` James Bottomley
  2018-12-21  7:54 ` [PATCH 04/10] pseries: ibmebus.c: " Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  9 siblings, 2 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Johannes Thumshirn, James E.J. Bottomley,
	Martin K. Petersen

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.

At the same time remove a unneeded EXPORT_SYMBOL() marking for the sysfs
callback function we are renaming, no idea of how that got into the
tree...

Cc: Johannes Thumshirn <jth@kernel.org>
Cc: "James E.J. Bottomley" <jejb@linux.vnet.ibm.com>
Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/scsi/fcoe/fcoe_sysfs.c     | 4 ++--
 drivers/scsi/fcoe/fcoe_transport.c | 7 ++-----
 include/scsi/libfcoe.h             | 6 ++----
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 5c8310bade61..3c23b2624bd4 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -671,8 +671,8 @@ 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 BUS_ATTR_WO(ctlr_create);
+static BUS_ATTR_WO(ctlr_destroy);
 
 static struct attribute *fcoe_bus_attrs[] = {
 	&bus_attr_ctlr_create.attr,
diff --git a/drivers/scsi/fcoe/fcoe_transport.c b/drivers/scsi/fcoe/fcoe_transport.c
index f4909cd206d3..9edf82efda15 100644
--- a/drivers/scsi/fcoe/fcoe_transport.c
+++ b/drivers/scsi/fcoe/fcoe_transport.c
@@ -754,8 +754,7 @@ static int libfcoe_device_notification(struct notifier_block *notifier,
 	return NOTIFY_OK;
 }
 
-ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
-			       const char *buf, size_t count)
+ssize_t ctlr_create_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	struct net_device *netdev = NULL;
 	struct fcoe_transport *ft = NULL;
@@ -817,8 +816,7 @@ ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
 	return count;
 }
 
-ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
-				const char *buf, size_t count)
+ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	int rc = -ENODEV;
 	struct net_device *netdev = NULL;
@@ -855,7 +853,6 @@ ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
 	mutex_unlock(&ft_mutex);
 	return rc;
 }
-EXPORT_SYMBOL(fcoe_ctlr_destroy_store);
 
 /**
  * fcoe_transport_create() - Create a fcoe interface
diff --git a/include/scsi/libfcoe.h b/include/scsi/libfcoe.h
index cb8a273732cf..44536f095681 100644
--- a/include/scsi/libfcoe.h
+++ b/include/scsi/libfcoe.h
@@ -405,10 +405,8 @@ int fcoe_transport_attach(struct fcoe_transport *ft);
 int fcoe_transport_detach(struct fcoe_transport *ft);
 
 /* sysfs store handler for ctrl_control interface */
-ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
-			       const char *buf, size_t count);
-ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
-				const char *buf, size_t count);
+ssize_t ctlr_create_store(struct bus_type *bus, const char *buf, size_t count);
+ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf, size_t count);
 
 #endif /* _LIBFCOE_H */
 
-- 
2.20.1


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

* [PATCH 04/10] pseries: ibmebus.c: convert to use BUS_ATTR_WO
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 03/10] SCSI: fcoe: " Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-27  5:27   ` Michael Ellerman
  2018-12-21  7:54 ` [PATCH 05/10] rapidio: rio-sysfs.c: " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Tyrel Datwyler

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

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/pseries/ibmebus.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
index 5b4a56131904..84e8ec4011ba 100644
--- a/arch/powerpc/platforms/pseries/ibmebus.c
+++ b/arch/powerpc/platforms/pseries/ibmebus.c
@@ -261,8 +261,7 @@ static char *ibmebus_chomp(const char *in, size_t count)
 	return out;
 }
 
-static ssize_t ibmebus_store_probe(struct bus_type *bus,
-				   const char *buf, size_t count)
+static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	struct device_node *dn = NULL;
 	struct device *dev;
@@ -298,10 +297,9 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
 		return rc;
 	return count;
 }
-static BUS_ATTR(probe, 0200, NULL, ibmebus_store_probe);
+static BUS_ATTR_WO(probe);
 
-static ssize_t ibmebus_store_remove(struct bus_type *bus,
-				    const char *buf, size_t count)
+static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	struct device *dev;
 	char *path;
@@ -325,7 +323,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
 		return -ENODEV;
 	}
 }
-static BUS_ATTR(remove, 0200, NULL, ibmebus_store_remove);
+static BUS_ATTR_WO(remove);
 
 static struct attribute *ibmbus_bus_attrs[] = {
 	&bus_attr_probe.attr,
-- 
2.20.1


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

* [PATCH 05/10] rapidio: rio-sysfs.c: convert to use BUS_ATTR_WO
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 04/10] pseries: ibmebus.c: " Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Matt Porter, Alexandre Bounine

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

Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/rapidio/rio-sysfs.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 73e4b407f162..ad5e303dda05 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -290,8 +290,7 @@ const struct attribute_group *rio_dev_groups[] = {
 	NULL,
 };
 
-static ssize_t bus_scan_store(struct bus_type *bus, const char *buf,
-				size_t count)
+static ssize_t scan_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	long val;
 	int rc;
@@ -314,7 +313,7 @@ static ssize_t bus_scan_store(struct bus_type *bus, const char *buf,
 
 	return rc;
 }
-static BUS_ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store);
+static BUS_ATTR_WO(scan);
 
 static struct attribute *rio_bus_attrs[] = {
 	&bus_attr_scan.attr,
-- 
2.20.1


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

* [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 05/10] rapidio: rio-sysfs.c: " Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  9:28   ` Ilya Dryomov
  2018-12-21  7:54 ` [PATCH 07/10] driver core: bus: convert to use BUS_ATTR_WO and RW Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Ilya Dryomov, Sage Weil, Alex Elder, Jens Axboe

We are trying to get rid of BUS_ATTR() and the usage of that in rbd.c
can be trivially converted to use BUS_ATTR_WO and RO, so use those
macros instead.

Cc: Ilya Dryomov <idryomov@gmail.com>
Cc: Sage Weil <sage@redhat.com>
Cc: Alex Elder <elder@kernel.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/block/rbd.c | 45 +++++++++++++++++++--------------------------
 1 file changed, 19 insertions(+), 26 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 8e5140bbf241..d871d364fdcf 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -428,14 +428,13 @@ static bool single_major = true;
 module_param(single_major, bool, 0444);
 MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)");
 
-static ssize_t rbd_add(struct bus_type *bus, const char *buf,
-		       size_t count);
-static ssize_t rbd_remove(struct bus_type *bus, const char *buf,
-			  size_t count);
-static ssize_t rbd_add_single_major(struct bus_type *bus, const char *buf,
-				    size_t count);
-static ssize_t rbd_remove_single_major(struct bus_type *bus, const char *buf,
-				       size_t count);
+static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count);
+static ssize_t remove_store(struct bus_type *bus, const char *buf,
+			    size_t count);
+static ssize_t add_single_major_store(struct bus_type *bus, const char *buf,
+				      size_t count);
+static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf,
+					 size_t count);
 static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);
 
 static int rbd_dev_id_to_minor(int dev_id)
@@ -464,16 +463,16 @@ static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
 	return is_lock_owner;
 }
 
-static ssize_t rbd_supported_features_show(struct bus_type *bus, char *buf)
+static ssize_t supported_features_show(struct bus_type *bus, char *buf)
 {
 	return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED);
 }
 
-static BUS_ATTR(add, 0200, NULL, rbd_add);
-static BUS_ATTR(remove, 0200, NULL, rbd_remove);
-static BUS_ATTR(add_single_major, 0200, NULL, rbd_add_single_major);
-static BUS_ATTR(remove_single_major, 0200, NULL, rbd_remove_single_major);
-static BUS_ATTR(supported_features, 0444, rbd_supported_features_show, NULL);
+static BUS_ATTR_WO(add);
+static BUS_ATTR_WO(remove);
+static BUS_ATTR_WO(add_single_major);
+static BUS_ATTR_WO(remove_single_major);
+static BUS_ATTR_RO(supported_features);
 
 static struct attribute *rbd_bus_attrs[] = {
 	&bus_attr_add.attr,
@@ -5934,9 +5933,7 @@ static ssize_t do_rbd_add(struct bus_type *bus,
 	goto out;
 }
 
-static ssize_t rbd_add(struct bus_type *bus,
-		       const char *buf,
-		       size_t count)
+static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	if (single_major)
 		return -EINVAL;
@@ -5944,9 +5941,8 @@ static ssize_t rbd_add(struct bus_type *bus,
 	return do_rbd_add(bus, buf, count);
 }
 
-static ssize_t rbd_add_single_major(struct bus_type *bus,
-				    const char *buf,
-				    size_t count)
+static ssize_t add_single_major_store(struct bus_type *bus, const char *buf,
+				      size_t count)
 {
 	return do_rbd_add(bus, buf, count);
 }
@@ -6050,9 +6046,7 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
 	return count;
 }
 
-static ssize_t rbd_remove(struct bus_type *bus,
-			  const char *buf,
-			  size_t count)
+static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count)
 {
 	if (single_major)
 		return -EINVAL;
@@ -6060,9 +6054,8 @@ static ssize_t rbd_remove(struct bus_type *bus,
 	return do_rbd_remove(bus, buf, count);
 }
 
-static ssize_t rbd_remove_single_major(struct bus_type *bus,
-				       const char *buf,
-				       size_t count)
+static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf,
+					 size_t count)
 {
 	return do_rbd_remove(bus, buf, count);
 }
-- 
2.20.1


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

* [PATCH 07/10] driver core: bus: convert to use BUS_ATTR_WO and RW
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 08/10] Documentation: driver core: remove use of BUS_ATTR Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

We are trying to get rid of BUS_ATTR() and the usage of that in bus.c
can be trivially converted to use BUS_ATTR_WO and RW, so use those
macros instead.

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 8bfd27ec73d6..f10d56c61a46 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -233,12 +233,12 @@ static ssize_t bind_store(struct device_driver *drv, const char *buf,
 }
 static DRIVER_ATTR_WO(bind);
 
-static ssize_t show_drivers_autoprobe(struct bus_type *bus, char *buf)
+static ssize_t drivers_autoprobe_show(struct bus_type *bus, char *buf)
 {
 	return sprintf(buf, "%d\n", bus->p->drivers_autoprobe);
 }
 
-static ssize_t store_drivers_autoprobe(struct bus_type *bus,
+static ssize_t drivers_autoprobe_store(struct bus_type *bus,
 				       const char *buf, size_t count)
 {
 	if (buf[0] == '0')
@@ -248,7 +248,7 @@ static ssize_t store_drivers_autoprobe(struct bus_type *bus,
 	return count;
 }
 
-static ssize_t store_drivers_probe(struct bus_type *bus,
+static ssize_t drivers_probe_store(struct bus_type *bus,
 				   const char *buf, size_t count)
 {
 	struct device *dev;
@@ -583,9 +583,8 @@ static void remove_bind_files(struct device_driver *drv)
 	driver_remove_file(drv, &driver_attr_unbind);
 }
 
-static BUS_ATTR(drivers_probe, S_IWUSR, NULL, store_drivers_probe);
-static BUS_ATTR(drivers_autoprobe, S_IWUSR | S_IRUGO,
-		show_drivers_autoprobe, store_drivers_autoprobe);
+static BUS_ATTR_WO(drivers_probe);
+static BUS_ATTR_RW(drivers_autoprobe);
 
 static int add_probe_files(struct bus_type *bus)
 {
-- 
2.20.1


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

* [PATCH 08/10] Documentation: driver core: remove use of BUS_ATTR
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 07/10] driver core: bus: convert to use BUS_ATTR_WO and RW Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 09/10] driver core: drop use of BUS_ATTR() Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 10/10] driver core: remove BUS_ATTR() Greg Kroah-Hartman
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

We are getting rid of the "raw" BUS_ATTR() macro, so fix up the
documentation to not refer to it anymore.

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 Documentation/driver-model/bus.txt  | 8 ++++----
 Documentation/filesystems/sysfs.txt | 4 +++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/Documentation/driver-model/bus.txt b/Documentation/driver-model/bus.txt
index b577a45b93ea..c247b488a567 100644
--- a/Documentation/driver-model/bus.txt
+++ b/Documentation/driver-model/bus.txt
@@ -124,11 +124,11 @@ struct bus_attribute {
 	ssize_t (*store)(struct bus_type *, const char * buf, size_t count);
 };
 
-Bus drivers can export attributes using the BUS_ATTR macro that works
-similarly to the DEVICE_ATTR macro for devices. For example, a definition 
-like this:
+Bus drivers can export attributes using the BUS_ATTR_RW macro that works
+similarly to the DEVICE_ATTR_RW macro for devices. For example, a
+definition like this:
 
-static BUS_ATTR(debug,0644,show_debug,store_debug);
+static BUS_ATTR_RW(debug);
 
 is equivalent to declaring:
 
diff --git a/Documentation/filesystems/sysfs.txt b/Documentation/filesystems/sysfs.txt
index a1426cabcef1..41411b0c60a3 100644
--- a/Documentation/filesystems/sysfs.txt
+++ b/Documentation/filesystems/sysfs.txt
@@ -344,7 +344,9 @@ struct bus_attribute {
 
 Declaring:
 
-BUS_ATTR(_name, _mode, _show, _store)
+static BUS_ATTR_RW(name);
+static BUS_ATTR_RO(name);
+static BUS_ATTR_WO(name);
 
 Creation/Removal:
 
-- 
2.20.1


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

* [PATCH 09/10] driver core: drop use of BUS_ATTR()
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 08/10] Documentation: driver core: remove use of BUS_ATTR Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  2018-12-21  7:54 ` [PATCH 10/10] driver core: remove BUS_ATTR() Greg Kroah-Hartman
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

We are trying to get rid of BUS_ATTR() so drop the last user of it from
the tree.  We had to "open code" it in order to prevent a function name
conflict due to the use of DEVICE_ATTR_WO() earlier in the file :(

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index f10d56c61a46..575bd6d752bd 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -830,7 +830,14 @@ static ssize_t bus_uevent_store(struct bus_type *bus,
 	kobject_synth_uevent(&bus->p->subsys.kobj, buf, count);
 	return count;
 }
-static BUS_ATTR(uevent, S_IWUSR, NULL, bus_uevent_store);
+/*
+ * "open code" the old BUS_ATTR() macro here.  We want to use BUS_ATTR_WO()
+ * here, but can not use it as earlier in the file we have
+ * DEVICE_ATTR_WO(uevent), which would cause a clash with the with the store
+ * function name.
+ */
+static struct bus_attribute bus_attr_uevent = __ATTR(uevent, S_IWUSR, NULL,
+						     bus_uevent_store);
 
 /**
  * bus_register - register a driver-core subsystem
-- 
2.20.1


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

* [PATCH 10/10] driver core: remove BUS_ATTR()
  2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2018-12-21  7:54 ` [PATCH 09/10] driver core: drop use of BUS_ATTR() Greg Kroah-Hartman
@ 2018-12-21  7:54 ` Greg Kroah-Hartman
  9 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-21  7:54 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

There are now no in-kernel users of BUS_ATTR() so drop it from device.h

Everyone should use BUS_ATTR_RO/RW/WO() from now on.

Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 include/linux/device.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/device.h b/include/linux/device.h
index 1b25c7a43f4c..1e8ae731fb97 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -49,8 +49,6 @@ struct bus_attribute {
 	ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
 };
 
-#define BUS_ATTR(_name, _mode, _show, _store)	\
-	struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
 #define BUS_ATTR_RW(_name) \
 	struct bus_attribute bus_attr_##_name = __ATTR_RW(_name)
 #define BUS_ATTR_RO(_name) \
-- 
2.20.1


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

* Re: [PATCH 03/10] SCSI: fcoe: convert to use BUS_ATTR_WO
  2018-12-21  7:54 ` [PATCH 03/10] SCSI: fcoe: " Greg Kroah-Hartman
@ 2018-12-21  8:00   ` Johannes Thumshirn
  2018-12-21 15:29   ` James Bottomley
  1 sibling, 0 replies; 17+ messages in thread
From: Johannes Thumshirn @ 2018-12-21  8:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel; +Cc: James E.J. Bottomley, Martin K. Petersen

Looks good,

Acked-by: Johannes Thumshirn <jth@kernel.org>



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

* Re: [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO
  2018-12-21  7:54 ` [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO Greg Kroah-Hartman
@ 2018-12-21  9:28   ` Ilya Dryomov
  0 siblings, 0 replies; 17+ messages in thread
From: Ilya Dryomov @ 2018-12-21  9:28 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Sage Weil, Alex Elder, Jens Axboe

On Fri, Dec 21, 2018 at 8:55 AM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> We are trying to get rid of BUS_ATTR() and the usage of that in rbd.c
> can be trivially converted to use BUS_ATTR_WO and RO, so use those
> macros instead.
>
> Cc: Ilya Dryomov <idryomov@gmail.com>
> Cc: Sage Weil <sage@redhat.com>
> Cc: Alex Elder <elder@kernel.org>
> Cc: Jens Axboe <axboe@kernel.dk>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/block/rbd.c | 45 +++++++++++++++++++--------------------------
>  1 file changed, 19 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 8e5140bbf241..d871d364fdcf 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -428,14 +428,13 @@ static bool single_major = true;
>  module_param(single_major, bool, 0444);
>  MODULE_PARM_DESC(single_major, "Use a single major number for all rbd devices (default: true)");
>
> -static ssize_t rbd_add(struct bus_type *bus, const char *buf,
> -                      size_t count);
> -static ssize_t rbd_remove(struct bus_type *bus, const char *buf,
> -                         size_t count);
> -static ssize_t rbd_add_single_major(struct bus_type *bus, const char *buf,
> -                                   size_t count);
> -static ssize_t rbd_remove_single_major(struct bus_type *bus, const char *buf,
> -                                      size_t count);
> +static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count);
> +static ssize_t remove_store(struct bus_type *bus, const char *buf,
> +                           size_t count);
> +static ssize_t add_single_major_store(struct bus_type *bus, const char *buf,
> +                                     size_t count);
> +static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf,
> +                                        size_t count);
>  static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);
>
>  static int rbd_dev_id_to_minor(int dev_id)
> @@ -464,16 +463,16 @@ static bool rbd_is_lock_owner(struct rbd_device *rbd_dev)
>         return is_lock_owner;
>  }
>
> -static ssize_t rbd_supported_features_show(struct bus_type *bus, char *buf)
> +static ssize_t supported_features_show(struct bus_type *bus, char *buf)
>  {
>         return sprintf(buf, "0x%llx\n", RBD_FEATURES_SUPPORTED);
>  }
>
> -static BUS_ATTR(add, 0200, NULL, rbd_add);
> -static BUS_ATTR(remove, 0200, NULL, rbd_remove);
> -static BUS_ATTR(add_single_major, 0200, NULL, rbd_add_single_major);
> -static BUS_ATTR(remove_single_major, 0200, NULL, rbd_remove_single_major);
> -static BUS_ATTR(supported_features, 0444, rbd_supported_features_show, NULL);
> +static BUS_ATTR_WO(add);
> +static BUS_ATTR_WO(remove);
> +static BUS_ATTR_WO(add_single_major);
> +static BUS_ATTR_WO(remove_single_major);
> +static BUS_ATTR_RO(supported_features);
>
>  static struct attribute *rbd_bus_attrs[] = {
>         &bus_attr_add.attr,
> @@ -5934,9 +5933,7 @@ static ssize_t do_rbd_add(struct bus_type *bus,
>         goto out;
>  }
>
> -static ssize_t rbd_add(struct bus_type *bus,
> -                      const char *buf,
> -                      size_t count)
> +static ssize_t add_store(struct bus_type *bus, const char *buf, size_t count)
>  {
>         if (single_major)
>                 return -EINVAL;
> @@ -5944,9 +5941,8 @@ static ssize_t rbd_add(struct bus_type *bus,
>         return do_rbd_add(bus, buf, count);
>  }
>
> -static ssize_t rbd_add_single_major(struct bus_type *bus,
> -                                   const char *buf,
> -                                   size_t count)
> +static ssize_t add_single_major_store(struct bus_type *bus, const char *buf,
> +                                     size_t count)
>  {
>         return do_rbd_add(bus, buf, count);
>  }
> @@ -6050,9 +6046,7 @@ static ssize_t do_rbd_remove(struct bus_type *bus,
>         return count;
>  }
>
> -static ssize_t rbd_remove(struct bus_type *bus,
> -                         const char *buf,
> -                         size_t count)
> +static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count)
>  {
>         if (single_major)
>                 return -EINVAL;
> @@ -6060,9 +6054,8 @@ static ssize_t rbd_remove(struct bus_type *bus,
>         return do_rbd_remove(bus, buf, count);
>  }
>
> -static ssize_t rbd_remove_single_major(struct bus_type *bus,
> -                                      const char *buf,
> -                                      size_t count)
> +static ssize_t remove_single_major_store(struct bus_type *bus, const char *buf,
> +                                        size_t count)
>  {
>         return do_rbd_remove(bus, buf, count);
>  }

Acked-by: Ilya Dryomov <idryomov@gmail.com>

Thanks,

                Ilya

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

* Re: [PATCH 03/10] SCSI: fcoe: convert to use BUS_ATTR_WO
  2018-12-21  7:54 ` [PATCH 03/10] SCSI: fcoe: " Greg Kroah-Hartman
  2018-12-21  8:00   ` Johannes Thumshirn
@ 2018-12-21 15:29   ` James Bottomley
  2018-12-28 12:50     ` Hannes Reinecke
  1 sibling, 1 reply; 17+ messages in thread
From: James Bottomley @ 2018-12-21 15:29 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Johannes Thumshirn, Martin K. Petersen, linux-scsi

[scsi list cc added]
On Fri, 2018-12-21 at 08:54 +0100, Greg Kroah-Hartman wrote:
> 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.
> 
> At the same time remove a unneeded EXPORT_SYMBOL() marking for the
> sysfs callback function we are renaming, no idea of how that got into
> the tree...

The EXPORT_SYMBOL removal is fine, but

[...]
> --- a/include/scsi/libfcoe.h
> +++ b/include/scsi/libfcoe.h
> @@ -405,10 +405,8 @@ int fcoe_transport_attach(struct fcoe_transport
> *ft);
>  int fcoe_transport_detach(struct fcoe_transport *ft);
> 
>  /* sysfs store handler for ctrl_control interface */
> -ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
> -			       const char *buf, size_t count);
> -ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
> -				const char *buf, size_t count);
> +ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
> size_t count);
> +ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
> size_t count);

You're really damaging our prefix namespace here.  It looks like the
ctlr_ name is a farly recent addition for sysfs (only myra/b) use it in
SCSI but it's inviting symbol clashes.

Since the XXX_ATTR_RO seem to be defined with only local file usage in
mind, I think we need static functions to shim the problem, like below
(provided this is the only instance, because if it isn't, you probably
need a XXX_ATTR_WO_prefix() macro)

James

---

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index 5c8310bade61..88e5c26ce381 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -671,8 +671,20 @@ 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 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_create);
+static BUS_ATTR_WO(ctlr_destroy);
 
 static struct attribute *fcoe_bus_attrs[] = {
 	&bus_attr_ctlr_create.attr,


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

* Re: [PATCH 04/10] pseries: ibmebus.c: convert to use BUS_ATTR_WO
  2018-12-21  7:54 ` [PATCH 04/10] pseries: ibmebus.c: " Greg Kroah-Hartman
@ 2018-12-27  5:27   ` Michael Ellerman
  0 siblings, 0 replies; 17+ messages in thread
From: Michael Ellerman @ 2018-12-27  5:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Tyrel Datwyler

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> We are trying to get rid of BUS_ATTR() and the usage of that in
> ibmebus.c can be trivially converted to use BUS_ATTR_WO(), so use that
> instead.
>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/powerpc/platforms/pseries/ibmebus.c | 10 ++++------
>  1 file changed, 4 insertions(+), 6 deletions(-)

LGTM.

Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)

cheers

> diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
> index 5b4a56131904..84e8ec4011ba 100644
> --- a/arch/powerpc/platforms/pseries/ibmebus.c
> +++ b/arch/powerpc/platforms/pseries/ibmebus.c
> @@ -261,8 +261,7 @@ static char *ibmebus_chomp(const char *in, size_t count)
>  	return out;
>  }
>  
> -static ssize_t ibmebus_store_probe(struct bus_type *bus,
> -				   const char *buf, size_t count)
> +static ssize_t probe_store(struct bus_type *bus, const char *buf, size_t count)
>  {
>  	struct device_node *dn = NULL;
>  	struct device *dev;
> @@ -298,10 +297,9 @@ static ssize_t ibmebus_store_probe(struct bus_type *bus,
>  		return rc;
>  	return count;
>  }
> -static BUS_ATTR(probe, 0200, NULL, ibmebus_store_probe);
> +static BUS_ATTR_WO(probe);
>  
> -static ssize_t ibmebus_store_remove(struct bus_type *bus,
> -				    const char *buf, size_t count)
> +static ssize_t remove_store(struct bus_type *bus, const char *buf, size_t count)
>  {
>  	struct device *dev;
>  	char *path;
> @@ -325,7 +323,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
>  		return -ENODEV;
>  	}
>  }
> -static BUS_ATTR(remove, 0200, NULL, ibmebus_store_remove);
> +static BUS_ATTR_WO(remove);
>  
>  static struct attribute *ibmbus_bus_attrs[] = {
>  	&bus_attr_probe.attr,
> -- 
> 2.20.1

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

* Re: [PATCH 03/10] SCSI: fcoe: convert to use BUS_ATTR_WO
  2018-12-21 15:29   ` James Bottomley
@ 2018-12-28 12:50     ` Hannes Reinecke
  2019-01-22 14:22       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 17+ messages in thread
From: Hannes Reinecke @ 2018-12-28 12:50 UTC (permalink / raw)
  To: James Bottomley, Greg Kroah-Hartman, linux-kernel
  Cc: Johannes Thumshirn, Martin K. Petersen, linux-scsi

On 12/21/18 4:29 PM, James Bottomley wrote:
> [scsi list cc added]
> On Fri, 2018-12-21 at 08:54 +0100, Greg Kroah-Hartman wrote:
>> 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.
>>
>> At the same time remove a unneeded EXPORT_SYMBOL() marking for the
>> sysfs callback function we are renaming, no idea of how that got into
>> the tree...
> 
> The EXPORT_SYMBOL removal is fine, but
> 
> [...]
>> --- a/include/scsi/libfcoe.h
>> +++ b/include/scsi/libfcoe.h
>> @@ -405,10 +405,8 @@ int fcoe_transport_attach(struct fcoe_transport
>> *ft);
>>   int fcoe_transport_detach(struct fcoe_transport *ft);
>>
>>   /* sysfs store handler for ctrl_control interface */
>> -ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
>> -			       const char *buf, size_t count);
>> -ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
>> -				const char *buf, size_t count);
>> +ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
>> size_t count);
>> +ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
>> size_t count);
> 
> You're really damaging our prefix namespace here.  It looks like the
> ctlr_ name is a farly recent addition for sysfs (only myra/b) use it in
> SCSI but it's inviting symbol clashes.
> 
Hmm. I was under the impression that all sysfs functions from myrb/myrs 
are local, hence I would not need to prefix them.
If this isn't the case I definitely will be fixing them.

But in any case, if possible any sysfs function should be local to the 
driver; no-one else should ever attempt to use them.
And we should be making it so if that's not the case.

Cheers,

Hannes

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

* Re: [PATCH 03/10] SCSI: fcoe: convert to use BUS_ATTR_WO
  2018-12-28 12:50     ` Hannes Reinecke
@ 2019-01-22 14:22       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 17+ messages in thread
From: Greg Kroah-Hartman @ 2019-01-22 14:22 UTC (permalink / raw)
  To: Hannes Reinecke
  Cc: James Bottomley, linux-kernel, Johannes Thumshirn,
	Martin K. Petersen, linux-scsi

On Fri, Dec 28, 2018 at 01:50:53PM +0100, Hannes Reinecke wrote:
> On 12/21/18 4:29 PM, James Bottomley wrote:
> > [scsi list cc added]
> > On Fri, 2018-12-21 at 08:54 +0100, Greg Kroah-Hartman wrote:
> > > 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.
> > > 
> > > At the same time remove a unneeded EXPORT_SYMBOL() marking for the
> > > sysfs callback function we are renaming, no idea of how that got into
> > > the tree...
> > 
> > The EXPORT_SYMBOL removal is fine, but
> > 
> > [...]
> > > --- a/include/scsi/libfcoe.h
> > > +++ b/include/scsi/libfcoe.h
> > > @@ -405,10 +405,8 @@ int fcoe_transport_attach(struct fcoe_transport
> > > *ft);
> > >   int fcoe_transport_detach(struct fcoe_transport *ft);
> > > 
> > >   /* sysfs store handler for ctrl_control interface */
> > > -ssize_t fcoe_ctlr_create_store(struct bus_type *bus,
> > > -			       const char *buf, size_t count);
> > > -ssize_t fcoe_ctlr_destroy_store(struct bus_type *bus,
> > > -				const char *buf, size_t count);
> > > +ssize_t ctlr_create_store(struct bus_type *bus, const char *buf,
> > > size_t count);
> > > +ssize_t ctlr_destroy_store(struct bus_type *bus, const char *buf,
> > > size_t count);
> > 
> > You're really damaging our prefix namespace here.  It looks like the
> > ctlr_ name is a farly recent addition for sysfs (only myra/b) use it in
> > SCSI but it's inviting symbol clashes.
> > 
> Hmm. I was under the impression that all sysfs functions from myrb/myrs are
> local, hence I would not need to prefix them.
> If this isn't the case I definitely will be fixing them.
> 
> But in any case, if possible any sysfs function should be local to the
> driver; no-one else should ever attempt to use them.
> And we should be making it so if that's not the case.

This is all in the same "driver", just that the driver is spread out
over multiple files.

James, thanks for the fixup, I'll go respin this and break this up into
two patches and resend in a bit.

thanks,

greg k-h

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

end of thread, other threads:[~2019-01-22 14:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-21  7:54 [PATCH 00/10] Driver core: remove BUS_ATTR() Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 01/10] PCI: pci.c: convert to use BUS_ATTR_RW Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 02/10] PCI: pci-sysfs.c: convert to use BUS_ATTR_WO Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 03/10] SCSI: fcoe: " Greg Kroah-Hartman
2018-12-21  8:00   ` Johannes Thumshirn
2018-12-21 15:29   ` James Bottomley
2018-12-28 12:50     ` Hannes Reinecke
2019-01-22 14:22       ` Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 04/10] pseries: ibmebus.c: " Greg Kroah-Hartman
2018-12-27  5:27   ` Michael Ellerman
2018-12-21  7:54 ` [PATCH 05/10] rapidio: rio-sysfs.c: " Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 06/10] block: rbd: convert to use BUS_ATTR_WO and RO Greg Kroah-Hartman
2018-12-21  9:28   ` Ilya Dryomov
2018-12-21  7:54 ` [PATCH 07/10] driver core: bus: convert to use BUS_ATTR_WO and RW Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 08/10] Documentation: driver core: remove use of BUS_ATTR Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 09/10] driver core: drop use of BUS_ATTR() Greg Kroah-Hartman
2018-12-21  7:54 ` [PATCH 10/10] driver core: remove BUS_ATTR() Greg Kroah-Hartman

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).