Skip to content

Commit 9e1815f

Browse files
Uwe Kleine-Königlag-linaro
authored andcommitted
leds: qcom-lpg: Use devm_pwmchip_add() simplifying driver removal
With pwmchip_remove() being automatically called after switching to devm_pwmchip_add() the remove function can be dropped completely. Yay! With lpg_remove() gone there is no user of the platform device's drvdata left, so platform_set_drvdata() can be dropped from .probe(), too. Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Lee Jones <[email protected]>
1 parent 25054b2 commit 9e1815f

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

drivers/leds/rgb/leds-qcom-lpg.c

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,7 +1095,7 @@ static int lpg_add_pwm(struct lpg *lpg)
10951095
lpg->pwm.npwm = lpg->num_channels;
10961096
lpg->pwm.ops = &lpg_pwm_ops;
10971097

1098-
ret = pwmchip_add(&lpg->pwm);
1098+
ret = devm_pwmchip_add(lpg->dev, &lpg->pwm);
10991099
if (ret)
11001100
dev_err(lpg->dev, "failed to add PWM chip: ret %d\n", ret);
11011101

@@ -1324,8 +1324,6 @@ static int lpg_probe(struct platform_device *pdev)
13241324
if (!lpg->data)
13251325
return -EINVAL;
13261326

1327-
platform_set_drvdata(pdev, lpg);
1328-
13291327
lpg->dev = &pdev->dev;
13301328
mutex_init(&lpg->lock);
13311329

@@ -1363,13 +1361,6 @@ static int lpg_probe(struct platform_device *pdev)
13631361
return lpg_add_pwm(lpg);
13641362
}
13651363

1366-
static void lpg_remove(struct platform_device *pdev)
1367-
{
1368-
struct lpg *lpg = platform_get_drvdata(pdev);
1369-
1370-
pwmchip_remove(&lpg->pwm);
1371-
}
1372-
13731364
static const struct lpg_data pm8916_pwm_data = {
13741365
.num_channels = 1,
13751366
.channels = (const struct lpg_channel_data[]) {
@@ -1529,7 +1520,6 @@ MODULE_DEVICE_TABLE(of, lpg_of_table);
15291520

15301521
static struct platform_driver lpg_driver = {
15311522
.probe = lpg_probe,
1532-
.remove_new = lpg_remove,
15331523
.driver = {
15341524
.name = "qcom-spmi-lpg",
15351525
.of_match_table = lpg_of_table,

0 commit comments

Comments
 (0)