diff options
author | Len Brown <len.brown@intel.com> | 2005-08-05 00:44:28 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2005-08-05 00:45:14 -0400 |
commit | 4be44fcd3bf648b782f4460fd06dfae6c42ded4b (patch) | |
tree | 5b5b7d296ea58786f53b95e5eac9565ff66890b0 /drivers/acpi/processor_perflib.c | |
parent | c65ade4dc8b486e8c8b9b0a6399789a5428e2039 (diff) |
[ACPI] Lindent all ACPI files
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi/processor_perflib.c')
-rw-r--r-- | drivers/acpi/processor_perflib.c | 297 |
1 files changed, 143 insertions, 154 deletions
diff --git a/drivers/acpi/processor_perflib.c b/drivers/acpi/processor_perflib.c index 1f0d6256302f..22c7bb66c200 100644 --- a/drivers/acpi/processor_perflib.c +++ b/drivers/acpi/processor_perflib.c | |||
@@ -26,7 +26,6 @@ | |||
26 | * | 26 | * |
27 | */ | 27 | */ |
28 | 28 | ||
29 | |||
30 | #include <linux/kernel.h> | 29 | #include <linux/kernel.h> |
31 | #include <linux/module.h> | 30 | #include <linux/module.h> |
32 | #include <linux/init.h> | 31 | #include <linux/init.h> |
@@ -42,14 +41,12 @@ | |||
42 | #include <acpi/acpi_bus.h> | 41 | #include <acpi/acpi_bus.h> |
43 | #include <acpi/processor.h> | 42 | #include <acpi/processor.h> |
44 | 43 | ||
45 | |||
46 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 | 44 | #define ACPI_PROCESSOR_COMPONENT 0x01000000 |
47 | #define ACPI_PROCESSOR_CLASS "processor" | 45 | #define ACPI_PROCESSOR_CLASS "processor" |
48 | #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" | 46 | #define ACPI_PROCESSOR_DRIVER_NAME "ACPI Processor Driver" |
49 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" | 47 | #define ACPI_PROCESSOR_FILE_PERFORMANCE "performance" |
50 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT | 48 | #define _COMPONENT ACPI_PROCESSOR_COMPONENT |
51 | ACPI_MODULE_NAME ("acpi_processor") | 49 | ACPI_MODULE_NAME("acpi_processor") |
52 | |||
53 | 50 | ||
54 | static DECLARE_MUTEX(performance_sem); | 51 | static DECLARE_MUTEX(performance_sem); |
55 | 52 | ||
@@ -69,8 +66,7 @@ static DECLARE_MUTEX(performance_sem); | |||
69 | static int acpi_processor_ppc_status = 0; | 66 | static int acpi_processor_ppc_status = 0; |
70 | 67 | ||
71 | static int acpi_processor_ppc_notifier(struct notifier_block *nb, | 68 | static int acpi_processor_ppc_notifier(struct notifier_block *nb, |
72 | unsigned long event, | 69 | unsigned long event, void *data) |
73 | void *data) | ||
74 | { | 70 | { |
75 | struct cpufreq_policy *policy = data; | 71 | struct cpufreq_policy *policy = data; |
76 | struct acpi_processor *pr; | 72 | struct acpi_processor *pr; |
@@ -85,7 +81,7 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
85 | if (!pr || !pr->performance) | 81 | if (!pr || !pr->performance) |
86 | goto out; | 82 | goto out; |
87 | 83 | ||
88 | ppc = (unsigned int) pr->performance_platform_limit; | 84 | ppc = (unsigned int)pr->performance_platform_limit; |
89 | if (!ppc) | 85 | if (!ppc) |
90 | goto out; | 86 | goto out; |
91 | 87 | ||
@@ -93,26 +89,23 @@ static int acpi_processor_ppc_notifier(struct notifier_block *nb, | |||
93 | goto out; | 89 | goto out; |
94 | 90 | ||
95 | cpufreq_verify_within_limits(policy, 0, | 91 | cpufreq_verify_within_limits(policy, 0, |
96 | pr->performance->states[ppc].core_frequency * 1000); | 92 | pr->performance->states[ppc]. |
93 | core_frequency * 1000); | ||
97 | 94 | ||
98 | out: | 95 | out: |
99 | up(&performance_sem); | 96 | up(&performance_sem); |
100 | 97 | ||
101 | return 0; | 98 | return 0; |
102 | } | 99 | } |
103 | 100 | ||
104 | |||
105 | static struct notifier_block acpi_ppc_notifier_block = { | 101 | static struct notifier_block acpi_ppc_notifier_block = { |
106 | .notifier_call = acpi_processor_ppc_notifier, | 102 | .notifier_call = acpi_processor_ppc_notifier, |
107 | }; | 103 | }; |
108 | 104 | ||
109 | 105 | static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |
110 | static int | ||
111 | acpi_processor_get_platform_limit ( | ||
112 | struct acpi_processor* pr) | ||
113 | { | 106 | { |
114 | acpi_status status = 0; | 107 | acpi_status status = 0; |
115 | unsigned long ppc = 0; | 108 | unsigned long ppc = 0; |
116 | 109 | ||
117 | ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); | 110 | ACPI_FUNCTION_TRACE("acpi_processor_get_platform_limit"); |
118 | 111 | ||
@@ -128,19 +121,17 @@ acpi_processor_get_platform_limit ( | |||
128 | if (status != AE_NOT_FOUND) | 121 | if (status != AE_NOT_FOUND) |
129 | acpi_processor_ppc_status |= PPC_IN_USE; | 122 | acpi_processor_ppc_status |= PPC_IN_USE; |
130 | 123 | ||
131 | if(ACPI_FAILURE(status) && status != AE_NOT_FOUND) { | 124 | if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) { |
132 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); | 125 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PPC\n")); |
133 | return_VALUE(-ENODEV); | 126 | return_VALUE(-ENODEV); |
134 | } | 127 | } |
135 | 128 | ||
136 | pr->performance_platform_limit = (int) ppc; | 129 | pr->performance_platform_limit = (int)ppc; |
137 | 130 | ||
138 | return_VALUE(0); | 131 | return_VALUE(0); |
139 | } | 132 | } |
140 | 133 | ||
141 | 134 | int acpi_processor_ppc_has_changed(struct acpi_processor *pr) | |
142 | int acpi_processor_ppc_has_changed( | ||
143 | struct acpi_processor *pr) | ||
144 | { | 135 | { |
145 | int ret = acpi_processor_get_platform_limit(pr); | 136 | int ret = acpi_processor_get_platform_limit(pr); |
146 | if (ret < 0) | 137 | if (ret < 0) |
@@ -149,44 +140,44 @@ int acpi_processor_ppc_has_changed( | |||
149 | return cpufreq_update_policy(pr->id); | 140 | return cpufreq_update_policy(pr->id); |
150 | } | 141 | } |
151 | 142 | ||
152 | 143 | void acpi_processor_ppc_init(void) | |
153 | void acpi_processor_ppc_init(void) { | 144 | { |
154 | if (!cpufreq_register_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) | 145 | if (!cpufreq_register_notifier |
146 | (&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER)) | ||
155 | acpi_processor_ppc_status |= PPC_REGISTERED; | 147 | acpi_processor_ppc_status |= PPC_REGISTERED; |
156 | else | 148 | else |
157 | printk(KERN_DEBUG "Warning: Processor Platform Limit not supported.\n"); | 149 | printk(KERN_DEBUG |
150 | "Warning: Processor Platform Limit not supported.\n"); | ||
158 | } | 151 | } |
159 | 152 | ||
160 | 153 | void acpi_processor_ppc_exit(void) | |
161 | void acpi_processor_ppc_exit(void) { | 154 | { |
162 | if (acpi_processor_ppc_status & PPC_REGISTERED) | 155 | if (acpi_processor_ppc_status & PPC_REGISTERED) |
163 | cpufreq_unregister_notifier(&acpi_ppc_notifier_block, CPUFREQ_POLICY_NOTIFIER); | 156 | cpufreq_unregister_notifier(&acpi_ppc_notifier_block, |
157 | CPUFREQ_POLICY_NOTIFIER); | ||
164 | 158 | ||
165 | acpi_processor_ppc_status &= ~PPC_REGISTERED; | 159 | acpi_processor_ppc_status &= ~PPC_REGISTERED; |
166 | } | 160 | } |
167 | 161 | ||
168 | 162 | static int acpi_processor_get_performance_control(struct acpi_processor *pr) | |
169 | static int | ||
170 | acpi_processor_get_performance_control ( | ||
171 | struct acpi_processor *pr) | ||
172 | { | 163 | { |
173 | int result = 0; | 164 | int result = 0; |
174 | acpi_status status = 0; | 165 | acpi_status status = 0; |
175 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 166 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
176 | union acpi_object *pct = NULL; | 167 | union acpi_object *pct = NULL; |
177 | union acpi_object obj = {0}; | 168 | union acpi_object obj = { 0 }; |
178 | 169 | ||
179 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); | 170 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_control"); |
180 | 171 | ||
181 | status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); | 172 | status = acpi_evaluate_object(pr->handle, "_PCT", NULL, &buffer); |
182 | if(ACPI_FAILURE(status)) { | 173 | if (ACPI_FAILURE(status)) { |
183 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); | 174 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PCT\n")); |
184 | return_VALUE(-ENODEV); | 175 | return_VALUE(-ENODEV); |
185 | } | 176 | } |
186 | 177 | ||
187 | pct = (union acpi_object *) buffer.pointer; | 178 | pct = (union acpi_object *)buffer.pointer; |
188 | if (!pct || (pct->type != ACPI_TYPE_PACKAGE) | 179 | if (!pct || (pct->type != ACPI_TYPE_PACKAGE) |
189 | || (pct->package.count != 2)) { | 180 | || (pct->package.count != 2)) { |
190 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); | 181 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PCT data\n")); |
191 | result = -EFAULT; | 182 | result = -EFAULT; |
192 | goto end; | 183 | goto end; |
@@ -199,15 +190,15 @@ acpi_processor_get_performance_control ( | |||
199 | obj = pct->package.elements[0]; | 190 | obj = pct->package.elements[0]; |
200 | 191 | ||
201 | if ((obj.type != ACPI_TYPE_BUFFER) | 192 | if ((obj.type != ACPI_TYPE_BUFFER) |
202 | || (obj.buffer.length < sizeof(struct acpi_pct_register)) | 193 | || (obj.buffer.length < sizeof(struct acpi_pct_register)) |
203 | || (obj.buffer.pointer == NULL)) { | 194 | || (obj.buffer.pointer == NULL)) { |
204 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 195 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
205 | "Invalid _PCT data (control_register)\n")); | 196 | "Invalid _PCT data (control_register)\n")); |
206 | result = -EFAULT; | 197 | result = -EFAULT; |
207 | goto end; | 198 | goto end; |
208 | } | 199 | } |
209 | memcpy(&pr->performance->control_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); | 200 | memcpy(&pr->performance->control_register, obj.buffer.pointer, |
210 | 201 | sizeof(struct acpi_pct_register)); | |
211 | 202 | ||
212 | /* | 203 | /* |
213 | * status_register | 204 | * status_register |
@@ -216,44 +207,42 @@ acpi_processor_get_performance_control ( | |||
216 | obj = pct->package.elements[1]; | 207 | obj = pct->package.elements[1]; |
217 | 208 | ||
218 | if ((obj.type != ACPI_TYPE_BUFFER) | 209 | if ((obj.type != ACPI_TYPE_BUFFER) |
219 | || (obj.buffer.length < sizeof(struct acpi_pct_register)) | 210 | || (obj.buffer.length < sizeof(struct acpi_pct_register)) |
220 | || (obj.buffer.pointer == NULL)) { | 211 | || (obj.buffer.pointer == NULL)) { |
221 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 212 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
222 | "Invalid _PCT data (status_register)\n")); | 213 | "Invalid _PCT data (status_register)\n")); |
223 | result = -EFAULT; | 214 | result = -EFAULT; |
224 | goto end; | 215 | goto end; |
225 | } | 216 | } |
226 | 217 | ||
227 | memcpy(&pr->performance->status_register, obj.buffer.pointer, sizeof(struct acpi_pct_register)); | 218 | memcpy(&pr->performance->status_register, obj.buffer.pointer, |
219 | sizeof(struct acpi_pct_register)); | ||
228 | 220 | ||
229 | end: | 221 | end: |
230 | acpi_os_free(buffer.pointer); | 222 | acpi_os_free(buffer.pointer); |
231 | 223 | ||
232 | return_VALUE(result); | 224 | return_VALUE(result); |
233 | } | 225 | } |
234 | 226 | ||
235 | 227 | static int acpi_processor_get_performance_states(struct acpi_processor *pr) | |
236 | static int | ||
237 | acpi_processor_get_performance_states ( | ||
238 | struct acpi_processor *pr) | ||
239 | { | 228 | { |
240 | int result = 0; | 229 | int result = 0; |
241 | acpi_status status = AE_OK; | 230 | acpi_status status = AE_OK; |
242 | struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL}; | 231 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
243 | struct acpi_buffer format = {sizeof("NNNNNN"), "NNNNNN"}; | 232 | struct acpi_buffer format = { sizeof("NNNNNN"), "NNNNNN" }; |
244 | struct acpi_buffer state = {0, NULL}; | 233 | struct acpi_buffer state = { 0, NULL }; |
245 | union acpi_object *pss = NULL; | 234 | union acpi_object *pss = NULL; |
246 | int i; | 235 | int i; |
247 | 236 | ||
248 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); | 237 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_states"); |
249 | 238 | ||
250 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); | 239 | status = acpi_evaluate_object(pr->handle, "_PSS", NULL, &buffer); |
251 | if(ACPI_FAILURE(status)) { | 240 | if (ACPI_FAILURE(status)) { |
252 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); | 241 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error evaluating _PSS\n")); |
253 | return_VALUE(-ENODEV); | 242 | return_VALUE(-ENODEV); |
254 | } | 243 | } |
255 | 244 | ||
256 | pss = (union acpi_object *) buffer.pointer; | 245 | pss = (union acpi_object *)buffer.pointer; |
257 | if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { | 246 | if (!pss || (pss->type != ACPI_TYPE_PACKAGE)) { |
258 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); | 247 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); |
259 | result = -EFAULT; | 248 | result = -EFAULT; |
@@ -261,10 +250,12 @@ acpi_processor_get_performance_states ( | |||
261 | } | 250 | } |
262 | 251 | ||
263 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n", | 252 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d performance states\n", |
264 | pss->package.count)); | 253 | pss->package.count)); |
265 | 254 | ||
266 | pr->performance->state_count = pss->package.count; | 255 | pr->performance->state_count = pss->package.count; |
267 | pr->performance->states = kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, GFP_KERNEL); | 256 | pr->performance->states = |
257 | kmalloc(sizeof(struct acpi_processor_px) * pss->package.count, | ||
258 | GFP_KERNEL); | ||
268 | if (!pr->performance->states) { | 259 | if (!pr->performance->states) { |
269 | result = -ENOMEM; | 260 | result = -ENOMEM; |
270 | goto end; | 261 | goto end; |
@@ -280,46 +271,44 @@ acpi_processor_get_performance_states ( | |||
280 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); | 271 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Extracting state %d\n", i)); |
281 | 272 | ||
282 | status = acpi_extract_package(&(pss->package.elements[i]), | 273 | status = acpi_extract_package(&(pss->package.elements[i]), |
283 | &format, &state); | 274 | &format, &state); |
284 | if (ACPI_FAILURE(status)) { | 275 | if (ACPI_FAILURE(status)) { |
285 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data\n")); | 276 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
277 | "Invalid _PSS data\n")); | ||
286 | result = -EFAULT; | 278 | result = -EFAULT; |
287 | kfree(pr->performance->states); | 279 | kfree(pr->performance->states); |
288 | goto end; | 280 | goto end; |
289 | } | 281 | } |
290 | 282 | ||
291 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 283 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
292 | "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", | 284 | "State [%d]: core_frequency[%d] power[%d] transition_latency[%d] bus_master_latency[%d] control[0x%x] status[0x%x]\n", |
293 | i, | 285 | i, |
294 | (u32) px->core_frequency, | 286 | (u32) px->core_frequency, |
295 | (u32) px->power, | 287 | (u32) px->power, |
296 | (u32) px->transition_latency, | 288 | (u32) px->transition_latency, |
297 | (u32) px->bus_master_latency, | 289 | (u32) px->bus_master_latency, |
298 | (u32) px->control, | 290 | (u32) px->control, (u32) px->status)); |
299 | (u32) px->status)); | ||
300 | 291 | ||
301 | if (!px->core_frequency) { | 292 | if (!px->core_frequency) { |
302 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid _PSS data: freq is zero\n")); | 293 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
294 | "Invalid _PSS data: freq is zero\n")); | ||
303 | result = -EFAULT; | 295 | result = -EFAULT; |
304 | kfree(pr->performance->states); | 296 | kfree(pr->performance->states); |
305 | goto end; | 297 | goto end; |
306 | } | 298 | } |
307 | } | 299 | } |
308 | 300 | ||
309 | end: | 301 | end: |
310 | acpi_os_free(buffer.pointer); | 302 | acpi_os_free(buffer.pointer); |
311 | 303 | ||
312 | return_VALUE(result); | 304 | return_VALUE(result); |
313 | } | 305 | } |
314 | 306 | ||
315 | 307 | static int acpi_processor_get_performance_info(struct acpi_processor *pr) | |
316 | static int | ||
317 | acpi_processor_get_performance_info ( | ||
318 | struct acpi_processor *pr) | ||
319 | { | 308 | { |
320 | int result = 0; | 309 | int result = 0; |
321 | acpi_status status = AE_OK; | 310 | acpi_status status = AE_OK; |
322 | acpi_handle handle = NULL; | 311 | acpi_handle handle = NULL; |
323 | 312 | ||
324 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); | 313 | ACPI_FUNCTION_TRACE("acpi_processor_get_performance_info"); |
325 | 314 | ||
@@ -331,7 +320,7 @@ acpi_processor_get_performance_info ( | |||
331 | status = acpi_get_handle(pr->handle, "_PCT", &handle); | 320 | status = acpi_get_handle(pr->handle, "_PCT", &handle); |
332 | if (ACPI_FAILURE(status)) { | 321 | if (ACPI_FAILURE(status)) { |
333 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 322 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
334 | "ACPI-based processor performance control unavailable\n")); | 323 | "ACPI-based processor performance control unavailable\n")); |
335 | return_VALUE(-ENODEV); | 324 | return_VALUE(-ENODEV); |
336 | } | 325 | } |
337 | 326 | ||
@@ -350,10 +339,10 @@ acpi_processor_get_performance_info ( | |||
350 | return_VALUE(0); | 339 | return_VALUE(0); |
351 | } | 340 | } |
352 | 341 | ||
353 | 342 | int acpi_processor_notify_smm(struct module *calling_module) | |
354 | int acpi_processor_notify_smm(struct module *calling_module) { | 343 | { |
355 | acpi_status status; | 344 | acpi_status status; |
356 | static int is_done = 0; | 345 | static int is_done = 0; |
357 | 346 | ||
358 | ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); | 347 | ACPI_FUNCTION_TRACE("acpi_processor_notify_smm"); |
359 | 348 | ||
@@ -371,8 +360,7 @@ int acpi_processor_notify_smm(struct module *calling_module) { | |||
371 | if (is_done > 0) { | 360 | if (is_done > 0) { |
372 | module_put(calling_module); | 361 | module_put(calling_module); |
373 | return_VALUE(0); | 362 | return_VALUE(0); |
374 | } | 363 | } else if (is_done < 0) { |
375 | else if (is_done < 0) { | ||
376 | module_put(calling_module); | 364 | module_put(calling_module); |
377 | return_VALUE(is_done); | 365 | return_VALUE(is_done); |
378 | } | 366 | } |
@@ -380,28 +368,30 @@ int acpi_processor_notify_smm(struct module *calling_module) { | |||
380 | is_done = -EIO; | 368 | is_done = -EIO; |
381 | 369 | ||
382 | /* Can't write pstate_cnt to smi_cmd if either value is zero */ | 370 | /* Can't write pstate_cnt to smi_cmd if either value is zero */ |
383 | if ((!acpi_fadt.smi_cmd) || | 371 | if ((!acpi_fadt.smi_cmd) || (!acpi_fadt.pstate_cnt)) { |
384 | (!acpi_fadt.pstate_cnt)) { | 372 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No SMI port or pstate_cnt\n")); |
385 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
386 | "No SMI port or pstate_cnt\n")); | ||
387 | module_put(calling_module); | 373 | module_put(calling_module); |
388 | return_VALUE(0); | 374 | return_VALUE(0); |
389 | } | 375 | } |
390 | 376 | ||
391 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); | 377 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
378 | "Writing pstate_cnt [0x%x] to smi_cmd [0x%x]\n", | ||
379 | acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); | ||
392 | 380 | ||
393 | /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use | 381 | /* FADT v1 doesn't support pstate_cnt, many BIOS vendors use |
394 | * it anyway, so we need to support it... */ | 382 | * it anyway, so we need to support it... */ |
395 | if (acpi_fadt_is_v1) { | 383 | if (acpi_fadt_is_v1) { |
396 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Using v1.0 FADT reserved value for pstate_cnt\n")); | 384 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
385 | "Using v1.0 FADT reserved value for pstate_cnt\n")); | ||
397 | } | 386 | } |
398 | 387 | ||
399 | status = acpi_os_write_port (acpi_fadt.smi_cmd, | 388 | status = acpi_os_write_port(acpi_fadt.smi_cmd, |
400 | (u32) acpi_fadt.pstate_cnt, 8); | 389 | (u32) acpi_fadt.pstate_cnt, 8); |
401 | if (ACPI_FAILURE (status)) { | 390 | if (ACPI_FAILURE(status)) { |
402 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 391 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
403 | "Failed to write pstate_cnt [0x%x] to " | 392 | "Failed to write pstate_cnt [0x%x] to " |
404 | "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, acpi_fadt.smi_cmd)); | 393 | "smi_cmd [0x%x]\n", acpi_fadt.pstate_cnt, |
394 | acpi_fadt.smi_cmd)); | ||
405 | module_put(calling_module); | 395 | module_put(calling_module); |
406 | return_VALUE(status); | 396 | return_VALUE(status); |
407 | } | 397 | } |
@@ -415,24 +405,24 @@ int acpi_processor_notify_smm(struct module *calling_module) { | |||
415 | 405 | ||
416 | return_VALUE(0); | 406 | return_VALUE(0); |
417 | } | 407 | } |
418 | EXPORT_SYMBOL(acpi_processor_notify_smm); | ||
419 | 408 | ||
409 | EXPORT_SYMBOL(acpi_processor_notify_smm); | ||
420 | 410 | ||
421 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF | 411 | #ifdef CONFIG_X86_ACPI_CPUFREQ_PROC_INTF |
422 | /* /proc/acpi/processor/../performance interface (DEPRECATED) */ | 412 | /* /proc/acpi/processor/../performance interface (DEPRECATED) */ |
423 | 413 | ||
424 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); | 414 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file); |
425 | static struct file_operations acpi_processor_perf_fops = { | 415 | static struct file_operations acpi_processor_perf_fops = { |
426 | .open = acpi_processor_perf_open_fs, | 416 | .open = acpi_processor_perf_open_fs, |
427 | .read = seq_read, | 417 | .read = seq_read, |
428 | .llseek = seq_lseek, | 418 | .llseek = seq_lseek, |
429 | .release = single_release, | 419 | .release = single_release, |
430 | }; | 420 | }; |
431 | 421 | ||
432 | static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) | 422 | static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) |
433 | { | 423 | { |
434 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; | 424 | struct acpi_processor *pr = (struct acpi_processor *)seq->private; |
435 | int i; | 425 | int i; |
436 | 426 | ||
437 | ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); | 427 | ACPI_FUNCTION_TRACE("acpi_processor_perf_seq_show"); |
438 | 428 | ||
@@ -445,42 +435,40 @@ static int acpi_processor_perf_seq_show(struct seq_file *seq, void *offset) | |||
445 | } | 435 | } |
446 | 436 | ||
447 | seq_printf(seq, "state count: %d\n" | 437 | seq_printf(seq, "state count: %d\n" |
448 | "active state: P%d\n", | 438 | "active state: P%d\n", |
449 | pr->performance->state_count, | 439 | pr->performance->state_count, pr->performance->state); |
450 | pr->performance->state); | ||
451 | 440 | ||
452 | seq_puts(seq, "states:\n"); | 441 | seq_puts(seq, "states:\n"); |
453 | for (i = 0; i < pr->performance->state_count; i++) | 442 | for (i = 0; i < pr->performance->state_count; i++) |
454 | seq_printf(seq, " %cP%d: %d MHz, %d mW, %d uS\n", | 443 | seq_printf(seq, |
455 | (i == pr->performance->state?'*':' '), i, | 444 | " %cP%d: %d MHz, %d mW, %d uS\n", |
456 | (u32) pr->performance->states[i].core_frequency, | 445 | (i == pr->performance->state ? '*' : ' '), i, |
457 | (u32) pr->performance->states[i].power, | 446 | (u32) pr->performance->states[i].core_frequency, |
458 | (u32) pr->performance->states[i].transition_latency); | 447 | (u32) pr->performance->states[i].power, |
459 | 448 | (u32) pr->performance->states[i].transition_latency); | |
460 | end: | 449 | |
450 | end: | ||
461 | return_VALUE(0); | 451 | return_VALUE(0); |
462 | } | 452 | } |
463 | 453 | ||
464 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) | 454 | static int acpi_processor_perf_open_fs(struct inode *inode, struct file *file) |
465 | { | 455 | { |
466 | return single_open(file, acpi_processor_perf_seq_show, | 456 | return single_open(file, acpi_processor_perf_seq_show, |
467 | PDE(inode)->data); | 457 | PDE(inode)->data); |
468 | } | 458 | } |
469 | 459 | ||
470 | static ssize_t | 460 | static ssize_t |
471 | acpi_processor_write_performance ( | 461 | acpi_processor_write_performance(struct file *file, |
472 | struct file *file, | 462 | const char __user * buffer, |
473 | const char __user *buffer, | 463 | size_t count, loff_t * data) |
474 | size_t count, | ||
475 | loff_t *data) | ||
476 | { | 464 | { |
477 | int result = 0; | 465 | int result = 0; |
478 | struct seq_file *m = (struct seq_file *) file->private_data; | 466 | struct seq_file *m = (struct seq_file *)file->private_data; |
479 | struct acpi_processor *pr = (struct acpi_processor *) m->private; | 467 | struct acpi_processor *pr = (struct acpi_processor *)m->private; |
480 | struct acpi_processor_performance *perf; | 468 | struct acpi_processor_performance *perf; |
481 | char state_string[12] = {'\0'}; | 469 | char state_string[12] = { '\0' }; |
482 | unsigned int new_state = 0; | 470 | unsigned int new_state = 0; |
483 | struct cpufreq_policy policy; | 471 | struct cpufreq_policy policy; |
484 | 472 | ||
485 | ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); | 473 | ACPI_FUNCTION_TRACE("acpi_processor_write_performance"); |
486 | 474 | ||
@@ -513,12 +501,10 @@ acpi_processor_write_performance ( | |||
513 | return_VALUE(count); | 501 | return_VALUE(count); |
514 | } | 502 | } |
515 | 503 | ||
516 | static void | 504 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) |
517 | acpi_cpufreq_add_file ( | ||
518 | struct acpi_processor *pr) | ||
519 | { | 505 | { |
520 | struct proc_dir_entry *entry = NULL; | 506 | struct proc_dir_entry *entry = NULL; |
521 | struct acpi_device *device = NULL; | 507 | struct acpi_device *device = NULL; |
522 | 508 | ||
523 | ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); | 509 | ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); |
524 | 510 | ||
@@ -527,11 +513,12 @@ acpi_cpufreq_add_file ( | |||
527 | 513 | ||
528 | /* add file 'performance' [R/W] */ | 514 | /* add file 'performance' [R/W] */ |
529 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | 515 | entry = create_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, |
530 | S_IFREG|S_IRUGO|S_IWUSR, acpi_device_dir(device)); | 516 | S_IFREG | S_IRUGO | S_IWUSR, |
517 | acpi_device_dir(device)); | ||
531 | if (!entry) | 518 | if (!entry) |
532 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 519 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
533 | "Unable to create '%s' fs entry\n", | 520 | "Unable to create '%s' fs entry\n", |
534 | ACPI_PROCESSOR_FILE_PERFORMANCE)); | 521 | ACPI_PROCESSOR_FILE_PERFORMANCE)); |
535 | else { | 522 | else { |
536 | entry->proc_fops = &acpi_processor_perf_fops; | 523 | entry->proc_fops = &acpi_processor_perf_fops; |
537 | entry->proc_fops->write = acpi_processor_write_performance; | 524 | entry->proc_fops->write = acpi_processor_write_performance; |
@@ -541,11 +528,9 @@ acpi_cpufreq_add_file ( | |||
541 | return_VOID; | 528 | return_VOID; |
542 | } | 529 | } |
543 | 530 | ||
544 | static void | 531 | static void acpi_cpufreq_remove_file(struct acpi_processor *pr) |
545 | acpi_cpufreq_remove_file ( | ||
546 | struct acpi_processor *pr) | ||
547 | { | 532 | { |
548 | struct acpi_device *device = NULL; | 533 | struct acpi_device *device = NULL; |
549 | 534 | ||
550 | ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); | 535 | ACPI_FUNCTION_TRACE("acpi_cpufreq_addfile"); |
551 | 536 | ||
@@ -554,21 +539,25 @@ acpi_cpufreq_remove_file ( | |||
554 | 539 | ||
555 | /* remove file 'performance' */ | 540 | /* remove file 'performance' */ |
556 | remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, | 541 | remove_proc_entry(ACPI_PROCESSOR_FILE_PERFORMANCE, |
557 | acpi_device_dir(device)); | 542 | acpi_device_dir(device)); |
558 | 543 | ||
559 | return_VOID; | 544 | return_VOID; |
560 | } | 545 | } |
561 | 546 | ||
562 | #else | 547 | #else |
563 | static void acpi_cpufreq_add_file (struct acpi_processor *pr) { return; } | 548 | static void acpi_cpufreq_add_file(struct acpi_processor *pr) |
564 | static void acpi_cpufreq_remove_file (struct acpi_processor *pr) { return; } | 549 | { |
565 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ | 550 | return; |
566 | 551 | } | |
552 | static void acpi_cpufreq_remove_file(struct acpi_processor *pr) | ||
553 | { | ||
554 | return; | ||
555 | } | ||
556 | #endif /* CONFIG_X86_ACPI_CPUFREQ_PROC_INTF */ | ||
567 | 557 | ||
568 | int | 558 | int |
569 | acpi_processor_register_performance ( | 559 | acpi_processor_register_performance(struct acpi_processor_performance |
570 | struct acpi_processor_performance * performance, | 560 | *performance, unsigned int cpu) |
571 | unsigned int cpu) | ||
572 | { | 561 | { |
573 | struct acpi_processor *pr; | 562 | struct acpi_processor *pr; |
574 | 563 | ||
@@ -603,13 +592,12 @@ acpi_processor_register_performance ( | |||
603 | up(&performance_sem); | 592 | up(&performance_sem); |
604 | return_VALUE(0); | 593 | return_VALUE(0); |
605 | } | 594 | } |
606 | EXPORT_SYMBOL(acpi_processor_register_performance); | ||
607 | 595 | ||
596 | EXPORT_SYMBOL(acpi_processor_register_performance); | ||
608 | 597 | ||
609 | void | 598 | void |
610 | acpi_processor_unregister_performance ( | 599 | acpi_processor_unregister_performance(struct acpi_processor_performance |
611 | struct acpi_processor_performance * performance, | 600 | *performance, unsigned int cpu) |
612 | unsigned int cpu) | ||
613 | { | 601 | { |
614 | struct acpi_processor *pr; | 602 | struct acpi_processor *pr; |
615 | 603 | ||
@@ -632,4 +620,5 @@ acpi_processor_unregister_performance ( | |||
632 | 620 | ||
633 | return_VOID; | 621 | return_VOID; |
634 | } | 622 | } |
623 | |||
635 | EXPORT_SYMBOL(acpi_processor_unregister_performance); | 624 | EXPORT_SYMBOL(acpi_processor_unregister_performance); |