From patchwork Mon Dec 19 02:16:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobias Jakobi X-Patchwork-Id: 9479583 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 66C3760836 for ; Mon, 19 Dec 2016 02:16:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5666D2845E for ; Mon, 19 Dec 2016 02:16:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ABCD28467; Mon, 19 Dec 2016 02:16:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFC022845E for ; Mon, 19 Dec 2016 02:16:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762094AbcLSCQm (ORCPT ); Sun, 18 Dec 2016 21:16:42 -0500 Received: from smtp.math.uni-bielefeld.de ([129.70.45.10]:43806 "EHLO smtp.math.uni-bielefeld.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762091AbcLSCQi (ORCPT ); Sun, 18 Dec 2016 21:16:38 -0500 Received: from chidori.lan (unknown [5.146.177.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client did not present a certificate) by smtp.math.uni-bielefeld.de (Postfix) with ESMTPSA id 456675F87A; Mon, 19 Dec 2016 03:16:36 +0100 (CET) From: Tobias Jakobi To: linux-samsung-soc@vger.kernel.org Cc: linux-pm@vger.kernel.org, m.reichl@fivetechno.de, myungjoo.ham@gmail.com, cw00.choi@samsung.com, Tobias Jakobi Subject: [RFC v2 1/7] PM / devfreq: Replace 'stop_polling' boolean with flags Date: Mon, 19 Dec 2016 03:16:21 +0100 Message-Id: <1482113787-28422-2-git-send-email-tjakobi@math.uni-bielefeld.de> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1482113787-28422-1-git-send-email-tjakobi@math.uni-bielefeld.de> References: <1482113787-28422-1-git-send-email-tjakobi@math.uni-bielefeld.de> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This is preparation for introducing some additional flags to struct devfreq. Signed-off-by: Tobias Jakobi --- drivers/devfreq/devfreq.c | 18 +++++++++++------- include/linux/devfreq.h | 4 ++-- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 614738d..82d8052 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -28,6 +28,10 @@ #include #include "governor.h" +enum devfreq_flag_bits { + DEVFREQ_BIT_STOP_POLLING, +}; + static struct class *devfreq_class; /* @@ -366,13 +370,13 @@ EXPORT_SYMBOL(devfreq_monitor_stop); void devfreq_monitor_suspend(struct devfreq *devfreq) { mutex_lock(&devfreq->lock); - if (devfreq->stop_polling) { + if (test_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags)) { mutex_unlock(&devfreq->lock); return; } devfreq_update_status(devfreq, devfreq->previous_freq); - devfreq->stop_polling = true; + __set_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags); mutex_unlock(&devfreq->lock); cancel_delayed_work_sync(&devfreq->work); } @@ -391,7 +395,7 @@ void devfreq_monitor_resume(struct devfreq *devfreq) unsigned long freq; mutex_lock(&devfreq->lock); - if (!devfreq->stop_polling) + if (!test_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags)) goto out; if (!delayed_work_pending(&devfreq->work) && @@ -400,7 +404,7 @@ void devfreq_monitor_resume(struct devfreq *devfreq) msecs_to_jiffies(devfreq->profile->polling_ms)); devfreq->last_stat_updated = jiffies; - devfreq->stop_polling = false; + __clear_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags); if (devfreq->profile->get_cur_freq && !devfreq->profile->get_cur_freq(devfreq->dev.parent, &freq)) @@ -427,7 +431,7 @@ void devfreq_interval_update(struct devfreq *devfreq, unsigned int *delay) mutex_lock(&devfreq->lock); devfreq->profile->polling_ms = new_delay; - if (devfreq->stop_polling) + if (test_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags)) goto out; /* if new delay is zero, stop polling */ @@ -449,7 +453,7 @@ void devfreq_interval_update(struct devfreq *devfreq, unsigned int *delay) mutex_unlock(&devfreq->lock); cancel_delayed_work_sync(&devfreq->work); mutex_lock(&devfreq->lock); - if (!devfreq->stop_polling) + if (!test_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags)) queue_delayed_work(devfreq_wq, &devfreq->work, msecs_to_jiffies(devfreq->profile->polling_ms)); } @@ -1203,7 +1207,7 @@ static ssize_t trans_stat_show(struct device *dev, int i, j; unsigned int max_state = devfreq->profile->max_state; - if (!devfreq->stop_polling && + if (!test_bit(DEVFREQ_BIT_STOP_POLLING, &devfreq->flags) && devfreq_update_status(devfreq, devfreq->previous_freq)) return 0; if (max_state == 0) diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 3bd15ae..d6bf9a3 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -145,7 +145,7 @@ struct devfreq_governor { * touch this. * @min_freq: Limit minimum frequency requested by user (0: none) * @max_freq: Limit maximum frequency requested by user (0: none) - * @stop_polling: devfreq polling status of a device. + * @flags: Internal DevFreq status of a device. * @total_trans: Number of devfreq transitions * @trans_table: Statistics of devfreq transitions * @time_in_state: Statistics of devfreq states @@ -180,7 +180,7 @@ struct devfreq { unsigned long min_freq; unsigned long max_freq; - bool stop_polling; + unsigned long flags; /* information for device frequency transition */ unsigned int total_trans;