提交 fe0e2cf9 编写于 作者: O oliver@schinagl.nl 提交者: Thierry Reding

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: NOlliver Schinagl <oliver@schinagl.nl>
Reviewed-by: NAriel D'Alessandro <ariel@vanguardiasur.com.ar>
Signed-off-by: NThierry Reding <thierry.reding@gmail.com>
上级 42ddcf4f
...@@ -413,14 +413,18 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) ...@@ -413,14 +413,18 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)
} }
for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) { for (i = 0; i < lpc18xx_pwm->chip.npwm; i++) {
struct lpc18xx_pwm_data *data;
pwm = &lpc18xx_pwm->chip.pwms[i]; pwm = &lpc18xx_pwm->chip.pwms[i];
pwm->chip_data = devm_kzalloc(lpc18xx_pwm->dev,
sizeof(struct lpc18xx_pwm_data), data = devm_kzalloc(lpc18xx_pwm->dev, sizeof(*data),
GFP_KERNEL); GFP_KERNEL);
if (!pwm->chip_data) { if (!data) {
ret = -ENOMEM; ret = -ENOMEM;
goto remove_pwmchip; goto remove_pwmchip;
} }
pwm_set_chip_data(pwm, data);
} }
platform_set_drvdata(pdev, lpc18xx_pwm); platform_set_drvdata(pdev, lpc18xx_pwm);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册