aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/xen/sys-hypervisor.c
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2016-02-21 19:06:07 -0500
committerDavid Vrabel <david.vrabel@citrix.com>2016-03-21 11:14:03 -0400
commit46894f17af151f9f2050821aaa889a32c7cbd16f (patch)
tree1558d924120992cae8162974b2fc966481e1a5d7 /drivers/xen/sys-hypervisor.c
parentab1241a1fc4351be16a5fd5c34001de08c696169 (diff)
drivers/xen: make sys-hypervisor.c explicitly non-modular
The Kconfig currently controlling compilation of this code is: config XEN_SYS_HYPERVISOR bool "Create xen entries under /sys/hypervisor" ...meaning that it currently is not being built as a module by anyone. Lets remove the modular code that is essentially orphaned, so that when reading the driver there is no doubt it is builtin-only. Since module_init translates to device_initcall in the non-modular case, the init ordering remains unchanged with this commit. However one could argue that fs_initcall() might make more sense here. This change means that the one line function xen_properties_destroy() has only one user left, and since that is inside an #ifdef, we just manually inline it there vs. adding more ifdeffery around the function to avoid compile warnings about "defined but not used". In order to be consistent we also manually inline the other _destroy functions that are also just one line sysfs functions calls with only one call site remaing, even though they wouldn't need #ifdeffery. Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Diffstat (limited to 'drivers/xen/sys-hypervisor.c')
-rw-r--r--drivers/xen/sys-hypervisor.c59
1 files changed, 8 insertions, 51 deletions
diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c
index b5a7342e0ba5..6881b3ceb675 100644
--- a/drivers/xen/sys-hypervisor.c
+++ b/drivers/xen/sys-hypervisor.c
@@ -9,7 +9,7 @@
9 9
10#include <linux/slab.h> 10#include <linux/slab.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/init.h>
13#include <linux/kobject.h> 13#include <linux/kobject.h>
14#include <linux/err.h> 14#include <linux/err.h>
15 15
@@ -50,11 +50,6 @@ static int __init xen_sysfs_type_init(void)
50 return sysfs_create_file(hypervisor_kobj, &type_attr.attr); 50 return sysfs_create_file(hypervisor_kobj, &type_attr.attr);
51} 51}
52 52
53static void xen_sysfs_type_destroy(void)
54{
55 sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
56}
57
58/* xen version attributes */ 53/* xen version attributes */
59static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer) 54static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer)
60{ 55{
@@ -111,11 +106,6 @@ static int __init xen_sysfs_version_init(void)
111 return sysfs_create_group(hypervisor_kobj, &version_group); 106 return sysfs_create_group(hypervisor_kobj, &version_group);
112} 107}
113 108
114static void xen_sysfs_version_destroy(void)
115{
116 sysfs_remove_group(hypervisor_kobj, &version_group);
117}
118
119/* UUID */ 109/* UUID */
120 110
121static ssize_t uuid_show_fallback(struct hyp_sysfs_attr *attr, char *buffer) 111static ssize_t uuid_show_fallback(struct hyp_sysfs_attr *attr, char *buffer)
@@ -157,11 +147,6 @@ static int __init xen_sysfs_uuid_init(void)
157 return sysfs_create_file(hypervisor_kobj, &uuid_attr.attr); 147 return sysfs_create_file(hypervisor_kobj, &uuid_attr.attr);
158} 148}
159 149
160static void xen_sysfs_uuid_destroy(void)
161{
162 sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr);
163}
164
165/* xen compilation attributes */ 150/* xen compilation attributes */
166 151
167static ssize_t compiler_show(struct hyp_sysfs_attr *attr, char *buffer) 152static ssize_t compiler_show(struct hyp_sysfs_attr *attr, char *buffer)
@@ -235,11 +220,6 @@ static int __init xen_compilation_init(void)
235 return sysfs_create_group(hypervisor_kobj, &xen_compilation_group); 220 return sysfs_create_group(hypervisor_kobj, &xen_compilation_group);
236} 221}
237 222
238static void xen_compilation_destroy(void)
239{
240 sysfs_remove_group(hypervisor_kobj, &xen_compilation_group);
241}
242
243/* xen properties info */ 223/* xen properties info */
244 224
245static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer) 225static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer)
@@ -366,11 +346,6 @@ static int __init xen_properties_init(void)
366 return sysfs_create_group(hypervisor_kobj, &xen_properties_group); 346 return sysfs_create_group(hypervisor_kobj, &xen_properties_group);
367} 347}
368 348
369static void xen_properties_destroy(void)
370{
371 sysfs_remove_group(hypervisor_kobj, &xen_properties_group);
372}
373
374#ifdef CONFIG_XEN_HAVE_VPMU 349#ifdef CONFIG_XEN_HAVE_VPMU
375struct pmu_mode { 350struct pmu_mode {
376 const char *name; 351 const char *name;
@@ -484,11 +459,6 @@ static int __init xen_pmu_init(void)
484{ 459{
485 return sysfs_create_group(hypervisor_kobj, &xen_pmu_group); 460 return sysfs_create_group(hypervisor_kobj, &xen_pmu_group);
486} 461}
487
488static void xen_pmu_destroy(void)
489{
490 sysfs_remove_group(hypervisor_kobj, &xen_pmu_group);
491}
492#endif 462#endif
493 463
494static int __init hyper_sysfs_init(void) 464static int __init hyper_sysfs_init(void)
@@ -517,7 +487,8 @@ static int __init hyper_sysfs_init(void)
517 if (xen_initial_domain()) { 487 if (xen_initial_domain()) {
518 ret = xen_pmu_init(); 488 ret = xen_pmu_init();
519 if (ret) { 489 if (ret) {
520 xen_properties_destroy(); 490 sysfs_remove_group(hypervisor_kobj,
491 &xen_properties_group);
521 goto prop_out; 492 goto prop_out;
522 } 493 }
523 } 494 }
@@ -525,31 +496,17 @@ static int __init hyper_sysfs_init(void)
525 goto out; 496 goto out;
526 497
527prop_out: 498prop_out:
528 xen_sysfs_uuid_destroy(); 499 sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr);
529uuid_out: 500uuid_out:
530 xen_compilation_destroy(); 501 sysfs_remove_group(hypervisor_kobj, &xen_compilation_group);
531comp_out: 502comp_out:
532 xen_sysfs_version_destroy(); 503 sysfs_remove_group(hypervisor_kobj, &version_group);
533version_out: 504version_out:
534 xen_sysfs_type_destroy(); 505 sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
535out: 506out:
536 return ret; 507 return ret;
537} 508}
538 509device_initcall(hyper_sysfs_init);
539static void __exit hyper_sysfs_exit(void)
540{
541#ifdef CONFIG_XEN_HAVE_VPMU
542 xen_pmu_destroy();
543#endif
544 xen_properties_destroy();
545 xen_compilation_destroy();
546 xen_sysfs_uuid_destroy();
547 xen_sysfs_version_destroy();
548 xen_sysfs_type_destroy();
549
550}
551module_init(hyper_sysfs_init);
552module_exit(hyper_sysfs_exit);
553 510
554static ssize_t hyp_sysfs_show(struct kobject *kobj, 511static ssize_t hyp_sysfs_show(struct kobject *kobj,
555 struct attribute *attr, 512 struct attribute *attr,