@@ -837,7 +837,7 @@ static int intel_sso_led_probe(struct platform_device *pdev)
return 0;
}
-static int intel_sso_led_remove(struct platform_device *pdev)
+static void intel_sso_led_remove(struct platform_device *pdev)
{
struct sso_led_priv *priv;
struct sso_led *led, *n;
@@ -850,8 +850,6 @@ static int intel_sso_led_remove(struct platform_device *pdev)
}
regmap_exit(priv->mmap);
-
- return 0;
}
static const struct of_device_id of_sso_led_match[] = {
@@ -863,7 +861,7 @@ MODULE_DEVICE_TABLE(of, of_sso_led_match);
static struct platform_driver intel_sso_led_driver = {
.probe = intel_sso_led_probe,
- .remove = intel_sso_led_remove,
+ .remove_new = intel_sso_led_remove,
.driver = {
.name = "lgm-ssoled",
.of_match_table = of_sso_led_match,
@@ -522,7 +522,7 @@ static int aat1290_led_probe(struct platform_device *pdev)
return ret;
}
-static int aat1290_led_remove(struct platform_device *pdev)
+static void aat1290_led_remove(struct platform_device *pdev)
{
struct aat1290_led *led = platform_get_drvdata(pdev);
@@ -530,8 +530,6 @@ static int aat1290_led_remove(struct platform_device *pdev)
led_classdev_flash_unregister(&led->fled_cdev);
mutex_destroy(&led->lock);
-
- return 0;
}
static const struct of_device_id aat1290_led_dt_match[] = {
@@ -542,7 +540,7 @@ MODULE_DEVICE_TABLE(of, aat1290_led_dt_match);
static struct platform_driver aat1290_led_driver = {
.probe = aat1290_led_probe,
- .remove = aat1290_led_remove,
+ .remove_new = aat1290_led_remove,
.driver = {
.name = "aat1290",
.of_match_table = aat1290_led_dt_match,
@@ -386,15 +386,13 @@ static int ktd2692_probe(struct platform_device *pdev)
return 0;
}
-static int ktd2692_remove(struct platform_device *pdev)
+static void ktd2692_remove(struct platform_device *pdev)
{
struct ktd2692_context *led = platform_get_drvdata(pdev);
led_classdev_flash_unregister(&led->fled_cdev);
mutex_destroy(&led->lock);
-
- return 0;
}
static const struct of_device_id ktd2692_match[] = {
@@ -409,7 +407,7 @@ static struct platform_driver ktd2692_driver = {
.of_match_table = ktd2692_match,
},
.probe = ktd2692_probe,
- .remove = ktd2692_remove,
+ .remove_new = ktd2692_remove,
};
module_platform_driver(ktd2692_driver);
@@ -1016,7 +1016,7 @@ static int max77693_led_probe(struct platform_device *pdev)
return ret;
}
-static int max77693_led_remove(struct platform_device *pdev)
+static void max77693_led_remove(struct platform_device *pdev)
{
struct max77693_led_device *led = platform_get_drvdata(pdev);
struct max77693_sub_led *sub_leds = led->sub_leds;
@@ -1032,8 +1032,6 @@ static int max77693_led_remove(struct platform_device *pdev)
}
mutex_destroy(&led->lock);
-
- return 0;
}
static const struct of_device_id max77693_led_dt_match[] = {
@@ -1044,7 +1042,7 @@ MODULE_DEVICE_TABLE(of, max77693_led_dt_match);
static struct platform_driver max77693_led_driver = {
.probe = max77693_led_probe,
- .remove = max77693_led_remove,
+ .remove_new = max77693_led_remove,
.driver = {
.name = "max77693-led",
.of_match_table = max77693_led_dt_match,
@@ -855,12 +855,11 @@ static int mt6360_led_probe(struct platform_device *pdev)
return ret;
}
-static int mt6360_led_remove(struct platform_device *pdev)
+static void mt6360_led_remove(struct platform_device *pdev)
{
struct mt6360_priv *priv = platform_get_drvdata(pdev);
mt6360_v4l2_flash_release(priv);
- return 0;
}
static const struct of_device_id __maybe_unused mt6360_led_of_id[] = {
@@ -875,7 +874,7 @@ static struct platform_driver mt6360_led_driver = {
.of_match_table = mt6360_led_of_id,
},
.probe = mt6360_led_probe,
- .remove = mt6360_led_remove,
+ .remove_new = mt6360_led_remove,
};
module_platform_driver(mt6360_led_driver);
@@ -755,7 +755,7 @@ static int qcom_flash_led_probe(struct platform_device *pdev)
return rc;
}
-static int qcom_flash_led_remove(struct platform_device *pdev)
+static void qcom_flash_led_remove(struct platform_device *pdev)
{
struct qcom_flash_data *flash_data = platform_get_drvdata(pdev);
@@ -763,7 +763,6 @@ static int qcom_flash_led_remove(struct platform_device *pdev)
v4l2_flash_release(flash_data->v4l2_flash[flash_data->leds_count--]);
mutex_destroy(&flash_data->lock);
- return 0;
}
static const struct of_device_id qcom_flash_led_match_table[] = {
@@ -778,7 +777,7 @@ static struct platform_driver qcom_flash_led_driver = {
.of_match_table = qcom_flash_led_match_table,
},
.probe = qcom_flash_led_probe,
- .remove = qcom_flash_led_remove,
+ .remove_new = qcom_flash_led_remove,
};
module_platform_driver(qcom_flash_led_driver);
@@ -367,15 +367,13 @@ static int rt8515_probe(struct platform_device *pdev)
return 0;
}
-static int rt8515_remove(struct platform_device *pdev)
+static void rt8515_remove(struct platform_device *pdev)
{
struct rt8515 *rt = platform_get_drvdata(pdev);
rt8515_v4l2_flash_release(rt);
del_timer_sync(&rt->powerdown_timer);
mutex_destroy(&rt->lock);
-
- return 0;
}
static const struct of_device_id rt8515_match[] = {
@@ -390,7 +388,7 @@ static struct platform_driver rt8515_driver = {
.of_match_table = rt8515_match,
},
.probe = rt8515_probe,
- .remove = rt8515_remove,
+ .remove_new = rt8515_remove,
};
module_platform_driver(rt8515_driver);
@@ -278,15 +278,13 @@ static int sgm3140_probe(struct platform_device *pdev)
return ret;
}
-static int sgm3140_remove(struct platform_device *pdev)
+static void sgm3140_remove(struct platform_device *pdev)
{
struct sgm3140 *priv = platform_get_drvdata(pdev);
del_timer_sync(&priv->powerdown_timer);
v4l2_flash_release(priv->v4l2_flash);
-
- return 0;
}
static const struct of_device_id sgm3140_dt_match[] = {
@@ -299,7 +297,7 @@ MODULE_DEVICE_TABLE(of, sgm3140_dt_match);
static struct platform_driver sgm3140_driver = {
.probe = sgm3140_probe,
- .remove = sgm3140_remove,
+ .remove_new = sgm3140_remove,
.driver = {
.name = "sgm3140",
.of_match_table = sgm3140_dt_match,
@@ -215,13 +215,11 @@ static int pm860x_led_probe(struct platform_device *pdev)
return 0;
}
-static int pm860x_led_remove(struct platform_device *pdev)
+static void pm860x_led_remove(struct platform_device *pdev)
{
struct pm860x_led *data = platform_get_drvdata(pdev);
led_classdev_unregister(&data->cdev);
-
- return 0;
}
static struct platform_driver pm860x_led_driver = {
@@ -229,7 +227,7 @@ static struct platform_driver pm860x_led_driver = {
.name = "88pm860x-led",
},
.probe = pm860x_led_probe,
- .remove = pm860x_led_remove,
+ .remove_new = pm860x_led_remove,
};
module_platform_driver(pm860x_led_driver);
@@ -163,7 +163,7 @@ static int adp5520_led_probe(struct platform_device *pdev)
return ret;
}
-static int adp5520_led_remove(struct platform_device *pdev)
+static void adp5520_led_remove(struct platform_device *pdev)
{
struct adp5520_leds_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct adp5520_led *led;
@@ -177,8 +177,6 @@ static int adp5520_led_remove(struct platform_device *pdev)
for (i = 0; i < pdata->num_leds; i++) {
led_classdev_unregister(&led[i].cdev);
}
-
- return 0;
}
static struct platform_driver adp5520_led_driver = {
@@ -186,7 +184,7 @@ static struct platform_driver adp5520_led_driver = {
.name = "adp5520-led",
},
.probe = adp5520_led_probe,
- .remove = adp5520_led_remove,
+ .remove_new = adp5520_led_remove,
};
module_platform_driver(adp5520_led_driver);
@@ -159,14 +159,13 @@ static int __init clevo_mail_led_probe(struct platform_device *pdev)
return led_classdev_register(&pdev->dev, &clevo_mail_led);
}
-static int clevo_mail_led_remove(struct platform_device *pdev)
+static void clevo_mail_led_remove(struct platform_device *pdev)
{
led_classdev_unregister(&clevo_mail_led);
- return 0;
}
static struct platform_driver clevo_mail_led_driver = {
- .remove = clevo_mail_led_remove,
+ .remove_new = clevo_mail_led_remove,
.driver = {
.name = KBUILD_MODNAME,
},
@@ -121,13 +121,11 @@ static int da903x_led_probe(struct platform_device *pdev)
return 0;
}
-static int da903x_led_remove(struct platform_device *pdev)
+static void da903x_led_remove(struct platform_device *pdev)
{
struct da903x_led *led = platform_get_drvdata(pdev);
led_classdev_unregister(&led->cdev);
-
- return 0;
}
static struct platform_driver da903x_led_driver = {
@@ -135,7 +133,7 @@ static struct platform_driver da903x_led_driver = {
.name = "da903x-led",
},
.probe = da903x_led_probe,
- .remove = da903x_led_remove,
+ .remove_new = da903x_led_remove,
};
module_platform_driver(da903x_led_driver);
@@ -156,7 +156,7 @@ static int da9052_led_probe(struct platform_device *pdev)
return error;
}
-static int da9052_led_remove(struct platform_device *pdev)
+static void da9052_led_remove(struct platform_device *pdev)
{
struct da9052_led *led = platform_get_drvdata(pdev);
struct da9052_pdata *pdata;
@@ -172,8 +172,6 @@ static int da9052_led_remove(struct platform_device *pdev)
da9052_set_led_brightness(&led[i], LED_OFF);
led_classdev_unregister(&led[i].cdev);
}
-
- return 0;
}
static struct platform_driver da9052_led_driver = {
@@ -181,7 +179,7 @@ static struct platform_driver da9052_led_driver = {
.name = "da9052-leds",
},
.probe = da9052_led_probe,
- .remove = da9052_led_remove,
+ .remove_new = da9052_led_remove,
};
module_platform_driver(da9052_led_driver);
@@ -718,7 +718,7 @@ static int lm3533_led_probe(struct platform_device *pdev)
return ret;
}
-static int lm3533_led_remove(struct platform_device *pdev)
+static void lm3533_led_remove(struct platform_device *pdev)
{
struct lm3533_led *led = platform_get_drvdata(pdev);
@@ -726,8 +726,6 @@ static int lm3533_led_remove(struct platform_device *pdev)
lm3533_ctrlbank_disable(&led->cb);
led_classdev_unregister(&led->cdev);
-
- return 0;
}
static void lm3533_led_shutdown(struct platform_device *pdev)
@@ -746,7 +744,7 @@ static struct platform_driver lm3533_led_driver = {
.name = "lm3533-leds",
},
.probe = lm3533_led_probe,
- .remove = lm3533_led_remove,
+ .remove_new = lm3533_led_remove,
.shutdown = lm3533_led_shutdown,
};
module_platform_driver(lm3533_led_driver);
@@ -261,15 +261,13 @@ static int __init mc13xxx_led_probe(struct platform_device *pdev)
return ret;
}
-static int mc13xxx_led_remove(struct platform_device *pdev)
+static void mc13xxx_led_remove(struct platform_device *pdev)
{
struct mc13xxx_leds *leds = platform_get_drvdata(pdev);
int i;
for (i = 0; i < leds->num_leds; i++)
led_classdev_unregister(&leds->led[i].cdev);
-
- return 0;
}
static const struct mc13xxx_led_devtype mc13783_led_devtype = {
@@ -305,7 +303,7 @@ static struct platform_driver mc13xxx_led_driver = {
.driver = {
.name = "mc13xxx-led",
},
- .remove = mc13xxx_led_remove,
+ .remove_new = mc13xxx_led_remove,
.id_table = mc13xxx_led_id_table,
};
module_platform_driver_probe(mc13xxx_led_driver, mc13xxx_led_probe);
@@ -275,13 +275,11 @@ static int mlxreg_led_probe(struct platform_device *pdev)
return mlxreg_led_config(priv);
}
-static int mlxreg_led_remove(struct platform_device *pdev)
+static void mlxreg_led_remove(struct platform_device *pdev)
{
struct mlxreg_led_priv_data *priv = dev_get_drvdata(&pdev->dev);
mutex_destroy(&priv->access_lock);
-
- return 0;
}
static struct platform_driver mlxreg_led_driver = {
@@ -289,7 +287,7 @@ static struct platform_driver mlxreg_led_driver = {
.name = "leds-mlxreg",
},
.probe = mlxreg_led_probe,
- .remove = mlxreg_led_remove,
+ .remove_new = mlxreg_led_remove,
};
module_platform_driver(mlxreg_led_driver);
@@ -632,7 +632,7 @@ static int mt6323_led_probe(struct platform_device *pdev)
return ret;
}
-static int mt6323_led_remove(struct platform_device *pdev)
+static void mt6323_led_remove(struct platform_device *pdev)
{
struct mt6323_leds *leds = platform_get_drvdata(pdev);
const struct mt6323_regs *regs = leds->pdata->regs;
@@ -647,8 +647,6 @@ static int mt6323_led_remove(struct platform_device *pdev)
RG_DRV_32K_CK_PDN);
mutex_destroy(&leds->lock);
-
- return 0;
}
static const struct mt6323_regs mt6323_registers = {
@@ -723,7 +721,7 @@ MODULE_DEVICE_TABLE(of, mt6323_led_dt_match);
static struct platform_driver mt6323_led_driver = {
.probe = mt6323_led_probe,
- .remove = mt6323_led_remove,
+ .remove_new = mt6323_led_remove,
.driver = {
.name = "mt6323-led",
.of_match_table = mt6323_led_dt_match,
@@ -167,15 +167,13 @@ static int nic78bx_probe(struct platform_device *pdev)
return ret;
}
-static int nic78bx_remove(struct platform_device *pdev)
+static void nic78bx_remove(struct platform_device *pdev)
{
struct nic78bx_led_data *led_data = platform_get_drvdata(pdev);
/* Lock LED register */
outb(NIC78BX_LOCK_VALUE,
led_data->io_base + NIC78BX_LOCK_REG_OFFSET);
-
- return 0;
}
static const struct acpi_device_id led_device_ids[] = {
@@ -186,7 +184,7 @@ MODULE_DEVICE_TABLE(acpi, led_device_ids);
static struct platform_driver led_driver = {
.probe = nic78bx_probe,
- .remove = nic78bx_remove,
+ .remove_new = nic78bx_remove,
.driver = {
.name = KBUILD_MODNAME,
.acpi_match_table = ACPI_PTR(led_device_ids),
@@ -309,7 +309,7 @@ static int powernv_led_probe(struct platform_device *pdev)
}
/* Platform driver remove */
-static int powernv_led_remove(struct platform_device *pdev)
+static void powernv_led_remove(struct platform_device *pdev)
{
struct powernv_led_common *powernv_led_common;
@@ -321,7 +321,6 @@ static int powernv_led_remove(struct platform_device *pdev)
mutex_destroy(&powernv_led_common->lock);
dev_info(&pdev->dev, "PowerNV led module unregistered\n");
- return 0;
}
/* Platform driver property match */
@@ -335,7 +334,7 @@ MODULE_DEVICE_TABLE(of, powernv_led_match);
static struct platform_driver powernv_led_driver = {
.probe = powernv_led_probe,
- .remove = powernv_led_remove,
+ .remove_new = powernv_led_remove,
.driver = {
.name = "powernv-led-driver",
.of_match_table = powernv_led_match,
@@ -42,15 +42,14 @@ static int rb532_led_probe(struct platform_device *pdev)
return led_classdev_register(&pdev->dev, &rb532_uled);
}
-static int rb532_led_remove(struct platform_device *pdev)
+static void rb532_led_remove(struct platform_device *pdev)
{
led_classdev_unregister(&rb532_uled);
- return 0;
}
static struct platform_driver rb532_led_driver = {
.probe = rb532_led_probe,
- .remove = rb532_led_remove,
+ .remove_new = rb532_led_remove,
.driver = {
.name = "rb532-led",
},
@@ -173,13 +173,12 @@ static int regulator_led_probe(struct platform_device *pdev)
return 0;
}
-static int regulator_led_remove(struct platform_device *pdev)
+static void regulator_led_remove(struct platform_device *pdev)
{
struct regulator_led *led = platform_get_drvdata(pdev);
led_classdev_unregister(&led->cdev);
regulator_led_disable(led);
- return 0;
}
static const struct of_device_id regulator_led_of_match[] = {
@@ -194,7 +193,7 @@ static struct platform_driver regulator_led_driver = {
.of_match_table = regulator_led_of_match,
},
.probe = regulator_led_probe,
- .remove = regulator_led_remove,
+ .remove_new = regulator_led_remove,
};
module_platform_driver(regulator_led_driver);
@@ -330,12 +330,11 @@ static int sc27xx_led_probe(struct platform_device *pdev)
return err;
}
-static int sc27xx_led_remove(struct platform_device *pdev)
+static void sc27xx_led_remove(struct platform_device *pdev)
{
struct sc27xx_led_priv *priv = platform_get_drvdata(pdev);
mutex_destroy(&priv->lock);
- return 0;
}
static const struct of_device_id sc27xx_led_of_match[] = {
@@ -350,7 +349,7 @@ static struct platform_driver sc27xx_led_driver = {
.of_match_table = sc27xx_led_of_match,
},
.probe = sc27xx_led_probe,
- .remove = sc27xx_led_remove,
+ .remove_new = sc27xx_led_remove,
};
module_platform_driver(sc27xx_led_driver);
@@ -163,15 +163,13 @@ static int sunfire_led_generic_probe(struct platform_device *pdev,
return 0;
}
-static int sunfire_led_generic_remove(struct platform_device *pdev)
+static void sunfire_led_generic_remove(struct platform_device *pdev)
{
struct sunfire_drvdata *p = platform_get_drvdata(pdev);
int i;
for (i = 0; i < NUM_LEDS_PER_BOARD; i++)
led_classdev_unregister(&p->leds[i].led_cdev);
-
- return 0;
}
static struct led_type clockboard_led_types[NUM_LEDS_PER_BOARD] = {
@@ -221,7 +219,7 @@ MODULE_ALIAS("platform:sunfire-fhc-leds");
static struct platform_driver sunfire_clockboard_led_driver = {
.probe = sunfire_clockboard_led_probe,
- .remove = sunfire_led_generic_remove,
+ .remove_new = sunfire_led_generic_remove,
.driver = {
.name = "sunfire-clockboard-leds",
},
@@ -229,7 +227,7 @@ static struct platform_driver sunfire_clockboard_led_driver = {
static struct platform_driver sunfire_fhc_led_driver = {
.probe = sunfire_fhc_led_probe,
- .remove = sunfire_led_generic_remove,
+ .remove_new = sunfire_led_generic_remove,
.driver = {
.name = "sunfire-fhc-leds",
},
@@ -280,13 +280,11 @@ static int wm831x_status_probe(struct platform_device *pdev)
return 0;
}
-static int wm831x_status_remove(struct platform_device *pdev)
+static void wm831x_status_remove(struct platform_device *pdev)
{
struct wm831x_status *drvdata = platform_get_drvdata(pdev);
led_classdev_unregister(&drvdata->cdev);
-
- return 0;
}
static struct platform_driver wm831x_status_driver = {
@@ -294,7 +292,7 @@ static struct platform_driver wm831x_status_driver = {
.name = "wm831x-status",
},
.probe = wm831x_status_probe,
- .remove = wm831x_status_remove,
+ .remove_new = wm831x_status_remove,
};
module_platform_driver(wm831x_status_driver);
@@ -242,13 +242,12 @@ static int wm8350_led_probe(struct platform_device *pdev)
return led_classdev_register(&pdev->dev, &led->cdev);
}
-static int wm8350_led_remove(struct platform_device *pdev)
+static void wm8350_led_remove(struct platform_device *pdev)
{
struct wm8350_led *led = platform_get_drvdata(pdev);
led_classdev_unregister(&led->cdev);
wm8350_led_disable(led);
- return 0;
}
static struct platform_driver wm8350_led_driver = {
@@ -256,7 +255,7 @@ static struct platform_driver wm8350_led_driver = {
.name = "wm8350-led",
},
.probe = wm8350_led_probe,
- .remove = wm8350_led_remove,
+ .remove_new = wm8350_led_remove,
.shutdown = wm8350_led_shutdown,
};
@@ -1364,13 +1364,11 @@ static int lpg_probe(struct platform_device *pdev)
return lpg_add_pwm(lpg);
}
-static int lpg_remove(struct platform_device *pdev)
+static void lpg_remove(struct platform_device *pdev)
{
struct lpg *lpg = platform_get_drvdata(pdev);
pwmchip_remove(&lpg->pwm);
-
- return 0;
}
static const struct lpg_data pm8916_pwm_data = {
@@ -1532,7 +1530,7 @@ MODULE_DEVICE_TABLE(of, lpg_of_table);
static struct platform_driver lpg_driver = {
.probe = lpg_probe,
- .remove = lpg_remove,
+ .remove_new = lpg_remove,
.driver = {
.name = "qcom-spmi-lpg",
.of_match_table = lpg_of_table,
The .remove() callback for a platform driver returns an int which makes many driver authors wrongly assume it's possible to do error handling by returning an error code. However the value returned is ignored (apart from emitting a warning) and this typically results in resource leaks. To improve here there is a quest to make the remove callback return void. In the first step of this quest all drivers are converted to .remove_new() which already returns void. Eventually after all drivers are converted, .remove_new() is renamed to .remove(). All platform drivers below drivers/leds/ unconditionally return zero in their remove callback and so can be converted trivially to the variant returning void. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> --- drivers/leds/blink/leds-lgm-sso.c | 6 ++---- drivers/leds/flash/leds-aat1290.c | 6 ++---- drivers/leds/flash/leds-ktd2692.c | 6 ++---- drivers/leds/flash/leds-max77693.c | 6 ++---- drivers/leds/flash/leds-mt6360.c | 5 ++--- drivers/leds/flash/leds-qcom-flash.c | 5 ++--- drivers/leds/flash/leds-rt8515.c | 6 ++---- drivers/leds/flash/leds-sgm3140.c | 6 ++---- drivers/leds/leds-88pm860x.c | 6 ++---- drivers/leds/leds-adp5520.c | 6 ++---- drivers/leds/leds-clevo-mail.c | 5 ++--- drivers/leds/leds-da903x.c | 6 ++---- drivers/leds/leds-da9052.c | 6 ++---- drivers/leds/leds-lm3533.c | 6 ++---- drivers/leds/leds-mc13783.c | 6 ++---- drivers/leds/leds-mlxreg.c | 6 ++---- drivers/leds/leds-mt6323.c | 6 ++---- drivers/leds/leds-nic78bx.c | 6 ++---- drivers/leds/leds-powernv.c | 5 ++--- drivers/leds/leds-rb532.c | 5 ++--- drivers/leds/leds-regulator.c | 5 ++--- drivers/leds/leds-sc27xx-bltc.c | 5 ++--- drivers/leds/leds-sunfire.c | 8 +++----- drivers/leds/leds-wm831x-status.c | 6 ++---- drivers/leds/leds-wm8350.c | 5 ++--- drivers/leds/rgb/leds-qcom-lpg.c | 6 ++---- 26 files changed, 53 insertions(+), 97 deletions(-) base-commit: dfa449a58323de195773cf928d99db4130702bf7