From patchwork Mon Oct 23 01:32:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chanwoo Choi X-Patchwork-Id: 10021897 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 8D1E060580 for ; Mon, 23 Oct 2017 01:32:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F4C6286CC for ; Mon, 23 Oct 2017 01:32:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73C1E286DE; Mon, 23 Oct 2017 01:32:33 +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 1286B286CC for ; Mon, 23 Oct 2017 01:32:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932326AbdJWBc3 (ORCPT ); Sun, 22 Oct 2017 21:32:29 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:60686 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932177AbdJWBcZ (ORCPT ); Sun, 22 Oct 2017 21:32:25 -0400 Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20171023013223epoutp02b29b1ec21a6161412d2b536b516fa226~wDvpf4NgK1222412224epoutp02b; Mon, 23 Oct 2017 01:32:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20171023013223epoutp02b29b1ec21a6161412d2b536b516fa226~wDvpf4NgK1222412224epoutp02b DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1508722343; bh=belrthHeearHVgwlXqXozeM9qsWsWGhKj38tKAUcO94=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=lE5RaAabqaFDYmijfi2Js5paqy+RMfMz7RHsZ2I2ABttirWIKmZA31YTPrnwEnrCX W5ohPooT2grqD/m5UVZHtdXwKuglfriUA2Tbx0OLaDGL5j/dva/qsw1+YiAm/Wwv3r FXGTnmCkYUJ02iEsd01xhfpC711ZRg3d/gYNCVr8= Received: from epsmges1p3.samsung.com (unknown [182.195.40.64]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20171023013223epcas1p26ad863e35bf520c00c67c9fbad12972d~wDvpLxnZ-1196511965epcas1p2f; Mon, 23 Oct 2017 01:32:23 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id AE.78.04169.F964DE95; Mon, 23 Oct 2017 10:32:15 +0900 (KST) Received: from epsmgms2p1new.samsung.com (unknown [182.195.42.142]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20171023013215epcas1p3e43fa1b26d20fcb7d7d5d89fd28f9166~wDvhg0Q8i1499214992epcas1p38; Mon, 23 Oct 2017 01:32:15 +0000 (GMT) X-AuditID: b6c32a37-f0bff70000001049-f1-59ed469f6c56 Received: from epmmp2 ( [203.254.227.17]) by epsmgms2p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 18.07.04095.E964DE95; Mon, 23 Oct 2017 10:32:15 +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 4/7] PM / devfreq: Change return type of devfreq_set_freq_table() Date: Mon, 23 Oct 2017 10:32:09 +0900 Message-id: <1508722332-10628-5-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+NgFlrJKsWRmVeSWpSXmKPExsWy7bCmvu58t7eRBkfeillMvHGFxeL6l+es FpPuT2CxONv0ht3i8q45bBafe48wWtxuXMFm8XjFW3YHDo/Fe14yeWxa1cnm0bdlFaPH501y ASxRqTYZqYkpqUUKqXnJ+SmZeem2St7B8c7xpmYGhrqGlhbmSgp5ibmptkouPgG6bpk5QGco KZQl5pQChQISi4uV9O1sivJLS1IVMvKLS2yVog0NjfQMDcz1jIyM9EyMY62MTIFKElIzdr3b yl5wU6hiaUtqA+Mi/i5GTg4JAROJHb2TWboYuTiEBHYwSnz438sO4XxnlDizvpsFpmrfgp+s EIkNjBLdO6cyQzg/GCU2PT/EBlLFJqAlsf/FDTBbRCBAonPtKiaQImaBJkaJ/fdusIMkhAXC JO7v6GMEsVkEVCWut34Fi/MKuEosmNMMtU5O4sOeR2BxTgE3ibtrvzKCDJIQ6GCTWHhuCytE kYvE0qUbGCFsYYlXx7cANXAA2dISl47aQtS3M0psnnOPBaqZUeL+ykaoZmOJU12NTCA2swCf xLuvPawQzbwSHW1CECUeEsen74aa7yhxdsknMFtIYCajxOq7ZhMYpRYwMqxiFEstKM5NTy02 LDDWK07MLS7NS9dLzs/dxAhOJlrmOxg3nPM5xCjAwajEw8tg+DZSiDWxrLgy9xCjBAezkgjv HAugEG9KYmVValF+fFFpTmrxIUZTYNhMZJYSTc4HJrq8knhDE0sDEzMj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 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20171023013215epcas1p3e43fa1b26d20fcb7d7d5d89fd28f9166 X-RootMTR: 20171023013215epcas1p3e43fa1b26d20fcb7d7d5d89fd28f9166 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 patch changes the return type of devfreq_set_freq_table() from 'void' to 'int' in order to check whether it fails or not. And This patch just removes the 'devfreq' prefix and the description of function. Because the helper functions are only used by the devfreq. Signed-off-by: Chanwoo Choi Acked-by: MyungJoo Ham --- drivers/devfreq/devfreq.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index ee3e7cee30b6..b2920cd2b78e 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -116,11 +116,7 @@ static int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) return -EINVAL; } -/** - * devfreq_set_freq_table() - Initialize freq_table for the frequency - * @devfreq: the devfreq instance - */ -static void devfreq_set_freq_table(struct devfreq *devfreq) +static int set_freq_table(struct devfreq *devfreq) { struct devfreq_dev_profile *profile = devfreq->profile; struct dev_pm_opp *opp; @@ -130,7 +126,7 @@ static void devfreq_set_freq_table(struct devfreq *devfreq) /* Initialize the freq_table from OPP table */ count = dev_pm_opp_get_opp_count(devfreq->dev.parent); if (count <= 0) - return; + return -EINVAL; profile->max_state = count; profile->freq_table = devm_kcalloc(devfreq->dev.parent, @@ -139,7 +135,7 @@ static void devfreq_set_freq_table(struct devfreq *devfreq) GFP_KERNEL); if (!profile->freq_table) { profile->max_state = 0; - return; + return -ENOMEM; } for (i = 0, freq = 0; i < profile->max_state; i++, freq++) { @@ -147,11 +143,13 @@ static void devfreq_set_freq_table(struct devfreq *devfreq) if (IS_ERR(opp)) { devm_kfree(devfreq->dev.parent, profile->freq_table); profile->max_state = 0; - return; + return PTR_ERR(opp); } dev_pm_opp_put(opp); profile->freq_table[i] = freq; } + + return 0; } /** @@ -601,7 +599,9 @@ struct devfreq *devfreq_add_device(struct device *dev, if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { mutex_unlock(&devfreq->lock); - devfreq_set_freq_table(devfreq); + err = set_freq_table(devfreq); + if (err < 0) + goto err_out; mutex_lock(&devfreq->lock); }