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

pwm: imx1: Simplify using devm_pwmchip_add()

With devm_pwmchip_add() we can drop pwmchip_remove() from the device
remove callback. The latter can then go away, too and as this is the
only user of platform_get_drvdata(), the respective call to
platform_set_drvdata() can go, too.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>

authored by

Uwe Kleine-König and committed by
Thierry Reding
f7edeb40 1bc6ea31

+1 -11
+1 -11
drivers/pwm/pwm-imx1.c
··· 141 141 if (!imx) 142 142 return -ENOMEM; 143 143 144 - platform_set_drvdata(pdev, imx); 145 - 146 144 imx->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); 147 145 if (IS_ERR(imx->clk_ipg)) 148 146 return dev_err_probe(&pdev->dev, PTR_ERR(imx->clk_ipg), ··· 159 161 if (IS_ERR(imx->mmio_base)) 160 162 return PTR_ERR(imx->mmio_base); 161 163 162 - return pwmchip_add(&imx->chip); 163 - } 164 - 165 - static int pwm_imx1_remove(struct platform_device *pdev) 166 - { 167 - struct pwm_imx1_chip *imx = platform_get_drvdata(pdev); 168 - 169 - return pwmchip_remove(&imx->chip); 164 + return devm_pwmchip_add(&pdev->dev, &imx->chip); 170 165 } 171 166 172 167 static struct platform_driver pwm_imx1_driver = { ··· 168 177 .of_match_table = pwm_imx1_dt_ids, 169 178 }, 170 179 .probe = pwm_imx1_probe, 171 - .remove = pwm_imx1_remove, 172 180 }; 173 181 module_platform_driver(pwm_imx1_driver); 174 182