Re: [PATCH 3/4] workqueue: Add anon workqueue sysfs hierarchy

From: Viresh Kumar
Date: Thu Apr 03 2014 - 03:07:15 EST


On 27 March 2014 22:51, Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:
> diff --git a/kernel/workqueue.c b/kernel/workqueue.c

> static int __init wq_sysfs_init(void)
> {
> - return subsys_virtual_register(&wq_subsys, NULL);
> + struct device *anon_dev;
> + int ret;
> +
> + ret = subsys_virtual_register(&wq_subsys, NULL);
> + if (ret < 0)
> + return ret;
> +
> + mutex_lock(&wq_unbound_mutex);
> + cpumask_copy(&wq_anon_cpumask, cpu_possible_mask);
> + mutex_unlock(&wq_unbound_mutex);
> +
> + anon_dev = kzalloc(sizeof(*anon_dev), GFP_KERNEL);
> + if (!anon_dev)
> + return -ENOMEM;
> +
> + anon_dev->bus = &wq_subsys;
> + anon_dev->init_name = "anon_wqs";
> + anon_dev->release = device_release;
> +
> + ret = device_register(anon_dev);
> + if (ret) {
> + kfree(anon_dev);
> + return ret;
> + }
> +
> + ret = device_create_file(anon_dev, &wq_sysfs_anon_attr);
> + if (ret) {
> + device_unregister(anon_dev);

kfree(anon_dev) ??

> + return ret;
> + }
> +
> + kobject_uevent(&anon_dev->kobj, KOBJ_ADD);
> +
> + return 0;
> }
> core_initcall(wq_sysfs_init);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/