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.c37
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index b23825ecfa37..6155eeb2e89a 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)