From patchwork Sun Feb 14 20:32:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Gortmaker X-Patchwork-Id: 8303221 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B121DC02AA for ; Sun, 14 Feb 2016 20:36:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA58420160 for ; Sun, 14 Feb 2016 20:36:11 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D8605200FE for ; Sun, 14 Feb 2016 20:36:10 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aV3ME-0006dE-R3; Sun, 14 Feb 2016 20:33:26 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aV3MC-0006ca-4z for xen-devel@lists.xenproject.org; Sun, 14 Feb 2016 20:33:24 +0000 Received: from [85.158.139.211] by server-17.bemta-5.messagelabs.com id F6/2B-21901-394E0C65; Sun, 14 Feb 2016 20:33:23 +0000 X-Env-Sender: Paul.Gortmaker@windriver.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1455482001!22004575!1 X-Originating-IP: [192.103.53.11] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 3185 invoked from network); 14 Feb 2016 20:33:22 -0000 Received: from mail5.windriver.com (HELO mail5.wrs.com) (192.103.53.11) by server-16.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 14 Feb 2016 20:33:22 -0000 Received: from ALA-HCA.corp.ad.wrs.com (ala-hca.corp.ad.wrs.com [147.11.189.40]) by mail5.wrs.com (8.15.2/8.15.2) with ESMTPS id u1EKXHt6011936 (version=TLSv1 cipher=AES128-SHA bits=128 verify=OK); Sun, 14 Feb 2016 12:33:18 -0800 Received: from yow-lpgnfs-02.corp.ad.wrs.com (128.224.149.8) by ALA-HCA.corp.ad.wrs.com (147.11.189.40) with Microsoft SMTP Server id 14.3.248.2; Sun, 14 Feb 2016 12:33:17 -0800 From: Paul Gortmaker To: Date: Sun, 14 Feb 2016 15:32:49 -0500 Message-ID: <1455481970-15239-5-git-send-email-paul.gortmaker@windriver.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1455481970-15239-1-git-send-email-paul.gortmaker@windriver.com> References: <1455481970-15239-1-git-send-email-paul.gortmaker@windriver.com> MIME-Version: 1.0 Cc: Paul Gortmaker , Boris Ostrovsky , xen-devel@lists.xenproject.org, David Vrabel Subject: [Xen-devel] [PATCH 4/5] drivers/xen: make sys-hypervisor.c explicitly non-modular X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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". 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,