From patchwork Sat Feb 9 01:08:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 2119511 X-Patchwork-Delegate: lenb@kernel.org Return-Path: X-Original-To: patchwork-linux-pm@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 05DAA3FD56 for ; Sat, 9 Feb 2013 01:11:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932352Ab3BIBLU (ORCPT ); Fri, 8 Feb 2013 20:11:20 -0500 Received: from mail-vb0-f42.google.com ([209.85.212.42]:56103 "EHLO mail-vb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1947581Ab3BIBIn (ORCPT ); Fri, 8 Feb 2013 20:08:43 -0500 Received: by mail-vb0-f42.google.com with SMTP id ff1so2731289vbb.1 for ; Fri, 08 Feb 2013 17:08:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references:reply-to:organization; bh=9+arluJOUL5EeSc8+Uj7qtMXhvbS2blm+rHPt8/4ccc=; b=QstbOkMiwnUoTX69iSdhcEtkAaY+0XNBr74DCynEibdU+BYRzaqxDBoqCNENFFP5Q3 0bKSAylCltjQvQmzyTe0vX1chdpr34SHw/Yi3/bcRjkQ4lRcL9pnLVw0fLG8Vm84rA8x a8YFx5wBaxpfGhvSMKHJ73WmT/pVg0AeWSHY3HvhSG5q8iv7UIMHYc8xM/iZC08+6Eyf oZrv8jEFfG6QZKjKnoeJiFGydMBj0fZejx3Qw5xv/8d342XpQCkXTnjWIIT1qnhU0RNw 5YSwSx47iyOI+OmONpRzUtNKfTAxFZ6nbsvcpWRlkVFaxNRr3WIe9zCPoYfWlTiZ7hVn wBFw== X-Received: by 10.52.89.100 with SMTP id bn4mr8122195vdb.88.1360372122174; Fri, 08 Feb 2013 17:08:42 -0800 (PST) Received: from x980.localdomain6 (pool-108-7-58-246.bstnma.fios.verizon.net. [108.7.58.246]) by mx.google.com with ESMTPS id e8sm5806990vdt.7.2013.02.08.17.08.40 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 08 Feb 2013 17:08:41 -0800 (PST) From: Len Brown To: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Daniel Lezcano , Len Brown Subject: [PATCH 08/16] ACPI / idle: pass the cpuidle_device parameter Date: Fri, 8 Feb 2013 20:08:12 -0500 Message-Id: <6ef0f086beafb3c7d81cd3de81d886d105ea25b2.1360371180.git.len.brown@intel.com> X-Mailer: git-send-email 1.8.1.3.535.ga923c31 In-Reply-To: <1360372100-28482-1-git-send-email-lenb@kernel.org> References: <1360372100-28482-1-git-send-email-lenb@kernel.org> In-Reply-To: References: Reply-To: Len Brown Organization: Intel Open Source Technology Center Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org From: Daniel Lezcano The cpuidle_device is retrieved in the function by using directly the global variable. But the caller of this function already have this device and it can be passed as a parameter. That is one small step to encapsulate the code more. Signed-off-by: Daniel Lezcano Signed-off-by: Len Brown --- drivers/acpi/processor_idle.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 82626e9..6837065 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -928,13 +928,14 @@ struct cpuidle_driver acpi_idle_driver = { * device i.e. per-cpu data * * @pr: the ACPI processor + * @dev : the cpuidle device */ -static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr) +static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr, + struct cpuidle_device *dev) { int i, count = CPUIDLE_DRIVER_STATE_START; struct acpi_processor_cx *cx; struct cpuidle_state_usage *state_usage; - struct cpuidle_device *dev = per_cpu(acpi_cpuidle_device, pr->id); if (!pr->flags.power_setup_done) return -EINVAL; @@ -1089,7 +1090,7 @@ int acpi_processor_hotplug(struct acpi_processor *pr) cpuidle_disable_device(dev); acpi_processor_get_power_info(pr); if (pr->flags.power) { - acpi_processor_setup_cpuidle_cx(pr); + acpi_processor_setup_cpuidle_cx(pr, dev); ret = cpuidle_enable_device(dev); } cpuidle_resume_and_unlock(); @@ -1147,8 +1148,8 @@ int acpi_processor_cst_has_changed(struct acpi_processor *pr) continue; acpi_processor_get_power_info(_pr); if (_pr->flags.power) { - acpi_processor_setup_cpuidle_cx(_pr); dev = per_cpu(acpi_cpuidle_device, cpu); + acpi_processor_setup_cpuidle_cx(_pr, dev); cpuidle_enable_device(dev); } } @@ -1217,7 +1218,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr) return -ENOMEM; per_cpu(acpi_cpuidle_device, pr->id) = dev; - acpi_processor_setup_cpuidle_cx(pr); + acpi_processor_setup_cpuidle_cx(pr, dev); /* Register per-cpu cpuidle_device. Cpuidle driver * must already be registered before registering device