Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

IPMI: Style fixes in the misc code

Lots of style fixes for the miscellaneous IPMI files. No functional
changes. Basically fixes everything reported by checkpatch and fixes the
comment style.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Corey Minyard and committed by
Linus Torvalds
36c7dc44 c305e3d3

+225 -199
+92 -88
drivers/char/ipmi/ipmi_poweroff.c
··· 87 87 88 88 /* parameter definition to allow user to flag power cycle */ 89 89 module_param(poweroff_powercycle, int, 0644); 90 - MODULE_PARM_DESC(poweroff_powercycle, " Set to non-zero to enable power cycle instead of power down. Power cycle is contingent on hardware support, otherwise it defaults back to power down."); 90 + MODULE_PARM_DESC(poweroff_powercycle, 91 + " Set to non-zero to enable power cycle instead of power" 92 + " down. Power cycle is contingent on hardware support," 93 + " otherwise it defaults back to power down."); 91 94 92 95 /* Stuff from the get device id command. */ 93 96 static unsigned int mfg_id; ··· 98 95 static unsigned char capabilities; 99 96 static unsigned char ipmi_version; 100 97 101 - /* We use our own messages for this operation, we don't let the system 102 - allocate them, since we may be in a panic situation. The whole 103 - thing is single-threaded, anyway, so multiple messages are not 104 - required. */ 98 + /* 99 + * We use our own messages for this operation, we don't let the system 100 + * allocate them, since we may be in a panic situation. The whole 101 + * thing is single-threaded, anyway, so multiple messages are not 102 + * required. 103 + */ 105 104 static atomic_t dummy_count = ATOMIC_INIT(0); 106 105 static void dummy_smi_free(struct ipmi_smi_msg *msg) 107 106 { ··· 113 108 { 114 109 atomic_dec(&dummy_count); 115 110 } 116 - static struct ipmi_smi_msg halt_smi_msg = 117 - { 111 + static struct ipmi_smi_msg halt_smi_msg = { 118 112 .done = dummy_smi_free 119 113 }; 120 - static struct ipmi_recv_msg halt_recv_msg = 121 - { 114 + static struct ipmi_recv_msg halt_recv_msg = { 122 115 .done = dummy_recv_free 123 116 }; 124 117 ··· 133 130 complete(comp); 134 131 } 135 132 136 - static struct ipmi_user_hndl ipmi_poweroff_handler = 137 - { 133 + static struct ipmi_user_hndl ipmi_poweroff_handler = { 138 134 .ipmi_recv_hndl = receive_handler 139 135 }; 140 136 ··· 200 198 201 199 static void (*atca_oem_poweroff_hook)(ipmi_user_t user); 202 200 203 - static void pps_poweroff_atca (ipmi_user_t user) 201 + static void pps_poweroff_atca(ipmi_user_t user) 204 202 { 205 - struct ipmi_system_interface_addr smi_addr; 206 - struct kernel_ipmi_msg send_msg; 207 - int rv; 208 - /* 209 - * Configure IPMI address for local access 210 - */ 211 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 212 - smi_addr.channel = IPMI_BMC_CHANNEL; 213 - smi_addr.lun = 0; 203 + struct ipmi_system_interface_addr smi_addr; 204 + struct kernel_ipmi_msg send_msg; 205 + int rv; 206 + /* 207 + * Configure IPMI address for local access 208 + */ 209 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 210 + smi_addr.channel = IPMI_BMC_CHANNEL; 211 + smi_addr.lun = 0; 214 212 215 - printk(KERN_INFO PFX "PPS powerdown hook used"); 213 + printk(KERN_INFO PFX "PPS powerdown hook used"); 216 214 217 - send_msg.netfn = IPMI_NETFN_OEM; 218 - send_msg.cmd = IPMI_ATCA_PPS_GRACEFUL_RESTART; 219 - send_msg.data = IPMI_ATCA_PPS_IANA; 220 - send_msg.data_len = 3; 221 - rv = ipmi_request_in_rc_mode(user, 222 - (struct ipmi_addr *) &smi_addr, 223 - &send_msg); 224 - if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { 225 - printk(KERN_ERR PFX "Unable to send ATCA ," 226 - " IPMI error 0x%x\n", rv); 227 - } 215 + send_msg.netfn = IPMI_NETFN_OEM; 216 + send_msg.cmd = IPMI_ATCA_PPS_GRACEFUL_RESTART; 217 + send_msg.data = IPMI_ATCA_PPS_IANA; 218 + send_msg.data_len = 3; 219 + rv = ipmi_request_in_rc_mode(user, 220 + (struct ipmi_addr *) &smi_addr, 221 + &send_msg); 222 + if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { 223 + printk(KERN_ERR PFX "Unable to send ATCA ," 224 + " IPMI error 0x%x\n", rv); 225 + } 228 226 return; 229 227 } 230 228 231 - static int ipmi_atca_detect (ipmi_user_t user) 229 + static int ipmi_atca_detect(ipmi_user_t user) 232 230 { 233 231 struct ipmi_system_interface_addr smi_addr; 234 232 struct kernel_ipmi_msg send_msg; 235 233 int rv; 236 234 unsigned char data[1]; 237 235 238 - /* 239 - * Configure IPMI address for local access 240 - */ 241 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 242 - smi_addr.channel = IPMI_BMC_CHANNEL; 243 - smi_addr.lun = 0; 236 + /* 237 + * Configure IPMI address for local access 238 + */ 239 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 240 + smi_addr.channel = IPMI_BMC_CHANNEL; 241 + smi_addr.lun = 0; 244 242 245 243 /* 246 244 * Use get address info to check and see if we are ATCA ··· 254 252 (struct ipmi_addr *) &smi_addr, 255 253 &send_msg); 256 254 257 - printk(KERN_INFO PFX "ATCA Detect mfg 0x%X prod 0x%X\n", mfg_id, prod_id); 258 - if((mfg_id == IPMI_MOTOROLA_MANUFACTURER_ID) 259 - && (prod_id == IPMI_MOTOROLA_PPS_IPMC_PRODUCT_ID)) { 260 - printk(KERN_INFO PFX "Installing Pigeon Point Systems Poweroff Hook\n"); 255 + printk(KERN_INFO PFX "ATCA Detect mfg 0x%X prod 0x%X\n", 256 + mfg_id, prod_id); 257 + if ((mfg_id == IPMI_MOTOROLA_MANUFACTURER_ID) 258 + && (prod_id == IPMI_MOTOROLA_PPS_IPMC_PRODUCT_ID)) { 259 + printk(KERN_INFO PFX 260 + "Installing Pigeon Point Systems Poweroff Hook\n"); 261 261 atca_oem_poweroff_hook = pps_poweroff_atca; 262 262 } 263 263 return !rv; 264 264 } 265 265 266 - static void ipmi_poweroff_atca (ipmi_user_t user) 266 + static void ipmi_poweroff_atca(ipmi_user_t user) 267 267 { 268 268 struct ipmi_system_interface_addr smi_addr; 269 269 struct kernel_ipmi_msg send_msg; 270 270 int rv; 271 271 unsigned char data[4]; 272 272 273 - /* 274 - * Configure IPMI address for local access 275 - */ 276 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 277 - smi_addr.channel = IPMI_BMC_CHANNEL; 278 - smi_addr.lun = 0; 273 + /* 274 + * Configure IPMI address for local access 275 + */ 276 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 277 + smi_addr.channel = IPMI_BMC_CHANNEL; 278 + smi_addr.lun = 0; 279 279 280 280 printk(KERN_INFO PFX "Powering down via ATCA power command\n"); 281 281 ··· 291 287 data[2] = 0; /* Power Level */ 292 288 data[3] = 0; /* Don't change saved presets */ 293 289 send_msg.data = data; 294 - send_msg.data_len = sizeof (data); 290 + send_msg.data_len = sizeof(data); 295 291 rv = ipmi_request_in_rc_mode(user, 296 292 (struct ipmi_addr *) &smi_addr, 297 293 &send_msg); 298 - /** At this point, the system may be shutting down, and most 299 - ** serial drivers (if used) will have interrupts turned off 300 - ** it may be better to ignore IPMI_UNKNOWN_ERR_COMPLETION_CODE 301 - ** return code 302 - **/ 303 - if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { 294 + /* 295 + * At this point, the system may be shutting down, and most 296 + * serial drivers (if used) will have interrupts turned off 297 + * it may be better to ignore IPMI_UNKNOWN_ERR_COMPLETION_CODE 298 + * return code 299 + */ 300 + if (rv && rv != IPMI_UNKNOWN_ERR_COMPLETION_CODE) { 304 301 printk(KERN_ERR PFX "Unable to send ATCA powerdown message," 305 302 " IPMI error 0x%x\n", rv); 306 303 goto out; 307 304 } 308 305 309 - if(atca_oem_poweroff_hook) 306 + if (atca_oem_poweroff_hook) 310 307 return atca_oem_poweroff_hook(user); 311 308 out: 312 309 return; ··· 329 324 #define IPMI_CPI1_PRODUCT_ID 0x000157 330 325 #define IPMI_CPI1_MANUFACTURER_ID 0x0108 331 326 332 - static int ipmi_cpi1_detect (ipmi_user_t user) 327 + static int ipmi_cpi1_detect(ipmi_user_t user) 333 328 { 334 329 return ((mfg_id == IPMI_CPI1_MANUFACTURER_ID) 335 330 && (prod_id == IPMI_CPI1_PRODUCT_ID)); 336 331 } 337 332 338 - static void ipmi_poweroff_cpi1 (ipmi_user_t user) 333 + static void ipmi_poweroff_cpi1(ipmi_user_t user) 339 334 { 340 335 struct ipmi_system_interface_addr smi_addr; 341 336 struct ipmi_ipmb_addr ipmb_addr; ··· 347 342 unsigned char aer_addr; 348 343 unsigned char aer_lun; 349 344 350 - /* 351 - * Configure IPMI address for local access 352 - */ 353 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 354 - smi_addr.channel = IPMI_BMC_CHANNEL; 355 - smi_addr.lun = 0; 345 + /* 346 + * Configure IPMI address for local access 347 + */ 348 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 349 + smi_addr.channel = IPMI_BMC_CHANNEL; 350 + smi_addr.lun = 0; 356 351 357 352 printk(KERN_INFO PFX "Powering down via CPI1 power command\n"); 358 353 ··· 444 439 */ 445 440 446 441 #define DELL_IANA_MFR_ID {0xA2, 0x02, 0x00} 447 - static int ipmi_dell_chassis_detect (ipmi_user_t user) 442 + static int ipmi_dell_chassis_detect(ipmi_user_t user) 448 443 { 449 444 const char ipmi_version_major = ipmi_version & 0xF; 450 445 const char ipmi_version_minor = (ipmi_version >> 4) & 0xF; ··· 463 458 #define IPMI_NETFN_CHASSIS_REQUEST 0 464 459 #define IPMI_CHASSIS_CONTROL_CMD 0x02 465 460 466 - static int ipmi_chassis_detect (ipmi_user_t user) 461 + static int ipmi_chassis_detect(ipmi_user_t user) 467 462 { 468 463 /* Chassis support, use it. */ 469 464 return (capabilities & 0x80); 470 465 } 471 466 472 - static void ipmi_poweroff_chassis (ipmi_user_t user) 467 + static void ipmi_poweroff_chassis(ipmi_user_t user) 473 468 { 474 469 struct ipmi_system_interface_addr smi_addr; 475 470 struct kernel_ipmi_msg send_msg; 476 471 int rv; 477 472 unsigned char data[1]; 478 473 479 - /* 480 - * Configure IPMI address for local access 481 - */ 482 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 483 - smi_addr.channel = IPMI_BMC_CHANNEL; 484 - smi_addr.lun = 0; 474 + /* 475 + * Configure IPMI address for local access 476 + */ 477 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 478 + smi_addr.channel = IPMI_BMC_CHANNEL; 479 + smi_addr.lun = 0; 485 480 486 481 powercyclefailed: 487 482 printk(KERN_INFO PFX "Powering %s via IPMI chassis control command\n", ··· 544 539 545 540 546 541 /* Called on a powerdown request. */ 547 - static void ipmi_poweroff_function (void) 542 + static void ipmi_poweroff_function(void) 548 543 { 549 544 if (!ready) 550 545 return; ··· 578 573 579 574 ipmi_ifnum = if_num; 580 575 581 - /* 582 - * Do a get device ide and store some results, since this is 576 + /* 577 + * Do a get device ide and store some results, since this is 583 578 * used by several functions. 584 - */ 585 - smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 586 - smi_addr.channel = IPMI_BMC_CHANNEL; 587 - smi_addr.lun = 0; 579 + */ 580 + smi_addr.addr_type = IPMI_SYSTEM_INTERFACE_ADDR_TYPE; 581 + smi_addr.channel = IPMI_BMC_CHANNEL; 582 + smi_addr.lun = 0; 588 583 589 584 send_msg.netfn = IPMI_NETFN_APP_REQUEST; 590 585 send_msg.cmd = IPMI_GET_DEVICE_ID_CMD; ··· 649 644 pm_power_off = old_poweroff_func; 650 645 } 651 646 652 - static struct ipmi_smi_watcher smi_watcher = 653 - { 647 + static struct ipmi_smi_watcher smi_watcher = { 654 648 .owner = THIS_MODULE, 655 649 .new_smi = ipmi_po_new_smi, 656 650 .smi_gone = ipmi_po_smi_gone ··· 691 687 /* 692 688 * Startup and shutdown functions. 693 689 */ 694 - static int ipmi_poweroff_init (void) 690 + static int ipmi_poweroff_init(void) 695 691 { 696 692 int rv; 697 693 698 - printk (KERN_INFO "Copyright (C) 2004 MontaVista Software -" 699 - " IPMI Powerdown via sys_reboot.\n"); 694 + printk(KERN_INFO "Copyright (C) 2004 MontaVista Software -" 695 + " IPMI Powerdown via sys_reboot.\n"); 700 696 701 697 if (poweroff_powercycle) 702 698 printk(KERN_INFO PFX "Power cycle is enabled.\n");
+133 -111
drivers/char/ipmi/ipmi_watchdog.c
··· 54 54 #include <asm/atomic.h> 55 55 56 56 #ifdef CONFIG_X86 57 - /* This is ugly, but I've determined that x86 is the only architecture 58 - that can reasonably support the IPMI NMI watchdog timeout at this 59 - time. If another architecture adds this capability somehow, it 60 - will have to be a somewhat different mechanism and I have no idea 61 - how it will work. So in the unlikely event that another 62 - architecture supports this, we can figure out a good generic 63 - mechanism for it at that time. */ 57 + /* 58 + * This is ugly, but I've determined that x86 is the only architecture 59 + * that can reasonably support the IPMI NMI watchdog timeout at this 60 + * time. If another architecture adds this capability somehow, it 61 + * will have to be a somewhat different mechanism and I have no idea 62 + * how it will work. So in the unlikely event that another 63 + * architecture supports this, we can figure out a good generic 64 + * mechanism for it at that time. 65 + */ 64 66 #include <asm/kdebug.h> 65 67 #define HAVE_DIE_NMI 66 68 #endif ··· 97 95 /* Operations that can be performed on a pretimout. */ 98 96 #define WDOG_PREOP_NONE 0 99 97 #define WDOG_PREOP_PANIC 1 100 - #define WDOG_PREOP_GIVE_DATA 2 /* Cause data to be available to 101 - read. Doesn't work in NMI 102 - mode. */ 98 + /* Cause data to be available to read. Doesn't work in NMI mode. */ 99 + #define WDOG_PREOP_GIVE_DATA 2 103 100 104 101 /* Actions to perform on a full timeout. */ 105 102 #define WDOG_SET_TIMEOUT_ACT(byte, use) \ ··· 109 108 #define WDOG_TIMEOUT_POWER_DOWN 2 110 109 #define WDOG_TIMEOUT_POWER_CYCLE 3 111 110 112 - /* Byte 3 of the get command, byte 4 of the get response is the 113 - pre-timeout in seconds. */ 111 + /* 112 + * Byte 3 of the get command, byte 4 of the get response is the 113 + * pre-timeout in seconds. 114 + */ 114 115 115 116 /* Bits for setting byte 4 of the set command, byte 5 of the get response. */ 116 117 #define WDOG_EXPIRE_CLEAR_BIOS_FRB2 (1 << 1) ··· 121 118 #define WDOG_EXPIRE_CLEAR_SMS_OS (1 << 4) 122 119 #define WDOG_EXPIRE_CLEAR_OEM (1 << 5) 123 120 124 - /* Setting/getting the watchdog timer value. This is for bytes 5 and 125 - 6 (the timeout time) of the set command, and bytes 6 and 7 (the 126 - timeout time) and 8 and 9 (the current countdown value) of the 127 - response. The timeout value is given in seconds (in the command it 128 - is 100ms intervals). */ 121 + /* 122 + * Setting/getting the watchdog timer value. This is for bytes 5 and 123 + * 6 (the timeout time) of the set command, and bytes 6 and 7 (the 124 + * timeout time) and 8 and 9 (the current countdown value) of the 125 + * response. The timeout value is given in seconds (in the command it 126 + * is 100ms intervals). 127 + */ 129 128 #define WDOG_SET_TIMEOUT(byte1, byte2, val) \ 130 129 (byte1) = (((val) * 10) & 0xff), (byte2) = (((val) * 10) >> 8) 131 130 #define WDOG_GET_TIMEOUT(byte1, byte2) \ ··· 189 184 static void ipmi_register_watchdog(int ipmi_intf); 190 185 static void ipmi_unregister_watchdog(int ipmi_intf); 191 186 192 - /* If true, the driver will start running as soon as it is configured 193 - and ready. */ 187 + /* 188 + * If true, the driver will start running as soon as it is configured 189 + * and ready. 190 + */ 194 191 static int start_now; 195 192 196 193 static int set_param_int(const char *val, struct kernel_param *kp) ··· 316 309 /* Is someone using the watchdog? Only one user is allowed. */ 317 310 static unsigned long ipmi_wdog_open; 318 311 319 - /* If set to 1, the heartbeat command will set the state to reset and 320 - start the timer. The timer doesn't normally run when the driver is 321 - first opened until the heartbeat is set the first time, this 322 - variable is used to accomplish this. */ 312 + /* 313 + * If set to 1, the heartbeat command will set the state to reset and 314 + * start the timer. The timer doesn't normally run when the driver is 315 + * first opened until the heartbeat is set the first time, this 316 + * variable is used to accomplish this. 317 + */ 323 318 static int ipmi_start_timer_on_heartbeat; 324 319 325 320 /* IPMI version of the BMC. */ ··· 338 329 339 330 static int ipmi_heartbeat(void); 340 331 341 - /* We use a mutex to make sure that only one thing can send a set 342 - timeout at one time, because we only have one copy of the data. 343 - The mutex is claimed when the set_timeout is sent and freed 344 - when both messages are free. */ 332 + /* 333 + * We use a mutex to make sure that only one thing can send a set 334 + * timeout at one time, because we only have one copy of the data. 335 + * The mutex is claimed when the set_timeout is sent and freed 336 + * when both messages are free. 337 + */ 345 338 static atomic_t set_timeout_tofree = ATOMIC_INIT(0); 346 339 static DEFINE_MUTEX(set_timeout_lock); 347 340 static DECLARE_COMPLETION(set_timeout_wait); ··· 357 346 if (atomic_dec_and_test(&set_timeout_tofree)) 358 347 complete(&set_timeout_wait); 359 348 } 360 - static struct ipmi_smi_msg set_timeout_smi_msg = 361 - { 349 + static struct ipmi_smi_msg set_timeout_smi_msg = { 362 350 .done = set_timeout_free_smi 363 351 }; 364 - static struct ipmi_recv_msg set_timeout_recv_msg = 365 - { 352 + static struct ipmi_recv_msg set_timeout_recv_msg = { 366 353 .done = set_timeout_free_recv 367 354 }; 368 - 355 + 369 356 static int i_ipmi_set_timeout(struct ipmi_smi_msg *smi_msg, 370 357 struct ipmi_recv_msg *recv_msg, 371 358 int *send_heartbeat_now) ··· 382 373 WDOG_SET_TIMER_USE(data[0], WDOG_TIMER_USE_SMS_OS); 383 374 384 375 if ((ipmi_version_major > 1) 385 - || ((ipmi_version_major == 1) && (ipmi_version_minor >= 5))) 386 - { 376 + || ((ipmi_version_major == 1) && (ipmi_version_minor >= 5))) { 387 377 /* This is an IPMI 1.5-only feature. */ 388 378 data[0] |= WDOG_DONT_STOP_ON_SET; 389 379 } else if (ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { 390 - /* In ipmi 1.0, setting the timer stops the watchdog, we 391 - need to start it back up again. */ 380 + /* 381 + * In ipmi 1.0, setting the timer stops the watchdog, we 382 + * need to start it back up again. 383 + */ 392 384 hbnow = 1; 393 385 } 394 386 ··· 475 465 atomic_dec(&panic_done_count); 476 466 } 477 467 478 - static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = 479 - { 468 + static struct ipmi_smi_msg panic_halt_heartbeat_smi_msg = { 480 469 .done = panic_smi_free 481 470 }; 482 - static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = 483 - { 471 + static struct ipmi_recv_msg panic_halt_heartbeat_recv_msg = { 484 472 .done = panic_recv_free 485 473 }; 486 474 ··· 488 480 struct ipmi_system_interface_addr addr; 489 481 int rv; 490 482 491 - /* Don't reset the timer if we have the timer turned off, that 492 - re-enables the watchdog. */ 483 + /* 484 + * Don't reset the timer if we have the timer turned off, that 485 + * re-enables the watchdog. 486 + */ 493 487 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) 494 488 return; 495 489 ··· 515 505 atomic_add(2, &panic_done_count); 516 506 } 517 507 518 - static struct ipmi_smi_msg panic_halt_smi_msg = 519 - { 508 + static struct ipmi_smi_msg panic_halt_smi_msg = { 520 509 .done = panic_smi_free 521 510 }; 522 - static struct ipmi_recv_msg panic_halt_recv_msg = 523 - { 511 + static struct ipmi_recv_msg panic_halt_recv_msg = { 524 512 .done = panic_recv_free 525 513 }; 526 514 527 - /* Special call, doesn't claim any locks. This is only to be called 528 - at panic or halt time, in run-to-completion mode, when the caller 529 - is the only CPU and the only thing that will be going is these IPMI 530 - calls. */ 515 + /* 516 + * Special call, doesn't claim any locks. This is only to be called 517 + * at panic or halt time, in run-to-completion mode, when the caller 518 + * is the only CPU and the only thing that will be going is these IPMI 519 + * calls. 520 + */ 531 521 static void panic_halt_ipmi_set_timeout(void) 532 522 { 533 523 int send_heartbeat_now; ··· 550 540 ipmi_poll_interface(watchdog_user); 551 541 } 552 542 553 - /* We use a semaphore to make sure that only one thing can send a 554 - heartbeat at one time, because we only have one copy of the data. 555 - The semaphore is claimed when the set_timeout is sent and freed 556 - when both messages are free. */ 543 + /* 544 + * We use a mutex to make sure that only one thing can send a 545 + * heartbeat at one time, because we only have one copy of the data. 546 + * The semaphore is claimed when the set_timeout is sent and freed 547 + * when both messages are free. 548 + */ 557 549 static atomic_t heartbeat_tofree = ATOMIC_INIT(0); 558 550 static DEFINE_MUTEX(heartbeat_lock); 559 551 static DECLARE_COMPLETION(heartbeat_wait); ··· 569 557 if (atomic_dec_and_test(&heartbeat_tofree)) 570 558 complete(&heartbeat_wait); 571 559 } 572 - static struct ipmi_smi_msg heartbeat_smi_msg = 573 - { 560 + static struct ipmi_smi_msg heartbeat_smi_msg = { 574 561 .done = heartbeat_free_smi 575 562 }; 576 - static struct ipmi_recv_msg heartbeat_recv_msg = 577 - { 563 + static struct ipmi_recv_msg heartbeat_recv_msg = { 578 564 .done = heartbeat_free_recv 579 565 }; 580 - 566 + 581 567 static int ipmi_heartbeat(void) 582 568 { 583 569 struct kernel_ipmi_msg msg; ··· 590 580 ipmi_watchdog_state = action_val; 591 581 return ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB); 592 582 } else if (pretimeout_since_last_heartbeat) { 593 - /* A pretimeout occurred, make sure we set the timeout. 594 - We don't want to set the action, though, we want to 595 - leave that alone (thus it can't be combined with the 596 - above operation. */ 583 + /* 584 + * A pretimeout occurred, make sure we set the timeout. 585 + * We don't want to set the action, though, we want to 586 + * leave that alone (thus it can't be combined with the 587 + * above operation. 588 + */ 597 589 return ipmi_set_timeout(IPMI_SET_TIMEOUT_HB_IF_NECESSARY); 598 590 } 599 591 ··· 603 591 604 592 atomic_set(&heartbeat_tofree, 2); 605 593 606 - /* Don't reset the timer if we have the timer turned off, that 607 - re-enables the watchdog. */ 594 + /* 595 + * Don't reset the timer if we have the timer turned off, that 596 + * re-enables the watchdog. 597 + */ 608 598 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) { 609 599 mutex_unlock(&heartbeat_lock); 610 600 return 0; ··· 639 625 wait_for_completion(&heartbeat_wait); 640 626 641 627 if (heartbeat_recv_msg.msg.data[0] != 0) { 642 - /* Got an error in the heartbeat response. It was already 643 - reported in ipmi_wdog_msg_handler, but we should return 644 - an error here. */ 645 - rv = -EINVAL; 628 + /* 629 + * Got an error in the heartbeat response. It was already 630 + * reported in ipmi_wdog_msg_handler, but we should return 631 + * an error here. 632 + */ 633 + rv = -EINVAL; 646 634 } 647 635 648 636 mutex_unlock(&heartbeat_lock); ··· 652 636 return rv; 653 637 } 654 638 655 - static struct watchdog_info ident = 656 - { 639 + static struct watchdog_info ident = { 657 640 .options = 0, /* WDIOF_SETTIMEOUT, */ 658 641 .firmware_version = 1, 659 642 .identity = "IPMI" ··· 665 650 int i; 666 651 int val; 667 652 668 - switch(cmd) { 653 + switch (cmd) { 669 654 case WDIOC_GETSUPPORT: 670 655 i = copy_to_user(argp, &ident, sizeof(ident)); 671 656 return i ? -EFAULT : 0; ··· 705 690 i = copy_from_user(&val, argp, sizeof(int)); 706 691 if (i) 707 692 return -EFAULT; 708 - if (val & WDIOS_DISABLECARD) 709 - { 693 + if (val & WDIOS_DISABLECARD) { 710 694 ipmi_watchdog_state = WDOG_TIMEOUT_NONE; 711 695 ipmi_set_timeout(IPMI_SET_TIMEOUT_NO_HB); 712 696 ipmi_start_timer_on_heartbeat = 0; 713 697 } 714 698 715 - if (val & WDIOS_ENABLECARD) 716 - { 699 + if (val & WDIOS_ENABLECARD) { 717 700 ipmi_watchdog_state = action_val; 718 701 ipmi_set_timeout(IPMI_SET_TIMEOUT_FORCE_HB); 719 702 } ··· 737 724 int rv; 738 725 739 726 if (len) { 740 - if (!nowayout) { 741 - size_t i; 727 + if (!nowayout) { 728 + size_t i; 742 729 743 730 /* In case it was set long ago */ 744 731 expect_close = 0; 745 732 746 - for (i = 0; i != len; i++) { 733 + for (i = 0; i != len; i++) { 747 734 char c; 748 735 749 736 if (get_user(c, buf + i)) ··· 771 758 if (count <= 0) 772 759 return 0; 773 760 774 - /* Reading returns if the pretimeout has gone off, and it only does 775 - it once per pretimeout. */ 761 + /* 762 + * Reading returns if the pretimeout has gone off, and it only does 763 + * it once per pretimeout. 764 + */ 776 765 spin_lock(&ipmi_read_lock); 777 766 if (!data_to_read) { 778 767 if (file->f_flags & O_NONBLOCK) { 779 768 rv = -EAGAIN; 780 769 goto out; 781 770 } 782 - 771 + 783 772 init_waitqueue_entry(&wait, current); 784 773 add_wait_queue(&read_q, &wait); 785 774 while (!data_to_read) { ··· 791 776 spin_lock(&ipmi_read_lock); 792 777 } 793 778 remove_wait_queue(&read_q, &wait); 794 - 779 + 795 780 if (signal_pending(current)) { 796 781 rv = -ERESTARTSYS; 797 782 goto out; ··· 814 799 815 800 static int ipmi_open(struct inode *ino, struct file *filep) 816 801 { 817 - switch (iminor(ino)) { 818 - case WATCHDOG_MINOR: 802 + switch (iminor(ino)) { 803 + case WATCHDOG_MINOR: 819 804 if (test_and_set_bit(0, &ipmi_wdog_open)) 820 - return -EBUSY; 805 + return -EBUSY; 821 806 822 - /* Don't start the timer now, let it start on the 823 - first heartbeat. */ 807 + /* 808 + * Don't start the timer now, let it start on the 809 + * first heartbeat. 810 + */ 824 811 ipmi_start_timer_on_heartbeat = 1; 825 812 return nonseekable_open(ino, filep); 826 813 827 814 default: 828 815 return (-ENODEV); 829 - } 816 + } 830 817 } 831 818 832 819 static unsigned int ipmi_poll(struct file *file, poll_table *wait) 833 820 { 834 821 unsigned int mask = 0; 835 - 822 + 836 823 poll_wait(file, &read_q, wait); 837 824 838 825 spin_lock(&ipmi_read_lock); ··· 868 851 clear_bit(0, &ipmi_wdog_open); 869 852 } 870 853 871 - ipmi_fasync (-1, filep, 0); 854 + ipmi_fasync(-1, filep, 0); 872 855 expect_close = 0; 873 856 874 857 return 0; ··· 899 882 msg->msg.data[0], 900 883 msg->msg.cmd); 901 884 } 902 - 885 + 903 886 ipmi_free_recv_msg(msg); 904 887 } 905 888 ··· 919 902 } 920 903 } 921 904 922 - /* On some machines, the heartbeat will give 923 - an error and not work unless we re-enable 924 - the timer. So do so. */ 905 + /* 906 + * On some machines, the heartbeat will give an error and not 907 + * work unless we re-enable the timer. So do so. 908 + */ 925 909 pretimeout_since_last_heartbeat = 1; 926 910 } 927 911 928 - static struct ipmi_user_hndl ipmi_hndlrs = 929 - { 912 + static struct ipmi_user_hndl ipmi_hndlrs = { 930 913 .ipmi_recv_hndl = ipmi_wdog_msg_handler, 931 914 .ipmi_watchdog_pretimeout = ipmi_wdog_pretimeout_handler 932 915 }; ··· 966 949 int old_timeout = timeout; 967 950 int old_preop_val = preop_val; 968 951 969 - /* Set the pretimeout to go off in a second and give 970 - ourselves plenty of time to stop the timer. */ 952 + /* 953 + * Set the pretimeout to go off in a second and give 954 + * ourselves plenty of time to stop the timer. 955 + */ 971 956 ipmi_watchdog_state = WDOG_TIMEOUT_RESET; 972 957 preop_val = WDOG_PREOP_NONE; /* Make sure nothing happens */ 973 958 pretimeout = 99; ··· 993 974 " occur. The NMI pretimeout will" 994 975 " likely not work\n"); 995 976 } 996 - out_restore: 977 + out_restore: 997 978 testing_nmi = 0; 998 979 preop_val = old_preop_val; 999 980 pretimeout = old_pretimeout; ··· 1028 1009 /* Make sure no one can call us any more. */ 1029 1010 misc_deregister(&ipmi_wdog_miscdev); 1030 1011 1031 - /* Wait to make sure the message makes it out. The lower layer has 1032 - pointers to our buffers, we want to make sure they are done before 1033 - we release our memory. */ 1012 + /* 1013 + * Wait to make sure the message makes it out. The lower layer has 1014 + * pointers to our buffers, we want to make sure they are done before 1015 + * we release our memory. 1016 + */ 1034 1017 while (atomic_read(&set_timeout_tofree)) 1035 1018 schedule_timeout_uninterruptible(1); 1036 1019 ··· 1073 1052 return NOTIFY_STOP; 1074 1053 } 1075 1054 1076 - /* If we are not expecting a timeout, ignore it. */ 1055 + /* If we are not expecting a timeout, ignore it. */ 1077 1056 if (ipmi_watchdog_state == WDOG_TIMEOUT_NONE) 1078 1057 return NOTIFY_OK; 1079 1058 1080 1059 if (preaction_val != WDOG_PRETIMEOUT_NMI) 1081 1060 return NOTIFY_OK; 1082 1061 1083 - /* If no one else handled the NMI, we assume it was the IPMI 1084 - watchdog. */ 1062 + /* 1063 + * If no one else handled the NMI, we assume it was the IPMI 1064 + * watchdog. 1065 + */ 1085 1066 if (preop_val == WDOG_PREOP_PANIC) { 1086 1067 /* On some machines, the heartbeat will give 1087 1068 an error and not work unless we re-enable ··· 1105 1082 unsigned long code, 1106 1083 void *unused) 1107 1084 { 1108 - static int reboot_event_handled = 0; 1085 + static int reboot_event_handled; 1109 1086 1110 1087 if ((watchdog_user) && (!reboot_event_handled)) { 1111 1088 /* Make sure we only do this once. */ ··· 1138 1115 unsigned long event, 1139 1116 void *unused) 1140 1117 { 1141 - static int panic_event_handled = 0; 1118 + static int panic_event_handled; 1142 1119 1143 1120 /* On a panic, if we have a panic timeout, make sure to extend 1144 1121 the watchdog timer to a reasonable value to complete the ··· 1148 1125 ipmi_watchdog_state != WDOG_TIMEOUT_NONE) { 1149 1126 /* Make sure we do this only once. */ 1150 1127 panic_event_handled = 1; 1151 - 1128 + 1152 1129 timeout = 255; 1153 1130 pretimeout = 0; 1154 1131 panic_halt_ipmi_set_timeout(); ··· 1174 1151 ipmi_unregister_watchdog(if_num); 1175 1152 } 1176 1153 1177 - static struct ipmi_smi_watcher smi_watcher = 1178 - { 1154 + static struct ipmi_smi_watcher smi_watcher = { 1179 1155 .owner = THIS_MODULE, 1180 1156 .new_smi = ipmi_new_smi, 1181 1157 .smi_gone = ipmi_smi_gone