2013-08-23 21:24:53

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 01/15] PCI: convert bus code to use bus_groups

The bus_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]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/pci/pci-driver.c | 2 +-
drivers/pci/pci-sysfs.c | 16 +++++++++++++---
drivers/pci/pci.h | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index e6515e21..09db761e 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1274,7 +1274,7 @@ struct bus_type pci_bus_type = {
.remove = pci_device_remove,
.shutdown = pci_device_shutdown,
.dev_attrs = pci_dev_attrs,
- .bus_attrs = pci_bus_attrs,
+ .bus_groups = pci_bus_groups,
.drv_attrs = pci_drv_attrs,
.pm = PCI_PM_OPS_PTR,
};
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index c0dbe1f6..f0195946 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -302,10 +302,20 @@ static ssize_t bus_rescan_store(struct bus_type *bus, const char *buf,
}
return count;
}
+static BUS_ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store);

-struct bus_attribute pci_bus_attrs[] = {
- __ATTR(rescan, (S_IWUSR|S_IWGRP), NULL, bus_rescan_store),
- __ATTR_NULL
+struct attribute *pci_bus_attrs[] = {
+ &bus_attr_rescan.attr,
+ NULL,
+};
+
+static const struct attribute_group pci_bus_group = {
+ .attrs = pci_bus_attrs,
+};
+
+const struct attribute_group *pci_bus_groups[] = {
+ &pci_bus_group,
+ NULL,
};

static ssize_t
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index d1182c4a..62bcf2bd 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)
extern struct device_attribute pci_dev_attrs[];
extern struct device_attribute pcibus_dev_attrs[];
extern struct device_type pci_dev_type;
-extern struct bus_attribute pci_bus_attrs[];
+extern const struct attribute_group *pci_bus_groups[];


/**
--
1.8.3.rc0.20.gb99dd2e


2013-08-23 21:24:59

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 06/15] SCSI: fcoe: convert bus code to use bus_groups

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

Cc: Robert Love <[email protected]>
Cc: "James E.J. Bottomley" <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/scsi/fcoe/fcoe_sysfs.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/fcoe/fcoe_sysfs.c b/drivers/scsi/fcoe/fcoe_sysfs.c
index c9382d6e..8189b96e 100644
--- a/drivers/scsi/fcoe/fcoe_sysfs.c
+++ b/drivers/scsi/fcoe/fcoe_sysfs.c
@@ -553,16 +553,20 @@ static struct device_type fcoe_fcf_device_type = {
.release = fcoe_fcf_device_release,
};

-static struct bus_attribute fcoe_bus_attr_group[] = {
- __ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store),
- __ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store),
- __ATTR_NULL
+static BUS_ATTR(ctlr_create, S_IWUSR, NULL, fcoe_ctlr_create_store);
+static BUS_ATTR(ctlr_destroy, S_IWUSR, NULL, fcoe_ctlr_destroy_store);
+
+static struct attribute *fcoe_bus_attrs[] = {
+ &bus_attr_ctlr_create.attr,
+ &bus_attr_ctrl_destroy.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(fcoe_bus);

static struct bus_type fcoe_bus_type = {
.name = "fcoe",
.match = &fcoe_bus_match,
- .bus_attrs = fcoe_bus_attr_group,
+ .bus_groups = fcoe_bus_groups,
};

/**
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:25:07

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 13/15] MEI: 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 MEI bus code to use
the correct field.

Cc: Tomas Winkler <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/misc/mei/bus.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/misc/mei/bus.c b/drivers/misc/mei/bus.c
index 9ecd49a7..2ce92a6a 100644
--- a/drivers/misc/mei/bus.c
+++ b/drivers/misc/mei/bus.c
@@ -108,11 +108,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,

return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
+static DEVICE_ATTR_RO(modalias);

-static struct device_attribute mei_cl_dev_attrs[] = {
- __ATTR_RO(modalias),
- __ATTR_NULL,
+static struct attribute *mei_cl_dev_attrs[] = {
+ &dev_attr_modalias.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(mei_cl_dev);

static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
{
@@ -124,7 +126,7 @@ static int mei_cl_uevent(struct device *dev, struct kobj_uevent_env *env)

static struct bus_type mei_cl_bus_type = {
.name = "mei",
- .dev_attrs = mei_cl_dev_attrs,
+ .dev_groups = mei_cl_dev_groups,
.match = mei_cl_device_match,
.probe = mei_cl_device_probe,
.remove = mei_cl_device_remove,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:25:06

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 14/15] pmu_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 pmu bus code to use
the correct field.

Cc: Peter Zijlstra <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/events/core.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index f86599e8..0417ccae 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -6189,6 +6189,7 @@ type_show(struct device *dev, struct device_attribute *attr, char *page)

return snprintf(page, PAGE_SIZE-1, "%d\n", pmu->type);
}
+static DEVICE_ATTR_RO(type);

static ssize_t
perf_event_mux_interval_ms_show(struct device *dev,
@@ -6233,17 +6234,19 @@ perf_event_mux_interval_ms_store(struct device *dev,

return count;
}
+static DEVICE_ATTR_RW(perf_event_mux_interval_ms);

-static struct device_attribute pmu_dev_attrs[] = {
- __ATTR_RO(type),
- __ATTR_RW(perf_event_mux_interval_ms),
- __ATTR_NULL,
+static struct attribute *pmu_dev_attrs[] = {
+ &dev_attr_type.attr,
+ &dev_attr_perf_event_mux_interval_ms.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(pmu_dev);

static int pmu_bus_running;
static struct bus_type pmu_bus = {
.name = "event_source",
- .dev_attrs = pmu_dev_attrs,
+ .dev_groups = pmu_dev_groups,
};

static void pmu_dev_release(struct device *dev)
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:25:45

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 10/15] USB: serial: convert bus code to use drv_groups

The drv_attrs field of struct bus_type is going away soon, drv_groups
should be used instead. This converts the USB serial bus code to use
the correct field.

Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/usb/serial/bus.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/serial/bus.c b/drivers/usb/serial/bus.c
index f053b302..24624339 100644
--- a/drivers/usb/serial/bus.c
+++ b/drivers/usb/serial/bus.c
@@ -122,7 +122,7 @@ static int usb_serial_device_remove(struct device *dev)
return retval;
}

-static ssize_t store_new_id(struct device_driver *driver,
+static ssize_t new_id_store(struct device_driver *driver,
const char *buf, size_t count)
{
struct usb_serial_driver *usb_drv = to_usb_serial_driver(driver);
@@ -135,17 +135,19 @@ static ssize_t store_new_id(struct device_driver *driver,
return retval;
}

-static ssize_t show_dynids(struct device_driver *driver, char *buf)
+static ssize_t new_id_show(struct device_driver *driver, char *buf)
{
struct usb_serial_driver *usb_drv = to_usb_serial_driver(driver);

return usb_show_dynids(&usb_drv->dynids, buf);
}
+static DRIVER_ATTR_RW(new_id);

-static struct driver_attribute drv_attrs[] = {
- __ATTR(new_id, S_IRUGO | S_IWUSR, show_dynids, store_new_id),
- __ATTR_NULL,
+static struct attribute *usb_serial_drv_attrs[] = {
+ &driver_attr_new_id.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(usb_serial_drv);

static void free_dynids(struct usb_serial_driver *drv)
{
@@ -164,7 +166,7 @@ struct bus_type usb_serial_bus_type = {
.match = usb_serial_device_match,
.probe = usb_serial_device_probe,
.remove = usb_serial_device_remove,
- .drv_attrs = drv_attrs,
+ .drv_groups = usb_serial_drv_groups,
};

int usb_serial_bus_register(struct usb_serial_driver *driver)
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:25:03

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 09/15] PCI: convert bus code to use drv_groups

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

Cc: Bjorn Helgaas <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/pci/pci-driver.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index 09db761e..a9c53f03 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -135,6 +135,7 @@ store_new_id(struct device_driver *driver, const char *buf, size_t count)
return retval;
return count;
}
+static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id);

/**
* store_remove_id - remove a PCI device ID from this driver
@@ -180,12 +181,14 @@ store_remove_id(struct device_driver *driver, const char *buf, size_t count)
return retval;
return count;
}
+static DRIVER_ATTR(remove_id, S_IWUSR, NULL, store_remove_id);

-static struct driver_attribute pci_drv_attrs[] = {
- __ATTR(new_id, S_IWUSR, NULL, store_new_id),
- __ATTR(remove_id, S_IWUSR, NULL, store_remove_id),
- __ATTR_NULL,
+static struct attribute *pci_drv_attrs[] = {
+ &driver_attr_new_id.attr,
+ &driver_attr_remove_id.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(pci_drv);

/**
* pci_match_id - See if a pci device matches a given pci_id table
@@ -1275,7 +1278,7 @@ struct bus_type pci_bus_type = {
.shutdown = pci_device_shutdown,
.dev_attrs = pci_dev_attrs,
.bus_groups = pci_bus_groups,
- .drv_attrs = pci_drv_attrs,
+ .drv_groups = pci_drv_groups,
.pm = PCI_PM_OPS_PTR,
};

--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:26:01

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 15/15] workqueue: 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 workqueue bus code to use
the correct field.

Cc: Tejun Heo <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
kernel/workqueue.c | 27 +++++++++++++++------------
1 file changed, 15 insertions(+), 12 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 7f5d4be2..0d6063d8 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -3086,25 +3086,26 @@ static struct workqueue_struct *dev_to_wq(struct device *dev)
return wq_dev->wq;
}

-static ssize_t wq_per_cpu_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t per_cpu_show(struct device *dev, struct device_attribute *attr,
+ char *buf)
{
struct workqueue_struct *wq = dev_to_wq(dev);

return scnprintf(buf, PAGE_SIZE, "%d\n", (bool)!(wq->flags & WQ_UNBOUND));
}
+static DEVICE_ATTR_RO(per_cpu);

-static ssize_t wq_max_active_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+static ssize_t max_active_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
{
struct workqueue_struct *wq = dev_to_wq(dev);

return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active);
}

-static ssize_t wq_max_active_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t count)
+static ssize_t max_active_store(struct device *dev,
+ struct device_attribute *attr, const char *buf,
+ size_t count)
{
struct workqueue_struct *wq = dev_to_wq(dev);
int val;
@@ -3115,12 +3116,14 @@ static ssize_t wq_max_active_store(struct device *dev,
workqueue_set_max_active(wq, val);
return count;
}
+static DEVICE_ATTR_RW(max_active);

-static struct device_attribute wq_sysfs_attrs[] = {
- __ATTR(per_cpu, 0444, wq_per_cpu_show, NULL),
- __ATTR(max_active, 0644, wq_max_active_show, wq_max_active_store),
- __ATTR_NULL,
+static struct attribute *wq_sysfs_attrs[] = {
+ &dev_attr_per_cpu.attr,
+ &dev_attr_max_active.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(wq_sysfs);

static ssize_t wq_pool_ids_show(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -3270,7 +3273,7 @@ static struct device_attribute wq_sysfs_unbound_attrs[] = {

static struct bus_type wq_subsys = {
.name = "workqueue",
- .dev_attrs = wq_sysfs_attrs,
+ .dev_groups = wq_sysfs_groups,
};

static int __init wq_sysfs_init(void)
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:26:27

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 12/15] HID: 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 HID bus code to use
the correct field.

Cc: Jiri Kosina <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/hid/hid-core.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index 36668d1a..b8f1c77f 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -1917,11 +1917,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,

return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
+static DEVICE_ATTR_RO(modalias);

-static struct device_attribute hid_dev_attrs[] = {
- __ATTR_RO(modalias),
- __ATTR_NULL,
+static struct attribute *hid_dev_attrs[] = {
+ &dev_attr_modalias.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(hid_dev);

static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
{
@@ -1949,7 +1951,7 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)

static struct bus_type hid_bus_type = {
.name = "hid",
- .dev_attrs = hid_dev_attrs,
+ .dev_groups = hid_dev_groups,
.match = hid_bus_match,
.probe = hid_device_probe,
.remove = hid_device_remove,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:26:42

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 11/15] driver-core: platform: 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 platform bus code to use
the correct field.

Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/base/platform.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 3c3197a8..5343f24e 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -672,11 +672,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,

return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
}
+static DEVICE_ATTR_RO(modalias);

-static struct device_attribute platform_dev_attrs[] = {
- __ATTR_RO(modalias),
- __ATTR_NULL,
+static struct attribute *platform_dev_attrs[] = {
+ &dev_attr_modalias.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(platform_dev);

static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)
{
@@ -893,7 +895,7 @@ static const struct dev_pm_ops platform_dev_pm_ops = {

struct bus_type platform_bus_type = {
.name = "platform",
- .dev_attrs = platform_dev_attrs,
+ .dev_groups = platform_dev_groups,
.match = platform_match,
.uevent = platform_uevent,
.pm = &platform_dev_pm_ops,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:27:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 08/15] Input: serio: convert bus code to use drv_groups

The drv_attrs field of struct bus_type is going away soon, drv_groups
should be used instead. This converts the serio bus code to use the
correct field.

Cc: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/input/serio/serio.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index 25fc5971..2b56855c 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -732,19 +732,20 @@ EXPORT_SYMBOL(serio_unregister_child_port);
* Serio driver operations
*/

-static ssize_t serio_driver_show_description(struct device_driver *drv, char *buf)
+static ssize_t description_show(struct device_driver *drv, char *buf)
{
struct serio_driver *driver = to_serio_driver(drv);
return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)");
}
+static DRIVER_ATTR_RO(description);

-static ssize_t serio_driver_show_bind_mode(struct device_driver *drv, char *buf)
+static ssize_t bind_mode_show(struct device_driver *drv, char *buf)
{
struct serio_driver *serio_drv = to_serio_driver(drv);
return sprintf(buf, "%s\n", serio_drv->manual_bind ? "manual" : "auto");
}

-static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char *buf, size_t count)
+static ssize_t bind_mode_store(struct device_driver *drv, const char *buf, size_t count)
{
struct serio_driver *serio_drv = to_serio_driver(drv);
int retval;
@@ -760,14 +761,14 @@ static ssize_t serio_driver_set_bind_mode(struct device_driver *drv, const char

return retval;
}
+static DRIVER_ATTR_RW(bind_mode);

-
-static struct driver_attribute serio_driver_attrs[] = {
- __ATTR(description, S_IRUGO, serio_driver_show_description, NULL),
- __ATTR(bind_mode, S_IWUSR | S_IRUGO,
- serio_driver_show_bind_mode, serio_driver_set_bind_mode),
- __ATTR_NULL
+static struct attribute *serio_driver_attrs[] = {
+ &driver_attr_description.attr,
+ &driver_attr_bind_mode.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(serio_driver);

static int serio_driver_probe(struct device *dev)
{
@@ -996,7 +997,7 @@ EXPORT_SYMBOL(serio_interrupt);
static struct bus_type serio_bus = {
.name = "serio",
.dev_attrs = serio_device_attrs,
- .drv_attrs = serio_driver_attrs,
+ .drv_groups = serio_driver_groups,
.match = serio_bus_match,
.uevent = serio_uevent,
.probe = serio_driver_probe,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:24:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 05/15] PPC: VIO: convert bus code to use bus_groups

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

Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
arch/powerpc/kernel/vio.c | 66 ++++++++++++++++++++++++++---------------------
1 file changed, 36 insertions(+), 30 deletions(-)

diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 536016d7..5e34f20b 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -997,21 +997,36 @@ static struct device_attribute vio_cmo_dev_attrs[] = {
/* sysfs bus functions and data structures for CMO */

#define viobus_cmo_rd_attr(name) \
-static ssize_t \
-viobus_cmo_##name##_show(struct bus_type *bt, char *buf) \
+static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf) \
{ \
return sprintf(buf, "%lu\n", vio_cmo.name); \
-}
+} \
+static BUS_ATTR_RO(cmo_##name)

#define viobus_cmo_pool_rd_attr(name, var) \
static ssize_t \
-viobus_cmo_##name##_pool_show_##var(struct bus_type *bt, char *buf) \
+cmo_##name##_##var##_show(struct bus_type *bt, char *buf) \
{ \
return sprintf(buf, "%lu\n", vio_cmo.name.var); \
+} \
+static BUS_ATTR_RO(cmo_##name##_##var)
+
+viobus_cmo_rd_attr(entitled);
+viobus_cmo_rd_attr(spare);
+viobus_cmo_rd_attr(min);
+viobus_cmo_rd_attr(desired);
+viobus_cmo_rd_attr(curr);
+viobus_cmo_pool_rd_attr(reserve, size);
+viobus_cmo_pool_rd_attr(excess, size);
+viobus_cmo_pool_rd_attr(excess, free);
+
+static ssize_t cmo_high_show(struct bus_type *bt, char *buf)
+{
+ return sprintf(buf, "%lu\n", vio_cmo.high);
}

-static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,
- size_t count)
+static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
+ size_t count)
{
unsigned long flags;

@@ -1021,35 +1036,26 @@ static ssize_t viobus_cmo_high_reset(struct bus_type *bt, const char *buf,

return count;
}
-
-viobus_cmo_rd_attr(entitled);
-viobus_cmo_pool_rd_attr(reserve, size);
-viobus_cmo_pool_rd_attr(excess, size);
-viobus_cmo_pool_rd_attr(excess, free);
-viobus_cmo_rd_attr(spare);
-viobus_cmo_rd_attr(min);
-viobus_cmo_rd_attr(desired);
-viobus_cmo_rd_attr(curr);
-viobus_cmo_rd_attr(high);
-
-static struct bus_attribute vio_cmo_bus_attrs[] = {
- __ATTR(cmo_entitled, S_IRUGO, viobus_cmo_entitled_show, NULL),
- __ATTR(cmo_reserve_size, S_IRUGO, viobus_cmo_reserve_pool_show_size, NULL),
- __ATTR(cmo_excess_size, S_IRUGO, viobus_cmo_excess_pool_show_size, NULL),
- __ATTR(cmo_excess_free, S_IRUGO, viobus_cmo_excess_pool_show_free, NULL),
- __ATTR(cmo_spare, S_IRUGO, viobus_cmo_spare_show, NULL),
- __ATTR(cmo_min, S_IRUGO, viobus_cmo_min_show, NULL),
- __ATTR(cmo_desired, S_IRUGO, viobus_cmo_desired_show, NULL),
- __ATTR(cmo_curr, S_IRUGO, viobus_cmo_curr_show, NULL),
- __ATTR(cmo_high, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
- viobus_cmo_high_show, viobus_cmo_high_reset),
- __ATTR_NULL
+static BUS_ATTR_RW(cmo_high);
+
+static struct attribute *vio_bus_attrs[] = {
+ &bus_attr_cmo_entitled.attr,
+ &bus_attr_cmo_spare.attr,
+ &bus_attr_cmo_min.attr,
+ &bus_attr_cmo_desired.attr,
+ &bus_attr_cmo_curr.attr,
+ &bus_attr_cmo_high.attr,
+ &bus_attr_cmo_reserve_size.attr,
+ &bus_attr_cmo_excess_size.attr,
+ &bus_attr_cmo_excess_free.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(vio_bus);

static void vio_cmo_sysfs_init(void)
{
vio_bus_type.dev_attrs = vio_cmo_dev_attrs;
- vio_bus_type.bus_attrs = vio_cmo_bus_attrs;
+ vio_bus_type.bus_groups = vio_bus_groups;
}
#else /* CONFIG_PPC_SMLPAR */
int vio_cmo_entitlement_update(size_t new_entitlement) { return 0; }
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:27:29

by Winkler, Tomas

[permalink] [raw]
Subject: RE: [PATCH 13/15] MEI: 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 MEI bus code to use the correct field.
>
> Cc: Tomas Winkler <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

ACK
+ CC: Samuel.
Thanks
Tomas

2013-08-23 21:27:44

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 07/15] Input: gameport: convert bus code to use drv_groups

The drv_attrs field of struct bus_type is going away soon, drv_groups
should be used instead. This converts the gameport bus code to use the
correct field.

Cc: Dmitry Torokhov <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/input/gameport/gameport.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/input/gameport/gameport.c b/drivers/input/gameport/gameport.c
index da739d9d..922a7fea 100644
--- a/drivers/input/gameport/gameport.c
+++ b/drivers/input/gameport/gameport.c
@@ -639,16 +639,18 @@ EXPORT_SYMBOL(gameport_unregister_port);
* Gameport driver operations
*/

-static ssize_t gameport_driver_show_description(struct device_driver *drv, char *buf)
+static ssize_t description_show(struct device_driver *drv, char *buf)
{
struct gameport_driver *driver = to_gameport_driver(drv);
return sprintf(buf, "%s\n", driver->description ? driver->description : "(none)");
}
+static DRIVER_ATTR_RO(description);

-static struct driver_attribute gameport_driver_attrs[] = {
- __ATTR(description, S_IRUGO, gameport_driver_show_description, NULL),
- __ATTR_NULL
+static struct attribute *gameport_driver_attrs[] = {
+ &driver_attr_description.attr,
+ NULL
};
+ATTRIBUTE_GROUPS(gameport_driver);

static int gameport_driver_probe(struct device *dev)
{
@@ -749,7 +751,7 @@ static int gameport_bus_match(struct device *dev, struct device_driver *drv)
static struct bus_type gameport_bus = {
.name = "gameport",
.dev_attrs = gameport_device_attrs,
- .drv_attrs = gameport_driver_attrs,
+ .drv_groups = gameport_driver_groups,
.match = gameport_bus_match,
.probe = gameport_driver_probe,
.remove = gameport_driver_remove,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:24:55

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 02/15] rbd: convert bus code to use bus_groups

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

Cc: Yehuda Sadeh <[email protected]>
Cc: Sage Weil <[email protected]>
Cc: Alex Elder <[email protected]>
Cc: <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/block/rbd.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 4ad2ad9a..191cd177 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -397,15 +397,19 @@ static ssize_t rbd_remove(struct bus_type *bus, const char *buf,
static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);
static void rbd_spec_put(struct rbd_spec *spec);

-static struct bus_attribute rbd_bus_attrs[] = {
- __ATTR(add, S_IWUSR, NULL, rbd_add),
- __ATTR(remove, S_IWUSR, NULL, rbd_remove),
- __ATTR_NULL
+static BUS_ATTR(add, S_IWUSR, NULL, rbd_add);
+static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove);
+
+static struct attribute *rbd_bus_attrs[] = {
+ &bus_attr_add.attr,
+ &bus_attr_remove.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(rbd_bus);

static struct bus_type rbd_bus_type = {
.name = "rbd",
- .bus_attrs = rbd_bus_attrs,
+ .bus_groups = rbd_bus_groups,
};

static void rbd_root_dev_release(struct device *dev)
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:28:01

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 04/15] PPC: ibmebus: convert bus code to use bus_groups

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

Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Paul Mackerras <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
arch/powerpc/kernel/ibmebus.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 16a7c232..1114d13a 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -292,6 +292,7 @@ out:
return rc;
return count;
}
+static BUS_ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe);

static ssize_t ibmebus_store_remove(struct bus_type *bus,
const char *buf, size_t count)
@@ -317,13 +318,14 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
return -ENODEV;
}
}
+static BUS_ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove);

-
-static struct bus_attribute ibmebus_bus_attrs[] = {
- __ATTR(probe, S_IWUSR, NULL, ibmebus_store_probe),
- __ATTR(remove, S_IWUSR, NULL, ibmebus_store_remove),
- __ATTR_NULL
+static struct attribute *ibmbus_bus_attrs[] = {
+ &bus_attr_probe.attr,
+ &bus_attr_remove.attr,
+ NULL,
};
+ATTRIBUTE_GROUPS(ibmbus_bus);

static int ibmebus_bus_bus_match(struct device *dev, struct device_driver *drv)
{
@@ -713,7 +715,7 @@ static struct dev_pm_ops ibmebus_bus_dev_pm_ops = {
struct bus_type ibmebus_bus_type = {
.name = "ibmebus",
.uevent = of_device_uevent_modalias,
- .bus_attrs = ibmebus_bus_attrs,
+ .bus_groups = ibmbus_bus_groups,
.match = ibmebus_bus_bus_match,
.probe = ibmebus_bus_device_probe,
.remove = ibmebus_bus_device_remove,
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:28:40

by Tejun Heo

[permalink] [raw]
Subject: Re: [PATCH 15/15] workqueue: convert bus code to use dev_groups

On Fri, Aug 23, 2013 at 02:24:41PM -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 workqueue bus code to use
> the correct field.
>
> Cc: Tejun Heo <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Tejun Heo <[email protected]>

If you want the patch to be routed through the wq tree, please let me
know.

Thanks.

--
tejun

2013-08-23 21:28:37

by Greg Kroah-Hartman

[permalink] [raw]
Subject: [PATCH 03/15] rapidio: convert bus code to use bus_groups

The bus_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]>
---
drivers/rapidio/rio-driver.c | 2 +-
drivers/rapidio/rio-sysfs.c | 16 +++++++++++++---
drivers/rapidio/rio.h | 2 +-
3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/drivers/rapidio/rio-driver.c b/drivers/rapidio/rio-driver.c
index 3e9b6a78..2be2d24d 100644
--- a/drivers/rapidio/rio-driver.c
+++ b/drivers/rapidio/rio-driver.c
@@ -224,7 +224,7 @@ struct bus_type rio_bus_type = {
.name = "rapidio",
.match = rio_match_bus,
.dev_attrs = rio_dev_attrs,
- .bus_attrs = rio_bus_attrs,
+ .bus_groups = rio_bus_groups,
.probe = rio_device_probe,
.remove = rio_device_remove,
.uevent = rio_uevent,
diff --git a/drivers/rapidio/rio-sysfs.c b/drivers/rapidio/rio-sysfs.c
index 9331be64..795a4776 100644
--- a/drivers/rapidio/rio-sysfs.c
+++ b/drivers/rapidio/rio-sysfs.c
@@ -316,8 +316,18 @@ exit:

return rc;
}
+static BUS_ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store);

-struct bus_attribute rio_bus_attrs[] = {
- __ATTR(scan, (S_IWUSR|S_IWGRP), NULL, bus_scan_store),
- __ATTR_NULL
+static struct attribute *rio_bus_attrs[] = {
+ &bus_attr_scan.attr,
+ NULL,
+};
+
+static const struct attribute_group rio_bus_group = {
+ .attrs = rio_bus_attrs,
+};
+
+const struct attribute_group *rio_bus_groups[] = {
+ &rio_bus_group,
+ NULL,
};
diff --git a/drivers/rapidio/rio.h b/drivers/rapidio/rio.h
index 085215cd..57d2ad06 100644
--- a/drivers/rapidio/rio.h
+++ b/drivers/rapidio/rio.h
@@ -49,7 +49,7 @@ extern int rio_mport_scan(int mport_id);

/* Structures internal to the RIO core code */
extern struct device_attribute rio_dev_attrs[];
-extern struct bus_attribute rio_bus_attrs[];
+extern const struct attribute_group *rio_bus_groups[];

#define RIO_GET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x00ff0000) >> 16))
#define RIO_SET_DID(size, x) (size ? (x & 0xffff) : ((x & 0x000000ff) << 16))
--
1.8.3.rc0.20.gb99dd2e

2013-08-23 21:34:21

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 15/15] workqueue: convert bus code to use dev_groups

On Fri, Aug 23, 2013 at 05:28:32PM -0400, Tejun Heo wrote:
> On Fri, Aug 23, 2013 at 02:24:41PM -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 workqueue bus code to use
> > the correct field.
> >
> > Cc: Tejun Heo <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> Acked-by: Tejun Heo <[email protected]>
>
> If you want the patch to be routed through the wq tree, please let me
> know.

No worries, I can take this through my driver-core tree, thanks for the
ack.

greg k-h

2013-08-24 23:33:22

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 07/15] Input: gameport: convert bus code to use drv_groups

On Fri, Aug 23, 2013 at 02:24:33PM -0700, Greg Kroah-Hartman wrote:
> The drv_attrs field of struct bus_type is going away soon, drv_groups
> should be used instead. This converts the gameport bus code to use the
> correct field.
>
> Cc: Dmitry Torokhov <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

I assume you'll be taking the entire series through your tree?

Thanks.

--
Dmitry

2013-08-24 23:33:45

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH 08/15] Input: serio: convert bus code to use drv_groups

On Fri, Aug 23, 2013 at 02:24:34PM -0700, Greg Kroah-Hartman wrote:
> The drv_attrs field of struct bus_type is going away soon, drv_groups
> should be used instead. This converts the serio bus code to use the
> correct field.
>
> Cc: Dmitry Torokhov <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Dmitry Torokhov <[email protected]>

Thanks.

--
Dmitry

2013-08-25 21:53:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 07/15] Input: gameport: convert bus code to use drv_groups

On Sat, Aug 24, 2013 at 04:33:18PM -0700, Dmitry Torokhov wrote:
> On Fri, Aug 23, 2013 at 02:24:33PM -0700, Greg Kroah-Hartman wrote:
> > The drv_attrs field of struct bus_type is going away soon, drv_groups
> > should be used instead. This converts the gameport bus code to use the
> > correct field.
> >
> > Cc: Dmitry Torokhov <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> Acked-by: Dmitry Torokhov <[email protected]>
>
> I assume you'll be taking the entire series through your tree?

Yes, I can easily do that, thanks.

greg k-h

2013-08-26 11:42:09

by Jiri Kosina

[permalink] [raw]
Subject: Re: [PATCH 12/15] HID: convert bus code to use dev_groups

On Fri, 23 Aug 2013, 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 HID bus code to use
> the correct field.
>
> Cc: Jiri Kosina <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>

Acked-by: Jiri Kosina <[email protected]>

> ---
> drivers/hid/hid-core.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
> index 36668d1a..b8f1c77f 100644
> --- a/drivers/hid/hid-core.c
> +++ b/drivers/hid/hid-core.c
> @@ -1917,11 +1917,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
>
> return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
> }
> +static DEVICE_ATTR_RO(modalias);
>
> -static struct device_attribute hid_dev_attrs[] = {
> - __ATTR_RO(modalias),
> - __ATTR_NULL,
> +static struct attribute *hid_dev_attrs[] = {
> + &dev_attr_modalias.attr,
> + NULL,
> };
> +ATTRIBUTE_GROUPS(hid_dev);
>
> static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
> {
> @@ -1949,7 +1951,7 @@ static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
>
> static struct bus_type hid_bus_type = {
> .name = "hid",
> - .dev_attrs = hid_dev_attrs,
> + .dev_groups = hid_dev_groups,
> .match = hid_bus_match,
> .probe = hid_device_probe,
> .remove = hid_device_remove,
> --
> 1.8.3.rc0.20.gb99dd2e
>

--
Jiri Kosina
SUSE Labs

2013-08-26 12:03:04

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 12/15] HID: convert bus code to use dev_groups

On Mon, Aug 26, 2013 at 01:42:03PM +0200, Jiri Kosina wrote:
> On Fri, 23 Aug 2013, 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 HID bus code to use
> > the correct field.
> >
> > Cc: Jiri Kosina <[email protected]>
> > Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> Acked-by: Jiri Kosina <[email protected]>

Thanks, I'll take this through my driver-core tree.

greg k-h

2013-08-27 12:35:25

by Alex Elder

[permalink] [raw]
Subject: Re: [PATCH 02/15] rbd: convert bus code to use bus_groups

On 08/23/2013 04:24 PM, Greg Kroah-Hartman wrote:
> The bus_attrs field of struct bus_type is going away soon, dev_groups
> should be used instead. This converts the RBD bus code to use the
> correct field.
>
> Cc: Yehuda Sadeh <[email protected]>
> Cc: Sage Weil <[email protected]>
> Cc: Alex Elder <[email protected]>

Looks reasonable to me.

Acked-by: Alex Elder <[email protected]>

> Cc: <[email protected]>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
> ---
> drivers/block/rbd.c | 14 +++++++++-----
> 1 file changed, 9 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
> index 4ad2ad9a..191cd177 100644
> --- a/drivers/block/rbd.c
> +++ b/drivers/block/rbd.c
> @@ -397,15 +397,19 @@ static ssize_t rbd_remove(struct bus_type *bus, const char *buf,
> static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);
> static void rbd_spec_put(struct rbd_spec *spec);
>
> -static struct bus_attribute rbd_bus_attrs[] = {
> - __ATTR(add, S_IWUSR, NULL, rbd_add),
> - __ATTR(remove, S_IWUSR, NULL, rbd_remove),
> - __ATTR_NULL
> +static BUS_ATTR(add, S_IWUSR, NULL, rbd_add);
> +static BUS_ATTR(remove, S_IWUSR, NULL, rbd_remove);
> +
> +static struct attribute *rbd_bus_attrs[] = {
> + &bus_attr_add.attr,
> + &bus_attr_remove.attr,
> + NULL,
> };
> +ATTRIBUTE_GROUPS(rbd_bus);
>
> static struct bus_type rbd_bus_type = {
> .name = "rbd",
> - .bus_attrs = rbd_bus_attrs,
> + .bus_groups = rbd_bus_groups,
> };
>
> static void rbd_root_dev_release(struct device *dev)
>

2013-08-28 05:04:50

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 02/15] rbd: convert bus code to use bus_groups

On Tue, Aug 27, 2013 at 07:35:32AM -0500, Alex Elder wrote:
> On 08/23/2013 04:24 PM, Greg Kroah-Hartman wrote:
> > The bus_attrs field of struct bus_type is going away soon, dev_groups
> > should be used instead. This converts the RBD bus code to use the
> > correct field.
> >
> > Cc: Yehuda Sadeh <[email protected]>
> > Cc: Sage Weil <[email protected]>
> > Cc: Alex Elder <[email protected]>
>
> Looks reasonable to me.
>
> Acked-by: Alex Elder <[email protected]>

Thanks for the review.

greg k-h