aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index b23825ecfa3..2b6c21d86b9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -26,6 +26,8 @@ extern struct acpi_device *acpi_root;
26 26
27#define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent) 27#define ACPI_IS_ROOT_DEVICE(device) (!(device)->parent)
28 28
29static const char *dummy_hid = "device";
30
29static LIST_HEAD(acpi_device_list); 31static LIST_HEAD(acpi_device_list);
30static LIST_HEAD(acpi_bus_id_list); 32static LIST_HEAD(acpi_bus_id_list);
31DEFINE_MUTEX(acpi_device_lock); 33DEFINE_MUTEX(acpi_device_lock);
@@ -49,6 +51,9 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
49 int count; 51 int count;
50 struct acpi_hardware_id *id; 52 struct acpi_hardware_id *id;
51 53
54 if (list_empty(&acpi_dev->pnp.ids))
55 return 0;
56
52 len = snprintf(modalias, size, "acpi:"); 57 len = snprintf(modalias, size, "acpi:");
53 size -= len; 58 size -= len;
54 59
@@ -202,13 +207,15 @@ static int acpi_device_setup_files(struct acpi_device *dev)
202 goto end; 207 goto end;
203 } 208 }
204 209
205 result = device_create_file(&dev->dev, &dev_attr_hid); 210 if (!list_empty(&dev->pnp.ids)) {
206 if (result) 211 result = device_create_file(&dev->dev, &dev_attr_hid);
207 goto end; 212 if (result)
213 goto end;
208 214
209 result = device_create_file(&dev->dev, &dev_attr_modalias); 215 result = device_create_file(&dev->dev, &dev_attr_modalias);
210 if (result) 216 if (result)
211 goto end; 217 goto end;
218 }
212 219
213 /* 220 /*
214 * If device has _EJ0, 'eject' file is created that is used to trigger 221 * If device has _EJ0, 'eject' file is created that is used to trigger
@@ -316,6 +323,9 @@ static int acpi_device_uevent(struct device *dev, struct kobj_uevent_env *env)
316 struct acpi_device *acpi_dev = to_acpi_device(dev); 323 struct acpi_device *acpi_dev = to_acpi_device(dev);
317 int len; 324 int len;
318 325
326 if (list_empty(&acpi_dev->pnp.ids))
327 return 0;
328
319 if (add_uevent_var(env, "MODALIAS=")) 329 if (add_uevent_var(env, "MODALIAS="))
320 return -ENOMEM; 330 return -ENOMEM;
321 len = create_modalias(acpi_dev, &env->buf[env->buflen - 1], 331 len = create_modalias(acpi_dev, &env->buf[env->buflen - 1],
@@ -1010,10 +1020,13 @@ static int acpi_dock_match(struct acpi_device *device)
1010 return acpi_get_handle(device->handle, "_DCK", &tmp); 1020 return acpi_get_handle(device->handle, "_DCK", &tmp);
1011} 1021}
1012 1022
1013char *acpi_device_hid(struct acpi_device *device) 1023const char *acpi_device_hid(struct acpi_device *device)
1014{ 1024{
1015 struct acpi_hardware_id *hid; 1025 struct acpi_hardware_id *hid;
1016 1026
1027 if (list_empty(&device->pnp.ids))
1028 return dummy_hid;
1029
1017 hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list); 1030 hid = list_first_entry(&device->pnp.ids, struct acpi_hardware_id, list);
1018 return hid->id; 1031 return hid->id;
1019} 1032}
@@ -1142,16 +1155,6 @@ static void acpi_device_set_id(struct acpi_device *device)
1142 acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF); 1155 acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF);
1143 break; 1156 break;
1144 } 1157 }
1145
1146 /*
1147 * We build acpi_devices for some objects that don't have _HID or _CID,
1148 * e.g., PCI bridges and slots. Drivers can't bind to these objects,
1149 * but we do use them indirectly by traversing the acpi_device tree.
1150 * This generic ID isn't useful for driver binding, but it provides
1151 * the useful property that "every acpi_device has an ID."
1152 */
1153 if (list_empty(&device->pnp.ids))
1154 acpi_add_id(device, "device");
1155} 1158}
1156 1159
1157static int acpi_device_set_context(struct acpi_device *device) 1160static int acpi_device_set_context(struct acpi_device *device)
@@ -1431,6 +1434,7 @@ EXPORT_SYMBOL(acpi_bus_add);
1431int acpi_bus_start(struct acpi_device *device) 1434int acpi_bus_start(struct acpi_device *device)
1432{ 1435{
1433 struct acpi_bus_ops ops; 1436 struct acpi_bus_ops ops;
1437 int result;
1434 1438
1435 if (!device) 1439 if (!device)
1436 return -EINVAL; 1440 return -EINVAL;
@@ -1438,7 +1442,11 @@ int acpi_bus_start(struct acpi_device *device)
1438 memset(&ops, 0, sizeof(ops)); 1442 memset(&ops, 0, sizeof(ops));
1439 ops.acpi_op_start = 1; 1443 ops.acpi_op_start = 1;
1440 1444
1441 return acpi_bus_scan(device->handle, &ops, NULL); 1445 result = acpi_bus_scan(device->handle, &ops, NULL);
1446
1447 acpi_update_gpes();
1448
1449 return result;
1442} 1450}
1443EXPORT_SYMBOL(acpi_bus_start); 1451EXPORT_SYMBOL(acpi_bus_start);
1444 1452
@@ -1552,6 +1560,8 @@ int __init acpi_scan_init(void)
1552 1560
1553 if (result) 1561 if (result)
1554 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); 1562 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
1563 else
1564 acpi_update_gpes();
1555 1565
1556 return result; 1566 return result;
1557} 1567}