diff options
author | Jiang Liu <jiang.liu@huawei.com> | 2013-06-28 12:24:38 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-07-14 19:33:10 -0400 |
commit | 952c63e9512b63220886105cfc791507046fa39a (patch) | |
tree | bf3bd0592ea0fac74418fe16b8a4125e2db799ea /drivers/acpi/video.c | |
parent | 472d963befe28b8614ea2789757b27536c8d79eb (diff) |
ACPI: introduce helper function acpi_has_method()
Introduce helper function acpi_has_method() and use it in a number
of places to simplify code.
[rjw: Changelog]
Signed-off-by: Jiang Liu <jiang.liu@huawei.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 5d7075d25700..a84533e67b9d 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -875,28 +875,21 @@ out: | |||
875 | 875 | ||
876 | static void acpi_video_device_find_cap(struct acpi_video_device *device) | 876 | static void acpi_video_device_find_cap(struct acpi_video_device *device) |
877 | { | 877 | { |
878 | acpi_handle h_dummy1; | 878 | if (acpi_has_method(device->dev->handle, "_ADR")) |
879 | |||
880 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_ADR", &h_dummy1))) { | ||
881 | device->cap._ADR = 1; | 879 | device->cap._ADR = 1; |
882 | } | 880 | if (acpi_has_method(device->dev->handle, "_BCL")) |
883 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCL", &h_dummy1))) { | ||
884 | device->cap._BCL = 1; | 881 | device->cap._BCL = 1; |
885 | } | 882 | if (acpi_has_method(device->dev->handle, "_BCM")) |
886 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCM", &h_dummy1))) { | ||
887 | device->cap._BCM = 1; | 883 | device->cap._BCM = 1; |
888 | } | 884 | if (acpi_has_method(device->dev->handle, "_BQC")) { |
889 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle,"_BQC",&h_dummy1))) | ||
890 | device->cap._BQC = 1; | 885 | device->cap._BQC = 1; |
891 | else if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_BCQ", | 886 | } else if (acpi_has_method(device->dev->handle, "_BCQ")) { |
892 | &h_dummy1))) { | ||
893 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); | 887 | printk(KERN_WARNING FW_BUG "_BCQ is used instead of _BQC\n"); |
894 | device->cap._BCQ = 1; | 888 | device->cap._BCQ = 1; |
895 | } | 889 | } |
896 | 890 | ||
897 | if (ACPI_SUCCESS(acpi_get_handle(device->dev->handle, "_DDC", &h_dummy1))) { | 891 | if (acpi_has_method(device->dev->handle, "_DDC")) |
898 | device->cap._DDC = 1; | 892 | device->cap._DDC = 1; |
899 | } | ||
900 | 893 | ||
901 | if (acpi_video_backlight_support()) { | 894 | if (acpi_video_backlight_support()) { |
902 | struct backlight_properties props; | 895 | struct backlight_properties props; |
@@ -984,26 +977,18 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device) | |||
984 | 977 | ||
985 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) | 978 | static void acpi_video_bus_find_cap(struct acpi_video_bus *video) |
986 | { | 979 | { |
987 | acpi_handle h_dummy1; | 980 | if (acpi_has_method(video->device->handle, "_DOS")) |
988 | |||
989 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOS", &h_dummy1))) { | ||
990 | video->cap._DOS = 1; | 981 | video->cap._DOS = 1; |
991 | } | 982 | if (acpi_has_method(video->device->handle, "_DOD")) |
992 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_DOD", &h_dummy1))) { | ||
993 | video->cap._DOD = 1; | 983 | video->cap._DOD = 1; |
994 | } | 984 | if (acpi_has_method(video->device->handle, "_ROM")) |
995 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_ROM", &h_dummy1))) { | ||
996 | video->cap._ROM = 1; | 985 | video->cap._ROM = 1; |
997 | } | 986 | if (acpi_has_method(video->device->handle, "_GPD")) |
998 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_GPD", &h_dummy1))) { | ||
999 | video->cap._GPD = 1; | 987 | video->cap._GPD = 1; |
1000 | } | 988 | if (acpi_has_method(video->device->handle, "_SPD")) |
1001 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_SPD", &h_dummy1))) { | ||
1002 | video->cap._SPD = 1; | 989 | video->cap._SPD = 1; |
1003 | } | 990 | if (acpi_has_method(video->device->handle, "_VPO")) |
1004 | if (ACPI_SUCCESS(acpi_get_handle(video->device->handle, "_VPO", &h_dummy1))) { | ||
1005 | video->cap._VPO = 1; | 991 | video->cap._VPO = 1; |
1006 | } | ||
1007 | } | 992 | } |
1008 | 993 | ||
1009 | /* | 994 | /* |