Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

oliver@schinagl.nl and committed by
Thierry Reding
fe0e2cf9 42ddcf4f

+8 -4
+8 -4
drivers/pwm/pwm-lpc18xx-sct.c
··· 413 413 } 414 414 415 415 for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { 416 + struct lpc18xx_pwm_data *data; 417 + 416 418 pwm = &lpc18xx_pwm->chip.pwms[i]; 417 - pwm->chip_data = devm_kzalloc(lpc18xx_pwm->dev, 418 - sizeof(struct lpc18xx_pwm_data), 419 - GFP_KERNEL); 420 - if (!pwm->chip_data) { 419 + 420 + data = devm_kzalloc(lpc18xx_pwm->dev, sizeof(*data), 421 + GFP_KERNEL); 422 + if (!data) { 421 423 ret = -ENOMEM; 422 424 goto remove_pwmchip; 423 425 } 426 + 427 + pwm_set_chip_data(pwm, data); 424 428 } 425 429 426 430 platform_set_drvdata(pdev, lpc18xx_pwm);