From patchwork Thu Nov 10 23:58:08 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 5035 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id C975523E03 for ; Thu, 10 Nov 2011 23:58:16 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id BE7E6A1831E for ; Thu, 10 Nov 2011 23:58:16 +0000 (UTC) Received: by mail-fx0-f52.google.com with SMTP id n26so5002552faa.11 for ; Thu, 10 Nov 2011 15:58:16 -0800 (PST) Received: by 10.152.135.166 with SMTP id pt6mr5723901lab.26.1320969496614; Thu, 10 Nov 2011 15:58:16 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.40.7 with SMTP id t7cs29167lak; Thu, 10 Nov 2011 15:58:16 -0800 (PST) Received: by 10.180.90.6 with SMTP id bs6mr11362457wib.63.1320969494511; Thu, 10 Nov 2011 15:58:14 -0800 (PST) Received: from smtp.smtpout.orange.fr (smtp07.smtpout.orange.fr. [80.12.242.129]) by mx.google.com with ESMTP id er14si5556935wbb.83.2011.11.10.15.58.14; Thu, 10 Nov 2011 15:58:14 -0800 (PST) Received-SPF: neutral (google.com: 80.12.242.129 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=80.12.242.129; Authentication-Results: mx.google.com; spf=neutral (google.com: 80.12.242.129 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: from monster.dhcp.lxc ([92.134.91.32]) by mwinf5d65 with ME id vbyD1h0010htGy403byDi9; Fri, 11 Nov 2011 00:58:14 +0100 From: Daniel Lezcano To: patches@linaro.org Subject: [PATCH 1/6] cpuidle : move code to prevent forward declaration Date: Fri, 11 Nov 2011 00:58:08 +0100 Message-Id: <1320969493-27292-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1320969493-27292-1-git-send-email-daniel.lezcano@linaro.org> References: <1320969493-27292-1-git-send-email-daniel.lezcano@linaro.org> A mindless change by moving __cpuidle_register_device and cpuidle_register_device up in the code and hence preventing the forward declaration. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/cpuidle.c | 116 ++++++++++++++++++++++----------------------- 1 files changed, 57 insertions(+), 59 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index 7a57b11..e0e2a02 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -50,8 +50,6 @@ static void cpuidle_kick_cpus(void) static void cpuidle_kick_cpus(void) {} #endif -static int __cpuidle_register_device(struct cpuidle_device *dev); - /** * cpuidle_idle_call - the main idle loop * @@ -202,6 +200,63 @@ static void poll_idle_init(struct cpuidle_driver *drv) {} #endif /* CONFIG_ARCH_HAS_CPU_RELAX */ /** + * __cpuidle_register_device - internal register function called before register + * and enable routines + * @dev: the cpu + * + * cpuidle_lock mutex must be held before this is called + */ +static int __cpuidle_register_device(struct cpuidle_device *dev) +{ + int ret; + struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); + struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); + + if (!sys_dev) + return -EINVAL; + if (!try_module_get(cpuidle_driver->owner)) + return -EINVAL; + + init_completion(&dev->kobj_unregister); + + per_cpu(cpuidle_devices, dev->cpu) = dev; + list_add(&dev->device_list, &cpuidle_detected_devices); + if ((ret = cpuidle_add_sysfs(sys_dev))) { + module_put(cpuidle_driver->owner); + return ret; + } + + dev->registered = 1; + return 0; +} + +/** + * cpuidle_register_device - registers a CPU's idle PM feature + * @dev: the cpu + */ +int cpuidle_register_device(struct cpuidle_device *dev) +{ + int ret; + + mutex_lock(&cpuidle_lock); + + if ((ret = __cpuidle_register_device(dev))) { + mutex_unlock(&cpuidle_lock); + return ret; + } + + cpuidle_enable_device(dev); + cpuidle_install_idle_handler(); + + mutex_unlock(&cpuidle_lock); + + return 0; + +} + +EXPORT_SYMBOL_GPL(cpuidle_register_device); + +/** * cpuidle_enable_device - enables idle PM for a CPU * @dev: the CPU * @@ -281,63 +336,6 @@ void cpuidle_disable_device(struct cpuidle_device *dev) EXPORT_SYMBOL_GPL(cpuidle_disable_device); /** - * __cpuidle_register_device - internal register function called before register - * and enable routines - * @dev: the cpu - * - * cpuidle_lock mutex must be held before this is called - */ -static int __cpuidle_register_device(struct cpuidle_device *dev) -{ - int ret; - struct sys_device *sys_dev = get_cpu_sysdev((unsigned long)dev->cpu); - struct cpuidle_driver *cpuidle_driver = cpuidle_get_driver(); - - if (!sys_dev) - return -EINVAL; - if (!try_module_get(cpuidle_driver->owner)) - return -EINVAL; - - init_completion(&dev->kobj_unregister); - - per_cpu(cpuidle_devices, dev->cpu) = dev; - list_add(&dev->device_list, &cpuidle_detected_devices); - if ((ret = cpuidle_add_sysfs(sys_dev))) { - module_put(cpuidle_driver->owner); - return ret; - } - - dev->registered = 1; - return 0; -} - -/** - * cpuidle_register_device - registers a CPU's idle PM feature - * @dev: the cpu - */ -int cpuidle_register_device(struct cpuidle_device *dev) -{ - int ret; - - mutex_lock(&cpuidle_lock); - - if ((ret = __cpuidle_register_device(dev))) { - mutex_unlock(&cpuidle_lock); - return ret; - } - - cpuidle_enable_device(dev); - cpuidle_install_idle_handler(); - - mutex_unlock(&cpuidle_lock); - - return 0; - -} - -EXPORT_SYMBOL_GPL(cpuidle_register_device); - -/** * cpuidle_unregister_device - unregisters a CPU's idle PM feature * @dev: the cpu */