2013-10-07 06:56:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 00/11] driver core bus cleanup to use dev_groups

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


2013-10-07 06:55:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 10/11] xenbus: convert bus code to use dev_groups

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 <[email protected]>
Cc: Boris Ostrovsky <[email protected]>
Cc: David Vrabel <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:55:48

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 01/11] pci: convert bus code to use dev_groups

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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:55:54

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 02/11] mdio_bus: convert bus code to use dev_groups

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 <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Nick Bowler <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:56:00

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 03/11] PNP: convert bus code to use dev_groups

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 <[email protected]>
Cc: Bjorn Helgaas <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:56:13

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 05/11] uwb: convert bus code to use dev_groups

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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
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

2013-10-07 06:56:07

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 04/11] MMC: convert bus code to use dev_groups

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 <[email protected]>
Cc: Ulf Hansson <[email protected]>
Cc: Konstantin Dorfman <[email protected]>
Cc: Seungwon Jeon <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:56:17

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 06/11] bcma: convert bus code to use dev_groups

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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:56:22

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 07/11] pcmcia: convert bus code to use dev_groups

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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
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

2013-10-07 06:56:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 09/11] ssb: convert bus code to use dev_groups

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 <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:56:26

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 08/11] rapidio: convert bus code to use dev_groups

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 <[email protected]>
Cc: Alexandre Bounine <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---

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

2013-10-07 06:58:40

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 11/11] hsi: convert bus code to use dev_groups

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 <[email protected]>
Cc: Kees Cook <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
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

2013-10-07 16:31:45

by Boris Ostrovsky

[permalink] [raw]
Subject: Re: [PATCH 10/11] xenbus: convert bus code to use dev_groups

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 <[email protected]>
> Cc: Boris Ostrovsky <[email protected]>
> Cc: David Vrabel <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> 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,
> },

2013-10-07 18:21:59

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 01/11] pci: convert bus code to use dev_groups

[+cc Sachin]

On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
<[email protected]> 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 <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> 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

2013-10-07 20:41:52

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 01/11] pci: convert bus code to use dev_groups

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
> <[email protected]> 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 <[email protected]>
> > Cc: <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
> > ---
> >
> > 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

2013-10-07 20:48:24

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 01/11] pci: convert bus code to use dev_groups

On Mon, Oct 7, 2013 at 2:41 PM, Greg Kroah-Hartman
<[email protected]> 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
>> <[email protected]> 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 <[email protected]>
>> > Cc: <[email protected]>
>> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
>> > ---
>> >
>> > 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

2013-10-07 21:18:59

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH 01/11] pci: convert bus code to use dev_groups

On Mon, Oct 7, 2013 at 12:55 AM, Greg Kroah-Hartman
<[email protected]> 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 <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> 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
>

2013-10-07 21:27:13

by Wysocki, Rafael J

[permalink] [raw]
Subject: Re: [PATCH 03/11] PNP: convert bus code to use dev_groups

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 <[email protected]>
> Cc: Bjorn Helgaas <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> 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 <[email protected]>

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.

2013-10-09 15:15:15

by John W. Linville

[permalink] [raw]
Subject: Re: [PATCH 06/11] bcma: convert bus code to use dev_groups

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 <[email protected]>
> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
>
> 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 [email protected]
> 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
[email protected] might be all we have. Be ready.

2013-10-10 08:08:22

by Rafał Miłecki

[permalink] [raw]
Subject: Re: [PATCH 06/11] bcma: convert bus code to use dev_groups

2013/10/9 John W. Linville <[email protected]>:
> 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 <[email protected]>
>> Cc: <[email protected]>
>> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>> ---
>>
>> 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 :)