diff options
author | Zhang Rui <rui.zhang@intel.com> | 2007-01-11 02:09:09 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-02-03 01:14:56 -0500 |
commit | 547352660506ab99d6b0bad58dea495bf3718cee (patch) | |
tree | 2fdfca6c709015fd1266b9bb44f1bfba50f5e069 /drivers/acpi | |
parent | 975a8e3ed2b9eab9f062a1e0ba7fe180e15204e1 (diff) |
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: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/bay.c | 18 | ||||
-rw-r--r-- | drivers/acpi/scan.c | 40 |
2 files changed, 41 insertions, 17 deletions
diff --git a/drivers/acpi/bay.c b/drivers/acpi/bay.c index aa1b131c0fce..667fa1dfa1a3 100644 --- a/drivers/acpi/bay.c +++ b/drivers/acpi/bay.c | |||
@@ -49,16 +49,14 @@ MODULE_LICENSE("GPL"); | |||
49 | static void bay_notify(acpi_handle handle, u32 event, void *data); | 49 | static void bay_notify(acpi_handle handle, u32 event, void *data); |
50 | static int acpi_bay_add(struct acpi_device *device); | 50 | static int acpi_bay_add(struct acpi_device *device); |
51 | static int acpi_bay_remove(struct acpi_device *device, int type); | 51 | static int acpi_bay_remove(struct acpi_device *device, int type); |
52 | static int acpi_bay_match(struct acpi_device *device, | ||
53 | struct acpi_driver *driver); | ||
54 | 52 | ||
55 | static struct acpi_driver acpi_bay_driver = { | 53 | static struct acpi_driver acpi_bay_driver = { |
56 | .name = ACPI_BAY_DRIVER_NAME, | 54 | .name = ACPI_BAY_DRIVER_NAME, |
57 | .class = ACPI_BAY_CLASS, | 55 | .class = ACPI_BAY_CLASS, |
56 | .ids = ACPI_BAY_HID, | ||
58 | .ops = { | 57 | .ops = { |
59 | .add = acpi_bay_add, | 58 | .add = acpi_bay_add, |
60 | .remove = acpi_bay_remove, | 59 | .remove = acpi_bay_remove, |
61 | .match = acpi_bay_match, | ||
62 | }, | 60 | }, |
63 | }; | 61 | }; |
64 | 62 | ||
@@ -347,20 +345,6 @@ static int acpi_bay_remove(struct acpi_device *device, int type) | |||
347 | return 0; | 345 | return 0; |
348 | } | 346 | } |
349 | 347 | ||
350 | static int acpi_bay_match(struct acpi_device *device, | ||
351 | struct acpi_driver *driver) | ||
352 | { | ||
353 | if (!device || !driver) | ||
354 | return -EINVAL; | ||
355 | |||
356 | if (is_ejectable_bay(device->handle)) { | ||
357 | bay_dprintk(device->handle, "matching bay device"); | ||
358 | return 0; | ||
359 | } | ||
360 | |||
361 | return -ENODEV; | ||
362 | } | ||
363 | |||
364 | /** | 348 | /** |
365 | * bay_create_acpi_device - add new devices to acpi | 349 | * bay_create_acpi_device - add new devices to acpi |
366 | * @handle - handle of the device to add | 350 | * @handle - handle of the device to add |
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 5049230ccf49..0a13d954daed 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -837,6 +837,42 @@ acpi_video_bus_match(struct acpi_device *device) | |||
837 | return -ENODEV; | 837 | return -ENODEV; |
838 | } | 838 | } |
839 | 839 | ||
840 | /* | ||
841 | * acpi_bay_match - see if a device is an ejectable driver bay | ||
842 | * | ||
843 | * If an acpi object is ejectable and has one of the ACPI ATA methods defined, | ||
844 | * then we can safely call it an ejectable drive bay | ||
845 | */ | ||
846 | static int acpi_bay_match(struct acpi_device *device){ | ||
847 | acpi_status status; | ||
848 | acpi_handle handle; | ||
849 | acpi_handle tmp; | ||
850 | acpi_handle phandle; | ||
851 | |||
852 | handle = device->handle; | ||
853 | |||
854 | status = acpi_get_handle(handle, "_EJ0", &tmp); | ||
855 | if (ACPI_FAILURE(status)) | ||
856 | return -ENODEV; | ||
857 | |||
858 | if ((ACPI_SUCCESS(acpi_get_handle(handle, "_GTF", &tmp))) || | ||
859 | (ACPI_SUCCESS(acpi_get_handle(handle, "_GTM", &tmp))) || | ||
860 | (ACPI_SUCCESS(acpi_get_handle(handle, "_STM", &tmp))) || | ||
861 | (ACPI_SUCCESS(acpi_get_handle(handle, "_SDD", &tmp)))) | ||
862 | return 0; | ||
863 | |||
864 | if (acpi_get_parent(handle, &phandle)) | ||
865 | return -ENODEV; | ||
866 | |||
867 | if ((ACPI_SUCCESS(acpi_get_handle(phandle, "_GTF", &tmp))) || | ||
868 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_GTM", &tmp))) || | ||
869 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_STM", &tmp))) || | ||
870 | (ACPI_SUCCESS(acpi_get_handle(phandle, "_SDD", &tmp)))) | ||
871 | return 0; | ||
872 | |||
873 | return -ENODEV; | ||
874 | } | ||
875 | |||
840 | static void acpi_device_set_id(struct acpi_device *device, | 876 | static void acpi_device_set_id(struct acpi_device *device, |
841 | struct acpi_device *parent, acpi_handle handle, | 877 | struct acpi_device *parent, acpi_handle handle, |
842 | int type) | 878 | int type) |
@@ -872,6 +908,10 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
872 | status = acpi_video_bus_match(device); | 908 | status = acpi_video_bus_match(device); |
873 | if(ACPI_SUCCESS(status)) | 909 | if(ACPI_SUCCESS(status)) |
874 | hid = ACPI_VIDEO_HID; | 910 | hid = ACPI_VIDEO_HID; |
911 | |||
912 | status = acpi_bay_match(device); | ||
913 | if (ACPI_SUCCESS(status)) | ||
914 | hid = ACPI_BAY_HID; | ||
875 | } | 915 | } |
876 | break; | 916 | break; |
877 | case ACPI_BUS_TYPE_POWER: | 917 | case ACPI_BUS_TYPE_POWER: |