From patchwork Mon Oct 23 01:32:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 10021917 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 EC78C60381 for ; Mon, 23 Oct 2017 01:35:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DD045284B5 for ; Mon, 23 Oct 2017 01:35:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D0488286CC; Mon, 23 Oct 2017 01:35:02 +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=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 40B14284B5 for ; Mon, 23 Oct 2017 01:35:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932184AbdJWBfB (ORCPT ); Sun, 22 Oct 2017 21:35:01 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:30130 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932171AbdJWBe7 (ORCPT ); Sun, 22 Oct 2017 21:34:59 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout4.samsung.com (KnoxPortal) with ESMTP id 20171023013458epoutp045827960f0f4692abbf7d086b39eac3b5~wDx5Xs8ht2099620996epoutp04z; Mon, 23 Oct 2017 01:34:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout4.samsung.com 20171023013458epoutp045827960f0f4692abbf7d086b39eac3b5~wDx5Xs8ht2099620996epoutp04z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1508722498; bh=yCAcE1esbvfdAJGOohDv16xfbpcfNvQrCN/WktJ7SYU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=cACHm+PD3zOc87yrSaoEPxbgsdjM3xpdCJ50wt8shujmCY6cQuMYv8RT4h70Rs8UG YTkZ4HHIpgjbJmwpUY4WnvvUfvamzgUoLQIprfX0l3+XSZ/ps1MjYspWEkfJ2cnVnG PJ1oCuhiwJGFMkCsJ5axmVeI6vDSGLIY3ANQlg/0= Received: from epsmges1p5.samsung.com (unknown [182.195.40.68]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20171023013457epcas1p3bc63d552a5b3fbcb89737ff0fa05b218~wDx41APbJ3230532305epcas1p3B; Mon, 23 Oct 2017 01:34:57 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id 21.8A.04139.E964DE95; Mon, 23 Oct 2017 10:32:14 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20171023013214epcas1p341c10076a9dfdea26510c12fac0d723a~wDvg3E_rI1728917289epcas1p37; Mon, 23 Oct 2017 01:32:14 +0000 (GMT) X-AuditID: b6c32a39-981ff7000000102b-5a-59ed469e7c29 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id F6.07.04095.E964DE95; Mon, 23 Oct 2017 10:32:14 +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:14 +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 Subject: [PATCH v5 2/7] Revert "PM / devfreq: Add show_one macro to delete the duplicate code" Date: Mon, 23 Oct 2017 10:32:07 +0900 Message-id: <1508722332-10628-3-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: H4sIAAAAAAAAA+NgFlrFKsWRmVeSWpSXmKPExsWy7bCmnu48t7eRBnPfallMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5QGco KZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVog0NjfQMDcz1jIyM9EyMY62MTIFKElIzdt77 zlzwm69i/sRetgbGvTxdjJwcEgImEuf717J2MXJxCAnsYJS4cvIEG4TznVHi0YlbTDBV587d ZYRIbABKrJvPDOH8YJTY9PwQG0gVm4CWxP4XN8BsEYEAic61q5hAipgFmhgl9t+7wQ6SEBZI kFjZdRjMZhFQlTi+/zJYA6+Aq8TDX/1sEOvkJD7seQRWwyngJnF37Vew1RICPWwSq+ddZoEo cpHo2XyWHcIWlnh1fAuQzQFkS0tcOmoLUd/OKLF5zj0WCKeDUeL+ykZWiAZjiVNdjWDPMQvw Sbz72sMK0cwr0dEmBGF6SJy+ZwBR7Six5MYraLjMZJQ49HwR0wRGqQWMDKsYxVILinPTU4sN C0z1ihNzi0vz0vWS83M3MYLTiZblDsZj53wOMQpwMCrx8DIYvo0UYk0sK67MPcQowcGsJMI7 xwIoxJuSWFmVWpQfX1Sak1p8iNEUGDYTmaVEk/OBqS6vJN7QxNLAxMwImBosDQ2VxHlF11+L EBJITyxJzU5NLUgtgulj4uCUamAU2ZB3e3ZG/IIigWaPzatP/HWdtOV+Iduvn1rGH412Nf3w MrMu3vgyvqQxxGOm1cHq32+f6Ui8lrnx8ELdykf32vY9i3xyjumvyj3v63N0HtbpC7o89uAN l+WOX1aUyrljYsKryF9LxUJFX+y111q15etjY9NNNZvi3xv8yb0jqnmlv3f/5S+rlViKMxIN tZiLihMBPOvzXz0DAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFuplluLIzCtJLcpLzFFi42I5/e+xoO48t7eRBk92iVlMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRXDYpqTmZZalF+nYJXBk7731nLvjNVzF/Yi9bA+Neni5GTg4JAROJc+fuMnYxcnEICaxj lDj68Rs7hPODUaLvSDsbSBWbgJbE/hc3wGwRAT+J7fPXg3UwCzQxSizvvwWWEBZIkFjZdZgd xGYRUJU4vv8yWJxXwFXi4a9+Noh1chIf9jwCq+EUcJO4u/YrI4gtBFTz99N/pgmMPAsYGVYx SqYWFOem5xYbFRjmpZbrFSfmFpfmpesl5+duYgQG0rbDWn07GO8viT/EKMDBqMTDy2D4NlKI NbGsuDL3EKMEB7OSCO8cC6AQb0piZVVqUX58UWlOavEhRmkOFiVx3tt5xyKFBNITS1KzU1ML UotgskwcnFINjMJVu3m3O85cdiruDUPMoa8aR/vmuGYy7Z7wPT/erSZ+t+G3renR5XuljG9W 5cipL1NaenBu2OUUZSX/eYUxGpM4L1dWB07aP/Hq7cCLli8Mt6dFrQ8WXn58Uvbt+gDTnAUC RYtFpz/77TXxzf1VX9f6TuS5POdwB0vtkf+vrEy6eLjnBXNk2yixFGckGmoxFxUnAgAxFHZ8 IAIAAA== X-CMS-MailID: 20171023013214epcas1p341c10076a9dfdea26510c12fac0d723a X-Msg-Generator: CA CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171023013214epcas1p341c10076a9dfdea26510c12fac0d723a X-RootMTR: 20171023013214epcas1p341c10076a9dfdea26510c12fac0d723a 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 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 6a6f88bccdee..b6ba24e5db0d 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -1124,6 +1124,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) { @@ -1150,17 +1156,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,