@@ -1280,19 +1280,6 @@ static int wmi_add_device(struct platform_device *pdev, struct wmi_device *wdev)
1280
1280
return device_add (& wdev -> dev );
1281
1281
}
1282
1282
1283
- static void wmi_free_devices (struct acpi_device * device )
1284
- {
1285
- struct wmi_block * wblock , * next ;
1286
-
1287
- /* Delete devices for all the GUIDs */
1288
- list_for_each_entry_safe (wblock , next , & wmi_block_list , list ) {
1289
- if (wblock -> acpi_device == device ) {
1290
- list_del (& wblock -> list );
1291
- device_unregister (& wblock -> dev .dev );
1292
- }
1293
- }
1294
- }
1295
-
1296
1283
static bool guid_already_parsed_for_legacy (struct acpi_device * device , const guid_t * guid )
1297
1284
{
1298
1285
struct wmi_block * wblock ;
@@ -1487,16 +1474,28 @@ static void acpi_wmi_notify_handler(acpi_handle handle, u32 event,
1487
1474
event , 0 );
1488
1475
}
1489
1476
1477
+ static int wmi_remove_device (struct device * dev , void * data )
1478
+ {
1479
+ struct wmi_block * wblock = dev_to_wblock (dev );
1480
+
1481
+ list_del (& wblock -> list );
1482
+ device_unregister (dev );
1483
+
1484
+ return 0 ;
1485
+ }
1486
+
1490
1487
static void acpi_wmi_remove (struct platform_device * device )
1491
1488
{
1492
1489
struct acpi_device * acpi_device = ACPI_COMPANION (& device -> dev );
1490
+ struct device * wmi_bus_device = dev_get_drvdata (& device -> dev );
1493
1491
1494
1492
acpi_remove_notify_handler (acpi_device -> handle , ACPI_ALL_NOTIFY ,
1495
1493
acpi_wmi_notify_handler );
1496
1494
acpi_remove_address_space_handler (acpi_device -> handle ,
1497
1495
ACPI_ADR_SPACE_EC , & acpi_wmi_ec_space_handler );
1498
- wmi_free_devices (acpi_device );
1499
- device_unregister (dev_get_drvdata (& device -> dev ));
1496
+
1497
+ device_for_each_child_reverse (wmi_bus_device , NULL , wmi_remove_device );
1498
+ device_unregister (wmi_bus_device );
1500
1499
}
1501
1500
1502
1501
static int acpi_wmi_probe (struct platform_device * device )
0 commit comments