aboutsummaryrefslogtreecommitdiffstats
path: root/arch/unicore32
diff options
context:
space:
mode:
authorThierry Reding <thierry.reding@avionic-design.de>2012-08-30 07:48:10 -0400
committerThierry Reding <thierry.reding@avionic-design.de>2012-10-05 14:56:40 -0400
commite551fadef3650c34137e90f17963ca613b8f8610 (patch)
tree387efc579d96bfdf9acd633fcf75f780f62d064e /arch/unicore32
parentdde9959b8d5b791a3e06e3c44f2d9ba0ec5143f0 (diff)
unicore32: pwm: Remove unnecessary indirection
Calling the actual probing function through a proxy isn't required and makes the code needlessly complex. Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de> Tested-by: Qin Rui <qinrui@mprc.pku.edu.cn> Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Diffstat (limited to 'arch/unicore32')
-rw-r--r--arch/unicore32/kernel/pwm.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/arch/unicore32/kernel/pwm.c b/arch/unicore32/kernel/pwm.c
index 012c54a8019a..7e234700d80f 100644
--- a/arch/unicore32/kernel/pwm.c
+++ b/arch/unicore32/kernel/pwm.c
@@ -156,8 +156,7 @@ static inline void __add_pwm(struct pwm_device *pwm)
156 mutex_unlock(&pwm_lock); 156 mutex_unlock(&pwm_lock);
157} 157}
158 158
159static struct pwm_device *pwm_probe(struct platform_device *pdev, 159static int __devinit pwm_probe(struct platform_device *pdev)
160 unsigned int pwm_id, struct pwm_device *parent_pwm)
161{ 160{
162 struct pwm_device *pwm; 161 struct pwm_device *pwm;
163 struct resource *r; 162 struct resource *r;
@@ -166,7 +165,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
166 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL); 165 pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
167 if (pwm == NULL) { 166 if (pwm == NULL) {
168 dev_err(&pdev->dev, "failed to allocate memory\n"); 167 dev_err(&pdev->dev, "failed to allocate memory\n");
169 return ERR_PTR(-ENOMEM); 168 return -ENOMEM;
170 } 169 }
171 170
172 pwm->clk = clk_get(NULL, "OST_CLK"); 171 pwm->clk = clk_get(NULL, "OST_CLK");
@@ -177,7 +176,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
177 pwm->clk_enabled = 0; 176 pwm->clk_enabled = 0;
178 177
179 pwm->use_count = 0; 178 pwm->use_count = 0;
180 pwm->pwm_id = pwm_id; 179 pwm->pwm_id = pdev->id;
181 pwm->pdev = pdev; 180 pwm->pdev = pdev;
182 181
183 r = platform_get_resource(pdev, IORESOURCE_MEM, 0); 182 r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -203,7 +202,7 @@ static struct pwm_device *pwm_probe(struct platform_device *pdev,
203 202
204 __add_pwm(pwm); 203 __add_pwm(pwm);
205 platform_set_drvdata(pdev, pwm); 204 platform_set_drvdata(pdev, pwm);
206 return pwm; 205 return 0;
207 206
208err_release_mem: 207err_release_mem:
209 release_mem_region(r->start, resource_size(r)); 208 release_mem_region(r->start, resource_size(r));
@@ -211,17 +210,7 @@ err_free_clk:
211 clk_put(pwm->clk); 210 clk_put(pwm->clk);
212err_free: 211err_free:
213 kfree(pwm); 212 kfree(pwm);
214 return ERR_PTR(ret); 213 return ret;
215}
216
217static int __devinit puv3_pwm_probe(struct platform_device *pdev)
218{
219 struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL);
220
221 if (IS_ERR(pwm))
222 return PTR_ERR(pwm);
223
224 return 0;
225} 214}
226 215
227static int __devexit pwm_remove(struct platform_device *pdev) 216static int __devexit pwm_remove(struct platform_device *pdev)
@@ -251,7 +240,7 @@ static struct platform_driver puv3_pwm_driver = {
251 .driver = { 240 .driver = {
252 .name = "PKUnity-v3-PWM", 241 .name = "PKUnity-v3-PWM",
253 }, 242 },
254 .probe = puv3_pwm_probe, 243 .probe = pwm_probe,
255 .remove = __devexit_p(pwm_remove), 244 .remove = __devexit_p(pwm_remove),
256}; 245};
257module_platform_driver(puv3_pwm_driver); 246module_platform_driver(puv3_pwm_driver);