From patchwork Wed Jan 18 06:56:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9522809 X-Patchwork-Delegate: rjw@sisk.pl 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 670616043A for ; Wed, 18 Jan 2017 06:57:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57D5E284D1 for ; Wed, 18 Jan 2017 06:57:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C1182855A; Wed, 18 Jan 2017 06:57:00 +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=ham 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 50C4C284D1 for ; Wed, 18 Jan 2017 06:56:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbdARG45 (ORCPT ); Wed, 18 Jan 2017 01:56:57 -0500 Received: from mailout4.samsung.com ([203.254.224.34]:54626 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751132AbdARG4z (ORCPT ); Wed, 18 Jan 2017 01:56:55 -0500 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OJY00CSLRATXDB0@mailout4.samsung.com>; Wed, 18 Jan 2017 15:56:53 +0900 (KST) Received: from epsmges5p1.samsung.com (unknown [182.195.40.67]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170118065653epcas1p46704bf52983e94a8ac6f1e804669944a~ay1m5BMmg0785207852epcas1p4C; Wed, 18 Jan 2017 06:56:53 +0000 (GMT) Received: from epcas5p2.samsung.com ( [182.195.41.40]) by epsmges5p1.samsung.com (EPCPMTA) with SMTP id 9E.4C.14952.5B11F785; Wed, 18 Jan 2017 15:56:53 +0900 (KST) Received: from epcpsbgm2new.samsung.com (u27.gpu120.samsung.co.kr [203.254.230.27]) by epcas5p2.samsung.com (KnoxPortal) with ESMTP id 20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5~ay1mrPOUm2143321433epcas5p2_; Wed, 18 Jan 2017 06:56:53 +0000 (GMT) X-AuditID: b6c32a2c-f79bc6d000003a68-9b-587f11b53541 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id E5.07.26370.5B11F785; Wed, 18 Jan 2017 15:56:53 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OJY00CC4RASPV10@mmp2.samsung.com>; Wed, 18 Jan 2017 15:56:52 +0900 (KST) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, rjw@rjwysocki.net Cc: cw00.choi@samsung.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/3] PM / devfreq: Fix available_governor sysfs Date: Wed, 18 Jan 2017 15:56:49 +0900 Message-id: <1484722611-10555-2-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1484722611-10555-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrMKsWRmVeSWpSXmKPExsWy7bCmhu5WwfoIg3nfRCyuf3nOanG26Q27 xeVdc9gsPvceYbS43biCzeLM6UusFgs2PmJ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ffllWMHp83yQUwR7nZZKQmpqQW KaTmJeenZOal2yqFhrjpWigp5CXmptoqRej6hgQpKZQl5pQCeUYGaMDBOcA9WEnfLsEtY+6Z fywF94UrGh58Ym9g7BXoYuTkkBAwkXiyezIrhC0mceHeerYuRi4OIYFZjBIvGt6yQDg/GCXu TjjCDFLFJqAlsf/FDTYQW0TAS2L/oS/sIDazQLZE4/+jLCC2sIC9xNtJrWA2i4CqxP3J/UAb ODh4BVwldq2qgFgmJ/FhzyOwVk4BN4nulj5GEFsIqGT/xw7WCYy8CxgZVjFKpBYkFxQnpeca 5aWW6xUn5haX5qXrJefnbmIEh+8z6R2Mh3e5H2IU4GBU4uENEK2LEGJNLCuuzD3EKMHBrCTC O4+vPkKINyWxsiq1KD++qDQntfgQoynQXROZpUST84GxlVcSb2hibmJubGBhbmlpYqQkzts4 +1m4kEB6YklqdmpqQWoRTB8TB6dUAyOf0v4urgm1/cFtZlw2r1asUV8947XV5nkSs7b+7xHP 2Krw6EzePkXP6OPuky79+mPF1/Wa05m3bIVrUiHvvVMuPCzim0Uevp8qt+iz9uwzVtuUVz69 FzX1x1JDznsmNcKXM3Yar0jaLORQkHfl/rY0a44SncjpoV3TJpQ91Xu5wffhoe3BxVZKLMUZ iYZazEXFiQAqUbI8dQIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5 X-Msg-Generator: CA X-Sender-IP: 203.254.230.27 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbUzUo7LGF7J6EKS9DaGFuZ2UgQWdlbnQ=?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTNS9TZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NUQUYbQzEwVjgxMTE=?= CMS-TYPE: 105P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5 X-RootMTR: 20170118065653epcas5p2b1b4a964772e300b56356a26ec5cb9e5 References: <1484722611-10555-1-git-send-email-cw00.choi@samsung.com> 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 The devfreq using passive governor is not able to change the governor. So, the user can not change the governor through 'available_governor' sysfs entry. Also, the devfreq which don't use the passive governor is not able to change to 'passive' governor on the fly. Fixes: 996133119f57 ("PM / devfreq: Add new passive governor") Cc: stable@vger.kernel.org Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 4bd7a8f71b07..a2c575a5a9ab 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -43,6 +43,11 @@ static LIST_HEAD(devfreq_list); static DEFINE_MUTEX(devfreq_list_lock); +static int is_passive_gov(const char *governor_name) +{ + return (!strncmp(governor_name, "passive", 7)) ? 1 : 0; +} + /** * find_device_devfreq() - find devfreq struct using device pointer * @dev: device pointer used to lookup device devfreq. @@ -933,6 +938,10 @@ static ssize_t governor_store(struct device *dev, struct device_attribute *attr, if (ret != 1) return -EINVAL; + /* The passive devfreq is not able to change the governor. */ + if (is_passive_gov(df->governor_name)) + return 0; + mutex_lock(&devfreq_list_lock); governor = find_devfreq_governor(str_governor); if (IS_ERR(governor)) { @@ -972,12 +981,35 @@ static ssize_t available_governors_show(struct device *d, char *buf) { struct devfreq_governor *tmp_governor; + struct devfreq *df = to_devfreq(d); ssize_t count = 0; mutex_lock(&devfreq_list_lock); - list_for_each_entry(tmp_governor, &devfreq_governor_list, node) + + /* + * The passive devfreq shows only passive governor. + * The governor except for passive are not available + * for passive devfreq device. + */ + if (is_passive_gov(df->governor_name)) { + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), + "%s ", df->governor_name); + goto out; + } + + /* + * The devfreq device show the registered governor except for + * 'passive' governor. + */ + list_for_each_entry(tmp_governor, &devfreq_governor_list, node) { + if (is_passive_gov(tmp_governor->name)) + continue; + count += scnprintf(&buf[count], (PAGE_SIZE - count - 2), "%s ", tmp_governor->name); + } + +out: mutex_unlock(&devfreq_list_lock); /* Truncate the trailing space */