From patchwork Mon Oct 23 01:32:12 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 10021905 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 ECF8860381 for ; Mon, 23 Oct 2017 01:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF2EC286A8 for ; Mon, 23 Oct 2017 01:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D403B286E1; Mon, 23 Oct 2017 01:33:03 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 5ECF1286A8 for ; Mon, 23 Oct 2017 01:33:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932274AbdJWBcY (ORCPT ); Sun, 22 Oct 2017 21:32:24 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:29020 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932177AbdJWBcT (ORCPT ); Sun, 22 Oct 2017 21:32:19 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20171023013217epoutp01070825f5581ec1057cc57da70bdd5861~wDvjeAOf-0536305363epoutp01S; Mon, 23 Oct 2017 01:32:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20171023013217epoutp01070825f5581ec1057cc57da70bdd5861~wDvjeAOf-0536305363epoutp01S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1508722337; bh=kDvpy7/01B3UrrJ8rIYZU2ljM2znn0R1dAidXFSWfVk=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=cLxydLMkve+lccBcixgMSYCls3Z4xBtsKvSeV54yyBrjpuq57sJQBUoXTLlVVGPKM hQvjqFG8xOLkwAyt+7y8REbNpii6IhBU+UAU73KXSXrbCJF6Uva19Y15UHNH2TvuRw 8w+aRaowDET6DW19gzD5UKbXngThAeF7l5Ae746k= Received: from epsmges2p2.samsung.com (unknown [182.195.40.67]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20171023013216epcas1p1c33b91d10b39809bd392aa8c013dbad6~wDvjCZ47W1156911569epcas1p1c; Mon, 23 Oct 2017 01:32:16 +0000 (GMT) Received: from epcas2p3.samsung.com ( [182.195.41.55]) by epsmges2p2.samsung.com (Symantec Messaging Gateway) with SMTP id 39.D0.04298.0A64DE95; Mon, 23 Oct 2017 10:32:16 +0900 (KST) Received: from epsmgms2p2new.samsung.com (unknown [182.195.42.143]) by epcas2p4.samsung.com (KnoxPortal) with ESMTP id 20171023013216epcas2p4be3855bdb37dbaf4b5b9b9fdd6f65289~wDvioYNNk2886128861epcas2p4z; Mon, 23 Oct 2017 01:32:16 +0000 (GMT) X-AuditID: b6c32a46-455ff700000010ca-50-59ed46a02818 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 09.27.03859.0A64DE95; Mon, 23 Oct 2017 10:32:16 +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 <0OY90045G5LPR020@mmp2.samsung.com>; Mon, 23 Oct 2017 10:32:16 +0900 (KST) From: Chanwoo Choi To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com Cc: rafael.j.wysocki@intel.com, chanwoo@kernel.org, inki.dae@samsung.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, Kukjin Kim , Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v5 7/7] PM / devfreq: Define the constant governor name Date: Mon, 23 Oct 2017 10:32:12 +0900 Message-id: <1508722332-10628-8-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1508722332-10628-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSe0hTYRjG+3bOtqO5OCyrDyuRA4kZrp15O0aLorJBgQMj0pJ10q/N2kV2 NivDdF1tUem2Ltr+KCxYA2VOMUkr2BpJpAbKUioljdJUsPuFyrad+u/3Pt/zwPt+PAQmDQiT iHKjBZmNrJ4SxeOdwdW5GTfyZ4vkV+6mMQ3DQzjz/PM7IeMYq8eZSxPTGDMw4BMzfSdmxIx/ IixkBu+5RcynC48Ac23ggYB5YfOImAnPrHhjgqq5Z0qg8nvPiVTtt2pUFzu8QPXJn6wWFqP1 OsSWIXMKMpaaysqNWiW1vVCzWZOdI6cz6Dwml0oxsgakpLbsUGfkl+sj61EplazeGpHULMdR azesN5usFpSiM3EWJbWHphUyWp4rUygUsqzMknWK7IhlH9J5uq7jFQMZR549OC2qBXOpdhBH QDIL9tu9wA7iCSnZBeDL+yeE/PANQMe8B7MDIubqs9O87gNwuLtFFE1Lye8Ajp5CURaR6fDh 5HBMTyTV8FyLVxANYORlAey83AiiD4vJbbB1pAmPMk6uguO9T2MsIbdCn/8rzq+UDOd6xsVR jiPz4auWL7H1IOkTwZmpR4A3bYGhtg9inhfD9487/vFy+Nbb9i9wFsB29yjOD3UAjt2xCXlX JnxitwmijJGLYF3wt5i/UwLrzkh5iwo+/uPDeN4Eexu6Mf7+RgDr3edBPUi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iZxbVWNND6eH+CsTFzTohC016V/sUxu/fLbf/Z 8mvt1ZpTxz08SuwyBJRYijMSDbWYi4oTAb7cw+c3AgAA X-CMS-MailID: 20171023013216epcas2p4be3855bdb37dbaf4b5b9b9fdd6f65289 X-Msg-Generator: CA CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171023013216epcas2p4be3855bdb37dbaf4b5b9b9fdd6f65289 X-RootMTR: 20171023013216epcas2p4be3855bdb37dbaf4b5b9b9fdd6f65289 References: <1508722332-10628-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 Prior to that, the devfreq device uses the governor name when adding the itself. In order to prevent the mistake used the wrong governor name, this patch defines the governor name as a constant and then uses them instead of using the string directly. Signed-off-by: Chanwoo Choi Acked-by: MyungJoo Ham Cc: Kukjin Kim Cc: Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org --- drivers/devfreq/exynos-bus.c | 5 +++-- drivers/devfreq/governor_passive.c | 2 +- drivers/devfreq/governor_performance.c | 2 +- drivers/devfreq/governor_powersave.c | 2 +- drivers/devfreq/governor_simpleondemand.c | 2 +- drivers/devfreq/governor_userspace.c | 2 +- drivers/devfreq/rk3399_dmc.c | 2 +- include/linux/devfreq.h | 7 +++++++ 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index 49f68929e024..c25658b26598 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -436,7 +436,8 @@ static int exynos_bus_probe(struct platform_device *pdev) ondemand_data->downdifferential = 5; /* Add devfreq device to monitor and handle the exynos bus */ - bus->devfreq = devm_devfreq_add_device(dev, profile, "simple_ondemand", + bus->devfreq = devm_devfreq_add_device(dev, profile, + DEVFREQ_GOV_SIMPLE_ONDEMAND, ondemand_data); if (IS_ERR(bus->devfreq)) { dev_err(dev, "failed to add devfreq device\n"); @@ -488,7 +489,7 @@ static int exynos_bus_probe(struct platform_device *pdev) passive_data->parent = parent_devfreq; /* Add devfreq device for exynos bus with passive governor */ - bus->devfreq = devm_devfreq_add_device(dev, profile, "passive", + bus->devfreq = devm_devfreq_add_device(dev, profile, DEVFREQ_GOV_PASSIVE, passive_data); if (IS_ERR(bus->devfreq)) { dev_err(dev, diff --git a/drivers/devfreq/governor_passive.c b/drivers/devfreq/governor_passive.c index 673ad8cc9a1d..3bc29acbd54e 100644 --- a/drivers/devfreq/governor_passive.c +++ b/drivers/devfreq/governor_passive.c @@ -183,7 +183,7 @@ static int devfreq_passive_event_handler(struct devfreq *devfreq, } static struct devfreq_governor devfreq_passive = { - .name = "passive", + .name = DEVFREQ_GOV_PASSIVE, .immutable = 1, .get_target_freq = devfreq_passive_get_target_freq, .event_handler = devfreq_passive_event_handler, diff --git a/drivers/devfreq/governor_performance.c b/drivers/devfreq/governor_performance.c index c72f942f30a8..4d23ecfbd948 100644 --- a/drivers/devfreq/governor_performance.c +++ b/drivers/devfreq/governor_performance.c @@ -42,7 +42,7 @@ static int devfreq_performance_handler(struct devfreq *devfreq, } static struct devfreq_governor devfreq_performance = { - .name = "performance", + .name = DEVFREQ_GOV_PERFORMANCE, .get_target_freq = devfreq_performance_func, .event_handler = devfreq_performance_handler, }; diff --git a/drivers/devfreq/governor_powersave.c b/drivers/devfreq/governor_powersave.c index 0c6bed567e6d..0c42f23249ef 100644 --- a/drivers/devfreq/governor_powersave.c +++ b/drivers/devfreq/governor_powersave.c @@ -39,7 +39,7 @@ static int devfreq_powersave_handler(struct devfreq *devfreq, } static struct devfreq_governor devfreq_powersave = { - .name = "powersave", + .name = DEVFREQ_GOV_POWERSAVE, .get_target_freq = devfreq_powersave_func, .event_handler = devfreq_powersave_handler, }; diff --git a/drivers/devfreq/governor_simpleondemand.c b/drivers/devfreq/governor_simpleondemand.c index ae72ba5e78df..28e0f2de7100 100644 --- a/drivers/devfreq/governor_simpleondemand.c +++ b/drivers/devfreq/governor_simpleondemand.c @@ -125,7 +125,7 @@ static int devfreq_simple_ondemand_handler(struct devfreq *devfreq, } static struct devfreq_governor devfreq_simple_ondemand = { - .name = "simple_ondemand", + .name = DEVFREQ_GOV_SIMPLE_ONDEMAND, .get_target_freq = devfreq_simple_ondemand_func, .event_handler = devfreq_simple_ondemand_handler, }; diff --git a/drivers/devfreq/governor_userspace.c b/drivers/devfreq/governor_userspace.c index 77028c27593c..080607c3f34d 100644 --- a/drivers/devfreq/governor_userspace.c +++ b/drivers/devfreq/governor_userspace.c @@ -87,7 +87,7 @@ static ssize_t show_freq(struct device *dev, struct device_attribute *attr, NULL, }; static const struct attribute_group dev_attr_group = { - .name = "userspace", + .name = DEVFREQ_GOV_USERSPACE, .attrs = dev_entries, }; diff --git a/drivers/devfreq/rk3399_dmc.c b/drivers/devfreq/rk3399_dmc.c index 1b89ebbad02c..5dfbfa3cc878 100644 --- a/drivers/devfreq/rk3399_dmc.c +++ b/drivers/devfreq/rk3399_dmc.c @@ -431,7 +431,7 @@ static int rk3399_dmcfreq_probe(struct platform_device *pdev) data->devfreq = devm_devfreq_add_device(dev, &rk3399_devfreq_dmc_profile, - "simple_ondemand", + DEVFREQ_GOV_SIMPLE_ONDEMAND, &data->ondemand_data); if (IS_ERR(data->devfreq)) return PTR_ERR(data->devfreq); diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h index 19520625ea94..3aae5b3af87c 100644 --- a/include/linux/devfreq.h +++ b/include/linux/devfreq.h @@ -19,6 +19,13 @@ #define DEVFREQ_NAME_LEN 16 +/* DEVFREQ governor name */ +#define DEVFREQ_GOV_SIMPLE_ONDEMAND "simple_ondemand" +#define DEVFREQ_GOV_PERFORMANCE "performance" +#define DEVFREQ_GOV_POWERSAVE "powersave" +#define DEVFREQ_GOV_USERSPACE "userspace" +#define DEVFREQ_GOV_PASSIVE "passive" + /* DEVFREQ notifier interface */ #define DEVFREQ_TRANSITION_NOTIFIER (0)