Skip to content

Commit dae377d

Browse files
committed
ACPI: make remove callback of ACPI driver void
JIRA: https://issues.redhat.com/browse/RHEL-25415 Conflicts: Some drivers need some minor int->void changes that are needed due to drift between RHEL9 and upstream. commit 6c0eb5b Author: Dawei Li <set_pte_at@outlook.com> Date: Mon Nov 14 00:26:09 2022 +0800 ACPI: make remove callback of ACPI driver void For bus-based driver, device removal is implemented as: 1 device_remove()-> 2 bus->remove()-> 3 driver->remove() Driver core needs no inform from callee(bus driver) about the result of remove callback. In that case, commit fc7a620 ("bus: Make remove callback return void") forces bus_type::remove be void-returned. Now we have the situation that both 1 & 2 of calling chain are void-returned, so it does not make much sense for 3(driver->remove) to return non-void to its caller. So the basic idea behind this change is making remove() callback of any bus-based driver to be void-returned. This change, for itself, is for device drivers based on acpi-bus. Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Lee Jones <lee@kernel.org> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Dawei Li <set_pte_at@outlook.com> Reviewed-by: Maximilian Luz <luzmaximilian@gmail.com> # for drivers/platform/surface/* Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Prarit Bhargava <prarit@redhat.com>
1 parent 23bf13e commit dae377d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+90
-155
lines changed

arch/ia64/hp/common/aml_nfw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,9 +187,9 @@ static int aml_nfw_add(struct acpi_device *device)
187187
return aml_nfw_add_global_handler();
188188
}
189189

190-
static int aml_nfw_remove(struct acpi_device *device)
190+
static void aml_nfw_remove(struct acpi_device *device)
191191
{
192-
return aml_nfw_remove_global_handler();
192+
aml_nfw_remove_global_handler();
193193
}
194194

195195
static const struct acpi_device_id aml_nfw_ids[] = {

arch/x86/platform/olpc/olpc-xo15-sci.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,12 @@ static int xo15_sci_add(struct acpi_device *device)
183183
return r;
184184
}
185185

186-
static int xo15_sci_remove(struct acpi_device *device)
186+
static void xo15_sci_remove(struct acpi_device *device)
187187
{
188188
acpi_disable_gpe(NULL, xo15_sci_gpe);
189189
acpi_remove_gpe_handler(NULL, xo15_sci_gpe, xo15_sci_gpe_handler);
190190
cancel_work_sync(&sci_work);
191191
sysfs_remove_file(&device->dev.kobj, &lid_wake_on_close_attr.attr);
192-
return 0;
193192
}
194193

195194
#ifdef CONFIG_PM_SLEEP

drivers/acpi/ac.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ MODULE_DESCRIPTION("ACPI AC Adapter Driver");
3333
MODULE_LICENSE("GPL");
3434

3535
static int acpi_ac_add(struct acpi_device *device);
36-
static int acpi_ac_remove(struct acpi_device *device);
36+
static void acpi_ac_remove(struct acpi_device *device);
3737
static void acpi_ac_notify(struct acpi_device *device, u32 event);
3838

3939
static const struct acpi_device_id ac_device_ids[] = {
@@ -288,21 +288,19 @@ static int acpi_ac_resume(struct device *dev)
288288
#define acpi_ac_resume NULL
289289
#endif
290290

291-
static int acpi_ac_remove(struct acpi_device *device)
291+
static void acpi_ac_remove(struct acpi_device *device)
292292
{
293293
struct acpi_ac *ac = NULL;
294294

295295
if (!device || !acpi_driver_data(device))
296-
return -EINVAL;
296+
return;
297297

298298
ac = acpi_driver_data(device);
299299

300300
power_supply_unregister(ac->charger);
301301
unregister_acpi_notifier(&ac->battery_nb);
302302

303303
kfree(ac);
304-
305-
return 0;
306304
}
307305

308306
static int __init acpi_ac_init(void)

drivers/acpi/acpi_pad.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,7 @@ static int acpi_pad_add(struct acpi_device *device)
449449
return 0;
450450
}
451451

452-
static int acpi_pad_remove(struct acpi_device *device)
452+
static void acpi_pad_remove(struct acpi_device *device)
453453
{
454454
mutex_lock(&isolated_cpus_lock);
455455
acpi_pad_idle_cpus(0);
@@ -458,7 +458,6 @@ static int acpi_pad_remove(struct acpi_device *device)
458458
acpi_remove_notify_handler(device->handle,
459459
ACPI_DEVICE_NOTIFY, acpi_pad_notify);
460460
acpi_pad_remove_sysfs(device);
461-
return 0;
462461
}
463462

464463
static const struct acpi_device_id pad_device_ids[] = {

drivers/acpi/acpi_video.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ static DEFINE_MUTEX(register_count_mutex);
7979
static DEFINE_MUTEX(video_list_lock);
8080
static LIST_HEAD(video_bus_head);
8181
static int acpi_video_bus_add(struct acpi_device *device);
82-
static int acpi_video_bus_remove(struct acpi_device *device);
82+
static void acpi_video_bus_remove(struct acpi_device *device);
8383
static void acpi_video_bus_notify(struct acpi_device *device, u32 event);
8484

8585
/*
@@ -2113,13 +2113,13 @@ static int acpi_video_bus_add(struct acpi_device *device)
21132113
return error;
21142114
}
21152115

2116-
static int acpi_video_bus_remove(struct acpi_device *device)
2116+
static void acpi_video_bus_remove(struct acpi_device *device)
21172117
{
21182118
struct acpi_video_bus *video = NULL;
21192119

21202120

21212121
if (!device || !acpi_driver_data(device))
2122-
return -EINVAL;
2122+
return;
21232123

21242124
video = acpi_driver_data(device);
21252125

@@ -2133,8 +2133,6 @@ static int acpi_video_bus_remove(struct acpi_device *device)
21332133

21342134
kfree(video->attached_array);
21352135
kfree(video);
2136-
2137-
return 0;
21382136
}
21392137

21402138
static int __init is_i740(struct pci_dev *dev)

drivers/acpi/battery.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1222,20 +1222,19 @@ static int acpi_battery_add(struct acpi_device *device)
12221222
return result;
12231223
}
12241224

1225-
static int acpi_battery_remove(struct acpi_device *device)
1225+
static void acpi_battery_remove(struct acpi_device *device)
12261226
{
12271227
struct acpi_battery *battery = NULL;
12281228

12291229
if (!device || !acpi_driver_data(device))
1230-
return -EINVAL;
1230+
return;
12311231
device_init_wakeup(&device->dev, 0);
12321232
battery = acpi_driver_data(device);
12331233
unregister_pm_notifier(&battery->pm_nb);
12341234
sysfs_remove_battery(battery);
12351235
mutex_destroy(&battery->lock);
12361236
mutex_destroy(&battery->sysfs_lock);
12371237
kfree(battery);
1238-
return 0;
12391238
}
12401239

12411240
#ifdef CONFIG_PM_SLEEP

drivers/acpi/button.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ static const struct dmi_system_id dmi_lid_quirks[] = {
125125
};
126126

127127
static int acpi_button_add(struct acpi_device *device);
128-
static int acpi_button_remove(struct acpi_device *device);
128+
static void acpi_button_remove(struct acpi_device *device);
129129
static void acpi_button_notify(struct acpi_device *device, u32 event);
130130

131131
#ifdef CONFIG_PM_SLEEP
@@ -580,14 +580,13 @@ static int acpi_button_add(struct acpi_device *device)
580580
return error;
581581
}
582582

583-
static int acpi_button_remove(struct acpi_device *device)
583+
static void acpi_button_remove(struct acpi_device *device)
584584
{
585585
struct acpi_button *button = acpi_driver_data(device);
586586

587587
acpi_button_remove_fs(device);
588588
input_unregister_device(button->input);
589589
kfree(button);
590-
return 0;
591590
}
592591

593592
static int param_set_lid_init_state(const char *val,

drivers/acpi/ec.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,12 +1673,12 @@ static int acpi_ec_add(struct acpi_device *device)
16731673
return ret;
16741674
}
16751675

1676-
static int acpi_ec_remove(struct acpi_device *device)
1676+
static void acpi_ec_remove(struct acpi_device *device)
16771677
{
16781678
struct acpi_ec *ec;
16791679

16801680
if (!device)
1681-
return -EINVAL;
1681+
return;
16821682

16831683
ec = acpi_driver_data(device);
16841684
release_region(ec->data_addr, 1);
@@ -1688,7 +1688,6 @@ static int acpi_ec_remove(struct acpi_device *device)
16881688
ec_remove_handlers(ec);
16891689
acpi_ec_free(ec);
16901690
}
1691-
return 0;
16921691
}
16931692

16941693
static acpi_status

drivers/acpi/hed.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,9 @@ static int acpi_hed_add(struct acpi_device *device)
5656
return 0;
5757
}
5858

59-
static int acpi_hed_remove(struct acpi_device *device)
59+
static void acpi_hed_remove(struct acpi_device *device)
6060
{
6161
hed_handle = NULL;
62-
return 0;
6362
}
6463

6564
static struct acpi_driver acpi_hed_driver = {

drivers/acpi/nfit/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3371,10 +3371,9 @@ static int acpi_nfit_add(struct acpi_device *adev)
33713371
return devm_add_action_or_reset(dev, acpi_nfit_shutdown, acpi_desc);
33723372
}
33733373

3374-
static int acpi_nfit_remove(struct acpi_device *adev)
3374+
static void acpi_nfit_remove(struct acpi_device *adev)
33753375
{
33763376
/* see acpi_nfit_unregister */
3377-
return 0;
33783377
}
33793378

33803379
static void acpi_nfit_update_notify(struct device *dev, acpi_handle handle)

0 commit comments

Comments
 (0)