From patchwork Fri Sep 7 10:19: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: 11231 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 C6EC423E41 for ; Fri, 7 Sep 2012 10:19:49 +0000 (UTC) Received: from mail-ie0-f180.google.com (mail-ie0-f180.google.com [209.85.223.180]) by fiordland.canonical.com (Postfix) with ESMTP id 71C02A18D99 for ; Fri, 7 Sep 2012 10:19:49 +0000 (UTC) Received: by mail-ie0-f180.google.com with SMTP id k11so4429471iea.11 for ; Fri, 07 Sep 2012 03:19:49 -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=EnbX20gP3I8v+L2KVpe8ffvtVQ6jYWQYpWsE2HNWIzE=; b=Sb/H+WbbgqKHmgrvKmg2K+qvCtjYmDMRywHZ55PAygFmapo6zJfuJb0eAL48kdUQVf 1+1ydSb/37BLuCaFY9fjQ8Tgago+cf662YI/+hk35WKHtOF3hkiSXYyQ7fsEAhraReMN csB8NmdB+wnDnrySd5n1yVd+QaFVtItFdf84THZoV6uiDyYwn8fKXP2HUuVNNv0iqkIQ c5Nnf63KzEiD3C41iKPXuKuCPrQl6GqDWBWPNWRjBAINES75L2D7BRtLgqMwiVKtxFLB K7gTfLrIwGvgWNFWIbKO2u3Up6qMbzawfr7biy17TjObQbE8MCWibfzdtfSdkslZbo7f byug== Received: by 10.50.242.3 with SMTP id wm3mr15704159igc.0.1347013189234; Fri, 07 Sep 2012 03:19:49 -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 ex8csp371150igc; Fri, 7 Sep 2012 03:19:48 -0700 (PDT) Received: by 10.204.145.76 with SMTP id c12mr2406877bkv.70.1347013188095; Fri, 07 Sep 2012 03:19:48 -0700 (PDT) Received: from mail-bk0-f50.google.com (mail-bk0-f50.google.com [209.85.214.50]) by mx.google.com with ESMTPS id hy16si4637905bkc.57.2012.09.07.03.19.47 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Sep 2012 03:19:48 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.214.50 is neither permitted nor denied by best guess record for domain of daniel.lezcano@linaro.org) client-ip=209.85.214.50; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.214.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-bk0-f50.google.com with SMTP id j5so1367058bkw.37 for ; Fri, 07 Sep 2012 03:19:47 -0700 (PDT) Received: by 10.204.152.211 with SMTP id h19mr2415140bkw.45.1347013187391; Fri, 07 Sep 2012 03:19:47 -0700 (PDT) Received: from localhost.localdomain (AToulouse-651-1-16-21.w92-149.abo.wanadoo.fr. [92.149.191.21]) by mx.google.com with ESMTPS id n5sm3018481bkv.14.2012.09.07.03.19.44 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Sep 2012 03:19:46 -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, pdeschrijver@nvidia.com, lorenzo.pieralisi@arm.com Subject: [PATCH 4/6] cpuidle : add a pointer for cpuidle_state in the cpuidle_device Date: Fri, 7 Sep 2012 12:19:30 +0200 Message-Id: <1347013172-12465-5-git-send-email-daniel.lezcano@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1347013172-12465-1-git-send-email-daniel.lezcano@linaro.org> References: <1347013172-12465-1-git-send-email-daniel.lezcano@linaro.org> X-Gm-Message-State: ALoCoQnBvw1Jc8Gpde0xCCQR+3/p+lPsw0l8grfvfQmWsi4VcKeVhoK5ydJth6j99+8zIY7f1tfp This patch adds a pointer to the cpuidle_state array in the cpuidle_device structure. When the cpuidle_device is initialized, the pointer is assigned from the driver's cpuidle states array. Signed-off-by: Daniel Lezcano Acked-by: Santosh Shilimkar Acked-by: Peter De Schrijver Tested-by: Peter De Schrijver --- drivers/cpuidle/cpuidle.c | 4 +++- include/linux/cpuidle.h | 1 + 2 files changed, 4 insertions(+), 1 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index e28f6ea..ef0e936 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -317,8 +317,10 @@ int cpuidle_enable_device(struct cpuidle_device *dev) return 0; if (!drv || !cpuidle_curr_governor) return -EIO; - if (!dev->state_count) + if (!dev->state_count) { dev->state_count = drv->state_count; + dev->states = drv->states; + } if (dev->registered == 0) { ret = __cpuidle_register_device(dev); diff --git a/include/linux/cpuidle.h b/include/linux/cpuidle.h index 279b1ea..5cf18b5 100644 --- a/include/linux/cpuidle.h +++ b/include/linux/cpuidle.h @@ -96,6 +96,7 @@ struct cpuidle_device { int last_residency; int state_count; + struct cpuidle_state *states; struct cpuidle_state_usage states_usage[CPUIDLE_STATE_MAX]; struct cpuidle_state_kobj *kobjs[CPUIDLE_STATE_MAX];