goto end;
}
- if (dev->flags.bus_address)
+ if (dev->pnp.type.bus_address)
result = device_create_file(&dev->dev, &dev_attr_adr);
if (dev->pnp.unique_id)
result = device_create_file(&dev->dev, &dev_attr_uid);
if (dev->pnp.unique_id)
device_remove_file(&dev->dev, &dev_attr_uid);
- if (dev->flags.bus_address)
+ if (dev->pnp.type.bus_address)
device_remove_file(&dev->dev, &dev_attr_adr);
device_remove_file(&dev->dev, &dev_attr_modalias);
device_remove_file(&dev->dev, &dev_attr_hid);
}
/*
- * acpi_bay_match - see if a device is an ejectable driver bay
+ * acpi_bay_match - see if an acpi object is an ejectable driver bay
*
* If an acpi object is ejectable and has one of the ACPI ATA methods defined,
* then we can safely call it an ejectable drive bay
*/
-static int acpi_bay_match(struct acpi_device *device){
+static int acpi_bay_match(acpi_handle handle)
+{
acpi_status status;
- acpi_handle handle;
acpi_handle tmp;
acpi_handle phandle;
- handle = device->handle;
-
status = acpi_get_handle(handle, "_EJ0", &tmp);
if (ACPI_FAILURE(status))
return -ENODEV;
}
/*
- * acpi_dock_match - see if a device has a _DCK method
+ * acpi_dock_match - see if an acpi object has a _DCK method
*/
-static int acpi_dock_match(struct acpi_device *device)
+static int acpi_dock_match(acpi_handle handle)
{
acpi_handle tmp;
- return acpi_get_handle(device->handle, "_DCK", &tmp);
+ return acpi_get_handle(handle, "_DCK", &tmp);
}
const char *acpi_device_hid(struct acpi_device *device)
}
EXPORT_SYMBOL(acpi_device_hid);
-static void acpi_add_id(struct acpi_device *device, const char *dev_id)
+static void acpi_add_id(struct acpi_device_pnp *pnp, const char *dev_id)
{
struct acpi_hardware_id *id;
return;
}
- list_add_tail(&id->list, &device->pnp.ids);
+ list_add_tail(&id->list, &pnp->ids);
+ pnp->type.hardware_id = 1;
}
/*
* lacks the SMBUS01 HID and the methods do not have the necessary "_"
* prefix. Work around this.
*/
-static int acpi_ibm_smbus_match(struct acpi_device *device)
+static int acpi_ibm_smbus_match(acpi_handle handle)
{
acpi_handle h_dummy;
struct acpi_buffer path = {ACPI_ALLOCATE_BUFFER, NULL};
return -ENODEV;
/* Look for SMBS object */
- result = acpi_get_name(device->handle, ACPI_SINGLE_NAME, &path);
+ result = acpi_get_name(handle, ACPI_SINGLE_NAME, &path);
if (result)
return result;
/* Does it have the necessary (but misnamed) methods? */
result = -ENODEV;
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "SBI", &h_dummy)) &&
- ACPI_SUCCESS(acpi_get_handle(device->handle, "SBR", &h_dummy)) &&
- ACPI_SUCCESS(acpi_get_handle(device->handle, "SBW", &h_dummy)))
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "SBI", &h_dummy)) &&
+ ACPI_SUCCESS(acpi_get_handle(handle, "SBR", &h_dummy)) &&
+ ACPI_SUCCESS(acpi_get_handle(handle, "SBW", &h_dummy)))
result = 0;
out:
kfree(path.pointer);
switch (device->device_type) {
case ACPI_BUS_TYPE_DEVICE:
if (ACPI_IS_ROOT_DEVICE(device)) {
- acpi_add_id(device, ACPI_SYSTEM_HID);
+ acpi_add_id(&device->pnp, ACPI_SYSTEM_HID);
break;
}
}
if (info->valid & ACPI_VALID_HID)
- acpi_add_id(device, info->hardware_id.string);
+ acpi_add_id(&device->pnp, info->hardware_id.string);
if (info->valid & ACPI_VALID_CID) {
cid_list = &info->compatible_id_list;
for (i = 0; i < cid_list->count; i++)
- acpi_add_id(device, cid_list->ids[i].string);
+ acpi_add_id(&device->pnp, cid_list->ids[i].string);
}
if (info->valid & ACPI_VALID_ADR) {
device->pnp.bus_address = info->address;
- device->flags.bus_address = 1;
+ device->pnp.type.bus_address = 1;
}
if (info->valid & ACPI_VALID_UID)
device->pnp.unique_id = kstrdup(info->unique_id.string,
* Some devices don't reliably have _HIDs & _CIDs, so add
* synthetic HIDs to make sure drivers can find them.
*/
- if (acpi_is_video_device(device))
- acpi_add_id(device, ACPI_VIDEO_HID);
- else if (ACPI_SUCCESS(acpi_bay_match(device)))
- acpi_add_id(device, ACPI_BAY_HID);
- else if (ACPI_SUCCESS(acpi_dock_match(device)))
- acpi_add_id(device, ACPI_DOCK_HID);
- else if (!acpi_ibm_smbus_match(device))
- acpi_add_id(device, ACPI_SMBUS_IBM_HID);
+ if (acpi_is_video_device(device->handle))
+ acpi_add_id(&device->pnp, ACPI_VIDEO_HID);
+ else if (ACPI_SUCCESS(acpi_bay_match(device->handle)))
+ acpi_add_id(&device->pnp, ACPI_BAY_HID);
+ else if (ACPI_SUCCESS(acpi_dock_match(device->handle)))
+ acpi_add_id(&device->pnp, ACPI_DOCK_HID);
+ else if (!acpi_ibm_smbus_match(device->handle))
+ acpi_add_id(&device->pnp, ACPI_SMBUS_IBM_HID);
else if (list_empty(&device->pnp.ids) &&
ACPI_IS_ROOT_DEVICE(device->parent)) {
- acpi_add_id(device, ACPI_BUS_HID); /* \_SB, LNXSYBUS */
+ acpi_add_id(&device->pnp, ACPI_BUS_HID); /* \_SB, LNXSYBUS */
strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
strcpy(device->pnp.device_class, ACPI_BUS_CLASS);
}
break;
case ACPI_BUS_TYPE_POWER:
- acpi_add_id(device, ACPI_POWER_HID);
+ acpi_add_id(&device->pnp, ACPI_POWER_HID);
break;
case ACPI_BUS_TYPE_PROCESSOR:
- acpi_add_id(device, ACPI_PROCESSOR_OBJECT_HID);
+ acpi_add_id(&device->pnp, ACPI_PROCESSOR_OBJECT_HID);
break;
case ACPI_BUS_TYPE_THERMAL:
- acpi_add_id(device, ACPI_THERMAL_HID);
+ acpi_add_id(&device->pnp, ACPI_THERMAL_HID);
break;
case ACPI_BUS_TYPE_POWER_BUTTON:
- acpi_add_id(device, ACPI_BUTTON_HID_POWERF);
+ acpi_add_id(&device->pnp, ACPI_BUTTON_HID_POWERF);
break;
case ACPI_BUS_TYPE_SLEEP_BUTTON:
- acpi_add_id(device, ACPI_BUTTON_HID_SLEEPF);
+ acpi_add_id(&device->pnp, ACPI_BUTTON_HID_SLEEPF);
break;
}
}
return 0;
}
-/* Returns true if the device is a video device which can be handled by
- * video.ko.
+/* Returns true if the ACPI object is a video device which can be
+ * handled by video.ko.
* The device will get a Linux specific CID added in scan.c to
* identify the device as an ACPI graphics device
* Be aware that the graphics device may not be physically present
* Use acpi_video_get_capabilities() to detect general ACPI video
* capabilities of present cards
*/
-long acpi_is_video_device(struct acpi_device *device)
+long acpi_is_video_device(acpi_handle handle)
{
acpi_handle h_dummy;
long video_caps = 0;
- if (!device)
- return 0;
-
/* Is this device able to support video switching ? */
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOD", &h_dummy)) ||
- ACPI_SUCCESS(acpi_get_handle(device->handle, "_DOS", &h_dummy)))
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) ||
+ ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy)))
video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
/* Is this device able to retrieve a video ROM ? */
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_ROM", &h_dummy)))
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy)))
video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
/* Is this device able to configure which video head to be POSTed ? */
- if (ACPI_SUCCESS(acpi_get_handle(device->handle, "_VPO", &h_dummy)) &&
- ACPI_SUCCESS(acpi_get_handle(device->handle, "_GPD", &h_dummy)) &&
- ACPI_SUCCESS(acpi_get_handle(device->handle, "_SPD", &h_dummy)))
+ if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) &&
+ ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) &&
+ ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy)))
video_caps |= ACPI_VIDEO_DEVICE_POSTING;
/* Only check for backlight functionality if one of the above hit. */
if (video_caps)
- acpi_walk_namespace(ACPI_TYPE_DEVICE, device->handle,
+ acpi_walk_namespace(ACPI_TYPE_DEVICE, handle,
ACPI_UINT32_MAX, acpi_backlight_cap_match, NULL,
&video_caps, NULL);
if (!dev)
return AE_OK;
pci_dev_put(dev);
- *cap |= acpi_is_video_device(acpi_dev);
+ *cap |= acpi_is_video_device(handle);
}
return AE_OK;
}