From patchwork Tue Jan 8 05:50:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajagopal Venkat X-Patchwork-Id: 1944001 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 334A73FF0F for ; Tue, 8 Jan 2013 05:55:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751924Ab3AHFyu (ORCPT ); Tue, 8 Jan 2013 00:54:50 -0500 Received: from mail-pa0-f50.google.com ([209.85.220.50]:39897 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751344Ab3AHFyt (ORCPT ); Tue, 8 Jan 2013 00:54:49 -0500 Received: by mail-pa0-f50.google.com with SMTP id hz10so114073pad.37 for ; Mon, 07 Jan 2013 21:54:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=rRYqhT4mujU+c9LvPRufgqlF/pxSanL3cs77CovCGV8=; b=XzWbiRUFfL9KmQ+kRH9eRS6Ztg172taSwQeT1kH4wmlzjU+RSwmRiMtwA6VIUxHe93 mzox1vrOf+xtOnq8HNIqNjIQS1dWfxaY5dr1sVcD/8T9Pq0rAH+ryuselmmwgflC3TIs Wp2szvU47wklXUgtof3eAuOFVGcvUojn/vJFpqIxFfqyXpAGgrEYQCasr9PJgvq51Kxl OojcOkj3BVkePca5Hf3K5Y8OstwWd21Y8yVBhBqOdpiVXN0oNIFZMO8cg006Ft4u8BLn 6Fr/GI5os4eBgSHO15N8ay7gb7LHt8ljV9gpNmB8b7wKcibQJHUDquqiJl+gOIH3Jchw olBA== X-Received: by 10.68.125.201 with SMTP id ms9mr195660148pbb.78.1357624488466; Mon, 07 Jan 2013 21:54:48 -0800 (PST) Received: from localhost.localdomain ([115.242.216.217]) by mx.google.com with ESMTPS id ty4sm38989248pbc.57.2013.01.07.21.54.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 07 Jan 2013 21:54:47 -0800 (PST) From: Rajagopal Venkat To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, mturquette@linaro.org, rjw@sisk.pl Cc: patches@linaro.org, linaro-dev@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Rajagopal Venkat Subject: [PATCH 3/3] PM / devfreq: account suspend/resume for stats Date: Tue, 8 Jan 2013 11:20:39 +0530 Message-Id: <1357624239-13938-3-git-send-email-rajagopal.venkat@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1357624239-13938-1-git-send-email-rajagopal.venkat@linaro.org> References: <1357624239-13938-1-git-send-email-rajagopal.venkat@linaro.org> X-Gm-Message-State: ALoCoQl8IQf6ifxwmiQ7fPXpptQckMERZ8aXMAPZBGCLu9L15uecXG2HONR4Bkk9gSruMY6gF4xq Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org devfreq stats is not taking device suspend and resume into account. Fix it. Signed-off-by: Rajagopal Venkat Acked-by: MyungJoo Ham --- drivers/devfreq/devfreq.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 2843a22..4c50235 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -297,6 +297,7 @@ void devfreq_monitor_suspend(struct devfreq *devfreq) return; } + devfreq_update_status(devfreq, devfreq->previous_freq); devfreq->stop_polling = true; mutex_unlock(&devfreq->lock); cancel_delayed_work_sync(&devfreq->work); @@ -313,6 +314,8 @@ EXPORT_SYMBOL(devfreq_monitor_suspend); */ void devfreq_monitor_resume(struct devfreq *devfreq) { + unsigned long freq; + mutex_lock(&devfreq->lock); if (!devfreq->stop_polling) goto out; @@ -321,8 +324,14 @@ void devfreq_monitor_resume(struct devfreq *devfreq) devfreq->profile->polling_ms) queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); + + devfreq->last_stat_updated = jiffies; devfreq->stop_polling = false; + if (devfreq->profile->get_cur_freq && + !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) + devfreq->previous_freq = freq; + out: mutex_unlock(&devfreq->lock); } @@ -931,11 +940,11 @@ static ssize_t show_trans_table(struct device *dev, struct device_attribute *att { struct devfreq *devfreq = to_devfreq(dev); ssize_t len; - int i, j, err; + int i, j; unsigned int max_state = devfreq->profile->max_state; - err = devfreq_update_status(devfreq, devfreq->previous_freq); - if (err) + if (!devfreq->stop_polling && + devfreq_update_status(devfreq, devfreq->previous_freq)) return 0; len = sprintf(buf, " From : To\n");