From patchwork Fri Oct 19 09:51:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 12361 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 EB1B223EFE for ; Fri, 19 Oct 2012 09:51:41 +0000 (UTC) Received: from mail-ia0-f180.google.com (mail-ia0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id B3DBFA1979E for ; Fri, 19 Oct 2012 09:51:41 +0000 (UTC) Received: by mail-ia0-f180.google.com with SMTP id f6so164226iag.11 for ; Fri, 19 Oct 2012 02:51:41 -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=8CPgocv9IX2/w2hfkis1Lh5NvzCZs9pUxNXTPZVjD5Y=; b=kuarliVsE1TGNaHxUei4bSmigQ6nfXx7zIt/wGWKdw4hSSWLz1KjdZbnTeUyCw4kHP KBYl83VZ6tLsCEFv8BZ8S1somwQoY0EC04PYCoCRqF4iqv5pDVJ2qKUhUhmJztUAtNQQ oCwOEgKDosEe/ByFxcHt3U9EYDBrz3MN/Ha1mhp1g6I2v3OdVQ4vONL/YULqwghL7bkv K5VYHWNLQjQZ+lf17XsG8Wn5DPmrd0o0s+f8eASaqoeRDKgVvyuotBG0TO8ovuUn6dq2 //UzD5g+wCmOBb3Erv0uQiCnWbPwVDdqXVsxLF8flRWEv/16VmyZngye3PUsfujjniYs 4XvQ== Received: by 10.50.88.233 with SMTP id bj9mr542523igb.70.1350640301459; Fri, 19 Oct 2012 02:51:41 -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 n20csp53891igt; Fri, 19 Oct 2012 02:51:40 -0700 (PDT) Received: by 10.180.102.131 with SMTP id fo3mr17741534wib.1.1350640300052; Fri, 19 Oct 2012 02:51:40 -0700 (PDT) Received: from mail-wg0-f50.google.com (mail-wg0-f50.google.com [74.125.82.50]) by mx.google.com with ESMTPS id gq9si37089780wib.13.2012.10.19.02.51.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 02:51:40 -0700 (PDT) Received-SPF: neutral (google.com: 74.125.82.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.50 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-wg0-f50.google.com with SMTP id 16so224310wgi.31 for ; Fri, 19 Oct 2012 02:51:39 -0700 (PDT) Received: by 10.180.91.71 with SMTP id cc7mr1967802wib.2.1350640299483; Fri, 19 Oct 2012 02:51:39 -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.36 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 19 Oct 2012 02:51:38 -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 3/5] cpuidle / ACPI : pass the cpuidle_device parameter Date: Fri, 19 Oct 2012 11:51:30 +0200 Message-Id: <1350640292-22468-3-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: ALoCoQlzpPB8U70sQrhy0lcwIKPyxnkWOgfj7nbUbEAHw7xqvWFDaKMS3MK6mxeAPGXBHpZDa1lM 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 --- 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 9aac69b..5c4330f 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c @@ -974,13 +974,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; @@ -1132,7 +1133,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(); @@ -1189,8 +1190,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); } } @@ -1259,7 +1260,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