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: 1617381 Return-Path: X-Original-To: patchwork-linux-acpi@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 675703FD9C for ; Fri, 19 Oct 2012 09:51:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754364Ab2JSJvr (ORCPT ); Fri, 19 Oct 2012 05:51:47 -0400 Received: from mail-wg0-f44.google.com ([74.125.82.44]:50414 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753054Ab2JSJvn (ORCPT ); Fri, 19 Oct 2012 05:51:43 -0400 Received: by mail-wg0-f44.google.com with SMTP id dr13so255377wgb.1 for ; Fri, 19 Oct 2012 02:51:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=tncq5wMJO9OF/VvLqC7XyDZk4EUU9MqN4SmqIdf2kHo=; b=EqZ5l3LprWtGmU7N7jHqKa31U7dgfD2rogB5Or0asYuVjGQr617hXRMt8aw+wu0tRB SPIx1XAtL7p0GR+oAmqYsOErq7H6VYMidwpdHFWIkDIFqdinZRhUIL/omVfIsL62pSDr BzUjeGLwEWlWgLPxU3rKEac9qaQ/G7UUvUULrm5YGwcawcvUjWb38XGGP04hDAuEpBYO Et0u6zC9YjDRjWM+/GTHCUNlbMibU5ihfWtS9YhJH5sEjkKXLysgc7pY3Atr+tAi1NA9 A/gwhhSqBXU4vmtgN4kJxS2DQOD16/PG3IP6LpEddm9tcEIq5X3Q71/yX/vaHOHGpJ63 VfPA== 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: ALoCoQluKIkV/nzOQRhW/SDnWtWhEdQnK8EyanEKhz/ldw6EdKwyUc7NxOVwFdPf+Pw4BrTzcu79 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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;