From patchwork Fri Oct 19 09:51:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12363 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 7E1C423EFE for ; Fri, 19 Oct 2012 09:51:45 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 2DDADA18A4B for ; Fri, 19 Oct 2012 09:51:45 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id e10so316502iej.11 for ; Fri, 19 Oct 2012 02:51:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tncq5wMJO9OF/VvLqC7XyDZk4EUU9MqN4SmqIdf2kHo=; b=SRg5to87fhdq3aZtGiBwZGtEYc9VLl7A3kw7lhF4iOwvhTIuRZLlh1Wbc0Q7ckyb1v u0BMEExhMP/p/qhxGlq/ImrthrYB/7cczi5kmBsi2YWqi5bHuQjjp4/cf3Ehzs/T9O3m cf3JaQNPfypk+VrAwihob7HjyeS9abaWBHPLmkugOhN4OihFsJtbz9o6soIFVpCQYo+D 937IAN3SOMEC+zQe5ExynaDypAC/kH1ofU9WEVp0x2R7bOJhCjI8DDRLH1w7Nt/lNy2E RIGd6nc/CF9vsP9ZHbmxnxNDfm1YzPBfB1O8RCmEONwsUGmb3NndUVbbCg98q839P0Tz y7QQ== Received: by 10.50.100.137 with SMTP id ey9mr559926igb.57.1350640304840; Fri, 19 Oct 2012 02:51:44 -0700 (PDT) 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.50.67.148 with SMTP id n20csp53897igt; Fri, 19 Oct 2012 02:51:43 -0700 (PDT) Received: by 10.180.95.97 with SMTP id dj1mr1964686wib.3.1350640303046; Fri, 19 Oct 2012 02:51:43 -0700 (PDT) Received: from mail-we0-f178.google.com (mail-we0-f178.google.com [74.125.82.178]) by mx.google.com with ESMTPS id y34si1299160wei.5.2012.10.19.02.51.42 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 02:51:43 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.178 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by mail-we0-f178.google.com with SMTP id r6so189273wey.37 for ; Fri, 19 Oct 2012 02:51:42 -0700 (PDT) Received: by 10.180.82.72 with SMTP id g8mr17215933wiy.20.1350640302545; Fri, 19 Oct 2012 02:51:42 -0700 (PDT) Received: from localhost.localdomain (AToulouse-654-1-1-158.w90-5.abo.wanadoo.fr. [90.5.56.158]) by mx.google.com with ESMTPS id dt9sm33952821wib.1.2012.10.19.02.51.41 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 02:51:41 -0700 (PDT) From: Daniel Lezcano To: lenb@kernel.org, rjw@sisk.pl Cc: linux-acpi@vger.kernel.org, linaro-dev@lists.linaro.org, patches@linaro.org Subject: [PATCH 5/5] cpuidle / ACPI : pass the cpuidle driver as parameter Date: Fri, 19 Oct 2012 11:51:32 +0200 Message-Id: <1350640292-22468-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1350640292-22468-1-git-send-email-daniel.lezcano@linaro.org> References: <1350640292-22468-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQnu+FPVVGK7vDNGyom+ADB3abE/MZIL+ljKUFDrmvY6SmS+S++7c6WUxNm5at1Jtax4+mlX Instead of refering to a global variable in the function, let's pass the cpuidle_driver as a parameter to this function. Signed-off-by: Daniel Lezcano --- drivers/acpi/processor_idle.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f87cb2e..da38a4b 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -1030,12 +1030,12 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, * * @pr: the ACPI processor */ -static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr) +static int acpi_processor_setup_cpuidle_states(struct acpi_processor *pr, + struct cpuidle_driver *drv) { int i, count = CPUIDLE_DRIVER_STATE_START; struct acpi_processor_cx *cx; struct cpuidle_state *state; - struct cpuidle_driver *drv = &acpi_idle_driver; if (!pr->flags.power_setup_done) return -EINVAL; @@ -1146,6 +1146,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) int cpu; struct acpi_processor *_pr; struct cpuidle_device *dev; + struct cpuidle_driver *drv = cpuidle_get_driver(); if (disabled_by_idle_boot_param()) return 0; @@ -1164,7 +1165,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) * system instead of once per-cpu. This condition is a hack * to make the code that updates C-States be called once. */ - if (pr->id != 0 || cpuidle_get_driver() != &acpi_idle_driver) + if (pr->id != 0 || drv != &acpi_idle_driver) return 0; cpuidle_pause_and_lock(); @@ -1181,7 +1182,7 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) } /* Populate Updated C-state information */ - acpi_processor_setup_cpuidle_states(pr); + acpi_processor_setup_cpuidle_states(pr, drv); /* Enable all cpuidle devices */ for_each_online_cpu(cpu) { @@ -1250,7 +1251,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) /* Register acpi_idle_driver if not already registered */ if (!acpi_processor_registered) { - acpi_processor_setup_cpuidle_states(pr); + acpi_processor_setup_cpuidle_states(pr, &acpi_idle_driver); retval = cpuidle_register_driver(&acpi_idle_driver); if (retval) return retval;