From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752958AbcBOLzQ (ORCPT ); Mon, 15 Feb 2016 06:55:16 -0500 Received: from smtp02.citrix.com ([66.165.176.63]:56634 "EHLO SMTP02.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751255AbcBOLzO (ORCPT ); Mon, 15 Feb 2016 06:55:14 -0500 X-IronPort-AV: E=Sophos;i="5.22,450,1449532800"; d="scan'208";a="338208087" Date: Mon, 15 Feb 2016 11:54:31 +0000 From: Stefano Stabellini X-X-Sender: sstabellini@kaball.uk.xensource.com To: Paul Gortmaker CC: , Konrad Rzeszutek Wilk , Boris Ostrovsky , "David Vrabel" , Subject: Re: [PATCH 4/5] drivers/xen: make sys-hypervisor.c explicitly non-modular In-Reply-To: <1455481970-15239-5-git-send-email-paul.gortmaker@windriver.com> Message-ID: References: <1455481970-15239-1-git-send-email-paul.gortmaker@windriver.com> <1455481970-15239-5-git-send-email-paul.gortmaker@windriver.com> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 14 Feb 2016, Paul Gortmaker wrote: > 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". Actually xen_sysfs_uuid_destroy, xen_compilation_destroy, xen_sysfs_version_destroy, and xen_sysfs_type_destroy are also one-liners with only one user left. > Cc: Konrad Rzeszutek Wilk > Cc: Boris Ostrovsky > Cc: David Vrabel > Cc: xen-devel@lists.xenproject.org > Signed-off-by: Paul Gortmaker > --- > drivers/xen/sys-hypervisor.c | 31 ++++--------------------------- > 1 file changed, 4 insertions(+), 27 deletions(-) > > diff --git a/drivers/xen/sys-hypervisor.c b/drivers/xen/sys-hypervisor.c > index b5a7342e0ba5..ea6e98d60af0 100644 > --- a/drivers/xen/sys-hypervisor.c > +++ b/drivers/xen/sys-hypervisor.c > @@ -9,7 +9,7 @@ > > #include > #include > -#include > +#include > #include > #include > > @@ -366,11 +366,6 @@ static int __init xen_properties_init(void) > return sysfs_create_group(hypervisor_kobj, &xen_properties_group); > } > > -static void xen_properties_destroy(void) > -{ > - sysfs_remove_group(hypervisor_kobj, &xen_properties_group); > -} > - > #ifdef CONFIG_XEN_HAVE_VPMU > struct pmu_mode { > const char *name; > @@ -484,11 +479,6 @@ static int __init xen_pmu_init(void) > { > return sysfs_create_group(hypervisor_kobj, &xen_pmu_group); > } > - > -static void xen_pmu_destroy(void) > -{ > - sysfs_remove_group(hypervisor_kobj, &xen_pmu_group); > -} > #endif > > static int __init hyper_sysfs_init(void) > @@ -517,7 +507,8 @@ static int __init hyper_sysfs_init(void) > if (xen_initial_domain()) { > ret = xen_pmu_init(); > if (ret) { > - xen_properties_destroy(); > + sysfs_remove_group(hypervisor_kobj, > + &xen_properties_group); > goto prop_out; > } > } > @@ -535,21 +526,7 @@ version_out: > out: > return ret; > } > - > -static void __exit hyper_sysfs_exit(void) > -{ > -#ifdef CONFIG_XEN_HAVE_VPMU > - xen_pmu_destroy(); > -#endif > - xen_properties_destroy(); > - xen_compilation_destroy(); > - xen_sysfs_uuid_destroy(); > - xen_sysfs_version_destroy(); > - xen_sysfs_type_destroy(); > - > -} > -module_init(hyper_sysfs_init); > -module_exit(hyper_sysfs_exit); > +device_initcall(hyper_sysfs_init); > > static ssize_t hyp_sysfs_show(struct kobject *kobj, > struct attribute *attr, > -- > 2.6.1 >