mirror of https://gitee.com/openkylin/linux.git
pwm: twl: Simplify using devm_pwmchip_add()
This allows to drop the platform_driver's remove function. This is the only user of driver data so this can go away, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
This commit is contained in:
parent
c9bb1c9e54
commit
a75bc6b783
|
@ -298,7 +298,6 @@ static const struct pwm_ops twl6030_pwm_ops = {
|
||||||
static int twl_pwm_probe(struct platform_device *pdev)
|
static int twl_pwm_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct twl_pwm_chip *twl;
|
struct twl_pwm_chip *twl;
|
||||||
int ret;
|
|
||||||
|
|
||||||
twl = devm_kzalloc(&pdev->dev, sizeof(*twl), GFP_KERNEL);
|
twl = devm_kzalloc(&pdev->dev, sizeof(*twl), GFP_KERNEL);
|
||||||
if (!twl)
|
if (!twl)
|
||||||
|
@ -314,20 +313,7 @@ static int twl_pwm_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
mutex_init(&twl->mutex);
|
mutex_init(&twl->mutex);
|
||||||
|
|
||||||
ret = pwmchip_add(&twl->chip);
|
return devm_pwmchip_add(&pdev->dev, &twl->chip);
|
||||||
if (ret < 0)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, twl);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int twl_pwm_remove(struct platform_device *pdev)
|
|
||||||
{
|
|
||||||
struct twl_pwm_chip *twl = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
return pwmchip_remove(&twl->chip);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_OF
|
#ifdef CONFIG_OF
|
||||||
|
@ -345,7 +331,6 @@ static struct platform_driver twl_pwm_driver = {
|
||||||
.of_match_table = of_match_ptr(twl_pwm_of_match),
|
.of_match_table = of_match_ptr(twl_pwm_of_match),
|
||||||
},
|
},
|
||||||
.probe = twl_pwm_probe,
|
.probe = twl_pwm_probe,
|
||||||
.remove = twl_pwm_remove,
|
|
||||||
};
|
};
|
||||||
module_platform_driver(twl_pwm_driver);
|
module_platform_driver(twl_pwm_driver);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue