[PATCH wq/for-next 1/2] workqueue: let subsystem core create the cpumask attribute

From: Julian Wiedmann
Date: Mon Jun 07 2021 - 05:44:34 EST


Wrap the cpumask attribute in an ATTRIBUTE_GROUPS() macro, so that
subsys_virtual_register() can add it to the dev_root device for us.

Signed-off-by: Julian Wiedmann <jwi@xxxxxxxxxxxxx>
---
kernel/workqueue.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 104e3ef04e33..817dc2d7438a 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -5625,15 +5625,15 @@ static struct device_attribute wq_sysfs_cpumask_attr =
__ATTR(cpumask, 0644, wq_unbound_cpumask_show,
wq_unbound_cpumask_store);

+static struct attribute *wq_sysfs_dev_root_attrs[] = {
+ &wq_sysfs_cpumask_attr.attr,
+ NULL,
+};
+ATTRIBUTE_GROUPS(wq_sysfs_dev_root);
+
static int __init wq_sysfs_init(void)
{
- int err;
-
- err = subsys_virtual_register(&wq_subsys, NULL);
- if (err)
- return err;
-
- return device_create_file(wq_subsys.dev_root, &wq_sysfs_cpumask_attr);
+ return subsys_virtual_register(&wq_subsys, wq_sysfs_dev_root_groups);
}
core_initcall(wq_sysfs_init);

--
2.25.1