Skip to content

Commit 490c210

Browse files
joshuacov1pelwell
authored andcommitted
hwmon: rp1-adc: allow the driver to bind again after removal
The driver is registered with module_platform_driver_probe(), so its probe function is discarded after boot and later devices fail to probe. When the RP1 device is unbound and bound again, the ADC device is recreated but never gets a driver, and the RP1 sensors stay missing until the next reboot. Register the driver with module_platform_driver() and drop __init from the probe function. Signed-off-by: Joshua Covington <joshuacov@gmail.com>
1 parent c8c4867 commit 490c210

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

‎drivers/hwmon/rp1-adc.c‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static const struct attribute_group rp1_adc_group = {
222222
};
223223
__ATTRIBUTE_GROUPS(rp1_adc);
224224

225-
static int __init rp1_adc_probe(struct platform_device *pdev)
225+
static int rp1_adc_probe(struct platform_device *pdev)
226226
{
227227
struct rp1_adc_data *data;
228228
struct regulator *reg;
@@ -287,13 +287,14 @@ static const struct of_device_id rp1_adc_dt_ids[] = {
287287
MODULE_DEVICE_TABLE(of, rp1_adc_dt_ids);
288288

289289
static struct platform_driver rp1_adc_driver = {
290+
.probe = rp1_adc_probe,
290291
.driver = {
291292
.name = MODULE_NAME,
292293
.of_match_table = rp1_adc_dt_ids,
293294
},
294295
};
295296

296-
module_platform_driver_probe(rp1_adc_driver, rp1_adc_probe);
297+
module_platform_driver(rp1_adc_driver);
297298

298299
MODULE_DESCRIPTION("RP1 ADC driver");
299300
MODULE_AUTHOR("Phil Elwell <phil@raspberrypi.com>");

0 commit comments

Comments
 (0)