提交 1a6661da 编写于 作者: G Greg Kroah-Hartman

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.
Acked-by: NTejun Heo <tj@kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 32f389ec
...@@ -3081,15 +3081,16 @@ static struct workqueue_struct *dev_to_wq(struct device *dev) ...@@ -3081,15 +3081,16 @@ static struct workqueue_struct *dev_to_wq(struct device *dev)
return wq_dev->wq; return wq_dev->wq;
} }
static ssize_t wq_per_cpu_show(struct device *dev, static ssize_t per_cpu_show(struct device *dev, struct device_attribute *attr,
struct device_attribute *attr, char *buf) char *buf)
{ {
struct workqueue_struct *wq = dev_to_wq(dev); struct workqueue_struct *wq = dev_to_wq(dev);
return scnprintf(buf, PAGE_SIZE, "%d\n", (bool)!(wq->flags & WQ_UNBOUND)); 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, static ssize_t max_active_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct workqueue_struct *wq = dev_to_wq(dev); struct workqueue_struct *wq = dev_to_wq(dev);
...@@ -3097,9 +3098,9 @@ static ssize_t wq_max_active_show(struct device *dev, ...@@ -3097,9 +3098,9 @@ static ssize_t wq_max_active_show(struct device *dev,
return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active); return scnprintf(buf, PAGE_SIZE, "%d\n", wq->saved_max_active);
} }
static ssize_t wq_max_active_store(struct device *dev, static ssize_t max_active_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr, const char *buf,
const char *buf, size_t count) size_t count)
{ {
struct workqueue_struct *wq = dev_to_wq(dev); struct workqueue_struct *wq = dev_to_wq(dev);
int val; int val;
...@@ -3110,12 +3111,14 @@ static ssize_t wq_max_active_store(struct device *dev, ...@@ -3110,12 +3111,14 @@ static ssize_t wq_max_active_store(struct device *dev,
workqueue_set_max_active(wq, val); workqueue_set_max_active(wq, val);
return count; return count;
} }
static DEVICE_ATTR_RW(max_active);
static struct device_attribute wq_sysfs_attrs[] = { static struct attribute *wq_sysfs_attrs[] = {
__ATTR(per_cpu, 0444, wq_per_cpu_show, NULL), &dev_attr_per_cpu.attr,
__ATTR(max_active, 0644, wq_max_active_show, wq_max_active_store), &dev_attr_max_active.attr,
__ATTR_NULL, NULL,
}; };
ATTRIBUTE_GROUPS(wq_sysfs);
static ssize_t wq_pool_ids_show(struct device *dev, static ssize_t wq_pool_ids_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
...@@ -3265,7 +3268,7 @@ static struct device_attribute wq_sysfs_unbound_attrs[] = { ...@@ -3265,7 +3268,7 @@ static struct device_attribute wq_sysfs_unbound_attrs[] = {
static struct bus_type wq_subsys = { static struct bus_type wq_subsys = {
.name = "workqueue", .name = "workqueue",
.dev_attrs = wq_sysfs_attrs, .dev_groups = wq_sysfs_groups,
}; };
static int __init wq_sysfs_init(void) static int __init wq_sysfs_init(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册