aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2017-10-22 21:32:09 -0400
committerMyungJoo Ham <myungjoo.ham@samsung.com>2017-10-26 04:08:40 -0400
commitea572f816032bef9ff2641a439a45651a20eab73 (patch)
tree23424a71a42b7430714b48bd7b49647abecbcb0a /drivers/devfreq/devfreq.c
parentf1d981eaecf8ace68ec1d15bf05f28a4887ea6fb (diff)
PM / devfreq: Change return type of devfreq_set_freq_table()
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 <cw00.choi@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c18
1 files 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)
116 return -EINVAL; 116 return -EINVAL;
117} 117}
118 118
119/** 119static int set_freq_table(struct devfreq *devfreq)
120 * devfreq_set_freq_table() - Initialize freq_table for the frequency
121 * @devfreq: the devfreq instance
122 */
123static void devfreq_set_freq_table(struct devfreq *devfreq)
124{ 120{
125 struct devfreq_dev_profile *profile = devfreq->profile; 121 struct devfreq_dev_profile *profile = devfreq->profile;
126 struct dev_pm_opp *opp; 122 struct dev_pm_opp *opp;
@@ -130,7 +126,7 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
130 /* Initialize the freq_table from OPP table */ 126 /* Initialize the freq_table from OPP table */
131 count = dev_pm_opp_get_opp_count(devfreq->dev.parent); 127 count = dev_pm_opp_get_opp_count(devfreq->dev.parent);
132 if (count <= 0) 128 if (count <= 0)
133 return; 129 return -EINVAL;
134 130
135 profile->max_state = count; 131 profile->max_state = count;
136 profile->freq_table = devm_kcalloc(devfreq->dev.parent, 132 profile->freq_table = devm_kcalloc(devfreq->dev.parent,
@@ -139,7 +135,7 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
139 GFP_KERNEL); 135 GFP_KERNEL);
140 if (!profile->freq_table) { 136 if (!profile->freq_table) {
141 profile->max_state = 0; 137 profile->max_state = 0;
142 return; 138 return -ENOMEM;
143 } 139 }
144 140
145 for (i = 0, freq = 0; i < profile->max_state; i++, freq++) { 141 for (i = 0, freq = 0; i < profile->max_state; i++, freq++) {
@@ -147,11 +143,13 @@ static void devfreq_set_freq_table(struct devfreq *devfreq)
147 if (IS_ERR(opp)) { 143 if (IS_ERR(opp)) {
148 devm_kfree(devfreq->dev.parent, profile->freq_table); 144 devm_kfree(devfreq->dev.parent, profile->freq_table);
149 profile->max_state = 0; 145 profile->max_state = 0;
150 return; 146 return PTR_ERR(opp);
151 } 147 }
152 dev_pm_opp_put(opp); 148 dev_pm_opp_put(opp);
153 profile->freq_table[i] = freq; 149 profile->freq_table[i] = freq;
154 } 150 }
151
152 return 0;
155} 153}
156 154
157/** 155/**
@@ -601,7 +599,9 @@ struct devfreq *devfreq_add_device(struct device *dev,
601 599
602 if (!devfreq->profile->max_state && !devfreq->profile->freq_table) { 600 if (!devfreq->profile->max_state && !devfreq->profile->freq_table) {
603 mutex_unlock(&devfreq->lock); 601 mutex_unlock(&devfreq->lock);
604 devfreq_set_freq_table(devfreq); 602 err = set_freq_table(devfreq);
603 if (err < 0)
604 goto err_out;
605 mutex_lock(&devfreq->lock); 605 mutex_lock(&devfreq->lock);
606 } 606 }
607 607