From patchwork Tue Jun 28 02:46:30 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Todd Poynor X-Patchwork-Id: 922992 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p5S2mt29030527 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 28 Jun 2011 02:49:16 GMT Received: from canuck.infradead.org ([134.117.69.58]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QbOLv-00032m-DC; Tue, 28 Jun 2011 02:48:39 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1QbOLt-0000rZ-QQ; Tue, 28 Jun 2011 02:48:37 +0000 Received: from smtp-out.google.com ([74.125.121.67]) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1QbOLJ-0000lu-L9 for linux-arm-kernel@lists.infradead.org; Tue, 28 Jun 2011 02:48:02 +0000 Received: from kpbe19.cbf.corp.google.com (kpbe19.cbf.corp.google.com [172.25.105.83]) by smtp-out.google.com with ESMTP id p5S2lr1e009781; Mon, 27 Jun 2011 19:47:54 -0700 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1309229275; bh=tHHx2tos8reDBaTEzLSHtRS4Cgw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=f48pfn0009ScXYfFRl/Z6goT9XRFr2YPKtElw/BmfMZji26E8/1SFUzZhqwsRGVrP pHNKsnARZDRiGgTRnLAFA== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=Lj/JRjyWV1gEh8JKHZEa2Xl8fAHtuBMz5LKwn6wkp7fXqgsybPJWyzYxrVl3j0vzK iNPAZ0NRXSDBAZyzWkxAg== Received: from conslugarocko.mtv.corp.google.com (conslugarocko.mtv.corp.google.com [172.18.102.26]) by kpbe19.cbf.corp.google.com with ESMTP id p5S2lpFY003901; Mon, 27 Jun 2011 19:47:52 -0700 Received: by conslugarocko.mtv.corp.google.com (Postfix, from userid 115684) id 1B7D42342B7; Mon, 27 Jun 2011 19:47:51 -0700 (PDT) From: Todd Poynor To: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Russell King Subject: [PATCH 3/3] ARM: Move leds idle start/stop calls to idle notifiers Date: Mon, 27 Jun 2011 19:46:30 -0700 Message-Id: <1309229190-25006-4-git-send-email-toddpoynor@google.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1309229190-25006-1-git-send-email-toddpoynor@google.com> References: <1309229190-25006-1-git-send-email-toddpoynor@google.com> X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110627_224802_008079_1FF75E35 X-CRM114-Status: GOOD ( 17.60 ) X-Spam-Score: -1.7 (-) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (-1.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/, medium trust [74.125.121.67 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain 0.7 FRT_TODAY2 BODY: ReplaceTags: Today (2) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Todd Poynor , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 28 Jun 2011 02:49:16 +0000 (UTC) Change-Id: I5d8e4e85b17bbab7992ecb477f0bdb5e4138b166 Signed-off-by: Todd Poynor --- arch/arm/kernel/leds.c | 27 ++++++++++++++++++++++++++- arch/arm/kernel/process.c | 3 --- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/arch/arm/kernel/leds.c b/arch/arm/kernel/leds.c index 0f107dc..136e837 100644 --- a/arch/arm/kernel/leds.c +++ b/arch/arm/kernel/leds.c @@ -9,6 +9,8 @@ */ #include #include +#include +#include #include #include @@ -101,6 +103,25 @@ static struct syscore_ops leds_syscore_ops = { .resume = leds_resume, }; +static int leds_idle_notifier(struct notifier_block *nb, unsigned long val, + void *data) +{ + switch (val) { + case IDLE_START: + leds_event(led_idle_start); + break; + case IDLE_END: + leds_event(led_idle_end); + break; + } + + return 0; +} + +static struct notifier_block leds_idle_nb = { + .notifier_call = leds_idle_notifier, +}; + static int __init leds_init(void) { int ret; @@ -109,8 +130,12 @@ static int __init leds_init(void) ret = sysdev_register(&leds_device); if (ret == 0) ret = sysdev_create_file(&leds_device, &attr_event); - if (ret == 0) + + if (ret == 0) { register_syscore_ops(&leds_syscore_ops); + idle_notifier_register(&leds_idle_nb); + } + return ret; } diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c index 1b9101e..6adf53f 100644 --- a/arch/arm/kernel/process.c +++ b/arch/arm/kernel/process.c @@ -32,7 +32,6 @@ #include #include -#include #include #include #include @@ -183,7 +182,6 @@ void cpu_idle(void) /* endless idle loop with no priority at all */ while (1) { tick_nohz_stop_sched_tick(1); - leds_event(led_idle_start); idle_notifier_call_chain(IDLE_START); while (!need_resched()) { #ifdef CONFIG_HOTPLUG_CPU @@ -208,7 +206,6 @@ void cpu_idle(void) local_irq_enable(); } } - leds_event(led_idle_end); idle_notifier_call_chain(IDLE_END); tick_nohz_restart_sched_tick(); preempt_enable_no_resched();