From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
To: Paul Gortmaker <paul.gortmaker@windriver.com>
Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
linux-kernel@vger.kernel.org,
David Vrabel <david.vrabel@citrix.com>,
xen-devel@lists.xenproject.org,
Boris Ostrovsky <boris.ostrovsky@oracle.com>
Subject: Re: [PATCH v2 4/5] drivers/xen: make sys-hypervisor.c explicitly non-modular
Date: Mon, 22 Feb 2016 11:25:45 +0000 [thread overview]
Message-ID: <alpine.DEB.2.02.1602221125260.17248__8048.45595635033$1456140450$gmane$org@kaball.uk.xensource.com> (raw)
In-Reply-To: <1456099568-5154-5-git-send-email-paul.gortmaker@windriver.com>
On Sun, 21 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".
>
> 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.
>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: David Vrabel <david.vrabel@citrix.com>
> Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> Cc: xen-devel@lists.xenproject.org
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
> drivers/xen/sys-hypervisor.c | 59 ++++++--------------------------------------
> 1 file 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 @@
>
> #include <linux/slab.h>
> #include <linux/kernel.h>
> -#include <linux/module.h>
> +#include <linux/init.h>
> #include <linux/kobject.h>
> #include <linux/err.h>
>
> @@ -50,11 +50,6 @@ static int __init xen_sysfs_type_init(void)
> return sysfs_create_file(hypervisor_kobj, &type_attr.attr);
> }
>
> -static void xen_sysfs_type_destroy(void)
> -{
> - sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
> -}
> -
> /* xen version attributes */
> static ssize_t major_show(struct hyp_sysfs_attr *attr, char *buffer)
> {
> @@ -111,11 +106,6 @@ static int __init xen_sysfs_version_init(void)
> return sysfs_create_group(hypervisor_kobj, &version_group);
> }
>
> -static void xen_sysfs_version_destroy(void)
> -{
> - sysfs_remove_group(hypervisor_kobj, &version_group);
> -}
> -
> /* UUID */
>
> static ssize_t uuid_show_fallback(struct hyp_sysfs_attr *attr, char *buffer)
> @@ -157,11 +147,6 @@ static int __init xen_sysfs_uuid_init(void)
> return sysfs_create_file(hypervisor_kobj, &uuid_attr.attr);
> }
>
> -static void xen_sysfs_uuid_destroy(void)
> -{
> - sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr);
> -}
> -
> /* xen compilation attributes */
>
> static ssize_t compiler_show(struct hyp_sysfs_attr *attr, char *buffer)
> @@ -235,11 +220,6 @@ static int __init xen_compilation_init(void)
> return sysfs_create_group(hypervisor_kobj, &xen_compilation_group);
> }
>
> -static void xen_compilation_destroy(void)
> -{
> - sysfs_remove_group(hypervisor_kobj, &xen_compilation_group);
> -}
> -
> /* xen properties info */
>
> static ssize_t capabilities_show(struct hyp_sysfs_attr *attr, char *buffer)
> @@ -366,11 +346,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 +459,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 +487,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;
> }
> }
> @@ -525,31 +496,17 @@ static int __init hyper_sysfs_init(void)
> goto out;
>
> prop_out:
> - xen_sysfs_uuid_destroy();
> + sysfs_remove_file(hypervisor_kobj, &uuid_attr.attr);
> uuid_out:
> - xen_compilation_destroy();
> + sysfs_remove_group(hypervisor_kobj, &xen_compilation_group);
> comp_out:
> - xen_sysfs_version_destroy();
> + sysfs_remove_group(hypervisor_kobj, &version_group);
> version_out:
> - xen_sysfs_type_destroy();
> + sysfs_remove_file(hypervisor_kobj, &type_attr.attr);
> 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
>
next prev parent reply other threads:[~2016-02-22 11:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1456099568-5154-1-git-send-email-paul.gortmaker@windriver.com>
2016-02-22 0:06 ` [PATCH v2 1/5] xen: audit usages of module.h ; remove unnecessary instances Paul Gortmaker
2016-02-22 0:06 ` [PATCH v2 2/5] drivers/xen: make [xen-]ballon explicitly non-modular Paul Gortmaker
2016-02-22 0:06 ` [PATCH v2 3/5] drivers/xen: make xenbus_dev_[front/back]end " Paul Gortmaker
2016-02-22 0:06 ` [PATCH v2 4/5] drivers/xen: make sys-hypervisor.c " Paul Gortmaker
2016-02-22 0:06 ` [PATCH v2 5/5] drivers/xen: make platform-pci.c " Paul Gortmaker
[not found] ` <1456099568-5154-5-git-send-email-paul.gortmaker@windriver.com>
2016-02-22 11:25 ` Stefano Stabellini [this message]
[not found] ` <1456099568-5154-6-git-send-email-paul.gortmaker@windriver.com>
2016-02-22 11:27 ` Stefano Stabellini
2016-03-20 0:23 ` [PATCH v2 0/5] xen: avoid module usage in non-modular code Paul Gortmaker
[not found] ` <20160320002321.GX23251@windriver.com>
2016-03-21 15:17 ` David Vrabel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='alpine.DEB.2.02.1602221125260.17248__8048.45595635033$1456140450$gmane$org@kaball.uk.xensource.com' \
--to=stefano.stabellini@eu.citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=linux-kernel@vger.kernel.org \
--cc=paul.gortmaker@windriver.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).