Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751706AbdHXBof (ORCPT ); Wed, 23 Aug 2017 21:44:35 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:12300 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751162AbdHXBnC (ORCPT ); Wed, 23 Aug 2017 21:43:02 -0400 X-AuditID: b6c32a46-f790d6d000003bf5-6e-599e2f247e9b 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 Subject: [PATCH 07/12] Revert "PM / devfreq: Add show_one macro to delete the duplicate code" Date: Thu, 24 Aug 2017 10:42:54 +0900 Message-id: <1503538979-22693-8-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrBKsWRmVeSWpSXmKPExsWy7bCmua6K/rxIg8tvdCwm3rjCYnH9y3NW i0n3J7BYnG16w25xedccNovPvUcYLW43rmCzeLziLbsDh8fiPS+ZPDat6mTz6NuyitHj8ya5 AJaoVJuM1MSU1CKF1Lzk/JTMvHRbJe/geOd4UzMDQ11DSwtzJYW8xNxUWyUXnwBdt8wcoDOU FMoSc0qBQgGJxcVK+nY2RfmlJakKGfnFJbZK0YaGRnqGBuZ6RkZGeibGsVZGpkAlCakZ3ZP7 2Ap+81WcnvmfuYFxL08XIyeHhICJxMuPcxghbDGJC/fWs3UxcnEICexglFj0dxszhPOdUWL1 ud+sMB0372yAqtrAKNGwcxuU84NR4sSETWCz2AS0JPa/uMEGYosIBEh0rl3FBFLELNDEKLH/ 3g12kISwQLxEV/NPsAYWAVWJliULweK8Aq4S7S+bmSDWyUl82PMILM4p4CbR8rSLBWSQhEAH m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T4d9Ll7367bhDNC7/v0DzVt4Kv5tT7zhxPEy+f+gWy h+pDqzzX5/4JC2uRNrr1Vqvg4e/Dn3O/H7p/9k4dW7nUK47cPq6EKTxui1t3BbtPy/Pfs7f9 LJOqzRupgp8RQt5TPJP43axbF9VVPjafwj1XanP28pL7xmeVWIozEg21mIuKEwFqqHlYHwIA AA== X-CMS-MailID: 20170824014300epcas2p3069258855c2e233ab4c01745eae93a73 X-Msg-Generator: CA X-Sender-IP: 182.195.42.143 X-Local-Sender: =?UTF-8?B?7LWc7LCs7JqwG1RpemVuIFBsYXRmb3JtIExhYihTL1fshLw=?= =?UTF-8?B?7YSwKRvsgrzshLHsoITsnpAbU2VuaW9yIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?Q2hhbndvbyBDaG9pG1RpemVuIFBsYXRmb3JtIExhYi4bU2Ft?= =?UTF-8?B?c3VuZyBFbGVjdHJvbmljcxtTZW5pb3IgRW5naW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1RFTEUbQzEwVjgxMTE=?= CMS-TYPE: 102P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170824014300epcas2p3069258855c2e233ab4c01745eae93a73 X-RootMTR: 20170824014300epcas2p3069258855c2e233ab4c01745eae93a73 References: <1503538979-22693-1-git-send-email-cw00.choi@samsung.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1858 Lines: 55 This reverts commit 3104fa3081126c9bda35793af5f335d0ee0d5818. The {min|max}_freq_show() show the stored value of the struct devfreq. But, if the drivers/thermal/devfreq_cooling.c disables the specific frequency value, {min|max}_freq_show() have to check this situation before showing the stored value. So, this patch revert the macro in order to add the additional codes. Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index f10017fe400f..be3d42f140ff 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1145,6 +1145,12 @@ static ssize_t min_freq_store(struct device *dev, struct device_attribute *attr, return ret; } +static ssize_t min_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%lu\n", to_devfreq(dev)->min_freq); +} + static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { @@ -1175,17 +1181,13 @@ static ssize_t max_freq_store(struct device *dev, struct device_attribute *attr, mutex_unlock(&df->lock); return ret; } +static DEVICE_ATTR_RW(min_freq); -#define show_one(name) \ -static ssize_t name##_show \ -(struct device *dev, struct device_attribute *attr, char *buf) \ -{ \ - return sprintf(buf, "%lu\n", to_devfreq(dev)->name); \ +static ssize_t max_freq_show(struct device *dev, struct device_attribute *attr, + char *buf) +{ + return sprintf(buf, "%lu\n", to_devfreq(dev)->max_freq); } -show_one(min_freq); -show_one(max_freq); - -static DEVICE_ATTR_RW(min_freq); static DEVICE_ATTR_RW(max_freq); static ssize_t available_frequencies_show(struct device *d, -- 1.9.1