aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/video_detect.c
diff options
context:
space:
mode:
authorJiang Liu <jiang.liu@huawei.com>2013-06-28 12:24:38 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-07-14 19:33:10 -0400
commit952c63e9512b63220886105cfc791507046fa39a (patch)
treebf3bd0592ea0fac74418fe16b8a4125e2db799ea /drivers/acpi/video_detect.c
parent472d963befe28b8614ea2789757b27536c8d79eb (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_detect.c')
-rw-r--r--drivers/acpi/video_detect.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/drivers/acpi/video_detect.c b/drivers/acpi/video_detect.c
index e6bd910bc6ed..ddefa5f954e2 100644
--- a/drivers/acpi/video_detect.c
+++ b/drivers/acpi/video_detect.c
@@ -51,14 +51,13 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
51 void **retyurn_value) 51 void **retyurn_value)
52{ 52{
53 long *cap = context; 53 long *cap = context;
54 acpi_handle h_dummy;
55 54
56 if (ACPI_SUCCESS(acpi_get_handle(handle, "_BCM", &h_dummy)) && 55 if (acpi_has_method(handle, "_BCM") &&
57 ACPI_SUCCESS(acpi_get_handle(handle, "_BCL", &h_dummy))) { 56 acpi_has_method(handle, "_BCL")) {
58 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight " 57 ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found generic backlight "
59 "support\n")); 58 "support\n"));
60 *cap |= ACPI_VIDEO_BACKLIGHT; 59 *cap |= ACPI_VIDEO_BACKLIGHT;
61 if (ACPI_FAILURE(acpi_get_handle(handle, "_BQC", &h_dummy))) 60 if (!acpi_has_method(handle, "_BQC"))
62 printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, " 61 printk(KERN_WARNING FW_BUG PREFIX "No _BQC method, "
63 "cannot determine initial brightness\n"); 62 "cannot determine initial brightness\n");
64 /* We have backlight support, no need to scan further */ 63 /* We have backlight support, no need to scan further */
@@ -77,22 +76,20 @@ acpi_backlight_cap_match(acpi_handle handle, u32 level, void *context,
77 */ 76 */
78long acpi_is_video_device(acpi_handle handle) 77long acpi_is_video_device(acpi_handle handle)
79{ 78{
80 acpi_handle h_dummy;
81 long video_caps = 0; 79 long video_caps = 0;
82 80
83 /* Is this device able to support video switching ? */ 81 /* Is this device able to support video switching ? */
84 if (ACPI_SUCCESS(acpi_get_handle(handle, "_DOD", &h_dummy)) || 82 if (acpi_has_method(handle, "_DOD") || acpi_has_method(handle, "_DOS"))
85 ACPI_SUCCESS(acpi_get_handle(handle, "_DOS", &h_dummy)))
86 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING; 83 video_caps |= ACPI_VIDEO_OUTPUT_SWITCHING;
87 84
88 /* Is this device able to retrieve a video ROM ? */ 85 /* Is this device able to retrieve a video ROM ? */
89 if (ACPI_SUCCESS(acpi_get_handle(handle, "_ROM", &h_dummy))) 86 if (acpi_has_method(handle, "_ROM"))
90 video_caps |= ACPI_VIDEO_ROM_AVAILABLE; 87 video_caps |= ACPI_VIDEO_ROM_AVAILABLE;
91 88
92 /* Is this device able to configure which video head to be POSTed ? */ 89 /* Is this device able to configure which video head to be POSTed ? */
93 if (ACPI_SUCCESS(acpi_get_handle(handle, "_VPO", &h_dummy)) && 90 if (acpi_has_method(handle, "_VPO") &&
94 ACPI_SUCCESS(acpi_get_handle(handle, "_GPD", &h_dummy)) && 91 acpi_has_method(handle, "_GPD") &&
95 ACPI_SUCCESS(acpi_get_handle(handle, "_SPD", &h_dummy))) 92 acpi_has_method(handle, "_SPD"))
96 video_caps |= ACPI_VIDEO_DEVICE_POSTING; 93 video_caps |= ACPI_VIDEO_DEVICE_POSTING;
97 94
98 /* Only check for backlight functionality if one of the above hit. */ 95 /* Only check for backlight functionality if one of the above hit. */