aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pwm
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-06-29 09:32:15 -0400
committerThierry Reding <thierry.reding@avionic-design.de>2012-07-23 07:24:03 -0400
commit6192fa87447ed3c6c4005be640a088fa8e5733f8 (patch)
tree47727919c2f156f3baa18566c420c224bbba919b /drivers/pwm
parent0c8f527d8c80a027b46798127a6dd815b4bb99c2 (diff)
pwm: Convert pwm-samsung to use devm_* APIs
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Thierry Reding <thierry.reding@avionic-design.de>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/pwm-samsung.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/pwm/pwm-samsung.c b/drivers/pwm/pwm-samsung.c
index c40c37e968e6..35fa0e8b0f87 100644
--- a/drivers/pwm/pwm-samsung.c
+++ b/drivers/pwm/pwm-samsung.c
@@ -1,4 +1,4 @@
1/* arch/arm/plat-s3c/pwm.c 1/* drivers/pwm/pwm-samsung.c
2 * 2 *
3 * Copyright (c) 2007 Ben Dooks 3 * Copyright (c) 2007 Ben Dooks
4 * Copyright (c) 2008 Simtec Electronics 4 * Copyright (c) 2008 Simtec Electronics
@@ -215,7 +215,7 @@ static int s3c_pwm_probe(struct platform_device *pdev)
215 return -ENXIO; 215 return -ENXIO;
216 } 216 }
217 217
218 s3c = kzalloc(sizeof(*s3c), GFP_KERNEL); 218 s3c = devm_kzalloc(&pdev->dev, sizeof(*s3c), GFP_KERNEL);
219 if (s3c == NULL) { 219 if (s3c == NULL) {
220 dev_err(dev, "failed to allocate pwm_device\n"); 220 dev_err(dev, "failed to allocate pwm_device\n");
221 return -ENOMEM; 221 return -ENOMEM;
@@ -227,18 +227,16 @@ static int s3c_pwm_probe(struct platform_device *pdev)
227 s3c->chip.base = -1; 227 s3c->chip.base = -1;
228 s3c->chip.npwm = 1; 228 s3c->chip.npwm = 1;
229 229
230 s3c->clk = clk_get(dev, "pwm-tin"); 230 s3c->clk = devm_clk_get(dev, "pwm-tin");
231 if (IS_ERR(s3c->clk)) { 231 if (IS_ERR(s3c->clk)) {
232 dev_err(dev, "failed to get pwm tin clk\n"); 232 dev_err(dev, "failed to get pwm tin clk\n");
233 ret = PTR_ERR(s3c->clk); 233 return PTR_ERR(s3c->clk);
234 goto err_alloc;
235 } 234 }
236 235
237 s3c->clk_div = clk_get(dev, "pwm-tdiv"); 236 s3c->clk_div = devm_clk_get(dev, "pwm-tdiv");
238 if (IS_ERR(s3c->clk_div)) { 237 if (IS_ERR(s3c->clk_div)) {
239 dev_err(dev, "failed to get pwm tdiv clk\n"); 238 dev_err(dev, "failed to get pwm tdiv clk\n");
240 ret = PTR_ERR(s3c->clk_div); 239 return PTR_ERR(s3c->clk_div);
241 goto err_clk_tin;
242 } 240 }
243 241
244 clk_enable(s3c->clk); 242 clk_enable(s3c->clk);
@@ -272,13 +270,6 @@ static int s3c_pwm_probe(struct platform_device *pdev)
272 err_clk_tdiv: 270 err_clk_tdiv:
273 clk_disable(s3c->clk_div); 271 clk_disable(s3c->clk_div);
274 clk_disable(s3c->clk); 272 clk_disable(s3c->clk);
275 clk_put(s3c->clk_div);
276
277 err_clk_tin:
278 clk_put(s3c->clk);
279
280 err_alloc:
281 kfree(s3c);
282 return ret; 273 return ret;
283} 274}
284 275
@@ -293,9 +284,6 @@ static int __devexit s3c_pwm_remove(struct platform_device *pdev)
293 284
294 clk_disable(s3c->clk_div); 285 clk_disable(s3c->clk_div);
295 clk_disable(s3c->clk); 286 clk_disable(s3c->clk);
296 clk_put(s3c->clk_div);
297 clk_put(s3c->clk);
298 kfree(s3c);
299 287
300 return 0; 288 return 0;
301} 289}