diff options
author | Lv Zheng <lv.zheng@intel.com> | 2013-09-13 01:15:00 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-09-30 13:46:13 -0400 |
commit | 50065300314e95c945665a17febc0c4e02941b06 (patch) | |
tree | 5025c7a481c7c1fb10babdb2d4f810dc0d34b6ff | |
parent | 4b88e330914941c86198ca0b48f4ce16f112bbf0 (diff) |
ACPI / IPMI: Cleanup coding styles
This patch only introduces indentation cleanups. No functional changes.
Signed-off-by: Lv Zheng <lv.zheng@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/acpi/acpi_ipmi.c | 105 |
1 files changed, 65 insertions, 40 deletions
diff --git a/drivers/acpi/acpi_ipmi.c b/drivers/acpi/acpi_ipmi.c index 9d187fdbfd96..ac0f52f6df2b 100644 --- a/drivers/acpi/acpi_ipmi.c +++ b/drivers/acpi/acpi_ipmi.c | |||
@@ -33,7 +33,6 @@ MODULE_AUTHOR("Zhao Yakui"); | |||
33 | MODULE_DESCRIPTION("ACPI IPMI Opregion driver"); | 33 | MODULE_DESCRIPTION("ACPI IPMI Opregion driver"); |
34 | MODULE_LICENSE("GPL"); | 34 | MODULE_LICENSE("GPL"); |
35 | 35 | ||
36 | |||
37 | #define ACPI_IPMI_OK 0 | 36 | #define ACPI_IPMI_OK 0 |
38 | #define ACPI_IPMI_TIMEOUT 0x10 | 37 | #define ACPI_IPMI_TIMEOUT 0x10 |
39 | #define ACPI_IPMI_UNKNOWN 0x07 | 38 | #define ACPI_IPMI_UNKNOWN 0x07 |
@@ -44,12 +43,14 @@ MODULE_LICENSE("GPL"); | |||
44 | struct acpi_ipmi_device { | 43 | struct acpi_ipmi_device { |
45 | /* the device list attached to driver_data.ipmi_devices */ | 44 | /* the device list attached to driver_data.ipmi_devices */ |
46 | struct list_head head; | 45 | struct list_head head; |
46 | |||
47 | /* the IPMI request message list */ | 47 | /* the IPMI request message list */ |
48 | struct list_head tx_msg_list; | 48 | struct list_head tx_msg_list; |
49 | spinlock_t tx_msg_lock; | 49 | |
50 | spinlock_t tx_msg_lock; | ||
50 | acpi_handle handle; | 51 | acpi_handle handle; |
51 | struct device *dev; | 52 | struct device *dev; |
52 | ipmi_user_t user_interface; | 53 | ipmi_user_t user_interface; |
53 | int ipmi_ifnum; /* IPMI interface number */ | 54 | int ipmi_ifnum; /* IPMI interface number */ |
54 | long curr_msgid; | 55 | long curr_msgid; |
55 | bool dead; | 56 | bool dead; |
@@ -57,10 +58,11 @@ struct acpi_ipmi_device { | |||
57 | }; | 58 | }; |
58 | 59 | ||
59 | struct ipmi_driver_data { | 60 | struct ipmi_driver_data { |
60 | struct list_head ipmi_devices; | 61 | struct list_head ipmi_devices; |
61 | struct ipmi_smi_watcher bmc_events; | 62 | struct ipmi_smi_watcher bmc_events; |
62 | struct ipmi_user_hndl ipmi_hndlrs; | 63 | struct ipmi_user_hndl ipmi_hndlrs; |
63 | struct mutex ipmi_lock; | 64 | struct mutex ipmi_lock; |
65 | |||
64 | /* | 66 | /* |
65 | * NOTE: IPMI System Interface Selection | 67 | * NOTE: IPMI System Interface Selection |
66 | * There is no system interface specified by the IPMI operation | 68 | * There is no system interface specified by the IPMI operation |
@@ -73,6 +75,7 @@ struct ipmi_driver_data { | |||
73 | 75 | ||
74 | struct acpi_ipmi_msg { | 76 | struct acpi_ipmi_msg { |
75 | struct list_head head; | 77 | struct list_head head; |
78 | |||
76 | /* | 79 | /* |
77 | * General speaking the addr type should be SI_ADDR_TYPE. And | 80 | * General speaking the addr type should be SI_ADDR_TYPE. And |
78 | * the addr channel should be BMC. | 81 | * the addr channel should be BMC. |
@@ -82,15 +85,19 @@ struct acpi_ipmi_msg { | |||
82 | */ | 85 | */ |
83 | struct ipmi_addr addr; | 86 | struct ipmi_addr addr; |
84 | long tx_msgid; | 87 | long tx_msgid; |
88 | |||
85 | /* it is used to track whether the IPMI message is finished */ | 89 | /* it is used to track whether the IPMI message is finished */ |
86 | struct completion tx_complete; | 90 | struct completion tx_complete; |
91 | |||
87 | struct kernel_ipmi_msg tx_message; | 92 | struct kernel_ipmi_msg tx_message; |
88 | int msg_done; | 93 | int msg_done; |
94 | |||
89 | /* tx/rx data . And copy it from/to ACPI object buffer */ | 95 | /* tx/rx data . And copy it from/to ACPI object buffer */ |
90 | u8 data[ACPI_IPMI_MAX_MSG_LENGTH]; | 96 | u8 data[ACPI_IPMI_MAX_MSG_LENGTH]; |
91 | u8 rx_len; | 97 | u8 rx_len; |
98 | |||
92 | struct acpi_ipmi_device *device; | 99 | struct acpi_ipmi_device *device; |
93 | struct kref kref; | 100 | struct kref kref; |
94 | }; | 101 | }; |
95 | 102 | ||
96 | /* IPMI request/response buffer per ACPI 4.0, sec 5.5.2.4.3.2 */ | 103 | /* IPMI request/response buffer per ACPI 4.0, sec 5.5.2.4.3.2 */ |
@@ -132,7 +139,6 @@ ipmi_dev_alloc(int iface, struct device *dev, acpi_handle handle) | |||
132 | INIT_LIST_HEAD(&ipmi_device->head); | 139 | INIT_LIST_HEAD(&ipmi_device->head); |
133 | INIT_LIST_HEAD(&ipmi_device->tx_msg_list); | 140 | INIT_LIST_HEAD(&ipmi_device->tx_msg_list); |
134 | spin_lock_init(&ipmi_device->tx_msg_lock); | 141 | spin_lock_init(&ipmi_device->tx_msg_lock); |
135 | |||
136 | ipmi_device->handle = handle; | 142 | ipmi_device->handle = handle; |
137 | ipmi_device->dev = get_device(dev); | 143 | ipmi_device->dev = get_device(dev); |
138 | ipmi_device->ipmi_ifnum = iface; | 144 | ipmi_device->ipmi_ifnum = iface; |
@@ -169,6 +175,7 @@ static void __ipmi_dev_kill(struct acpi_ipmi_device *ipmi_device) | |||
169 | list_del(&ipmi_device->head); | 175 | list_del(&ipmi_device->head); |
170 | if (driver_data.selected_smi == ipmi_device) | 176 | if (driver_data.selected_smi == ipmi_device) |
171 | driver_data.selected_smi = NULL; | 177 | driver_data.selected_smi = NULL; |
178 | |||
172 | /* | 179 | /* |
173 | * Always setting dead flag after deleting from the list or | 180 | * Always setting dead flag after deleting from the list or |
174 | * list_for_each_entry() codes must get changed. | 181 | * list_for_each_entry() codes must get changed. |
@@ -203,16 +210,19 @@ static struct acpi_ipmi_msg *ipmi_msg_alloc(void) | |||
203 | ipmi = acpi_ipmi_dev_get(); | 210 | ipmi = acpi_ipmi_dev_get(); |
204 | if (!ipmi) | 211 | if (!ipmi) |
205 | return NULL; | 212 | return NULL; |
213 | |||
206 | ipmi_msg = kzalloc(sizeof(struct acpi_ipmi_msg), GFP_KERNEL); | 214 | ipmi_msg = kzalloc(sizeof(struct acpi_ipmi_msg), GFP_KERNEL); |
207 | if (!ipmi_msg) { | 215 | if (!ipmi_msg) { |
208 | acpi_ipmi_dev_put(ipmi); | 216 | acpi_ipmi_dev_put(ipmi); |
209 | return NULL; | 217 | return NULL; |
210 | } | 218 | } |
219 | |||
211 | kref_init(&ipmi_msg->kref); | 220 | kref_init(&ipmi_msg->kref); |
212 | init_completion(&ipmi_msg->tx_complete); | 221 | init_completion(&ipmi_msg->tx_complete); |
213 | INIT_LIST_HEAD(&ipmi_msg->head); | 222 | INIT_LIST_HEAD(&ipmi_msg->head); |
214 | ipmi_msg->device = ipmi; | 223 | ipmi_msg->device = ipmi; |
215 | ipmi_msg->msg_done = ACPI_IPMI_UNKNOWN; | 224 | ipmi_msg->msg_done = ACPI_IPMI_UNKNOWN; |
225 | |||
216 | return ipmi_msg; | 226 | return ipmi_msg; |
217 | } | 227 | } |
218 | 228 | ||
@@ -242,11 +252,11 @@ static void acpi_ipmi_msg_put(struct acpi_ipmi_msg *tx_msg) | |||
242 | kref_put(&tx_msg->kref, ipmi_msg_release_kref); | 252 | kref_put(&tx_msg->kref, ipmi_msg_release_kref); |
243 | } | 253 | } |
244 | 254 | ||
245 | #define IPMI_OP_RGN_NETFN(offset) ((offset >> 8) & 0xff) | 255 | #define IPMI_OP_RGN_NETFN(offset) ((offset >> 8) & 0xff) |
246 | #define IPMI_OP_RGN_CMD(offset) (offset & 0xff) | 256 | #define IPMI_OP_RGN_CMD(offset) (offset & 0xff) |
247 | static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, | 257 | static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, |
248 | acpi_physical_address address, | 258 | acpi_physical_address address, |
249 | acpi_integer *value) | 259 | acpi_integer *value) |
250 | { | 260 | { |
251 | struct kernel_ipmi_msg *msg; | 261 | struct kernel_ipmi_msg *msg; |
252 | struct acpi_ipmi_buffer *buffer; | 262 | struct acpi_ipmi_buffer *buffer; |
@@ -254,6 +264,7 @@ static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, | |||
254 | unsigned long flags; | 264 | unsigned long flags; |
255 | 265 | ||
256 | msg = &tx_msg->tx_message; | 266 | msg = &tx_msg->tx_message; |
267 | |||
257 | /* | 268 | /* |
258 | * IPMI network function and command are encoded in the address | 269 | * IPMI network function and command are encoded in the address |
259 | * within the IPMI OpRegion; see ACPI 4.0, sec 5.5.2.4.3. | 270 | * within the IPMI OpRegion; see ACPI 4.0, sec 5.5.2.4.3. |
@@ -261,11 +272,13 @@ static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, | |||
261 | msg->netfn = IPMI_OP_RGN_NETFN(address); | 272 | msg->netfn = IPMI_OP_RGN_NETFN(address); |
262 | msg->cmd = IPMI_OP_RGN_CMD(address); | 273 | msg->cmd = IPMI_OP_RGN_CMD(address); |
263 | msg->data = tx_msg->data; | 274 | msg->data = tx_msg->data; |
275 | |||
264 | /* | 276 | /* |
265 | * value is the parameter passed by the IPMI opregion space handler. | 277 | * value is the parameter passed by the IPMI opregion space handler. |
266 | * It points to the IPMI request message buffer | 278 | * It points to the IPMI request message buffer |
267 | */ | 279 | */ |
268 | buffer = (struct acpi_ipmi_buffer *)value; | 280 | buffer = (struct acpi_ipmi_buffer *)value; |
281 | |||
269 | /* copy the tx message data */ | 282 | /* copy the tx message data */ |
270 | if (buffer->length > ACPI_IPMI_MAX_MSG_LENGTH) { | 283 | if (buffer->length > ACPI_IPMI_MAX_MSG_LENGTH) { |
271 | dev_WARN_ONCE(tx_msg->device->dev, true, | 284 | dev_WARN_ONCE(tx_msg->device->dev, true, |
@@ -275,6 +288,7 @@ static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, | |||
275 | } | 288 | } |
276 | msg->data_len = buffer->length; | 289 | msg->data_len = buffer->length; |
277 | memcpy(tx_msg->data, buffer->data, msg->data_len); | 290 | memcpy(tx_msg->data, buffer->data, msg->data_len); |
291 | |||
278 | /* | 292 | /* |
279 | * now the default type is SYSTEM_INTERFACE and channel type is BMC. | 293 | * now the default type is SYSTEM_INTERFACE and channel type is BMC. |
280 | * If the netfn is APP_REQUEST and the cmd is SEND_MESSAGE, | 294 | * If the netfn is APP_REQUEST and the cmd is SEND_MESSAGE, |
@@ -288,15 +302,17 @@ static int acpi_format_ipmi_request(struct acpi_ipmi_msg *tx_msg, | |||
288 | 302 | ||
289 | /* Get the msgid */ | 303 | /* Get the msgid */ |
290 | device = tx_msg->device; | 304 | device = tx_msg->device; |
305 | |||
291 | spin_lock_irqsave(&device->tx_msg_lock, flags); | 306 | spin_lock_irqsave(&device->tx_msg_lock, flags); |
292 | device->curr_msgid++; | 307 | device->curr_msgid++; |
293 | tx_msg->tx_msgid = device->curr_msgid; | 308 | tx_msg->tx_msgid = device->curr_msgid; |
294 | spin_unlock_irqrestore(&device->tx_msg_lock, flags); | 309 | spin_unlock_irqrestore(&device->tx_msg_lock, flags); |
310 | |||
295 | return 0; | 311 | return 0; |
296 | } | 312 | } |
297 | 313 | ||
298 | static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, | 314 | static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, |
299 | acpi_integer *value) | 315 | acpi_integer *value) |
300 | { | 316 | { |
301 | struct acpi_ipmi_buffer *buffer; | 317 | struct acpi_ipmi_buffer *buffer; |
302 | 318 | ||
@@ -305,6 +321,7 @@ static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, | |||
305 | * IPMI message returned by IPMI command. | 321 | * IPMI message returned by IPMI command. |
306 | */ | 322 | */ |
307 | buffer = (struct acpi_ipmi_buffer *)value; | 323 | buffer = (struct acpi_ipmi_buffer *)value; |
324 | |||
308 | /* | 325 | /* |
309 | * If the flag of msg_done is not set, it means that the IPMI command is | 326 | * If the flag of msg_done is not set, it means that the IPMI command is |
310 | * not executed correctly. | 327 | * not executed correctly. |
@@ -312,6 +329,7 @@ static void acpi_format_ipmi_response(struct acpi_ipmi_msg *msg, | |||
312 | buffer->status = msg->msg_done; | 329 | buffer->status = msg->msg_done; |
313 | if (msg->msg_done != ACPI_IPMI_OK) | 330 | if (msg->msg_done != ACPI_IPMI_OK) |
314 | return; | 331 | return; |
332 | |||
315 | /* | 333 | /* |
316 | * If the IPMI response message is obtained correctly, the status code | 334 | * If the IPMI response message is obtained correctly, the status code |
317 | * will be ACPI_IPMI_OK | 335 | * will be ACPI_IPMI_OK |
@@ -379,11 +397,12 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
379 | unsigned long flags; | 397 | unsigned long flags; |
380 | 398 | ||
381 | if (msg->user != ipmi_device->user_interface) { | 399 | if (msg->user != ipmi_device->user_interface) { |
382 | dev_warn(dev, "Unexpected response is returned. " | 400 | dev_warn(dev, |
383 | "returned user %p, expected user %p\n", | 401 | "Unexpected response is returned. returned user %p, expected user %p\n", |
384 | msg->user, ipmi_device->user_interface); | 402 | msg->user, ipmi_device->user_interface); |
385 | goto out_msg; | 403 | goto out_msg; |
386 | } | 404 | } |
405 | |||
387 | spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); | 406 | spin_lock_irqsave(&ipmi_device->tx_msg_lock, flags); |
388 | list_for_each_entry_safe(tx_msg, temp, &ipmi_device->tx_msg_list, head) { | 407 | list_for_each_entry_safe(tx_msg, temp, &ipmi_device->tx_msg_list, head) { |
389 | if (msg->msgid == tx_msg->tx_msgid) { | 408 | if (msg->msgid == tx_msg->tx_msgid) { |
@@ -395,8 +414,9 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
395 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); | 414 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); |
396 | 415 | ||
397 | if (!msg_found) { | 416 | if (!msg_found) { |
398 | dev_warn(dev, "Unexpected response (msg id %ld) is " | 417 | dev_warn(dev, |
399 | "returned.\n", msg->msgid); | 418 | "Unexpected response (msg id %ld) is returned.\n", |
419 | msg->msgid); | ||
400 | goto out_msg; | 420 | goto out_msg; |
401 | } | 421 | } |
402 | 422 | ||
@@ -407,6 +427,7 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
407 | msg->msg.data_len); | 427 | msg->msg.data_len); |
408 | goto out_comp; | 428 | goto out_comp; |
409 | } | 429 | } |
430 | |||
410 | /* response msg is an error msg */ | 431 | /* response msg is an error msg */ |
411 | msg->recv_type = IPMI_RESPONSE_RECV_TYPE; | 432 | msg->recv_type = IPMI_RESPONSE_RECV_TYPE; |
412 | if (msg->recv_type == IPMI_RESPONSE_RECV_TYPE && | 433 | if (msg->recv_type == IPMI_RESPONSE_RECV_TYPE && |
@@ -418,15 +439,17 @@ static void ipmi_msg_handler(struct ipmi_recv_msg *msg, void *user_msg_data) | |||
418 | } | 439 | } |
419 | goto out_comp; | 440 | goto out_comp; |
420 | } | 441 | } |
442 | |||
421 | tx_msg->rx_len = msg->msg.data_len; | 443 | tx_msg->rx_len = msg->msg.data_len; |
422 | memcpy(tx_msg->data, msg->msg.data, tx_msg->rx_len); | 444 | memcpy(tx_msg->data, msg->msg.data, tx_msg->rx_len); |
423 | tx_msg->msg_done = ACPI_IPMI_OK; | 445 | tx_msg->msg_done = ACPI_IPMI_OK; |
446 | |||
424 | out_comp: | 447 | out_comp: |
425 | complete(&tx_msg->tx_complete); | 448 | complete(&tx_msg->tx_complete); |
426 | acpi_ipmi_msg_put(tx_msg); | 449 | acpi_ipmi_msg_put(tx_msg); |
427 | out_msg: | 450 | out_msg: |
428 | ipmi_free_recv_msg(msg); | 451 | ipmi_free_recv_msg(msg); |
429 | }; | 452 | } |
430 | 453 | ||
431 | static void ipmi_register_bmc(int iface, struct device *dev) | 454 | static void ipmi_register_bmc(int iface, struct device *dev) |
432 | { | 455 | { |
@@ -436,7 +459,6 @@ static void ipmi_register_bmc(int iface, struct device *dev) | |||
436 | acpi_handle handle; | 459 | acpi_handle handle; |
437 | 460 | ||
438 | err = ipmi_get_smi_info(iface, &smi_data); | 461 | err = ipmi_get_smi_info(iface, &smi_data); |
439 | |||
440 | if (err) | 462 | if (err) |
441 | return; | 463 | return; |
442 | 464 | ||
@@ -461,11 +483,11 @@ static void ipmi_register_bmc(int iface, struct device *dev) | |||
461 | if (temp->handle == handle) | 483 | if (temp->handle == handle) |
462 | goto err_lock; | 484 | goto err_lock; |
463 | } | 485 | } |
464 | |||
465 | if (!driver_data.selected_smi) | 486 | if (!driver_data.selected_smi) |
466 | driver_data.selected_smi = ipmi_device; | 487 | driver_data.selected_smi = ipmi_device; |
467 | list_add_tail(&ipmi_device->head, &driver_data.ipmi_devices); | 488 | list_add_tail(&ipmi_device->head, &driver_data.ipmi_devices); |
468 | mutex_unlock(&driver_data.ipmi_lock); | 489 | mutex_unlock(&driver_data.ipmi_lock); |
490 | |||
469 | put_device(smi_data.dev); | 491 | put_device(smi_data.dev); |
470 | return; | 492 | return; |
471 | 493 | ||
@@ -484,7 +506,7 @@ static void ipmi_bmc_gone(int iface) | |||
484 | 506 | ||
485 | mutex_lock(&driver_data.ipmi_lock); | 507 | mutex_lock(&driver_data.ipmi_lock); |
486 | list_for_each_entry_safe(ipmi_device, temp, | 508 | list_for_each_entry_safe(ipmi_device, temp, |
487 | &driver_data.ipmi_devices, head) { | 509 | &driver_data.ipmi_devices, head) { |
488 | if (ipmi_device->ipmi_ifnum != iface) { | 510 | if (ipmi_device->ipmi_ifnum != iface) { |
489 | dev_found = true; | 511 | dev_found = true; |
490 | __ipmi_dev_kill(ipmi_device); | 512 | __ipmi_dev_kill(ipmi_device); |
@@ -496,14 +518,13 @@ static void ipmi_bmc_gone(int iface) | |||
496 | &driver_data.ipmi_devices, | 518 | &driver_data.ipmi_devices, |
497 | struct acpi_ipmi_device, head); | 519 | struct acpi_ipmi_device, head); |
498 | mutex_unlock(&driver_data.ipmi_lock); | 520 | mutex_unlock(&driver_data.ipmi_lock); |
521 | |||
499 | if (dev_found) { | 522 | if (dev_found) { |
500 | ipmi_flush_tx_msg(ipmi_device); | 523 | ipmi_flush_tx_msg(ipmi_device); |
501 | acpi_ipmi_dev_put(ipmi_device); | 524 | acpi_ipmi_dev_put(ipmi_device); |
502 | } | 525 | } |
503 | } | 526 | } |
504 | /* -------------------------------------------------------------------------- | 527 | |
505 | * Address Space Management | ||
506 | * -------------------------------------------------------------------------- */ | ||
507 | /* | 528 | /* |
508 | * This is the IPMI opregion space handler. | 529 | * This is the IPMI opregion space handler. |
509 | * @function: indicates the read/write. In fact as the IPMI message is driven | 530 | * @function: indicates the read/write. In fact as the IPMI message is driven |
@@ -516,17 +537,17 @@ static void ipmi_bmc_gone(int iface) | |||
516 | * the response IPMI message returned by IPMI command. | 537 | * the response IPMI message returned by IPMI command. |
517 | * @handler_context: IPMI device context. | 538 | * @handler_context: IPMI device context. |
518 | */ | 539 | */ |
519 | |||
520 | static acpi_status | 540 | static acpi_status |
521 | acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | 541 | acpi_ipmi_space_handler(u32 function, acpi_physical_address address, |
522 | u32 bits, acpi_integer *value, | 542 | u32 bits, acpi_integer *value, |
523 | void *handler_context, void *region_context) | 543 | void *handler_context, void *region_context) |
524 | { | 544 | { |
525 | struct acpi_ipmi_msg *tx_msg; | 545 | struct acpi_ipmi_msg *tx_msg; |
526 | struct acpi_ipmi_device *ipmi_device; | 546 | struct acpi_ipmi_device *ipmi_device; |
527 | int err; | 547 | int err; |
528 | acpi_status status; | 548 | acpi_status status; |
529 | unsigned long flags; | 549 | unsigned long flags; |
550 | |||
530 | /* | 551 | /* |
531 | * IPMI opregion message. | 552 | * IPMI opregion message. |
532 | * IPMI message is firstly written to the BMC and system software | 553 | * IPMI message is firstly written to the BMC and system software |
@@ -539,13 +560,13 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | |||
539 | tx_msg = ipmi_msg_alloc(); | 560 | tx_msg = ipmi_msg_alloc(); |
540 | if (!tx_msg) | 561 | if (!tx_msg) |
541 | return AE_NOT_EXIST; | 562 | return AE_NOT_EXIST; |
542 | |||
543 | ipmi_device = tx_msg->device; | 563 | ipmi_device = tx_msg->device; |
544 | 564 | ||
545 | if (acpi_format_ipmi_request(tx_msg, address, value) != 0) { | 565 | if (acpi_format_ipmi_request(tx_msg, address, value) != 0) { |
546 | ipmi_msg_release(tx_msg); | 566 | ipmi_msg_release(tx_msg); |
547 | return AE_TYPE; | 567 | return AE_TYPE; |
548 | } | 568 | } |
569 | |||
549 | acpi_ipmi_msg_get(tx_msg); | 570 | acpi_ipmi_msg_get(tx_msg); |
550 | mutex_lock(&driver_data.ipmi_lock); | 571 | mutex_lock(&driver_data.ipmi_lock); |
551 | /* Do not add a tx_msg that can not be flushed. */ | 572 | /* Do not add a tx_msg that can not be flushed. */ |
@@ -558,16 +579,18 @@ acpi_ipmi_space_handler(u32 function, acpi_physical_address address, | |||
558 | list_add_tail(&tx_msg->head, &ipmi_device->tx_msg_list); | 579 | list_add_tail(&tx_msg->head, &ipmi_device->tx_msg_list); |
559 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); | 580 | spin_unlock_irqrestore(&ipmi_device->tx_msg_lock, flags); |
560 | mutex_unlock(&driver_data.ipmi_lock); | 581 | mutex_unlock(&driver_data.ipmi_lock); |
582 | |||
561 | err = ipmi_request_settime(ipmi_device->user_interface, | 583 | err = ipmi_request_settime(ipmi_device->user_interface, |
562 | &tx_msg->addr, | 584 | &tx_msg->addr, |
563 | tx_msg->tx_msgid, | 585 | tx_msg->tx_msgid, |
564 | &tx_msg->tx_message, | 586 | &tx_msg->tx_message, |
565 | NULL, 0, 0, IPMI_TIMEOUT); | 587 | NULL, 0, 0, IPMI_TIMEOUT); |
566 | if (err) { | 588 | if (err) { |
567 | status = AE_ERROR; | 589 | status = AE_ERROR; |
568 | goto out_msg; | 590 | goto out_msg; |
569 | } | 591 | } |
570 | wait_for_completion(&tx_msg->tx_complete); | 592 | wait_for_completion(&tx_msg->tx_complete); |
593 | |||
571 | acpi_format_ipmi_response(tx_msg, value); | 594 | acpi_format_ipmi_response(tx_msg, value); |
572 | status = AE_OK; | 595 | status = AE_OK; |
573 | 596 | ||
@@ -586,8 +609,9 @@ static int __init acpi_ipmi_init(void) | |||
586 | return 0; | 609 | return 0; |
587 | 610 | ||
588 | status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT, | 611 | status = acpi_install_address_space_handler(ACPI_ROOT_OBJECT, |
589 | ACPI_ADR_SPACE_IPMI, &acpi_ipmi_space_handler, | 612 | ACPI_ADR_SPACE_IPMI, |
590 | NULL, NULL); | 613 | &acpi_ipmi_space_handler, |
614 | NULL, NULL); | ||
591 | if (ACPI_FAILURE(status)) { | 615 | if (ACPI_FAILURE(status)) { |
592 | pr_warn("Can't register IPMI opregion space handle\n"); | 616 | pr_warn("Can't register IPMI opregion space handle\n"); |
593 | return -EINVAL; | 617 | return -EINVAL; |
@@ -629,7 +653,8 @@ static void __exit acpi_ipmi_exit(void) | |||
629 | } | 653 | } |
630 | mutex_unlock(&driver_data.ipmi_lock); | 654 | mutex_unlock(&driver_data.ipmi_lock); |
631 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 655 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
632 | ACPI_ADR_SPACE_IPMI, &acpi_ipmi_space_handler); | 656 | ACPI_ADR_SPACE_IPMI, |
657 | &acpi_ipmi_space_handler); | ||
633 | } | 658 | } |
634 | 659 | ||
635 | module_init(acpi_ipmi_init); | 660 | module_init(acpi_ipmi_init); |