From patchwork Thu Sep 21 00:33:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 9963073 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 250136056A for ; Thu, 21 Sep 2017 00:34:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17C352926A for ; Thu, 21 Sep 2017 00:34:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B38029283; Thu, 21 Sep 2017 00:34:49 +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 AE2DD2927D for ; Thu, 21 Sep 2017 00:34:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751999AbdIUAd7 (ORCPT ); Wed, 20 Sep 2017 20:33:59 -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 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20170921003356epoutp01ba5f8d8f79cd79ce27304595ceb95ebd~mOTeme2ah1469514695epoutp01w; Thu, 21 Sep 2017 00:33:56 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.68]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20170921003356epcas1p17e1e38d186840d7ae6b164d2b4baf849~mOTeVU8vk2183121831epcas1p1U; Thu, 21 Sep 2017 00:33:56 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 1D.36.20955.4F803C95; Thu, 21 Sep 2017 09:33:56 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170921003355epcas1p4ecc54d2b7437b4e0d052d9b99647930e~mOTd9iew20338303383epcas1p44; Thu, 21 Sep 2017 00:33:55 +0000 (GMT) X-AuditID: b6c32a36-f79196d0000051db-e3-59c308f4b8c3 Received: from epmmp1.local.host ( [203.254.227.16]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A7.02.11757.3F803C95; Thu, 21 Sep 2017 09:33:55 +0900 (KST) Received: from localhost.localdomain ([10.113.62.212]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0OWL00BYOTKJX990@mmp1.samsung.com>; Thu, 21 Sep 2017 09:33:55 +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-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+6CKhQineEDWzq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3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRXDYpqTmZZalF+nYJXBnr319nKfjNV7Hv0VnGBsa9PF2MHBwSAiYSM7oyuhi5OIQEdjJK HDo0jwnC+cEocevuWfYuRk4ONgEtif0vbrCB2CICfhLb569nBCliFmhilNj47AATSEJYIEHi 0brPLCA2i4CqRG/7J0YQm1fAReLq1k9ggyQE5CQ+7HkEZnMKuEp8O9sFNlQIqObsi9dsExh5 FjAyrGKUTC0ozk3PLTYqMMxLLdcrTswtLs1L10vOz93ECAyjbYe1+nYw3l8Sf4hRgINRiYc3 wOpgpBBrYllxZe4hRgkOZiUR3piHhyKFeFMSK6tSi/Lji0pzUosPMUpzsCiJ82b2zYgUEkhP LEnNTk0tSC2CyTJxcEo1MFofmMQiNF3U29T56+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-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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,