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.c56
1 files changed, 23 insertions, 33 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index da11b5379dc8..468921bed22f 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1016,21 +1016,19 @@ static void acpi_add_id(struct acpi_device *device, const char *dev_id)
1016 1016
1017static void acpi_device_set_id(struct acpi_device *device) 1017static void acpi_device_set_id(struct acpi_device *device)
1018{ 1018{
1019 struct acpi_device_info *info = NULL;
1020 char *hid = NULL;
1021 struct acpica_device_id_list *cid_list = NULL;
1022 char *cid_add = NULL;
1023 acpi_status status; 1019 acpi_status status;
1020 struct acpi_device_info *info;
1021 struct acpica_device_id_list *cid_list;
1024 int i; 1022 int i;
1025 1023
1026 switch (device->device_type) { 1024 switch (device->device_type) {
1027 case ACPI_BUS_TYPE_DEVICE: 1025 case ACPI_BUS_TYPE_DEVICE:
1028 if (ACPI_IS_ROOT_DEVICE(device)) { 1026 if (ACPI_IS_ROOT_DEVICE(device)) {
1029 hid = ACPI_SYSTEM_HID; 1027 acpi_add_id(device, ACPI_SYSTEM_HID);
1030 break; 1028 break;
1031 } else if (ACPI_IS_ROOT_DEVICE(device->parent)) { 1029 } else if (ACPI_IS_ROOT_DEVICE(device->parent)) {
1032 /* \_SB_, the only root-level namespace device */ 1030 /* \_SB_, the only root-level namespace device */
1033 hid = ACPI_BUS_HID; 1031 acpi_add_id(device, ACPI_BUS_HID);
1034 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); 1032 strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
1035 strcpy(device->pnp.device_class, ACPI_BUS_CLASS); 1033 strcpy(device->pnp.device_class, ACPI_BUS_CLASS);
1036 break; 1034 break;
@@ -1043,41 +1041,43 @@ static void acpi_device_set_id(struct acpi_device *device)
1043 } 1041 }
1044 1042
1045 if (info->valid & ACPI_VALID_HID) 1043 if (info->valid & ACPI_VALID_HID)
1046 hid = info->hardware_id.string; 1044 acpi_add_id(device, info->hardware_id.string);
1047 if (info->valid & ACPI_VALID_CID) 1045 if (info->valid & ACPI_VALID_CID) {
1048 cid_list = &info->compatible_id_list; 1046 cid_list = &info->compatible_id_list;
1047 for (i = 0; i < cid_list->count; i++)
1048 acpi_add_id(device, cid_list->ids[i].string);
1049 }
1049 if (info->valid & ACPI_VALID_ADR) { 1050 if (info->valid & ACPI_VALID_ADR) {
1050 device->pnp.bus_address = info->address; 1051 device->pnp.bus_address = info->address;
1051 device->flags.bus_address = 1; 1052 device->flags.bus_address = 1;
1052 } 1053 }
1053 1054
1054 /* If we have a video/bay/dock device, add our selfdefined 1055 /*
1055 HID to the CID list. Like that the video/bay/dock drivers 1056 * Some devices don't reliably have _HIDs & _CIDs, so add
1056 will get autoloaded and the device might still match 1057 * synthetic HIDs to make sure drivers can find them.
1057 against another driver. 1058 */
1058 */
1059 if (acpi_is_video_device(device)) 1059 if (acpi_is_video_device(device))
1060 cid_add = ACPI_VIDEO_HID; 1060 acpi_add_id(device, ACPI_VIDEO_HID);
1061 else if (ACPI_SUCCESS(acpi_bay_match(device))) 1061 else if (ACPI_SUCCESS(acpi_bay_match(device)))
1062 cid_add = ACPI_BAY_HID; 1062 acpi_add_id(device, ACPI_BAY_HID);
1063 else if (ACPI_SUCCESS(acpi_dock_match(device))) 1063 else if (ACPI_SUCCESS(acpi_dock_match(device)))
1064 cid_add = ACPI_DOCK_HID; 1064 acpi_add_id(device, ACPI_DOCK_HID);
1065 1065
1066 break; 1066 break;
1067 case ACPI_BUS_TYPE_POWER: 1067 case ACPI_BUS_TYPE_POWER:
1068 hid = ACPI_POWER_HID; 1068 acpi_add_id(device, ACPI_POWER_HID);
1069 break; 1069 break;
1070 case ACPI_BUS_TYPE_PROCESSOR: 1070 case ACPI_BUS_TYPE_PROCESSOR:
1071 hid = ACPI_PROCESSOR_OBJECT_HID; 1071 acpi_add_id(device, ACPI_PROCESSOR_OBJECT_HID);
1072 break; 1072 break;
1073 case ACPI_BUS_TYPE_THERMAL: 1073 case ACPI_BUS_TYPE_THERMAL:
1074 hid = ACPI_THERMAL_HID; 1074 acpi_add_id(device, ACPI_THERMAL_HID);
1075 break; 1075 break;
1076 case ACPI_BUS_TYPE_POWER_BUTTON: 1076 case ACPI_BUS_TYPE_POWER_BUTTON:
1077 hid = ACPI_BUTTON_HID_POWERF; 1077 acpi_add_id(device, ACPI_BUTTON_HID_POWERF);
1078 break; 1078 break;
1079 case ACPI_BUS_TYPE_SLEEP_BUTTON: 1079 case ACPI_BUS_TYPE_SLEEP_BUTTON:
1080 hid = ACPI_BUTTON_HID_SLEEPF; 1080 acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF);
1081 break; 1081 break;
1082 } 1082 }
1083 1083
@@ -1088,18 +1088,8 @@ static void acpi_device_set_id(struct acpi_device *device)
1088 * This generic ID isn't useful for driver binding, but it provides 1088 * This generic ID isn't useful for driver binding, but it provides
1089 * the useful property that "every acpi_device has an ID." 1089 * the useful property that "every acpi_device has an ID."
1090 */ 1090 */
1091 if (!hid && !cid_list && !cid_add) 1091 if (list_empty(&device->pnp.ids))
1092 hid = "device"; 1092 acpi_add_id(device, "device");
1093
1094 if (hid)
1095 acpi_add_id(device, hid);
1096 if (cid_list)
1097 for (i = 0; i < cid_list->count; i++)
1098 acpi_add_id(device, cid_list->ids[i].string);
1099 if (cid_add)
1100 acpi_add_id(device, cid_add);
1101
1102 kfree(info);
1103} 1093}
1104 1094
1105static int acpi_device_set_context(struct acpi_device *device) 1095static int acpi_device_set_context(struct acpi_device *device)