aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroliver@schinagl.nl <oliver@schinagl.nl>2016-08-25 12:47:09 -0400
committerThierry Reding <thierry.reding@gmail.com>2016-09-08 04:55:05 -0400
commitfe0e2cf931fc3c156850ae5184e7ecf9576431f8 (patch)
treeca56774cf1c5cf091b23915a3b807d4914dca4be
parent42ddcf4f9ebbfeac75fac3851f2807833b222399 (diff)
pwm: lpc-18xx: use pwm_set_chip_data
The lpc-18xx driver currently manipulates the pwm_device struct directly rather than using the pwm_set_chip_data() function. While the current method may save a clock cycle or two, using the explicit function call makes it more obvious that data is set to the local chip data pointer. Signed-off-by: Olliver Schinagl <oliver@schinagl.nl> Reviewed-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r--drivers/pwm/pwm-lpc18xx-sct.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/pwm/pwm-lpc18xx-sct.c b/drivers/pwm/pwm-lpc18xx-sct.c
index 19dc64cab2f0..d7f5f7de030d 100644
--- a/drivers/pwm/pwm-lpc18xx-sct.c
+++ b/drivers/pwm/pwm-lpc18xx-sct.c
@@ -413,14 +413,18 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
413 } 413 }
414 414
415 for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { 415 for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) {
416 struct lpc18xx_pwm_data *data;
417
416 pwm = &lpc18xx_pwm->chip.pwms[i]; 418 pwm = &lpc18xx_pwm->chip.pwms[i];
417 pwm->chip_data = devm_kzalloc(lpc18xx_pwm->dev, 419
418 sizeof(struct lpc18xx_pwm_data), 420 data = devm_kzalloc(lpc18xx_pwm->dev, sizeof(*data),
419 GFP_KERNEL); 421 GFP_KERNEL);
420 if (!pwm->chip_data) { 422 if (!data) {
421 ret = -ENOMEM; 423 ret = -ENOMEM;
422 goto remove_pwmchip; 424 goto remove_pwmchip;
423 } 425 }
426
427 pwm_set_chip_data(pwm, data);
424 } 428 }
425 429
426 platform_set_drvdata(pdev, lpc18xx_pwm); 430 platform_set_drvdata(pdev, lpc18xx_pwm);