Skip to content

Commit ab892b7

Browse files
Uwe Kleine-Königdtor
authored andcommitted
Input: tps65219-pwrbutton - convert to .remove_new()
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). 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(). Before this driver might have returned an error. In this case emit a warning that tells more about the problem than the generic warning by the core, and instead of making the remove callback return zero unconditionally, convert to .remove_new() which is equivalent. Signed-off-by: Uwe Kleine-König <[email protected]> Reviewed-by: Markus Schneider-Pargmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent b003156 commit ab892b7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/input/misc/tps65219-pwrbutton.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,17 @@ static int tps65219_pb_probe(struct platform_device *pdev)
117117
return 0;
118118
}
119119

120-
static int tps65219_pb_remove(struct platform_device *pdev)
120+
static void tps65219_pb_remove(struct platform_device *pdev)
121121
{
122122
struct tps65219 *tps = dev_get_drvdata(pdev->dev.parent);
123+
int ret;
123124

124125
/* Disable interrupt for the pushbutton */
125-
return regmap_update_bits(tps->regmap, TPS65219_REG_MASK_CONFIG,
126-
TPS65219_REG_MASK_INT_FOR_PB_MASK,
127-
TPS65219_REG_MASK_INT_FOR_PB_MASK);
126+
ret = regmap_update_bits(tps->regmap, TPS65219_REG_MASK_CONFIG,
127+
TPS65219_REG_MASK_INT_FOR_PB_MASK,
128+
TPS65219_REG_MASK_INT_FOR_PB_MASK);
129+
if (ret)
130+
dev_warn(&pdev->dev, "Failed to disable irq (%pe)\n", ERR_PTR(ret));
128131
}
129132

130133
static const struct platform_device_id tps65219_pwrbtn_id_table[] = {
@@ -135,7 +138,7 @@ MODULE_DEVICE_TABLE(platform, tps65219_pwrbtn_id_table);
135138

136139
static struct platform_driver tps65219_pb_driver = {
137140
.probe = tps65219_pb_probe,
138-
.remove = tps65219_pb_remove,
141+
.remove_new = tps65219_pb_remove,
139142
.driver = {
140143
.name = "tps65219_pwrbutton",
141144
},

0 commit comments

Comments
 (0)