aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2009-09-21 15:35:29 -0400
committerLen Brown <len.brown@intel.com>2009-09-25 15:09:48 -0400
commit1131b938f0757350f569f8ad5bee737cd02b8e58 (patch)
tree679f4ff97f6858f18af7c86807644dc8144512f0 /drivers
parentb2972f87508a21db7584d11fdb5c97cb7101a788 (diff)
ACPI: remove acpi_device.flags.hardware_id
Every acpi_device has at least one ID (if there's no _HID or _CID, we give it a synthetic or default ID). So there's no longer a need to check whether an ID exists; we can just use it. Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/scan.c37
-rw-r--r--drivers/pnp/pnpacpi/core.c3
2 files changed, 14 insertions, 26 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 395ae129aae..7e031b90c09 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -47,9 +47,6 @@ static int create_modalias(struct acpi_device *acpi_dev, char *modalias,
47 int count; 47 int count;
48 struct acpi_hardware_id *id; 48 struct acpi_hardware_id *id;
49 49
50 if (!acpi_dev->flags.hardware_id)
51 return -ENODEV;
52
53 len = snprintf(modalias, size, "acpi:"); 50 len = snprintf(modalias, size, "acpi:");
54 size -= len; 51 size -= len;
55 52
@@ -203,17 +200,13 @@ static int acpi_device_setup_files(struct acpi_device *dev)
203 goto end; 200 goto end;
204 } 201 }
205 202
206 if (dev->flags.hardware_id) { 203 result = device_create_file(&dev->dev, &dev_attr_hid);
207 result = device_create_file(&dev->dev, &dev_attr_hid); 204 if (result)
208 if (result) 205 goto end;
209 goto end;
210 }
211 206
212 if (dev->flags.hardware_id) { 207 result = device_create_file(&dev->dev, &dev_attr_modalias);
213 result = device_create_file(&dev->dev, &dev_attr_modalias); 208 if (result)
214 if (result) 209 goto end;
215 goto end;
216 }
217 210
218 /* 211 /*
219 * If device has _EJ0, 'eject' file is created that is used to trigger 212 * If device has _EJ0, 'eject' file is created that is used to trigger
@@ -239,11 +232,8 @@ static void acpi_device_remove_files(struct acpi_device *dev)
239 if (ACPI_SUCCESS(status)) 232 if (ACPI_SUCCESS(status))
240 device_remove_file(&dev->dev, &dev_attr_eject); 233 device_remove_file(&dev->dev, &dev_attr_eject);
241 234
242 if (dev->flags.hardware_id) 235 device_remove_file(&dev->dev, &dev_attr_modalias);
243 device_remove_file(&dev->dev, &dev_attr_modalias); 236 device_remove_file(&dev->dev, &dev_attr_hid);
244
245 if (dev->flags.hardware_id)
246 device_remove_file(&dev->dev, &dev_attr_hid);
247 if (dev->handle) 237 if (dev->handle)
248 device_remove_file(&dev->dev, &dev_attr_path); 238 device_remove_file(&dev->dev, &dev_attr_path);
249} 239}
@@ -474,8 +464,9 @@ static int acpi_device_register(struct acpi_device *device)
474 * If failed, create one and link it into acpi_bus_id_list 464 * If failed, create one and link it into acpi_bus_id_list
475 */ 465 */
476 list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) { 466 list_for_each_entry(acpi_device_bus_id, &acpi_bus_id_list, node) {
477 if (!strcmp(acpi_device_bus_id->bus_id, device->flags.hardware_id ? acpi_device_hid(device) : "device")) { 467 if (!strcmp(acpi_device_bus_id->bus_id,
478 acpi_device_bus_id->instance_no ++; 468 acpi_device_hid(device))) {
469 acpi_device_bus_id->instance_no++;
479 found = 1; 470 found = 1;
480 kfree(new_bus_id); 471 kfree(new_bus_id);
481 break; 472 break;
@@ -483,7 +474,7 @@ static int acpi_device_register(struct acpi_device *device)
483 } 474 }
484 if (!found) { 475 if (!found) {
485 acpi_device_bus_id = new_bus_id; 476 acpi_device_bus_id = new_bus_id;
486 strcpy(acpi_device_bus_id->bus_id, device->flags.hardware_id ? acpi_device_hid(device) : "device"); 477 strcpy(acpi_device_bus_id->bus_id, acpi_device_hid(device));
487 acpi_device_bus_id->instance_no = 0; 478 acpi_device_bus_id->instance_no = 0;
488 list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list); 479 list_add_tail(&acpi_device_bus_id->node, &acpi_bus_id_list);
489 } 480 }
@@ -1103,10 +1094,8 @@ static void acpi_device_set_id(struct acpi_device *device)
1103 if (!hid && !cid_list && !cid_add) 1094 if (!hid && !cid_list && !cid_add)
1104 hid = "device"; 1095 hid = "device";
1105 1096
1106 if (hid) { 1097 if (hid)
1107 acpi_add_id(device, hid); 1098 acpi_add_id(device, hid);
1108 device->flags.hardware_id = 1;
1109 }
1110 if (uid) { 1099 if (uid) {
1111 device->pnp.unique_id = ACPI_ALLOCATE_ZEROED(strlen (uid) + 1); 1100 device->pnp.unique_id = ACPI_ALLOCATE_ZEROED(strlen (uid) + 1);
1112 if (device->pnp.unique_id) { 1101 if (device->pnp.unique_id) {
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 3a4478f1fc7..83b8b5ac49c 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -230,8 +230,7 @@ static int __init acpi_pnp_match(struct device *dev, void *_pnp)
230 struct pnp_dev *pnp = _pnp; 230 struct pnp_dev *pnp = _pnp;
231 231
232 /* true means it matched */ 232 /* true means it matched */
233 return acpi->flags.hardware_id 233 return !acpi_get_physical_device(acpi->handle)
234 && !acpi_get_physical_device(acpi->handle)
235 && compare_pnp_id(pnp->id, acpi_device_hid(acpi)); 234 && compare_pnp_id(pnp->id, acpi_device_hid(acpi));
236} 235}
237 236