Commit 54735266 authored by Zhang Rui's avatar Zhang Rui Committed by Len Brown

ACPI: bay: Convert ACPI Bay driver to be compatible with sysfs update.

	Set fake hid for ejectable drive bay.
	Match bay devices by checking the hid.
	Remove .match method of Bay driver.
Signed-off-by: default avatarZhang Rui <rui.zhang@intel.com>
Signed-off-by: default avatarLen Brown <len.brown@intel.com>
parent 975a8e3e
...@@ -49,16 +49,14 @@ MODULE_LICENSE("GPL"); ...@@ -49,16 +49,14 @@ MODULE_LICENSE("GPL");
static void bay_notify(acpi_handle handle, u32 event, void *data); static void bay_notify(acpi_handle handle, u32 event, void *data);
static int acpi_bay_add(struct acpi_device *device); static int acpi_bay_add(struct acpi_device *device);
static int acpi_bay_remove(struct acpi_device *device, int type); static int acpi_bay_remove(struct acpi_device *device, int type);
static int acpi_bay_match(struct acpi_device *device,
struct acpi_driver *driver);
static struct acpi_driver acpi_bay_driver = { static struct acpi_driver acpi_bay_driver = {
.name = ACPI_BAY_DRIVER_NAME, .name = ACPI_BAY_DRIVER_NAME,
.class = ACPI_BAY_CLASS, .class = ACPI_BAY_CLASS,
.ids = ACPI_BAY_HID,
.ops = { .ops = {
.add = acpi_bay_add, .add = acpi_bay_add,
.remove = acpi_bay_remove, .remove = acpi_bay_remove,
.match = acpi_bay_match,
}, },
}; };
...@@ -347,20 +345,6 @@ static int acpi_bay_remove(struct acpi_device *device, int type) ...@@ -347,20 +345,6 @@ static int acpi_bay_remove(struct acpi_device *device, int type)
return 0; return 0;
} }
static int acpi_bay_match(struct acpi_device *device,
struct acpi_driver *driver)
{
if (!device || !driver)
return -EINVAL;
if (is_ejectable_bay(device->handle)) {
bay_dprintk(device->handle, "matching bay device");
return 0;
}
return -ENODEV;
}
/** /**
* bay_create_acpi_device - add new devices to acpi * bay_create_acpi_device - add new devices to acpi
* @handle - handle of the device to add * @handle - handle of the device to add
......
...@@ -837,6 +837,42 @@ acpi_video_bus_match(struct acpi_device *device) ...@@ -837,6 +837,42 @@ acpi_video_bus_match(struct acpi_device *device)
return -ENODEV; return -ENODEV;
} }
/*
* acpi_bay_match - see if a device 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){
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;
if ((ACPI_SUCCESS(acpi_get_handle(handle, "_GTF", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(handle, "_GTM", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(handle, "_STM", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(handle, "_SDD", &tmp))))
return 0;
if (acpi_get_parent(handle, &phandle))
return -ENODEV;
if ((ACPI_SUCCESS(acpi_get_handle(phandle, "_GTF", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(phandle, "_GTM", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(phandle, "_STM", &tmp))) ||
(ACPI_SUCCESS(acpi_get_handle(phandle, "_SDD", &tmp))))
return 0;
return -ENODEV;
}
static void acpi_device_set_id(struct acpi_device *device, static void acpi_device_set_id(struct acpi_device *device,
struct acpi_device *parent, acpi_handle handle, struct acpi_device *parent, acpi_handle handle,
int type) int type)
...@@ -872,6 +908,10 @@ static void acpi_device_set_id(struct acpi_device *device, ...@@ -872,6 +908,10 @@ static void acpi_device_set_id(struct acpi_device *device,
status = acpi_video_bus_match(device); status = acpi_video_bus_match(device);
if(ACPI_SUCCESS(status)) if(ACPI_SUCCESS(status))
hid = ACPI_VIDEO_HID; hid = ACPI_VIDEO_HID;
status = acpi_bay_match(device);
if (ACPI_SUCCESS(status))
hid = ACPI_BAY_HID;
} }
break; break;
case ACPI_BUS_TYPE_POWER: case ACPI_BUS_TYPE_POWER:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment