Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kobject: convert /sys/hypervisor to use kobject_create

We don't need a kset here, a simple kobject will do just fine, so
dynamically create the kobject and use it.

We also rename hypervisor_subsys to hypervisor_kset to catch all users
of the variable.

Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

+11 -7
+1 -1
arch/s390/hypfs/inode.c
··· 506 506 goto fail_diag; 507 507 } 508 508 } 509 - s390_subsys.kobj.kset = &hypervisor_subsys; 509 + s390_subsys.kobj.parent = hypervisor_kobj; 510 510 rc = subsystem_register(&s390_subsys); 511 511 if (rc) 512 512 goto fail_sysfs;
+8 -4
drivers/base/hypervisor.c
··· 2 2 * hypervisor.c - /sys/hypervisor subsystem. 3 3 * 4 4 * Copyright (C) IBM Corp. 2006 5 + * Copyright (C) 2007 Greg Kroah-Hartman <gregkh@suse.de> 6 + * Copyright (C) 2007 Novell Inc. 5 7 * 6 8 * This file is released under the GPLv2 7 9 */ 8 10 9 11 #include <linux/kobject.h> 10 12 #include <linux/device.h> 11 - 12 13 #include "base.h" 13 14 14 - decl_subsys(hypervisor, NULL); 15 - EXPORT_SYMBOL_GPL(hypervisor_subsys); 15 + struct kobject *hypervisor_kobj; 16 + EXPORT_SYMBOL_GPL(hypervisor_kobj); 16 17 17 18 int __init hypervisor_init(void) 18 19 { 19 - return subsystem_register(&hypervisor_subsys); 20 + hypervisor_kobj = kobject_create_and_add("hypervisor", NULL); 21 + if (!hypervisor_kobj) 22 + return -ENOMEM; 23 + return 0; 20 24 }
+2 -2
include/linux/kobject.h
··· 196 196 197 197 /* The global /sys/kernel/ kset for people to chain off of */ 198 198 extern struct kset *kernel_kset; 199 - /* The global /sys/hypervisor/ subsystem */ 200 - extern struct kset hypervisor_subsys; 199 + /* The global /sys/hypervisor/ kobject for people to chain off of */ 200 + extern struct kobject *hypervisor_kobj; 201 201 202 202 extern int __must_check subsystem_register(struct kset *); 203 203 extern void subsystem_unregister(struct kset *);