Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752137AbdIUAeB (ORCPT ); Wed, 20 Sep 2017 20:34:01 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:55650 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751858AbdIUAd6 (ORCPT ); Wed, 20 Sep 2017 20:33:58 -0400 X-AuditID: b6c32a36-f79196d0000051db-e3-59c308f4b8c3 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-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/8] Revert "PM / devfreq: Add show_one macro to delete the duplicate code" Date: Thu, 21 Sep 2017 09:33:46 +0900 Message-id: <1505954032-3327-3-git-send-email-cw00.choi@samsung.com> X-Mailer: git-send-email 1.8.0 In-reply-to: <1505954032-3327-1-git-send-email-cw00.choi@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWSa0hTcRjG/buzs6M4O8zbPyUZBwI1nDvzdiZODLVGBU3sQ5qip3lw1m7t bKJd8FJ5WZlaJgZ+6CKhQineEDWzqRiBGdO8VGpZkUbL8JbQh9o89u33vjwPPDw8GE/UxQ/E 8vVmxqSntQTqifSOhIaHb2Ij6dJm+z6qbm4aoWY3v/Gp20u1CDVR9kNATfU3odRG9Sig3pe2 oNTnFocgEVM+Glx1V3a2VaHKW91tQLnRGaxCMph4DUPnMiYxo1cbcvP1eQrieFp2UnZ0jJQM J+VULCHW0zpGQSSfUIUfydc6YxDiAlprcb5UNMsSEQnxJoPFzIg1BtasIM6QpExCSmMlMplM EhWZFSeLdkpyGE372ixi/ONdOLQ8AUrAMy8r8MAgHgWv1XXxOPaHbxbbUSvwxER4H4ADFfUC 7vgN4GbPHLACbNfRaNW4DCJ8AMCFhnMc7wBo70h1MYqHwecrc6iLfXEVrHrS5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tSC2CyTJxcEo1MFofmMQiNF3U29T56+xDN/bfF+xLELp464tjDu/azuI6t/61l9Uu vNqo0jptgv+KY5LPT72/fOacu45lrqpQrGNt752JHTG12iu23qtLfC9pdXTtvOXTbW5GMc/c 9UznnzhL+m5nmQerddKZLx+Tv+DozHs6ou7XvE3rdT2OdshaJlpyf7X/M0OJpTgj0VCLuag4 EQD8uG7sHwIAAA== X-CMS-MailID: 20170921003355epcas1p4ecc54d2b7437b4e0d052d9b99647930e X-Msg-Generator: CA X-Sender-IP: 182.195.42.142 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: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20170921003355epcas1p4ecc54d2b7437b4e0d052d9b99647930e X-RootMTR: 20170921003355epcas1p4ecc54d2b7437b4e0d052d9b99647930e References: <1505954032-3327-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 ae8717a6eee1..2ce1fd0a1324 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1125,6 +1125,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) { @@ -1151,17 +1157,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