Skip to content

Commit 514bcab

Browse files
committed
ACPI: scan: Relocate acpi_bus_trim_one()
Relocate acpi_bus_trim_one() (without modifications) so as to avoid the need to add a forward declaration of it in a subsequent patch. No functional changes. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent 793551c commit 514bcab

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

drivers/acpi/scan.c

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,32 @@ static int acpi_scan_try_to_offline(struct acpi_device *device)
244244
return 0;
245245
}
246246

247+
static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used)
248+
{
249+
struct acpi_scan_handler *handler = adev->handler;
250+
251+
acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL);
252+
253+
adev->flags.match_driver = false;
254+
if (handler) {
255+
if (handler->detach)
256+
handler->detach(adev);
257+
258+
adev->handler = NULL;
259+
} else {
260+
device_release_driver(&adev->dev);
261+
}
262+
/*
263+
* Most likely, the device is going away, so put it into D3cold before
264+
* that.
265+
*/
266+
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
267+
adev->flags.initialized = false;
268+
acpi_device_clear_enumerated(adev);
269+
270+
return 0;
271+
}
272+
247273
static int acpi_scan_hot_remove(struct acpi_device *device)
248274
{
249275
acpi_handle handle = device->handle;
@@ -2547,32 +2573,6 @@ int acpi_bus_scan(acpi_handle handle)
25472573
}
25482574
EXPORT_SYMBOL(acpi_bus_scan);
25492575

2550-
static int acpi_bus_trim_one(struct acpi_device *adev, void *not_used)
2551-
{
2552-
struct acpi_scan_handler *handler = adev->handler;
2553-
2554-
acpi_dev_for_each_child_reverse(adev, acpi_bus_trim_one, NULL);
2555-
2556-
adev->flags.match_driver = false;
2557-
if (handler) {
2558-
if (handler->detach)
2559-
handler->detach(adev);
2560-
2561-
adev->handler = NULL;
2562-
} else {
2563-
device_release_driver(&adev->dev);
2564-
}
2565-
/*
2566-
* Most likely, the device is going away, so put it into D3cold before
2567-
* that.
2568-
*/
2569-
acpi_device_set_power(adev, ACPI_STATE_D3_COLD);
2570-
adev->flags.initialized = false;
2571-
acpi_device_clear_enumerated(adev);
2572-
2573-
return 0;
2574-
}
2575-
25762576
/**
25772577
* acpi_bus_trim - Detach scan handlers and drivers from ACPI device objects.
25782578
* @adev: Root of the ACPI namespace scope to walk.

0 commit comments

Comments
 (0)