diff options
Diffstat (limited to 'drivers/pci/pci-acpi.c')
-rw-r--r-- | drivers/pci/pci-acpi.c | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 7d33fc0ec2fc..981919d163a0 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c | |||
@@ -24,15 +24,13 @@ struct acpi_osc_data { | |||
24 | acpi_handle handle; | 24 | acpi_handle handle; |
25 | u32 support_set; | 25 | u32 support_set; |
26 | u32 control_set; | 26 | u32 control_set; |
27 | int is_queried; | ||
28 | u32 query_result; | ||
29 | struct list_head sibiling; | 27 | struct list_head sibiling; |
30 | }; | 28 | }; |
31 | static LIST_HEAD(acpi_osc_data_list); | 29 | static LIST_HEAD(acpi_osc_data_list); |
32 | 30 | ||
33 | struct acpi_osc_args { | 31 | struct acpi_osc_args { |
34 | u32 capbuf[3]; | 32 | u32 capbuf[3]; |
35 | u32 query_result; | 33 | u32 ctrl_result; |
36 | }; | 34 | }; |
37 | 35 | ||
38 | static DEFINE_MUTEX(pci_acpi_lock); | 36 | static DEFINE_MUTEX(pci_acpi_lock); |
@@ -110,9 +108,8 @@ static acpi_status acpi_run_osc(acpi_handle handle, | |||
110 | goto out_kfree; | 108 | goto out_kfree; |
111 | } | 109 | } |
112 | out_success: | 110 | out_success: |
113 | if (flags & OSC_QUERY_ENABLE) | 111 | osc_args->ctrl_result = |
114 | osc_args->query_result = | 112 | *((u32 *)(out_obj->buffer.pointer + 8)); |
115 | *((u32 *)(out_obj->buffer.pointer + 8)); | ||
116 | status = AE_OK; | 113 | status = AE_OK; |
117 | 114 | ||
118 | out_kfree: | 115 | out_kfree: |
@@ -120,7 +117,8 @@ out_kfree: | |||
120 | return status; | 117 | return status; |
121 | } | 118 | } |
122 | 119 | ||
123 | static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data) | 120 | static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data, |
121 | u32 *result) | ||
124 | { | 122 | { |
125 | acpi_status status; | 123 | acpi_status status; |
126 | u32 support_set; | 124 | u32 support_set; |
@@ -135,8 +133,7 @@ static acpi_status __acpi_query_osc(u32 flags, struct acpi_osc_data *osc_data) | |||
135 | status = acpi_run_osc(osc_data->handle, &osc_args); | 133 | status = acpi_run_osc(osc_data->handle, &osc_args); |
136 | if (ACPI_SUCCESS(status)) { | 134 | if (ACPI_SUCCESS(status)) { |
137 | osc_data->support_set = support_set; | 135 | osc_data->support_set = support_set; |
138 | osc_data->query_result = osc_args.query_result; | 136 | *result = osc_args.ctrl_result; |
139 | osc_data->is_queried = 1; | ||
140 | } | 137 | } |
141 | 138 | ||
142 | return status; | 139 | return status; |
@@ -147,7 +144,7 @@ static acpi_status acpi_query_osc(acpi_handle handle, | |||
147 | { | 144 | { |
148 | acpi_status status; | 145 | acpi_status status; |
149 | struct acpi_osc_data *osc_data; | 146 | struct acpi_osc_data *osc_data; |
150 | u32 flags = (unsigned long)context; | 147 | u32 flags = (unsigned long)context, dummy; |
151 | acpi_handle tmp; | 148 | acpi_handle tmp; |
152 | 149 | ||
153 | status = acpi_get_handle(handle, "_OSC", &tmp); | 150 | status = acpi_get_handle(handle, "_OSC", &tmp); |
@@ -162,7 +159,7 @@ static acpi_status acpi_query_osc(acpi_handle handle, | |||
162 | goto out; | 159 | goto out; |
163 | } | 160 | } |
164 | 161 | ||
165 | status = __acpi_query_osc(flags, osc_data); | 162 | status = __acpi_query_osc(flags, osc_data, &dummy); |
166 | out: | 163 | out: |
167 | mutex_unlock(&pci_acpi_lock); | 164 | mutex_unlock(&pci_acpi_lock); |
168 | return status; | 165 | return status; |
@@ -196,7 +193,7 @@ acpi_status __pci_osc_support_set(u32 flags, const char *hid) | |||
196 | acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | 193 | acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) |
197 | { | 194 | { |
198 | acpi_status status; | 195 | acpi_status status; |
199 | u32 ctrlset, control_set; | 196 | u32 ctrlset, control_set, result; |
200 | acpi_handle tmp; | 197 | acpi_handle tmp; |
201 | struct acpi_osc_data *osc_data; | 198 | struct acpi_osc_data *osc_data; |
202 | struct acpi_osc_args osc_args; | 199 | struct acpi_osc_args osc_args; |
@@ -219,13 +216,11 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags) | |||
219 | goto out; | 216 | goto out; |
220 | } | 217 | } |
221 | 218 | ||
222 | if (!osc_data->is_queried) { | 219 | status = __acpi_query_osc(osc_data->support_set, osc_data, &result); |
223 | status = __acpi_query_osc(osc_data->support_set, osc_data); | 220 | if (ACPI_FAILURE(status)) |
224 | if (ACPI_FAILURE(status)) | 221 | goto out; |
225 | goto out; | ||
226 | } | ||
227 | 222 | ||
228 | if ((osc_data->query_result & ctrlset) != ctrlset) { | 223 | if ((result & ctrlset) != ctrlset) { |
229 | status = AE_SUPPORT; | 224 | status = AE_SUPPORT; |
230 | goto out; | 225 | goto out; |
231 | } | 226 | } |