linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/11] driver core bus cleanup to use dev_groups
@ 2013-10-07  6:55 Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
                   ` (10 more replies)
  0 siblings, 11 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel

Here's a series to start cleaning up the different bus code to not use
'dev_attr' and instead, use 'dev_groups' as dev_attr will be removed
soon.

greg k-h

---
 drivers/bcma/main.c                        |   23 ++++++---
 drivers/hsi/hsi.c                          |   10 ++-
 drivers/mmc/core/bus.c                     |   12 ++--
 drivers/mmc/core/sdio_bus.c                |   21 ++++----
 drivers/net/phy/mdio_bus.c                 |   10 ++-
 drivers/pci/pci-driver.c                   |    2 
 drivers/pci/pci-sysfs.c                    |   73 ++++++++++++++++++-----------
 drivers/pci/pci.h                          |    2 
 drivers/pcmcia/ds.c                        |   65 +++++++++++++++----------
 drivers/pnp/base.h                         |    2 
 drivers/pnp/driver.c                       |    2 
 drivers/pnp/interface.c                    |   43 ++++++++++-------
 drivers/rapidio/rio-driver.c               |    2 
 drivers/rapidio/rio-sysfs.c                |   38 +++++++++------
 drivers/rapidio/rio.h                      |    2 
 drivers/ssb/main.c                         |   25 +++++----
 drivers/uwb/umc-bus.c                      |   13 +++--
 drivers/xen/xenbus/xenbus_probe.c          |   24 +++++++--
 drivers/xen/xenbus/xenbus_probe.h          |    2 
 drivers/xen/xenbus/xenbus_probe_backend.c  |    2 
 drivers/xen/xenbus/xenbus_probe_frontend.c |    2 
 21 files changed, 231 insertions(+), 144 deletions(-)



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

* [PATCH 01/11] pci: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07 18:21   ` Bjorn Helgaas
  2013-10-07 21:18   ` Bjorn Helgaas
  2013-10-07  6:55 ` [PATCH 02/11] mdio_bus: " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  10 siblings, 2 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bjorn Helgaas, linux-pci

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the PCI bus code to use the
correct field.

Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: <linux-pci@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Bjorn, I can take this through my driver-core tree if you like, just let
me know what would be the easiest for you.

 drivers/pci/pci-driver.c |  2 +-
 drivers/pci/pci-sysfs.c  | 73 ++++++++++++++++++++++++++++++------------------
 drivers/pci/pci.h        |  2 +-
 3 files changed, 48 insertions(+), 29 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 38f3c01..9f85960 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1319,7 +1319,7 @@ struct bus_type pci_bus_type = {
 	.probe		= pci_device_probe,
 	.remove		= pci_device_remove,
 	.shutdown	= pci_device_shutdown,
-	.dev_attrs	= pci_dev_attrs,
+	.dev_groups	= pci_dev_groups,
 	.bus_groups	= pci_bus_groups,
 	.drv_groups	= pci_drv_groups,
 	.pm		= PCI_PM_OPS_PTR,
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index d8eb880..618c060 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -42,7 +42,8 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf)				\
 									\
 	pdev = to_pci_dev (dev);					\
 	return sprintf (buf, format_string, pdev->field);		\
-}
+}									\
+static DEVICE_ATTR_RO(field)
 
 pci_config_attr(vendor, "0x%04x\n");
 pci_config_attr(device, "0x%04x\n");
@@ -73,6 +74,7 @@ static ssize_t broken_parity_status_store(struct device *dev,
 
 	return count;
 }
+static DEVICE_ATTR_RW(broken_parity_status);
 
 static ssize_t local_cpus_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
@@ -91,7 +93,7 @@ static ssize_t local_cpus_show(struct device *dev,
 	buf[len] = '\0';
 	return len;
 }
-
+static DEVICE_ATTR_RO(local_cpus);
 
 static ssize_t local_cpulist_show(struct device *dev,
 			struct device_attribute *attr, char *buf)
@@ -110,6 +112,7 @@ static ssize_t local_cpulist_show(struct device *dev,
 	buf[len] = '\0';
 	return len;
 }
+static DEVICE_ATTR_RO(local_cpulist);
 
 /*
  * PCI Bus Class Devices
@@ -170,6 +173,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
 	}
 	return (str - buf);
 }
+static DEVICE_ATTR_RO(resource);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -181,10 +185,11 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 		       (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
 		       (u8)(pci_dev->class));
 }
+static DEVICE_ATTR_RO(modalias);
 
-static ssize_t is_enabled_store(struct device *dev,
-				struct device_attribute *attr, const char *buf,
-				size_t count)
+static ssize_t enabled_store(struct device *dev,
+			     struct device_attribute *attr, const char *buf,
+			     size_t count)
 {
 	struct pci_dev *pdev = to_pci_dev(dev);
 	unsigned long val;
@@ -208,14 +213,15 @@ static ssize_t is_enabled_store(struct device *dev,
 	return result < 0 ? result : count;
 }
 
-static ssize_t is_enabled_show(struct device *dev,
-			       struct device_attribute *attr, char *buf)
+static ssize_t enabled_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct pci_dev *pdev;
 
 	pdev = to_pci_dev (dev);
 	return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt));
 }
+static DEVICE_ATTR_RW(enabled);
 
 #ifdef CONFIG_NUMA
 static ssize_t
@@ -223,6 +229,7 @@ numa_node_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	return sprintf (buf, "%d\n", dev->numa_node);
 }
+static DEVICE_ATTR_RO(numa_node);
 #endif
 
 static ssize_t
@@ -232,6 +239,7 @@ dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf)
 
 	return sprintf (buf, "%d\n", fls64(pdev->dma_mask));
 }
+static DEVICE_ATTR_RO(dma_mask_bits);
 
 static ssize_t
 consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
@@ -239,6 +247,7 @@ consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
 {
 	return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask));
 }
+static DEVICE_ATTR_RO(consistent_dma_mask_bits);
 
 static ssize_t
 msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
@@ -283,6 +292,7 @@ msi_bus_store(struct device *dev, struct device_attribute *attr,
 
 	return count;
 }
+static DEVICE_ATTR_RW(msi_bus);
 
 static DEFINE_MUTEX(pci_remove_rescan_mutex);
 static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
@@ -414,6 +424,7 @@ static ssize_t d3cold_allowed_show(struct device *dev,
 	struct pci_dev *pdev = to_pci_dev(dev);
 	return sprintf (buf, "%u\n", pdev->d3cold_allowed);
 }
+static DEVICE_ATTR_RW(d3cold_allowed);
 #endif
 
 #ifdef CONFIG_PCI_IOV
@@ -499,30 +510,38 @@ static struct device_attribute sriov_numvfs_attr =
 		       sriov_numvfs_show, sriov_numvfs_store);
 #endif /* CONFIG_PCI_IOV */
 
-struct device_attribute pci_dev_attrs[] = {
-	__ATTR_RO(resource),
-	__ATTR_RO(vendor),
-	__ATTR_RO(device),
-	__ATTR_RO(subsystem_vendor),
-	__ATTR_RO(subsystem_device),
-	__ATTR_RO(class),
-	__ATTR_RO(irq),
-	__ATTR_RO(local_cpus),
-	__ATTR_RO(local_cpulist),
-	__ATTR_RO(modalias),
+struct attribute *pci_dev_attrs[] = {
+	&dev_attr_resource.attr,
+	&dev_attr_vendor.attr,
+	&dev_attr_device.attr,
+	&dev_attr_subsystem_vendor.attr,
+	&dev_attr_subsystem_device.attr,
+	&dev_attr_class.attr,
+	&dev_attr_irq.attr,
+	&dev_attr_local_cpus.attr,
+	&dev_attr_local_cpulist.attr,
+	&dev_attr_modalias.attr,
 #ifdef CONFIG_NUMA
-	__ATTR_RO(numa_node),
+	&dev_attr_numa_node.attr,
 #endif
-	__ATTR_RO(dma_mask_bits),
-	__ATTR_RO(consistent_dma_mask_bits),
-	__ATTR(enable, 0600, is_enabled_show, is_enabled_store),
-	__ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
-		broken_parity_status_show,broken_parity_status_store),
-	__ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
+	&dev_attr_dma_mask_bits.attr,
+	&dev_attr_consistent_dma_mask_bits.attr,
+	&dev_attr_enabled.attr,
+	&dev_attr_broken_parity_status.attr,
+	&dev_attr_msi_bus.attr,
 #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
-	__ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store),
+	&dev_attr_d3cold_allowed.attr,
 #endif
-	__ATTR_NULL,
+	NULL,
+};
+
+static const struct attribute_group pci_dev_group = {
+	.attrs = pci_dev_attrs,
+};
+
+const struct attribute_group *pci_dev_groups[] = {
+	&pci_dev_group,
+	NULL,
 };
 
 static struct attribute *pcibus_attrs[] = {
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 607be58..9c91ecc 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -153,7 +153,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
 	return (dev->no_d1d2 || parent_dstates);
 
 }
-extern struct device_attribute pci_dev_attrs[];
+extern const struct attribute_group *pci_dev_groups[];
 extern const struct attribute_group *pcibus_groups[];
 extern struct device_type pci_dev_type;
 extern const struct attribute_group *pci_bus_groups[];
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 02/11] mdio_bus: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 03/11] PNP: " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, David S. Miller, Mark Brown, Nick Bowler, netdev

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the MDIO bus code to use the
correct field.

Cc: David S. Miller <davem@davemloft.net>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Nick Bowler <nbowler@elliptictech.com>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

David, I can take this through my driver-core tree if you like, just let
me know what would be the easiest for you.

 drivers/net/phy/mdio_bus.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index dc92097..5617876 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -438,17 +438,19 @@ phy_id_show(struct device *dev, struct device_attribute *attr, char *buf)
 
 	return sprintf(buf, "0x%.8lx\n", (unsigned long)phydev->phy_id);
 }
+static DEVICE_ATTR_RO(phy_id);
 
-static struct device_attribute mdio_dev_attrs[] = {
-	__ATTR_RO(phy_id),
-	__ATTR_NULL
+static struct attribute *mdio_dev_attrs[] = {
+	&dev_attr_phy_id.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(mdio_dev);
 
 struct bus_type mdio_bus_type = {
 	.name		= "mdio_bus",
 	.match		= mdio_bus_match,
 	.pm		= MDIO_BUS_PM_OPS,
-	.dev_attrs	= mdio_dev_attrs,
+	.dev_groups	= mdio_dev_groups,
 };
 EXPORT_SYMBOL(mdio_bus_type);
 
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 03/11] PNP: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 02/11] mdio_bus: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07 21:27   ` Rafael J. Wysocki
  2013-10-07  6:55 ` [PATCH 04/11] MMC: " Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki, Bjorn Helgaas

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the PNP bus code to use the
correct field.

Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Rafael, I can take this through my driver-core tree if you like, just let
me know what would be the easiest for you.

 drivers/pnp/base.h      |  2 +-
 drivers/pnp/driver.c    |  2 +-
 drivers/pnp/interface.c | 43 ++++++++++++++++++++++++++-----------------
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
index ffd53e3..c8873b0 100644
--- a/drivers/pnp/base.h
+++ b/drivers/pnp/base.h
@@ -4,7 +4,7 @@
  */
 
 extern spinlock_t pnp_lock;
-extern struct device_attribute pnp_interface_attrs[];
+extern const struct attribute_group *pnp_dev_groups[];
 void *pnp_alloc(long size);
 
 int pnp_register_protocol(struct pnp_protocol *protocol);
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index a39ee38..6936e0a 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -246,7 +246,7 @@ struct bus_type pnp_bus_type = {
 	.remove  = pnp_device_remove,
 	.shutdown = pnp_device_shutdown,
 	.pm	 = &pnp_bus_dev_pm_ops,
-	.dev_attrs = pnp_interface_attrs,
+	.dev_groups = pnp_dev_groups,
 };
 
 int pnp_register_driver(struct pnp_driver *drv)
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index 0c20131..e6c403b 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -203,8 +203,8 @@ static void pnp_print_option(pnp_info_buffer_t * buffer, char *space,
 	}
 }
 
-static ssize_t pnp_show_options(struct device *dmdev,
-				struct device_attribute *attr, char *buf)
+static ssize_t options_show(struct device *dmdev, struct device_attribute *attr,
+			    char *buf)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
 	pnp_info_buffer_t *buffer;
@@ -241,10 +241,10 @@ static ssize_t pnp_show_options(struct device *dmdev,
 	kfree(buffer);
 	return ret;
 }
+static DEVICE_ATTR_RO(options);
 
-static ssize_t pnp_show_current_resources(struct device *dmdev,
-					  struct device_attribute *attr,
-					  char *buf)
+static ssize_t resources_show(struct device *dmdev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
 	pnp_info_buffer_t *buffer;
@@ -331,9 +331,9 @@ static char *pnp_get_resource_value(char *buf,
 	return buf;
 }
 
-static ssize_t pnp_set_current_resources(struct device *dmdev,
-					 struct device_attribute *attr,
-					 const char *ubuf, size_t count)
+static ssize_t resources_store(struct device *dmdev,
+			       struct device_attribute *attr, const char *ubuf,
+			       size_t count)
 {
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
 	char *buf = (void *)ubuf;
@@ -434,9 +434,10 @@ done:
 		return retval;
 	return count;
 }
+static DEVICE_ATTR_RW(resources);
 
-static ssize_t pnp_show_current_ids(struct device *dmdev,
-				    struct device_attribute *attr, char *buf)
+static ssize_t id_show(struct device *dmdev, struct device_attribute *attr,
+		       char *buf)
 {
 	char *str = buf;
 	struct pnp_dev *dev = to_pnp_dev(dmdev);
@@ -448,12 +449,20 @@ static ssize_t pnp_show_current_ids(struct device *dmdev,
 	}
 	return (str - buf);
 }
+static DEVICE_ATTR_RO(id);
 
-struct device_attribute pnp_interface_attrs[] = {
-	__ATTR(resources, S_IRUGO | S_IWUSR,
-		   pnp_show_current_resources,
-		   pnp_set_current_resources),
-	__ATTR(options, S_IRUGO, pnp_show_options, NULL),
-	__ATTR(id, S_IRUGO, pnp_show_current_ids, NULL),
-	__ATTR_NULL,
+static struct attribute *pnp_dev_attrs[] = {
+	&dev_attr_resources.attr,
+	&dev_attr_options.attr,
+	&dev_attr_id.attr,
+	NULL,
+};
+
+static const struct attribute_group pnp_dev_group = {
+	.attrs = pnp_dev_attrs,
+};
+
+const struct attribute_group *pnp_dev_groups[] = {
+	&pnp_dev_group,
+	NULL,
 };
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 04/11] MMC: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 03/11] PNP: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 05/11] uwb: " Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Chris Ball, Ulf Hansson, Konstantin Dorfman,
	Seungwon Jeon, linux-mmc

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the MMC bus code to use the
correct field.

Cc: Chris Ball <cjb@laptop.org>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: Konstantin Dorfman <kdorfman@codeaurora.org>
Cc: Seungwon Jeon <tgih.jun@samsung.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Chris, I can take this through my driver-core tree if you like, just let
me know what would be the easiest for you.

 drivers/mmc/core/bus.c      | 12 +++++++-----
 drivers/mmc/core/sdio_bus.c | 21 ++++++++++++---------
 2 files changed, 19 insertions(+), 14 deletions(-)

diff --git a/drivers/mmc/core/bus.c b/drivers/mmc/core/bus.c
index 704bf66..3e227bd 100644
--- a/drivers/mmc/core/bus.c
+++ b/drivers/mmc/core/bus.c
@@ -27,7 +27,7 @@
 
 #define to_mmc_driver(d)	container_of(d, struct mmc_driver, drv)
 
-static ssize_t mmc_type_show(struct device *dev,
+static ssize_t type_show(struct device *dev,
 	struct device_attribute *attr, char *buf)
 {
 	struct mmc_card *card = mmc_dev_to_card(dev);
@@ -45,11 +45,13 @@ static ssize_t mmc_type_show(struct device *dev,
 		return -EFAULT;
 	}
 }
+static DEVICE_ATTR_RO(type);
 
-static struct device_attribute mmc_dev_attrs[] = {
-	__ATTR(type, S_IRUGO, mmc_type_show, NULL),
-	__ATTR_NULL,
+static struct attribute *mmc_dev_attrs[] = {
+	&dev_attr_type.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(mmc_dev);
 
 /*
  * This currently matches any MMC driver to any MMC card - drivers
@@ -218,7 +220,7 @@ static const struct dev_pm_ops mmc_bus_pm_ops = {
 
 static struct bus_type mmc_bus_type = {
 	.name		= "mmc",
-	.dev_attrs	= mmc_dev_attrs,
+	.dev_groups	= mmc_dev_groups,
 	.match		= mmc_bus_match,
 	.uevent		= mmc_bus_uevent,
 	.probe		= mmc_bus_probe,
diff --git a/drivers/mmc/core/sdio_bus.c b/drivers/mmc/core/sdio_bus.c
index 6d67492..ef89565 100644
--- a/drivers/mmc/core/sdio_bus.c
+++ b/drivers/mmc/core/sdio_bus.c
@@ -34,7 +34,8 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf)				\
 									\
 	func = dev_to_sdio_func (dev);					\
 	return sprintf (buf, format_string, func->field);		\
-}
+}									\
+static DEVICE_ATTR_RO(field)
 
 sdio_config_attr(class, "0x%02x\n");
 sdio_config_attr(vendor, "0x%04x\n");
@@ -47,14 +48,16 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "sdio:c%02Xv%04Xd%04X\n",
 			func->class, func->vendor, func->device);
 }
-
-static struct device_attribute sdio_dev_attrs[] = {
-	__ATTR_RO(class),
-	__ATTR_RO(vendor),
-	__ATTR_RO(device),
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static DEVICE_ATTR_RO(modalias);
+
+static struct attribute *sdio_dev_attrs[] = {
+	&dev_attr_class.attr,
+	&dev_attr_vendor.attr,
+	&dev_attr_device.attr,
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(sdio_dev);
 
 static const struct sdio_device_id *sdio_match_one(struct sdio_func *func,
 	const struct sdio_device_id *id)
@@ -225,7 +228,7 @@ static const struct dev_pm_ops sdio_bus_pm_ops = {
 
 static struct bus_type sdio_bus_type = {
 	.name		= "sdio",
-	.dev_attrs	= sdio_dev_attrs,
+	.dev_groups	= sdio_dev_groups,
 	.match		= sdio_bus_match,
 	.uevent		= sdio_bus_uevent,
 	.probe		= sdio_bus_probe,
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 05/11] uwb: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 04/11] MMC: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 06/11] bcma: " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bruno Morelli, linux-usb

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the uwb bus code to use the
correct field.

Cc: Bruno Morelli <bruno@evidence.eu.com>
Cc: <linux-usb@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/uwb/umc-bus.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/uwb/umc-bus.c b/drivers/uwb/umc-bus.c
index 5c5b3fc..e3ed6ff 100644
--- a/drivers/uwb/umc-bus.c
+++ b/drivers/uwb/umc-bus.c
@@ -201,6 +201,7 @@ static ssize_t capability_id_show(struct device *dev, struct device_attribute *a
 
 	return sprintf(buf, "0x%02x\n", umc->cap_id);
 }
+static DEVICE_ATTR_RO(capability_id);
 
 static ssize_t version_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -208,12 +209,14 @@ static ssize_t version_show(struct device *dev, struct device_attribute *attr, c
 
 	return sprintf(buf, "0x%04x\n", umc->version);
 }
+static DEVICE_ATTR_RO(version);
 
-static struct device_attribute umc_dev_attrs[] = {
-	__ATTR_RO(capability_id),
-	__ATTR_RO(version),
-	__ATTR_NULL,
+static struct attribute *umc_dev_attrs[] = {
+	&dev_attr_capability_id.attr,
+	&dev_attr_version.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(umc_dev);
 
 struct bus_type umc_bus_type = {
 	.name		= "umc",
@@ -222,7 +225,7 @@ struct bus_type umc_bus_type = {
 	.remove		= umc_device_remove,
 	.suspend        = umc_device_suspend,
 	.resume         = umc_device_resume,
-	.dev_attrs	= umc_dev_attrs,
+	.dev_groups	= umc_dev_groups,
 };
 EXPORT_SYMBOL_GPL(umc_bus_type);
 
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 06/11] bcma: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 05/11] uwb: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-09 15:13   ` John W. Linville
  2013-10-07  6:55 ` [PATCH 07/11] pcmcia: " Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  10 siblings, 1 reply; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafał Miłecki, linux-wireless

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the bcma bus code to use the
correct field.

Cc: Rafał Miłecki <zajec5@gmail.com>
Cc: <linux-wireless@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Rafał, I can take this through my driver-core tree if you like, just let
me know what would be the easiest for you.

 drivers/bcma/main.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
index 90ee350..e15430a 100644
--- a/drivers/bcma/main.c
+++ b/drivers/bcma/main.c
@@ -30,28 +30,37 @@ static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, cha
 	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
 	return sprintf(buf, "0x%03X\n", core->id.manuf);
 }
+static DEVICE_ATTR_RO(manuf);
+
 static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
 	return sprintf(buf, "0x%03X\n", core->id.id);
 }
+static DEVICE_ATTR_RO(id);
+
 static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
 	return sprintf(buf, "0x%02X\n", core->id.rev);
 }
+static DEVICE_ATTR_RO(rev);
+
 static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
 	return sprintf(buf, "0x%X\n", core->id.class);
 }
-static struct device_attribute bcma_device_attrs[] = {
-	__ATTR_RO(manuf),
-	__ATTR_RO(id),
-	__ATTR_RO(rev),
-	__ATTR_RO(class),
-	__ATTR_NULL,
+static DEVICE_ATTR_RO(class);
+
+static struct attribute *bcma_device_attrs[] = {
+	&dev_attr_manuf.attr,
+	&dev_attr_id.attr,
+	&dev_attr_rev.attr,
+	&dev_attr_class.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(bcma_device);
 
 static struct bus_type bcma_bus_type = {
 	.name		= "bcma",
@@ -59,7 +68,7 @@ static struct bus_type bcma_bus_type = {
 	.probe		= bcma_device_probe,
 	.remove		= bcma_device_remove,
 	.uevent		= bcma_device_uevent,
-	.dev_attrs	= bcma_device_attrs,
+	.dev_groups	= bcma_device_groups,
 };
 
 static u16 bcma_cc_core_id(struct bcma_bus *bus)
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 07/11] pcmcia: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 06/11] bcma: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 08/11] rapidio: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Bill Pemberton, linux-pcmcia

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the pcmcia bus code to use the
correct field.

Cc: Bill Pemberton <wfp5p@virginia.edu>
Cc: <linux-pcmcia@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/pcmcia/ds.c | 65 ++++++++++++++++++++++++++++++++---------------------
 1 file changed, 39 insertions(+), 26 deletions(-)

diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c
index 2deacbb..757119b 100644
--- a/drivers/pcmcia/ds.c
+++ b/drivers/pcmcia/ds.c
@@ -992,16 +992,17 @@ static ssize_t field##_show (struct device *dev, struct device_attribute *attr,
 {									\
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);		\
 	return p_dev->test ? sprintf(buf, format, p_dev->field) : -ENODEV; \
-}
+}									\
+static DEVICE_ATTR_RO(field);
 
 #define pcmcia_device_stringattr(name, field)					\
 static ssize_t name##_show (struct device *dev, struct device_attribute *attr, char *buf)		\
 {									\
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);		\
 	return p_dev->field ? sprintf(buf, "%s\n", p_dev->field) : -ENODEV; \
-}
+}									\
+static DEVICE_ATTR_RO(name);
 
-pcmcia_device_attr(func, socket, "0x%02x\n");
 pcmcia_device_attr(func_id, has_func_id, "0x%02x\n");
 pcmcia_device_attr(manf_id, has_manf_id, "0x%04x\n");
 pcmcia_device_attr(card_id, has_card_id, "0x%04x\n");
@@ -1010,8 +1011,16 @@ pcmcia_device_stringattr(prod_id2, prod_id[1]);
 pcmcia_device_stringattr(prod_id3, prod_id[2]);
 pcmcia_device_stringattr(prod_id4, prod_id[3]);
 
-static ssize_t pcmcia_show_resources(struct device *dev,
-				     struct device_attribute *attr, char *buf)
+static ssize_t function_show(struct device *dev, struct device_attribute *attr,
+			     char *buf)
+{
+	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
+	return p_dev->socket ? sprintf(buf, "0x%02x\n", p_dev->func) : -ENODEV;
+}
+static DEVICE_ATTR_RO(function);
+
+static ssize_t resources_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 	char *str = buf;
@@ -1022,8 +1031,9 @@ static ssize_t pcmcia_show_resources(struct device *dev,
 
 	return str - buf;
 }
+static DEVICE_ATTR_RO(resources);
 
-static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t pm_state_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 
@@ -1033,8 +1043,8 @@ static ssize_t pcmcia_show_pm_state(struct device *dev, struct device_attribute
 		return sprintf(buf, "on\n");
 }
 
-static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute *attr,
-				     const char *buf, size_t count)
+static ssize_t pm_state_store(struct device *dev, struct device_attribute *attr,
+			      const char *buf, size_t count)
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
 	int ret = 0;
@@ -1049,7 +1059,7 @@ static ssize_t pcmcia_store_pm_state(struct device *dev, struct device_attribute
 
 	return ret ? ret : count;
 }
-
+static DEVICE_ATTR_RW(pm_state);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
@@ -1072,8 +1082,9 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 				p_dev->func, p_dev->device_no,
 				hash[0], hash[1], hash[2], hash[3]);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
+static ssize_t allow_func_id_match_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct pcmcia_device *p_dev = to_pcmcia_dev(dev);
@@ -1088,22 +1099,24 @@ static ssize_t pcmcia_store_allow_func_id_match(struct device *dev,
 
 	return count;
 }
-
-static struct device_attribute pcmcia_dev_attrs[] = {
-	__ATTR(function, 0444, func_show, NULL),
-	__ATTR(pm_state, 0644, pcmcia_show_pm_state, pcmcia_store_pm_state),
-	__ATTR(resources, 0444, pcmcia_show_resources, NULL),
-	__ATTR_RO(func_id),
-	__ATTR_RO(manf_id),
-	__ATTR_RO(card_id),
-	__ATTR_RO(prod_id1),
-	__ATTR_RO(prod_id2),
-	__ATTR_RO(prod_id3),
-	__ATTR_RO(prod_id4),
-	__ATTR_RO(modalias),
-	__ATTR(allow_func_id_match, 0200, NULL, pcmcia_store_allow_func_id_match),
-	__ATTR_NULL,
+static DEVICE_ATTR_WO(allow_func_id_match);
+
+static struct attribute *pcmcia_dev_attrs[] = {
+	&dev_attr_resources.attr,
+	&dev_attr_pm_state.attr,
+	&dev_attr_function.attr,
+	&dev_attr_func_id.attr,
+	&dev_attr_manf_id.attr,
+	&dev_attr_card_id.attr,
+	&dev_attr_prod_id1.attr,
+	&dev_attr_prod_id2.attr,
+	&dev_attr_prod_id3.attr,
+	&dev_attr_prod_id4.attr,
+	&dev_attr_modalias.attr,
+	&dev_attr_allow_func_id_match.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(pcmcia_dev);
 
 /* PM support, also needed for reset */
 
@@ -1389,7 +1402,7 @@ struct bus_type pcmcia_bus_type = {
 	.name = "pcmcia",
 	.uevent = pcmcia_bus_uevent,
 	.match = pcmcia_bus_match,
-	.dev_attrs = pcmcia_dev_attrs,
+	.dev_groups = pcmcia_dev_groups,
 	.probe = pcmcia_device_probe,
 	.remove = pcmcia_device_remove,
 	.suspend = pcmcia_dev_suspend,
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 08/11] rapidio: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 07/11] pcmcia: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 09/11] ssb: " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Matt Porter, Alexandre Bounine

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the rapidio bus code to use the
correct field.

Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Alexandre Bounine <alexandre.bounine@idt.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Matt and Alexandre, I can take this through my driver-core tree if you
like, just let me know what would be the easiest for you.

 drivers/rapidio/rio-driver.c |  2 +-
 drivers/rapidio/rio-sysfs.c  | 38 ++++++++++++++++++++++++--------------
 drivers/rapidio/rio.h        |  2 +-
 3 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 2be2d24..c9ae692 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -223,7 +223,7 @@ struct device rio_bus = {
 struct bus_type rio_bus_type = {
 	.name = "rapidio",
 	.match = rio_match_bus,
-	.dev_attrs = rio_dev_attrs,
+	.dev_groups = rio_dev_groups,
 	.bus_groups = rio_bus_groups,
 	.probe = rio_device_probe,
 	.remove = rio_device_remove,
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 795a477..e0221c6 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -27,6 +27,7 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf)			\
 									\
 	return sprintf(buf, format_string, rdev->field);		\
 }									\
+static DEVICE_ATTR_RO(field);
 
 rio_config_attr(did, "0x%04x\n");
 rio_config_attr(vid, "0x%04x\n");
@@ -54,6 +55,7 @@ static ssize_t routes_show(struct device *dev, struct device_attribute *attr, ch
 
 	return (str - buf);
 }
+static DEVICE_ATTR_RO(routes);
 
 static ssize_t lprev_show(struct device *dev,
 			  struct device_attribute *attr, char *buf)
@@ -63,6 +65,7 @@ static ssize_t lprev_show(struct device *dev,
 	return sprintf(buf, "%s\n",
 			(rdev->prev) ? rio_name(rdev->prev) : "root");
 }
+static DEVICE_ATTR_RO(lprev);
 
 static ssize_t lnext_show(struct device *dev,
 			  struct device_attribute *attr, char *buf)
@@ -83,6 +86,7 @@ static ssize_t lnext_show(struct device *dev,
 
 	return str - buf;
 }
+static DEVICE_ATTR_RO(lnext);
 
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
@@ -92,23 +96,29 @@ static ssize_t modalias_show(struct device *dev,
 	return sprintf(buf, "rapidio:v%04Xd%04Xav%04Xad%04X\n",
 		       rdev->vid, rdev->did, rdev->asm_vid, rdev->asm_did);
 }
+static DEVICE_ATTR_RO(modalias);
+
+static struct attribute *rio_dev_attrs[] = {
+	&dev_attr_did.attr,
+	&dev_attr_vid.attr,
+	&dev_attr_device_rev.attr,
+	&dev_attr_asm_did.attr,
+	&dev_attr_asm_vid.attr,
+	&dev_attr_asm_rev.attr,
+	&dev_attr_lprev.attr,
+	&dev_attr_destid.attr,
+	&dev_attr_modalias.attr,
+	NULL,
+};
 
-struct device_attribute rio_dev_attrs[] = {
-	__ATTR_RO(did),
-	__ATTR_RO(vid),
-	__ATTR_RO(device_rev),
-	__ATTR_RO(asm_did),
-	__ATTR_RO(asm_vid),
-	__ATTR_RO(asm_rev),
-	__ATTR_RO(lprev),
-	__ATTR_RO(destid),
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static const struct attribute_group rio_dev_group = {
+	.attrs = rio_dev_attrs,
 };
 
-static DEVICE_ATTR(routes, S_IRUGO, routes_show, NULL);
-static DEVICE_ATTR(lnext, S_IRUGO, lnext_show, NULL);
-static DEVICE_ATTR(hopcount, S_IRUGO, hopcount_show, NULL);
+const struct attribute_group *rio_dev_groups[] = {
+	&rio_dev_group,
+	NULL,
+};
 
 static ssize_t
 rio_read_config(struct file *filp, struct kobject *kobj,
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index 57d2ad0..5f99d22 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -48,7 +48,7 @@ extern struct rio_mport *rio_find_mport(int mport_id);
 extern int rio_mport_scan(int mport_id);
 
 /* Structures internal to the RIO core code */
-extern struct device_attribute rio_dev_attrs[];
+extern const struct attribute_group *rio_dev_groups[];
 extern const struct attribute_group *rio_bus_groups[];
 
 #define RIO_GET_DID(size, x)	(size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 09/11] ssb: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 08/11] rapidio: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 10/11] xenbus: " Greg Kroah-Hartman
  2013-10-07  6:55 ` [PATCH 11/11] hsi: " Greg Kroah-Hartman
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Michael Buesch, netdev

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the ssb bus code to use the
correct field.

Cc: Michael Buesch <m@bues.ch>
Cc: <netdev@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Michael, I can take this through my driver-core tree if you like, just
let me know what would be the easiest for you.

 drivers/ssb/main.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/drivers/ssb/main.c b/drivers/ssb/main.c
index e55ddf7..32a811d 100644
--- a/drivers/ssb/main.c
+++ b/drivers/ssb/main.c
@@ -374,7 +374,8 @@ static ssize_t \
 attrib##_show(struct device *dev, struct device_attribute *attr, char *buf) \
 { \
 	return sprintf(buf, format_string, dev_to_ssb_dev(dev)->field); \
-}
+} \
+static DEVICE_ATTR_RO(attrib);
 
 ssb_config_attr(core_num, core_index, "%u\n")
 ssb_config_attr(coreid, id.coreid, "0x%04x\n")
@@ -387,16 +388,18 @@ name_show(struct device *dev, struct device_attribute *attr, char *buf)
 	return sprintf(buf, "%s\n",
 		       ssb_core_name(dev_to_ssb_dev(dev)->id.coreid));
 }
-
-static struct device_attribute ssb_device_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_RO(core_num),
-	__ATTR_RO(coreid),
-	__ATTR_RO(vendor),
-	__ATTR_RO(revision),
-	__ATTR_RO(irq),
-	__ATTR_NULL,
+static DEVICE_ATTR_RO(name);
+
+static struct attribute *ssb_device_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_core_num.attr,
+	&dev_attr_coreid.attr,
+	&dev_attr_vendor.attr,
+	&dev_attr_revision.attr,
+	&dev_attr_irq.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ssb_device);
 
 static struct bus_type ssb_bustype = {
 	.name		= "ssb",
@@ -407,7 +410,7 @@ static struct bus_type ssb_bustype = {
 	.suspend	= ssb_device_suspend,
 	.resume		= ssb_device_resume,
 	.uevent		= ssb_device_uevent,
-	.dev_attrs	= ssb_device_attrs,
+	.dev_groups	= ssb_device_groups,
 };
 
 static void ssb_buses_lock(void)
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 10/11] xenbus: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 09/11] ssb: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  2013-10-07 16:34   ` Boris Ostrovsky
  2013-10-07  6:55 ` [PATCH 11/11] hsi: " Greg Kroah-Hartman
  10 siblings, 1 reply; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Konrad Rzeszutek Wilk, Boris Ostrovsky,
	David Vrabel, xen-devel

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the xenbus code to use the
correct field.

Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: David Vrabel <david.vrabel@citrix.com>
Cc: <xen-devel@lists.xenproject.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

Konrad, I can take this through my driver-core tree if you like, just
let me know what would be the easiest for you.

 drivers/xen/xenbus/xenbus_probe.c          | 24 ++++++++++++++++++------
 drivers/xen/xenbus/xenbus_probe.h          |  2 +-
 drivers/xen/xenbus/xenbus_probe_backend.c  |  2 +-
 drivers/xen/xenbus/xenbus_probe_frontend.c |  2 +-
 4 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
index 38e92b7..3c0a74b 100644
--- a/drivers/xen/xenbus/xenbus_probe.c
+++ b/drivers/xen/xenbus/xenbus_probe.c
@@ -384,12 +384,14 @@ static ssize_t nodename_show(struct device *dev,
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
 }
+static DEVICE_ATTR_RO(nodename);
 
 static ssize_t devtype_show(struct device *dev,
 			    struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
 }
+static DEVICE_ATTR_RO(devtype);
 
 static ssize_t modalias_show(struct device *dev,
 			     struct device_attribute *attr, char *buf)
@@ -397,14 +399,24 @@ static ssize_t modalias_show(struct device *dev,
 	return sprintf(buf, "%s:%s\n", dev->bus->name,
 		       to_xenbus_device(dev)->devicetype);
 }
+static DEVICE_ATTR_RO(modalias);
 
-struct device_attribute xenbus_dev_attrs[] = {
-	__ATTR_RO(nodename),
-	__ATTR_RO(devtype),
-	__ATTR_RO(modalias),
-	__ATTR_NULL
+static struct attribute *xenbus_dev_attrs[] = {
+	&dev_attr_nodename.attr,
+	&dev_attr_devtype.attr,
+	&dev_attr_modalias.attr,
+	NULL,
 };
-EXPORT_SYMBOL_GPL(xenbus_dev_attrs);
+
+static const struct attribute_group xenbus_dev_group = {
+	.attrs = xenbus_dev_attrs,
+};
+
+const struct attribute_group *xenbus_dev_groups[] = {
+	&xenbus_dev_group,
+	NULL,
+};
+EXPORT_SYMBOL_GPL(xenbus_dev_groups);
 
 int xenbus_probe_node(struct xen_bus_type *bus,
 		      const char *type,
diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
index 146f857..1085ec2 100644
--- a/drivers/xen/xenbus/xenbus_probe.h
+++ b/drivers/xen/xenbus/xenbus_probe.h
@@ -54,7 +54,7 @@ enum xenstore_init {
 	XS_LOCAL,
 };
 
-extern struct device_attribute xenbus_dev_attrs[];
+extern const struct attribute_group *xenbus_dev_groups[];
 
 extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
 extern int xenbus_dev_probe(struct device *_dev);
diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
index 998bbba..5125dce 100644
--- a/drivers/xen/xenbus/xenbus_probe_backend.c
+++ b/drivers/xen/xenbus/xenbus_probe_backend.c
@@ -200,7 +200,7 @@ static struct xen_bus_type xenbus_backend = {
 		.probe		= xenbus_dev_probe,
 		.remove		= xenbus_dev_remove,
 		.shutdown	= xenbus_dev_shutdown,
-		.dev_attrs	= xenbus_dev_attrs,
+		.dev_groups	= xenbus_dev_groups,
 	},
 };
 
diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
index 34b20bf..129bf84 100644
--- a/drivers/xen/xenbus/xenbus_probe_frontend.c
+++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
@@ -154,7 +154,7 @@ static struct xen_bus_type xenbus_frontend = {
 		.probe		= xenbus_frontend_dev_probe,
 		.remove		= xenbus_dev_remove,
 		.shutdown	= xenbus_dev_shutdown,
-		.dev_attrs	= xenbus_dev_attrs,
+		.dev_groups	= xenbus_dev_groups,
 
 		.pm		= &xenbus_pm_ops,
 	},
-- 
1.8.4.6.g82e253f.dirty


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

* [PATCH 11/11] hsi: convert bus code to use dev_groups
  2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2013-10-07  6:55 ` [PATCH 10/11] xenbus: " Greg Kroah-Hartman
@ 2013-10-07  6:55 ` Greg Kroah-Hartman
  10 siblings, 0 replies; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07  6:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Andrew Morton, Kees Cook

The dev_attrs field of struct bus_type is going away soon, dev_groups
should be used instead.  This converts the hsi code to use the
correct field.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hsi/hsi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hsi/hsi.c b/drivers/hsi/hsi.c
index 66d4458..749f7b5 100644
--- a/drivers/hsi/hsi.c
+++ b/drivers/hsi/hsi.c
@@ -33,11 +33,13 @@ static ssize_t modalias_show(struct device *dev,
 {
 	return sprintf(buf, "hsi:%s\n", dev_name(dev));
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute hsi_bus_dev_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static struct attribute *hsi_bus_dev_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(hsi_bus_dev);
 
 static int hsi_bus_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
@@ -53,7 +55,7 @@ static int hsi_bus_match(struct device *dev, struct device_driver *driver)
 
 static struct bus_type hsi_bus_type = {
 	.name		= "hsi",
-	.dev_attrs	= hsi_bus_dev_attrs,
+	.dev_groups	= hsi_bus_dev_groups,
 	.match		= hsi_bus_match,
 	.uevent		= hsi_bus_uevent,
 };
-- 
1.8.4.6.g82e253f.dirty


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

* Re: [PATCH 10/11] xenbus: convert bus code to use dev_groups
  2013-10-07  6:55 ` [PATCH 10/11] xenbus: " Greg Kroah-Hartman
@ 2013-10-07 16:34   ` Boris Ostrovsky
  0 siblings, 0 replies; 20+ messages in thread
From: Boris Ostrovsky @ 2013-10-07 16:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Konrad Rzeszutek Wilk, David Vrabel, xen-devel

On 10/07/2013 02:55 AM, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead.  This converts the xenbus code to use the
> correct field.
>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: <xen-devel@lists.xenproject.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Konrad, I can take this through my driver-core tree if you like, just
> let me know what would be the easiest for you.

Konrad is likely out this (and possibly next) week but given that you
are taking a bunch of these patches it make sense that you take this one
as well.

(and just in case I gave it a quick test and it looked good).

-boris


>
>   drivers/xen/xenbus/xenbus_probe.c          | 24 ++++++++++++++++++------
>   drivers/xen/xenbus/xenbus_probe.h          |  2 +-
>   drivers/xen/xenbus/xenbus_probe_backend.c  |  2 +-
>   drivers/xen/xenbus/xenbus_probe_frontend.c |  2 +-
>   4 files changed, 21 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/xen/xenbus/xenbus_probe.c b/drivers/xen/xenbus/xenbus_probe.c
> index 38e92b7..3c0a74b 100644
> --- a/drivers/xen/xenbus/xenbus_probe.c
> +++ b/drivers/xen/xenbus/xenbus_probe.c
> @@ -384,12 +384,14 @@ static ssize_t nodename_show(struct device *dev,
>   {
>   	return sprintf(buf, "%s\n", to_xenbus_device(dev)->nodename);
>   }
> +static DEVICE_ATTR_RO(nodename);
>   
>   static ssize_t devtype_show(struct device *dev,
>   			    struct device_attribute *attr, char *buf)
>   {
>   	return sprintf(buf, "%s\n", to_xenbus_device(dev)->devicetype);
>   }
> +static DEVICE_ATTR_RO(devtype);
>   
>   static ssize_t modalias_show(struct device *dev,
>   			     struct device_attribute *attr, char *buf)
> @@ -397,14 +399,24 @@ static ssize_t modalias_show(struct device *dev,
>   	return sprintf(buf, "%s:%s\n", dev->bus->name,
>   		       to_xenbus_device(dev)->devicetype);
>   }
> +static DEVICE_ATTR_RO(modalias);
>   
> -struct device_attribute xenbus_dev_attrs[] = {
> -	__ATTR_RO(nodename),
> -	__ATTR_RO(devtype),
> -	__ATTR_RO(modalias),
> -	__ATTR_NULL
> +static struct attribute *xenbus_dev_attrs[] = {
> +	&dev_attr_nodename.attr,
> +	&dev_attr_devtype.attr,
> +	&dev_attr_modalias.attr,
> +	NULL,
>   };
> -EXPORT_SYMBOL_GPL(xenbus_dev_attrs);
> +
> +static const struct attribute_group xenbus_dev_group = {
> +	.attrs = xenbus_dev_attrs,
> +};
> +
> +const struct attribute_group *xenbus_dev_groups[] = {
> +	&xenbus_dev_group,
> +	NULL,
> +};
> +EXPORT_SYMBOL_GPL(xenbus_dev_groups);
>   
>   int xenbus_probe_node(struct xen_bus_type *bus,
>   		      const char *type,
> diff --git a/drivers/xen/xenbus/xenbus_probe.h b/drivers/xen/xenbus/xenbus_probe.h
> index 146f857..1085ec2 100644
> --- a/drivers/xen/xenbus/xenbus_probe.h
> +++ b/drivers/xen/xenbus/xenbus_probe.h
> @@ -54,7 +54,7 @@ enum xenstore_init {
>   	XS_LOCAL,
>   };
>   
> -extern struct device_attribute xenbus_dev_attrs[];
> +extern const struct attribute_group *xenbus_dev_groups[];
>   
>   extern int xenbus_match(struct device *_dev, struct device_driver *_drv);
>   extern int xenbus_dev_probe(struct device *_dev);
> diff --git a/drivers/xen/xenbus/xenbus_probe_backend.c b/drivers/xen/xenbus/xenbus_probe_backend.c
> index 998bbba..5125dce 100644
> --- a/drivers/xen/xenbus/xenbus_probe_backend.c
> +++ b/drivers/xen/xenbus/xenbus_probe_backend.c
> @@ -200,7 +200,7 @@ static struct xen_bus_type xenbus_backend = {
>   		.probe		= xenbus_dev_probe,
>   		.remove		= xenbus_dev_remove,
>   		.shutdown	= xenbus_dev_shutdown,
> -		.dev_attrs	= xenbus_dev_attrs,
> +		.dev_groups	= xenbus_dev_groups,
>   	},
>   };
>   
> diff --git a/drivers/xen/xenbus/xenbus_probe_frontend.c b/drivers/xen/xenbus/xenbus_probe_frontend.c
> index 34b20bf..129bf84 100644
> --- a/drivers/xen/xenbus/xenbus_probe_frontend.c
> +++ b/drivers/xen/xenbus/xenbus_probe_frontend.c
> @@ -154,7 +154,7 @@ static struct xen_bus_type xenbus_frontend = {
>   		.probe		= xenbus_frontend_dev_probe,
>   		.remove		= xenbus_dev_remove,
>   		.shutdown	= xenbus_dev_shutdown,
> -		.dev_attrs	= xenbus_dev_attrs,
> +		.dev_groups	= xenbus_dev_groups,
>   
>   		.pm		= &xenbus_pm_ops,
>   	},


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

* Re: [PATCH 01/11] pci: convert bus code to use dev_groups
  2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
@ 2013-10-07 18:21   ` Bjorn Helgaas
  2013-10-07 20:41     ` Greg Kroah-Hartman
  2013-10-07 21:18   ` Bjorn Helgaas
  1 sibling, 1 reply; 20+ messages in thread
From: Bjorn Helgaas @ 2013-10-07 18:21 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-pci, Sachin Kamat

[+cc Sachin]

On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> The dev_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead.  This converts the PCI bus code to use the
> correct field.
>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: <linux-pci@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Bjorn, I can take this through my driver-core tree if you like, just let
> me know what would be the easiest for you.

Let me take it, if I can figure out how to do it.  I already tripped
over a conflict where Sachin made pci_bus_attrs static, which is fine
in linux-next (with your 244afeca ("PCI: convert bus code to
use bus_groups") commit), but not fine in pci/next, which didn't have that.

I should be able to "git merge --no-ff --log gregkh/driver-core-next"
into my "next" branch, then apply your patch as usual, right?

Bjorn

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

* Re: [PATCH 01/11] pci: convert bus code to use dev_groups
  2013-10-07 18:21   ` Bjorn Helgaas
@ 2013-10-07 20:41     ` Greg Kroah-Hartman
  2013-10-07 20:47       ` Bjorn Helgaas
  0 siblings, 1 reply; 20+ messages in thread
From: Greg Kroah-Hartman @ 2013-10-07 20:41 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-kernel, linux-pci, Sachin Kamat

On Mon, Oct 07, 2013 at 12:21:36PM -0600, Bjorn Helgaas wrote:
> [+cc Sachin]
> 
> On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > The dev_attrs field of struct bus_type is going away soon, dev_groups
> > should be used instead.  This converts the PCI bus code to use the
> > correct field.
> >
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: <linux-pci@vger.kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >
> > Bjorn, I can take this through my driver-core tree if you like, just let
> > me know what would be the easiest for you.
> 
> Let me take it, if I can figure out how to do it.  I already tripped
> over a conflict where Sachin made pci_bus_attrs static, which is fine
> in linux-next (with your 244afeca ("PCI: convert bus code to
> use bus_groups") commit), but not fine in pci/next, which didn't have that.

Ah, yeah, that will conflict, sorry.

> I should be able to "git merge --no-ff --log gregkh/driver-core-next"
> into my "next" branch, then apply your patch as usual, right?

You can, but do you really want all of my driver-core changes in there?
I can just send you the one pci change and you can then apply both of
them.  Then when we merge with Linus, there will not be any conflicts as
the same patches just showed up in two different trees, which should be
fine.

thanks,

greg k-h

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

* Re: [PATCH 01/11] pci: convert bus code to use dev_groups
  2013-10-07 20:41     ` Greg Kroah-Hartman
@ 2013-10-07 20:47       ` Bjorn Helgaas
  0 siblings, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2013-10-07 20:47 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-pci, Sachin Kamat

On Mon, Oct 7, 2013 at 2:41 PM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Mon, Oct 07, 2013 at 12:21:36PM -0600, Bjorn Helgaas wrote:
>> [+cc Sachin]
>>
>> On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
>> <gregkh@linuxfoundation.org> wrote:
>> > The dev_attrs field of struct bus_type is going away soon, dev_groups
>> > should be used instead.  This converts the PCI bus code to use the
>> > correct field.
>> >
>> > Cc: Bjorn Helgaas <bhelgaas@google.com>
>> > Cc: <linux-pci@vger.kernel.org>
>> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > ---
>> >
>> > Bjorn, I can take this through my driver-core tree if you like, just let
>> > me know what would be the easiest for you.
>>
>> Let me take it, if I can figure out how to do it.  I already tripped
>> over a conflict where Sachin made pci_bus_attrs static, which is fine
>> in linux-next (with your 244afeca ("PCI: convert bus code to
>> use bus_groups") commit), but not fine in pci/next, which didn't have that.
>
> Ah, yeah, that will conflict, sorry.
>
>> I should be able to "git merge --no-ff --log gregkh/driver-core-next"
>> into my "next" branch, then apply your patch as usual, right?
>
> You can, but do you really want all of my driver-core changes in there?
> I can just send you the one pci change and you can then apply both of
> them.  Then when we merge with Linus, there will not be any conflicts as
> the same patches just showed up in two different trees, which should be
> fine.

Yes, putting just the PCI changes in my tree sounds much better.  I'll
try to work out what I need, and I'll poke you again if I need help :)

Bjorn

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

* Re: [PATCH 01/11] pci: convert bus code to use dev_groups
  2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
  2013-10-07 18:21   ` Bjorn Helgaas
@ 2013-10-07 21:18   ` Bjorn Helgaas
  1 sibling, 0 replies; 20+ messages in thread
From: Bjorn Helgaas @ 2013-10-07 21:18 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, linux-pci

On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> The dev_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead.  This converts the PCI bus code to use the
> correct field.
>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Cc: <linux-pci@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Bjorn, I can take this through my driver-core tree if you like, just let
> me know what would be the easiest for you.

I merged this to my pci/gregkh-driver-core branch for v3.13.  Thanks!

Bjorn

>  drivers/pci/pci-driver.c |  2 +-
>  drivers/pci/pci-sysfs.c  | 73 ++++++++++++++++++++++++++++++------------------
>  drivers/pci/pci.h        |  2 +-
>  3 files changed, 48 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 38f3c01..9f85960 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -1319,7 +1319,7 @@ struct bus_type pci_bus_type = {
>         .probe          = pci_device_probe,
>         .remove         = pci_device_remove,
>         .shutdown       = pci_device_shutdown,
> -       .dev_attrs      = pci_dev_attrs,
> +       .dev_groups     = pci_dev_groups,
>         .bus_groups     = pci_bus_groups,
>         .drv_groups     = pci_drv_groups,
>         .pm             = PCI_PM_OPS_PTR,
> diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
> index d8eb880..618c060 100644
> --- a/drivers/pci/pci-sysfs.c
> +++ b/drivers/pci/pci-sysfs.c
> @@ -42,7 +42,8 @@ field##_show(struct device *dev, struct device_attribute *attr, char *buf)                            \
>                                                                         \
>         pdev = to_pci_dev (dev);                                        \
>         return sprintf (buf, format_string, pdev->field);               \
> -}
> +}                                                                      \
> +static DEVICE_ATTR_RO(field)
>
>  pci_config_attr(vendor, "0x%04x\n");
>  pci_config_attr(device, "0x%04x\n");
> @@ -73,6 +74,7 @@ static ssize_t broken_parity_status_store(struct device *dev,
>
>         return count;
>  }
> +static DEVICE_ATTR_RW(broken_parity_status);
>
>  static ssize_t local_cpus_show(struct device *dev,
>                         struct device_attribute *attr, char *buf)
> @@ -91,7 +93,7 @@ static ssize_t local_cpus_show(struct device *dev,
>         buf[len] = '\0';
>         return len;
>  }
> -
> +static DEVICE_ATTR_RO(local_cpus);
>
>  static ssize_t local_cpulist_show(struct device *dev,
>                         struct device_attribute *attr, char *buf)
> @@ -110,6 +112,7 @@ static ssize_t local_cpulist_show(struct device *dev,
>         buf[len] = '\0';
>         return len;
>  }
> +static DEVICE_ATTR_RO(local_cpulist);
>
>  /*
>   * PCI Bus Class Devices
> @@ -170,6 +173,7 @@ resource_show(struct device * dev, struct device_attribute *attr, char * buf)
>         }
>         return (str - buf);
>  }
> +static DEVICE_ATTR_RO(resource);
>
>  static ssize_t modalias_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
> @@ -181,10 +185,11 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>                        (u8)(pci_dev->class >> 16), (u8)(pci_dev->class >> 8),
>                        (u8)(pci_dev->class));
>  }
> +static DEVICE_ATTR_RO(modalias);
>
> -static ssize_t is_enabled_store(struct device *dev,
> -                               struct device_attribute *attr, const char *buf,
> -                               size_t count)
> +static ssize_t enabled_store(struct device *dev,
> +                            struct device_attribute *attr, const char *buf,
> +                            size_t count)
>  {
>         struct pci_dev *pdev = to_pci_dev(dev);
>         unsigned long val;
> @@ -208,14 +213,15 @@ static ssize_t is_enabled_store(struct device *dev,
>         return result < 0 ? result : count;
>  }
>
> -static ssize_t is_enabled_show(struct device *dev,
> -                              struct device_attribute *attr, char *buf)
> +static ssize_t enabled_show(struct device *dev,
> +                           struct device_attribute *attr, char *buf)
>  {
>         struct pci_dev *pdev;
>
>         pdev = to_pci_dev (dev);
>         return sprintf (buf, "%u\n", atomic_read(&pdev->enable_cnt));
>  }
> +static DEVICE_ATTR_RW(enabled);
>
>  #ifdef CONFIG_NUMA
>  static ssize_t
> @@ -223,6 +229,7 @@ numa_node_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>         return sprintf (buf, "%d\n", dev->numa_node);
>  }
> +static DEVICE_ATTR_RO(numa_node);
>  #endif
>
>  static ssize_t
> @@ -232,6 +239,7 @@ dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf)
>
>         return sprintf (buf, "%d\n", fls64(pdev->dma_mask));
>  }
> +static DEVICE_ATTR_RO(dma_mask_bits);
>
>  static ssize_t
>  consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
> @@ -239,6 +247,7 @@ consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr,
>  {
>         return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask));
>  }
> +static DEVICE_ATTR_RO(consistent_dma_mask_bits);
>
>  static ssize_t
>  msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf)
> @@ -283,6 +292,7 @@ msi_bus_store(struct device *dev, struct device_attribute *attr,
>
>         return count;
>  }
> +static DEVICE_ATTR_RW(msi_bus);
>
>  static DEFINE_MUTEX(pci_remove_rescan_mutex);
>  static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
> @@ -414,6 +424,7 @@ static ssize_t d3cold_allowed_show(struct device *dev,
>         struct pci_dev *pdev = to_pci_dev(dev);
>         return sprintf (buf, "%u\n", pdev->d3cold_allowed);
>  }
> +static DEVICE_ATTR_RW(d3cold_allowed);
>  #endif
>
>  #ifdef CONFIG_PCI_IOV
> @@ -499,30 +510,38 @@ static struct device_attribute sriov_numvfs_attr =
>                        sriov_numvfs_show, sriov_numvfs_store);
>  #endif /* CONFIG_PCI_IOV */
>
> -struct device_attribute pci_dev_attrs[] = {
> -       __ATTR_RO(resource),
> -       __ATTR_RO(vendor),
> -       __ATTR_RO(device),
> -       __ATTR_RO(subsystem_vendor),
> -       __ATTR_RO(subsystem_device),
> -       __ATTR_RO(class),
> -       __ATTR_RO(irq),
> -       __ATTR_RO(local_cpus),
> -       __ATTR_RO(local_cpulist),
> -       __ATTR_RO(modalias),
> +struct attribute *pci_dev_attrs[] = {
> +       &dev_attr_resource.attr,
> +       &dev_attr_vendor.attr,
> +       &dev_attr_device.attr,
> +       &dev_attr_subsystem_vendor.attr,
> +       &dev_attr_subsystem_device.attr,
> +       &dev_attr_class.attr,
> +       &dev_attr_irq.attr,
> +       &dev_attr_local_cpus.attr,
> +       &dev_attr_local_cpulist.attr,
> +       &dev_attr_modalias.attr,
>  #ifdef CONFIG_NUMA
> -       __ATTR_RO(numa_node),
> +       &dev_attr_numa_node.attr,
>  #endif
> -       __ATTR_RO(dma_mask_bits),
> -       __ATTR_RO(consistent_dma_mask_bits),
> -       __ATTR(enable, 0600, is_enabled_show, is_enabled_store),
> -       __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR),
> -               broken_parity_status_show,broken_parity_status_store),
> -       __ATTR(msi_bus, 0644, msi_bus_show, msi_bus_store),
> +       &dev_attr_dma_mask_bits.attr,
> +       &dev_attr_consistent_dma_mask_bits.attr,
> +       &dev_attr_enabled.attr,
> +       &dev_attr_broken_parity_status.attr,
> +       &dev_attr_msi_bus.attr,
>  #if defined(CONFIG_PM_RUNTIME) && defined(CONFIG_ACPI)
> -       __ATTR(d3cold_allowed, 0644, d3cold_allowed_show, d3cold_allowed_store),
> +       &dev_attr_d3cold_allowed.attr,
>  #endif
> -       __ATTR_NULL,
> +       NULL,
> +};
> +
> +static const struct attribute_group pci_dev_group = {
> +       .attrs = pci_dev_attrs,
> +};
> +
> +const struct attribute_group *pci_dev_groups[] = {
> +       &pci_dev_group,
> +       NULL,
>  };
>
>  static struct attribute *pcibus_attrs[] = {
> diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
> index 607be58..9c91ecc 100644
> --- a/drivers/pci/pci.h
> +++ b/drivers/pci/pci.h
> @@ -153,7 +153,7 @@ static inline int pci_no_d1d2(struct pci_dev *dev)
>         return (dev->no_d1d2 || parent_dstates);
>
>  }
> -extern struct device_attribute pci_dev_attrs[];
> +extern const struct attribute_group *pci_dev_groups[];
>  extern const struct attribute_group *pcibus_groups[];
>  extern struct device_type pci_dev_type;
>  extern const struct attribute_group *pci_bus_groups[];
> --
> 1.8.4.6.g82e253f.dirty
>

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

* Re: [PATCH 03/11] PNP: convert bus code to use dev_groups
  2013-10-07  6:55 ` [PATCH 03/11] PNP: " Greg Kroah-Hartman
@ 2013-10-07 21:27   ` Rafael J. Wysocki
  0 siblings, 0 replies; 20+ messages in thread
From: Rafael J. Wysocki @ 2013-10-07 21:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Bjorn Helgaas

On 10/7/2013 8:55 AM, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead.  This converts the PNP bus code to use the
> correct field.
>
> Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Cc: Bjorn Helgaas <bhelgaas@google.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>
> Rafael, I can take this through my driver-core tree if you like, just let
> me know what would be the easiest for you.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

and please merge through driver-core.

Thanks!

>   drivers/pnp/base.h      |  2 +-
>   drivers/pnp/driver.c    |  2 +-
>   drivers/pnp/interface.c | 43 ++++++++++++++++++++++++++-----------------
>   3 files changed, 28 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/pnp/base.h b/drivers/pnp/base.h
> index ffd53e3..c8873b0 100644
> --- a/drivers/pnp/base.h
> +++ b/drivers/pnp/base.h
> @@ -4,7 +4,7 @@
>    */
>   
>   extern spinlock_t pnp_lock;
> -extern struct device_attribute pnp_interface_attrs[];
> +extern const struct attribute_group *pnp_dev_groups[];
>   void *pnp_alloc(long size);
>   
>   int pnp_register_protocol(struct pnp_protocol *protocol);
> diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
> index a39ee38..6936e0a 100644
> --- a/drivers/pnp/driver.c
> +++ b/drivers/pnp/driver.c
> @@ -246,7 +246,7 @@ struct bus_type pnp_bus_type = {
>   	.remove  = pnp_device_remove,
>   	.shutdown = pnp_device_shutdown,
>   	.pm	 = &pnp_bus_dev_pm_ops,
> -	.dev_attrs = pnp_interface_attrs,
> +	.dev_groups = pnp_dev_groups,
>   };
>   
>   int pnp_register_driver(struct pnp_driver *drv)
> diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
> index 0c20131..e6c403b 100644
> --- a/drivers/pnp/interface.c
> +++ b/drivers/pnp/interface.c
> @@ -203,8 +203,8 @@ static void pnp_print_option(pnp_info_buffer_t * buffer, char *space,
>   	}
>   }
>   
> -static ssize_t pnp_show_options(struct device *dmdev,
> -				struct device_attribute *attr, char *buf)
> +static ssize_t options_show(struct device *dmdev, struct device_attribute *attr,
> +			    char *buf)
>   {
>   	struct pnp_dev *dev = to_pnp_dev(dmdev);
>   	pnp_info_buffer_t *buffer;
> @@ -241,10 +241,10 @@ static ssize_t pnp_show_options(struct device *dmdev,
>   	kfree(buffer);
>   	return ret;
>   }
> +static DEVICE_ATTR_RO(options);
>   
> -static ssize_t pnp_show_current_resources(struct device *dmdev,
> -					  struct device_attribute *attr,
> -					  char *buf)
> +static ssize_t resources_show(struct device *dmdev,
> +			      struct device_attribute *attr, char *buf)
>   {
>   	struct pnp_dev *dev = to_pnp_dev(dmdev);
>   	pnp_info_buffer_t *buffer;
> @@ -331,9 +331,9 @@ static char *pnp_get_resource_value(char *buf,
>   	return buf;
>   }
>   
> -static ssize_t pnp_set_current_resources(struct device *dmdev,
> -					 struct device_attribute *attr,
> -					 const char *ubuf, size_t count)
> +static ssize_t resources_store(struct device *dmdev,
> +			       struct device_attribute *attr, const char *ubuf,
> +			       size_t count)
>   {
>   	struct pnp_dev *dev = to_pnp_dev(dmdev);
>   	char *buf = (void *)ubuf;
> @@ -434,9 +434,10 @@ done:
>   		return retval;
>   	return count;
>   }
> +static DEVICE_ATTR_RW(resources);
>   
> -static ssize_t pnp_show_current_ids(struct device *dmdev,
> -				    struct device_attribute *attr, char *buf)
> +static ssize_t id_show(struct device *dmdev, struct device_attribute *attr,
> +		       char *buf)
>   {
>   	char *str = buf;
>   	struct pnp_dev *dev = to_pnp_dev(dmdev);
> @@ -448,12 +449,20 @@ static ssize_t pnp_show_current_ids(struct device *dmdev,
>   	}
>   	return (str - buf);
>   }
> +static DEVICE_ATTR_RO(id);
>   
> -struct device_attribute pnp_interface_attrs[] = {
> -	__ATTR(resources, S_IRUGO | S_IWUSR,
> -		   pnp_show_current_resources,
> -		   pnp_set_current_resources),
> -	__ATTR(options, S_IRUGO, pnp_show_options, NULL),
> -	__ATTR(id, S_IRUGO, pnp_show_current_ids, NULL),
> -	__ATTR_NULL,
> +static struct attribute *pnp_dev_attrs[] = {
> +	&dev_attr_resources.attr,
> +	&dev_attr_options.attr,
> +	&dev_attr_id.attr,
> +	NULL,
> +};
> +
> +static const struct attribute_group pnp_dev_group = {
> +	.attrs = pnp_dev_attrs,
> +};
> +
> +const struct attribute_group *pnp_dev_groups[] = {
> +	&pnp_dev_group,
> +	NULL,
>   };

--------------------------------------------------------------------

Intel Technology Poland sp. z o.o.
ul. Slowackiego 173 | 80-298 Gdansk | Sad Rejonowy Gdansk Polnoc | VII Wydzial Gospodarczy Krajowego Rejestru Sadowego - KRS 101882 | NIP 957-07-52-316 | Kapital zakladowy 200.000 PLN.

Ta wiadomosc wraz z zalacznikami jest przeznaczona dla okreslonego adresata i moze zawierac informacje poufne. W razie przypadkowego otrzymania tej wiadomosci, prosimy o powiadomienie nadawcy oraz trwale jej usuniecie; jakiekolwiek przegladanie lub rozpowszechnianie jest zabronione.
This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.


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

* Re: [PATCH 06/11] bcma: convert bus code to use dev_groups
  2013-10-07  6:55 ` [PATCH 06/11] bcma: " Greg Kroah-Hartman
@ 2013-10-09 15:13   ` John W. Linville
  2013-10-10  8:08     ` Rafał Miłecki
  0 siblings, 1 reply; 20+ messages in thread
From: John W. Linville @ 2013-10-09 15:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafał Miłecki, linux-wireless

On Sun, Oct 06, 2013 at 11:55:45PM -0700, Greg Kroah-Hartman wrote:
> The dev_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead.  This converts the bcma bus code to use the
> correct field.
> 
> Cc: Rafał Miłecki <zajec5@gmail.com>
> Cc: <linux-wireless@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
> 
> Rafał, I can take this through my driver-core tree if you like, just let
> me know what would be the easiest for you.

Makes sense to me...

> 
>  drivers/bcma/main.c | 23 ++++++++++++++++-------
>  1 file changed, 16 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/bcma/main.c b/drivers/bcma/main.c
> index 90ee350..e15430a 100644
> --- a/drivers/bcma/main.c
> +++ b/drivers/bcma/main.c
> @@ -30,28 +30,37 @@ static ssize_t manuf_show(struct device *dev, struct device_attribute *attr, cha
>  	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
>  	return sprintf(buf, "0x%03X\n", core->id.manuf);
>  }
> +static DEVICE_ATTR_RO(manuf);
> +
>  static ssize_t id_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
>  	return sprintf(buf, "0x%03X\n", core->id.id);
>  }
> +static DEVICE_ATTR_RO(id);
> +
>  static ssize_t rev_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
>  	return sprintf(buf, "0x%02X\n", core->id.rev);
>  }
> +static DEVICE_ATTR_RO(rev);
> +
>  static ssize_t class_show(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct bcma_device *core = container_of(dev, struct bcma_device, dev);
>  	return sprintf(buf, "0x%X\n", core->id.class);
>  }
> -static struct device_attribute bcma_device_attrs[] = {
> -	__ATTR_RO(manuf),
> -	__ATTR_RO(id),
> -	__ATTR_RO(rev),
> -	__ATTR_RO(class),
> -	__ATTR_NULL,
> +static DEVICE_ATTR_RO(class);
> +
> +static struct attribute *bcma_device_attrs[] = {
> +	&dev_attr_manuf.attr,
> +	&dev_attr_id.attr,
> +	&dev_attr_rev.attr,
> +	&dev_attr_class.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(bcma_device);
>  
>  static struct bus_type bcma_bus_type = {
>  	.name		= "bcma",
> @@ -59,7 +68,7 @@ static struct bus_type bcma_bus_type = {
>  	.probe		= bcma_device_probe,
>  	.remove		= bcma_device_remove,
>  	.uevent		= bcma_device_uevent,
> -	.dev_attrs	= bcma_device_attrs,
> +	.dev_groups	= bcma_device_groups,
>  };
>  
>  static u16 bcma_cc_core_id(struct bcma_bus *bus)
> -- 
> 1.8.4.6.g82e253f.dirty
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 

-- 
John W. Linville		Someday the world will need a hero, and you
linville@tuxdriver.com			might be all we have.  Be ready.

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

* Re: [PATCH 06/11] bcma: convert bus code to use dev_groups
  2013-10-09 15:13   ` John W. Linville
@ 2013-10-10  8:08     ` Rafał Miłecki
  0 siblings, 0 replies; 20+ messages in thread
From: Rafał Miłecki @ 2013-10-10  8:08 UTC (permalink / raw)
  To: John W. Linville
  Cc: Greg Kroah-Hartman, Linux Kernel Mailing List, linux-wireless

2013/10/9 John W. Linville <linville@tuxdriver.com>:
> On Sun, Oct 06, 2013 at 11:55:45PM -0700, Greg Kroah-Hartman wrote:
>> The dev_attrs field of struct bus_type is going away soon, dev_groups
>> should be used instead.  This converts the bcma bus code to use the
>> correct field.
>>
>> Cc: Rafał Miłecki <zajec5@gmail.com>
>> Cc: <linux-wireless@vger.kernel.org>
>> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> ---
>>
>> Rafał, I can take this through my driver-core tree if you like, just let
>> me know what would be the easiest for you.
>
> Makes sense to me...

Oops, sorry, missed that. I'll just agree with John :)

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

end of thread, other threads:[~2013-10-10  8:08 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-07  6:55 [PATCH 00/11] driver core bus cleanup to use dev_groups Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 01/11] pci: convert bus code " Greg Kroah-Hartman
2013-10-07 18:21   ` Bjorn Helgaas
2013-10-07 20:41     ` Greg Kroah-Hartman
2013-10-07 20:47       ` Bjorn Helgaas
2013-10-07 21:18   ` Bjorn Helgaas
2013-10-07  6:55 ` [PATCH 02/11] mdio_bus: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 03/11] PNP: " Greg Kroah-Hartman
2013-10-07 21:27   ` Rafael J. Wysocki
2013-10-07  6:55 ` [PATCH 04/11] MMC: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 05/11] uwb: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 06/11] bcma: " Greg Kroah-Hartman
2013-10-09 15:13   ` John W. Linville
2013-10-10  8:08     ` Rafał Miłecki
2013-10-07  6:55 ` [PATCH 07/11] pcmcia: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 08/11] rapidio: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 09/11] ssb: " Greg Kroah-Hartman
2013-10-07  6:55 ` [PATCH 10/11] xenbus: " Greg Kroah-Hartman
2013-10-07 16:34   ` Boris Ostrovsky
2013-10-07  6:55 ` [PATCH 11/11] hsi: " 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).