From patchwork Mon Feb 4 22:44:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 14548 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 751CF24195 for ; Mon, 4 Feb 2013 22:44:52 +0000 (UTC) Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com [209.85.212.53]) by fiordland.canonical.com (Postfix) with ESMTP id 33513A187AA for ; Mon, 4 Feb 2013 22:44:52 +0000 (UTC) Received: by mail-vb0-f53.google.com with SMTP id fj18so4253972vbb.12 for ; Mon, 04 Feb 2013 14:44:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-forwarded-to:x-forwarded-for:delivered-to:x-received :received-spf:x-received:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state; bh=9t1vz33Go17nBGJx4vOrvWJ1me1JHdbFd1QnKjCL1Sk=; b=LGFyP8CRrY1L3LKQAvzw2F3RFJS5kuZY7d0se0R8vh5XdAJ4NzpwcLUwcrHTurqOdB bnPhCz4K7yizwQXTp2YGa/pohFBh2Qz1gA87TWtSIgwwY8+OdgfmQfwXYJt5J7yR0Fdw huJE0/NeER5Kkf+ZfYKJkpViWXbBRdxxDUllzrNdbUxtNitNdh9evbgDAMqDJfKry0EG XhQyPBL5GcsMVT1ixT56l6q4MeZD2NAgjqc/YufxFoZhJsDLBAMS1HOh8R6KjyDa/I0l LGbEzq1BVE+RB4jD4N22QCt+eOv+DjsA+Ixz/loeTNug5VOZ1G+5XjNTj8Bcw9dOR7z+ d59w== X-Received: by 10.220.219.77 with SMTP id ht13mr24345877vcb.66.1360017891657; Mon, 04 Feb 2013 14:44:51 -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.58.252.8 with SMTP id zo8csp110417vec; Mon, 4 Feb 2013 14:44:51 -0800 (PST) X-Received: by 10.180.84.131 with SMTP id z3mr13214947wiy.25.1360017890786; Mon, 04 Feb 2013 14:44:50 -0800 (PST) Received: from mail-wg0-f54.google.com (mail-wg0-f54.google.com [74.125.82.54]) by mx.google.com with ESMTPS id o7si6421692wjb.229.2013.02.04.14.44.50 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 14:44:50 -0800 (PST) Received-SPF: neutral (google.com: 74.125.82.54 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=74.125.82.54; Authentication-Results: mx.google.com; spf=neutral (google.com: 74.125.82.54 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-f54.google.com with SMTP id fm10so5286594wgb.9 for ; Mon, 04 Feb 2013 14:44:50 -0800 (PST) X-Received: by 10.180.99.72 with SMTP id eo8mr13256234wib.34.1360017890329; Mon, 04 Feb 2013 14:44:50 -0800 (PST) Received: from mai.home (AToulouse-654-1-332-150.w86-199.abo.wanadoo.fr. [86.199.219.150]) by mx.google.com with ESMTPS id ex1sm2812774wib.7.2013.02.04.14.44.48 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 04 Feb 2013 14:44:49 -0800 (PST) From: Daniel Lezcano To: rjw@sisk.pl Cc: linaro-dev@lists.linaro.org, patches@linaro.org, lenb@kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 3/4] ACPI / idle: pass the cpuidle_device parameter Date: Mon, 4 Feb 2013 23:44:42 +0100 Message-Id: <1360017883-9544-3-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1360017883-9544-1-git-send-email-daniel.lezcano@linaro.org> References: <1360017883-9544-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQm3r3Wop4cfKbesRKgGKXipg4GyE8oP/i8ku5Km3R7006fNlhNAQbdTjATH7Dshb9Jqn9oB 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 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