From patchwork Wed Sep 19 17:22:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Lezcano X-Patchwork-Id: 11509 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 CD33A1B4E05 for ; Wed, 19 Sep 2012 17:22:57 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 43B4BA1BBC3 for ; Wed, 19 Sep 2012 17:22:57 +0000 (UTC) Received: by iafj25 with SMTP id j25so938805iaf.11 for ; Wed, 19 Sep 2012 10:22:56 -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=ChGrd2gYkTS687Uc5wy5RH9osO1F452QWx/SVA1D1sU=; b=WUkhK2eRDRdTAvgrEWEVmIW0R/5UhFRGP1jNQLSixvVgDO5RR3vHWUTW715Q3PyRCO w+A5NFSdUSRDxzqgTiWYwnbIUrNvJQabCT5D5paJHuKYteJVeXLhdQUKHUqZsGceh5xj Wdq4Pg4dFBKaKYa6iZfJZ3U0WtkBsOb9VyLRVubL6FpRaMp+DqKEMasJWg01ZoyW0xtD 2TuW714Vp6tFB4xevYewOxg7+AC97YUPVW06eXdRNlSLgkqg8ObEHznWX/pLP/V4LcN1 76IdWoZHB+9UtSPjSPWqpEF5LvM0SS44ndgBfn/R0qnsmWLGcKQqf2fwFRXCJ0msX4nf Hztw== Received: by 10.50.237.41 with SMTP id uz9mr3423167igc.43.1348075376653; Wed, 19 Sep 2012 10:22:56 -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.184.232 with SMTP id ex8csp34736igc; Wed, 19 Sep 2012 10:22:55 -0700 (PDT) Received: by 10.216.23.202 with SMTP id v52mr2072409wev.32.1348075374926; Wed, 19 Sep 2012 10:22:54 -0700 (PDT) Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by mx.google.com with ESMTPS id n6si4230957wee.121.2012.09.19.10.22.54 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 10:22:54 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.170 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=209.85.212.170; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.170 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) smtp.mail=daniel.lezcano@linaro.org Received: by wibhq12 with SMTP id hq12so6979610wib.1 for ; Wed, 19 Sep 2012 10:22:54 -0700 (PDT) Received: by 10.216.140.213 with SMTP id e63mr2173077wej.48.1348075374368; Wed, 19 Sep 2012 10:22:54 -0700 (PDT) Received: from localhost.localdomain (AToulouse-651-1-259-252.w109-214.abo.wanadoo.fr. [109.214.174.252]) by mx.google.com with ESMTPS id r9sm5977769wia.2.2012.09.19.10.22.52 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Sep 2012 10:22:53 -0700 (PDT) From: Daniel Lezcano To: rjw@sisk.pl, lenb@kernel.org Cc: linux-pm@vger.kernel.org, linux-acpi@vger.kernel.org, patches@linaro.org, linaro-dev@lists.linaro.org Subject: [PATCH 2/3] cpuidle : rename function name "__cpuidle_register_driver" Date: Wed, 19 Sep 2012 19:22:48 +0200 Message-Id: <1348075369-16451-2-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1348075369-16451-1-git-send-email-daniel.lezcano@linaro.org> References: <1348075369-16451-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQmR8HXjFrzIpT/1OdUtCHT0tjJyrGw1exxm9R25zoNWZJRmlJwgOuVOwbGdFNyeZMZbKEQX Clarify the purpose of the function by changing its name and move the condition out of this function. Signed-off-by: Daniel Lezcano --- drivers/cpuidle/driver.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 40cd3f3..774d2cb 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -17,9 +17,10 @@ static struct cpuidle_driver *cpuidle_curr_driver; DEFINE_SPINLOCK(cpuidle_driver_lock); -static void __cpuidle_register_driver(struct cpuidle_driver *drv) +static void set_power_states(struct cpuidle_driver *drv) { int i; + /* * cpuidle driver should set the drv->power_specified bit * before registering if the driver provides @@ -34,10 +35,8 @@ static void __cpuidle_register_driver(struct cpuidle_driver *drv) * an power value of -1. So we use -2, -3, etc, for other * c-states. */ - if (!drv->power_specified) { - for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) - drv->states[i].power_usage = -1 - i; - } + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) + drv->states[i].power_usage = -1 - i; } @@ -58,8 +57,10 @@ int cpuidle_register_driver(struct cpuidle_driver *drv) spin_unlock(&cpuidle_driver_lock); return -EBUSY; } - __cpuidle_register_driver(drv); - cpuidle_curr_driver = drv; + + if (!drv->power_specified) + set_power_states(drv); + spin_unlock(&cpuidle_driver_lock); return 0;