scan.c (939de1d69c5fb0da0cfe05a1a7c981421cf876f7) | scan.c (c511cc1990bbc263c3f8a2ef4d7d613a3b40ffe2) |
---|---|
1/* 2 * scan.c - support for transforming the ACPI namespace into individual objects 3 */ 4 5#include <linux/module.h> 6#include <linux/init.h> 7#include <linux/slab.h> 8#include <linux/kernel.h> --- 38 unchanged lines hidden (view full) --- 47 { "INT33C6", 0 }, 48 { "INT33C7", 0 }, 49 50 { } 51}; 52 53static LIST_HEAD(acpi_device_list); 54static LIST_HEAD(acpi_bus_id_list); | 1/* 2 * scan.c - support for transforming the ACPI namespace into individual objects 3 */ 4 5#include <linux/module.h> 6#include <linux/init.h> 7#include <linux/slab.h> 8#include <linux/kernel.h> --- 38 unchanged lines hidden (view full) --- 47 { "INT33C6", 0 }, 48 { "INT33C7", 0 }, 49 50 { } 51}; 52 53static LIST_HEAD(acpi_device_list); 54static LIST_HEAD(acpi_bus_id_list); |
55static DEFINE_MUTEX(acpi_scan_lock); |
|
55DEFINE_MUTEX(acpi_device_lock); 56LIST_HEAD(acpi_wakeup_device_list); 57 58struct acpi_device_bus_id{ 59 char bus_id[15]; 60 unsigned int instance_no; 61 struct list_head node; 62}; --- 59 unchanged lines hidden (view full) --- 122 struct acpi_object_list arg_list; 123 union acpi_object arg; 124 acpi_status status = AE_OK; 125 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ 126 127 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 128 "Hot-removing device %s...\n", dev_name(&device->dev))); 129 | 56DEFINE_MUTEX(acpi_device_lock); 57LIST_HEAD(acpi_wakeup_device_list); 58 59struct acpi_device_bus_id{ 60 char bus_id[15]; 61 unsigned int instance_no; 62 struct list_head node; 63}; --- 59 unchanged lines hidden (view full) --- 123 struct acpi_object_list arg_list; 124 union acpi_object arg; 125 acpi_status status = AE_OK; 126 u32 ost_code = ACPI_OST_SC_NON_SPECIFIC_FAILURE; /* default */ 127 128 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 129 "Hot-removing device %s...\n", dev_name(&device->dev))); 130 |
130 if (acpi_bus_trim(device)) { 131 printk(KERN_ERR PREFIX 132 "Removing device failed\n"); 133 goto err_out; 134 } 135 136 /* device has been freed */ | 131 acpi_bus_trim(device); 132 /* Device node has been released. */ |
137 device = NULL; 138 139 /* power off device */ 140 status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); 141 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) 142 printk(KERN_WARNING PREFIX 143 "Power-off device failed\n"); 144 --- 1442 unchanged lines hidden (view full) --- 1587 * If no devices were found, -ENODEV is returned, but it does not mean that 1588 * there has been a real error. There just have been no suitable ACPI objects 1589 * in the table trunk from which the kernel could create a device and add an 1590 * appropriate driver. 1591 */ 1592int acpi_bus_scan(acpi_handle handle) 1593{ 1594 void *device = NULL; | 133 device = NULL; 134 135 /* power off device */ 136 status = acpi_evaluate_object(handle, "_PS3", NULL, NULL); 137 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) 138 printk(KERN_WARNING PREFIX 139 "Power-off device failed\n"); 140 --- 1442 unchanged lines hidden (view full) --- 1583 * If no devices were found, -ENODEV is returned, but it does not mean that 1584 * there has been a real error. There just have been no suitable ACPI objects 1585 * in the table trunk from which the kernel could create a device and add an 1586 * appropriate driver. 1587 */ 1588int acpi_bus_scan(acpi_handle handle) 1589{ 1590 void *device = NULL; |
1591 int error = 0; |
|
1595 | 1592 |
1593 mutex_lock(&acpi_scan_lock); 1594 |
|
1596 if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) 1597 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1598 acpi_bus_check_add, NULL, NULL, &device); 1599 1600 if (!device) | 1595 if (ACPI_SUCCESS(acpi_bus_check_add(handle, 0, NULL, &device))) 1596 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1597 acpi_bus_check_add, NULL, NULL, &device); 1598 1599 if (!device) |
1601 return -ENODEV; 1602 1603 if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL))) | 1600 error = -ENODEV; 1601 else if (ACPI_SUCCESS(acpi_bus_device_attach(handle, 0, NULL, NULL))) |
1604 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1605 acpi_bus_device_attach, NULL, NULL, NULL); 1606 | 1602 acpi_walk_namespace(ACPI_TYPE_ANY, handle, ACPI_UINT32_MAX, 1603 acpi_bus_device_attach, NULL, NULL, NULL); 1604 |
1607 return 0; | 1605 mutex_unlock(&acpi_scan_lock); 1606 return error; |
1608} 1609EXPORT_SYMBOL(acpi_bus_scan); 1610 1611static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, 1612 void *not_used, void **ret_not_used) 1613{ 1614 struct acpi_device *device = NULL; 1615 --- 10 unchanged lines hidden (view full) --- 1626 struct acpi_device *device = NULL; 1627 1628 if (!acpi_bus_get_device(handle, &device)) 1629 acpi_device_unregister(device); 1630 1631 return AE_OK; 1632} 1633 | 1607} 1608EXPORT_SYMBOL(acpi_bus_scan); 1609 1610static acpi_status acpi_bus_device_detach(acpi_handle handle, u32 lvl_not_used, 1611 void *not_used, void **ret_not_used) 1612{ 1613 struct acpi_device *device = NULL; 1614 --- 10 unchanged lines hidden (view full) --- 1625 struct acpi_device *device = NULL; 1626 1627 if (!acpi_bus_get_device(handle, &device)) 1628 acpi_device_unregister(device); 1629 1630 return AE_OK; 1631} 1632 |
1634int acpi_bus_trim(struct acpi_device *start) | 1633void acpi_bus_trim(struct acpi_device *start) |
1635{ | 1634{ |
1635 mutex_lock(&acpi_scan_lock); 1636 |
|
1636 /* 1637 * Execute acpi_bus_device_detach() as a post-order callback to detach 1638 * all ACPI drivers from the device nodes being removed. 1639 */ 1640 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, 1641 acpi_bus_device_detach, NULL, NULL); 1642 acpi_bus_device_detach(start->handle, 0, NULL, NULL); 1643 /* 1644 * Execute acpi_bus_remove() as a post-order callback to remove device 1645 * nodes in the given namespace scope. 1646 */ 1647 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, 1648 acpi_bus_remove, NULL, NULL); 1649 acpi_bus_remove(start->handle, 0, NULL, NULL); | 1637 /* 1638 * Execute acpi_bus_device_detach() as a post-order callback to detach 1639 * all ACPI drivers from the device nodes being removed. 1640 */ 1641 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, 1642 acpi_bus_device_detach, NULL, NULL); 1643 acpi_bus_device_detach(start->handle, 0, NULL, NULL); 1644 /* 1645 * Execute acpi_bus_remove() as a post-order callback to remove device 1646 * nodes in the given namespace scope. 1647 */ 1648 acpi_walk_namespace(ACPI_TYPE_ANY, start->handle, ACPI_UINT32_MAX, NULL, 1649 acpi_bus_remove, NULL, NULL); 1650 acpi_bus_remove(start->handle, 0, NULL, NULL); |
1650 return 0; | 1651 1652 mutex_unlock(&acpi_scan_lock); |
1651} 1652EXPORT_SYMBOL_GPL(acpi_bus_trim); 1653 1654static int acpi_bus_scan_fixed(void) 1655{ 1656 int result = 0; 1657 struct acpi_device *device = NULL; 1658 --- 42 unchanged lines hidden (view full) --- 1701 1702 result = acpi_bus_scan_fixed(); 1703 if (result) { 1704 acpi_device_unregister(acpi_root); 1705 return result; 1706 } 1707 1708 acpi_update_all_gpes(); | 1653} 1654EXPORT_SYMBOL_GPL(acpi_bus_trim); 1655 1656static int acpi_bus_scan_fixed(void) 1657{ 1658 int result = 0; 1659 struct acpi_device *device = NULL; 1660 --- 42 unchanged lines hidden (view full) --- 1703 1704 result = acpi_bus_scan_fixed(); 1705 if (result) { 1706 acpi_device_unregister(acpi_root); 1707 return result; 1708 } 1709 1710 acpi_update_all_gpes(); |
1709 1710 acpi_pci_root_hp_init(); 1711 | |
1712 return 0; 1713} | 1711 return 0; 1712} |