Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbdHXBoi (ORCPT ); Wed, 23 Aug 2017 21:44:38 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:45183 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751156AbdHXBnC (ORCPT ); Wed, 23 Aug 2017 21:43:02 -0400 X-AuditID: b6c32a48-f79a16d00000362a-3c-599e2f242b93 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 10/12] PM / devfreq: Remove 'devfreq' prefix from helper function Date: Thu, 24 Aug 2017 10:42:57 +0900 Message-id: <1503538979-22693-11-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+NgFtrCKsWRmVeSWpSXmKPExsWy7bCmma6K/rxIg+bHihYTb1xhsbj+5Tmr xaT7E1gszja9Ybe4vGsOm8Xn3iOMFrcbV7BZPF7xlt2Bw2PxnpdMHptWdbJ59G1ZxejxeZNc AEtUqk1GamJKapFCal5yfkpmXrqtkndwvHO8qZmBoa6hpYW5kkJeYm6qrZKLT4CuW2YO0BlK CmWJOaVAoYDE4mIlfTubovzSklSFjPziElulaENDIz1DA3M9IyMjPRPjWCsjU6CShNSMhddc C6bIVex6dI+tgfGeRBcjJ4eEgInEr1XNbBC2mMSFe+vBbCGBHYwSX65ydjFyAdnfGSXeXZ3J 1MXIAdZwcGkVRM0GRolj//0gan4wSpyYsIkRJMEmoCWx/8UNsEEiAgESnWtXMYEUMQs0MUrs v3eDHSQhLBAssf7LW7AGFgFViTnfz7CC2LwCbhIn1jxlhrhITuLDnkdg9ZxA8ZanXSwggyQE JrB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9Byd9LGx20Hxz4GmyfvjOnY7vf9YpqGpEGcpH6J444WJQxR1+ 50h81UUz3Vtrwx/t4fI6/7JrZbHyXLOQ7FXHv0/cI7LyLMe8n5URK4u1c+J/mb7ynWLkv21L k9KUNkvTqmq+9nlP3TmncHm9OXHsKIvKgc8XjksdFVdb46huzKLwUmGJEktxRqKhFnNRcSIA 97nmUB4CAAA= X-CMS-MailID: 20170824014300epcas2p452c864106cf4fd9754d075d57b8a9ca1 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: 20170824014300epcas2p452c864106cf4fd9754d075d57b8a9ca1 X-RootMTR: 20170824014300epcas2p452c864106cf4fd9754d075d57b8a9ca1 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: 3743 Lines: 115 This patch just removes the 'devfreq' prefix from internal helper function in order to clarify the role of the following functions. - devfreq_get_freq_level() - get_freq_level() - devfreq_set_freq_table() - set_freq_table() Also, this patch changes the return value of set_freq_table() from 'void' to 'int' and then removes the function description of internal helper function. Because the internal helper function is used by the devfreq core. Signed-off-by: Chanwoo Choi --- drivers/devfreq/devfreq.c | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index d8ff16419452..77eb3edf6bf3 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -116,12 +116,7 @@ static int is_supported_freq(struct devfreq *devfreq, unsigned long freq) return ret; } -/** - * devfreq_get_freq_level() - Lookup freq_table for the frequency - * @devfreq: the devfreq instance - * @freq: the target frequency - */ -static int devfreq_get_freq_level(struct devfreq *devfreq, unsigned long freq) +static int get_freq_level(struct devfreq *devfreq, unsigned long freq) { int lev; @@ -132,11 +127,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; @@ -146,7 +137,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 count; profile->max_state = count; profile->freq_table = devm_kcalloc(devfreq->dev.parent, @@ -155,7 +146,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++) { @@ -163,11 +154,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 -EINVAL; } dev_pm_opp_put(opp); profile->freq_table[i] = freq; } + + return 0; } /** @@ -186,7 +179,7 @@ int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) if (!devfreq->previous_freq) goto out; - prev_lev = devfreq_get_freq_level(devfreq, devfreq->previous_freq); + prev_lev = get_freq_level(devfreq, devfreq->previous_freq); if (prev_lev < 0) { ret = prev_lev; goto out; @@ -195,7 +188,7 @@ int devfreq_update_status(struct devfreq *devfreq, unsigned long freq) devfreq->time_in_state[prev_lev] += cur_time - devfreq->last_stat_updated; - lev = devfreq_get_freq_level(devfreq, freq); + lev = get_freq_level(devfreq, freq); if (lev < 0) { ret = lev; goto out; @@ -600,8 +593,13 @@ struct devfreq *devfreq_add_device(struct device *dev, devfreq->data = data; devfreq->nb.notifier_call = devfreq_notifier_call; - if (!devfreq->profile->max_state && !devfreq->profile->freq_table) - devfreq_set_freq_table(devfreq); + if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { + err = set_freq_table(devfreq); + if (err < 0) { + mutex_unlock(&devfreq->lock); + goto err_dev; + } + } /* Set the scaling available min_freq and max_freq */ devfreq->min_freq = find_available_min_freq(devfreq); -- 1.9.1