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

Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog

* git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog:
[WATCHDOG] make watchdog/hpwdt.c:asminline_call() static
[WATCHDOG] Remove volatiles from watchdog device structures
[WATCHDOG] replace remaining __FUNCTION__ occurrences
[WATCHDOG] hpwdt: Use dmi_walk() instead of own copy
[WATCHDOG] Fix return value warning in hpwdt
[WATCHDOG] Fix declaration of struct smbios_entry_point in hpwdt
[WATCHDOG] it8712f_wdt support for 16-bit timeout values, WDIOC_GETSTATUS

+99 -215
+2 -2
drivers/watchdog/cpu5wdt.c
··· 59 59 60 60 static struct { 61 61 struct completion stop; 62 - volatile int running; 62 + int running; 63 63 struct timer_list timer; 64 - volatile int queue; 64 + int queue; 65 65 int default_ticks; 66 66 unsigned long inuse; 67 67 } cpu5wdt_device;
+24 -190
drivers/watchdog/hpwdt.c
··· 58 58 u8 reserved[5]; 59 59 }; 60 60 61 - /* 62 - * smbios_entry_point - defines SMBIOS entry point structure 63 - * 64 - * anchor[4] - anchor string (_SM_) 65 - * checksum - checksum of the entry point structure 66 - * length - length of the entry point structure 67 - * major_ver - major version (02h for revision 2.1) 68 - * minor_ver - minor version (01h for revision 2.1) 69 - * max_struct_size - size of the largest SMBIOS structure 70 - * revision - entry point structure revision implemented 71 - * formatted_area[5] - reserved 72 - * intermediate_anchor[5] - intermediate anchor string (_DMI_) 73 - * intermediate_checksum - intermediate checksum 74 - * table_length - structure table length 75 - * table_address - structure table address 76 - * table_num_structs - number of SMBIOS structures present 77 - * bcd_revision - BCD revision 78 - */ 79 - struct smbios_entry_point { 80 - u8 anchor[4]; 81 - u8 checksum; 82 - u8 length; 83 - u8 major_ver; 84 - u8 minor_ver; 85 - u16 max_struct_size; 86 - u8 revision; 87 - u8 formatted_area[5]; 88 - u8 intermediate_anchor[5]; 89 - u8 intermediate_checksum; 90 - u16 table_length; 91 - u64 table_address; 92 - u16 table_num_structs; 93 - u8 bcd_revision; 94 - }; 95 - 96 61 /* type 212 */ 97 62 struct smbios_cru64_info { 98 63 u8 type; ··· 140 175 }; 141 176 MODULE_DEVICE_TABLE(pci, hpwdt_devices); 142 177 143 - /* 144 - * bios_checksum 145 - */ 146 - static int __devinit bios_checksum(const char __iomem *ptr, int len) 147 - { 148 - char sum = 0; 149 - int i; 150 - 151 - /* 152 - * calculate checksum of size bytes. This should add up 153 - * to zero if we have a valid header. 154 - */ 155 - for (i = 0; i < len; i++) 156 - sum += ptr[i]; 157 - 158 - return ((sum == 0) && (len > 0)); 159 - } 160 - 161 178 #ifndef CONFIG_X86_64 162 179 /* --32 Bit Bios------------------------------------------------------------ */ 163 180 164 181 #define HPWDT_ARCH 32 165 182 166 - asmlinkage void asminline_call(struct cmn_registers *pi86Regs, 167 - unsigned long *pRomEntry) 183 + static void asminline_call(struct cmn_registers *pi86Regs, 184 + unsigned long *pRomEntry) 168 185 { 169 186 asm("pushl %ebp \n\t" 170 187 "movl %esp, %ebp \n\t" ··· 250 303 } 251 304 252 305 /* 306 + * bios_checksum 307 + */ 308 + static int __devinit bios_checksum(const char __iomem *ptr, int len) 309 + { 310 + char sum = 0; 311 + int i; 312 + 313 + /* 314 + * calculate checksum of size bytes. This should add up 315 + * to zero if we have a valid header. 316 + */ 317 + for (i = 0; i < len; i++) 318 + sum += ptr[i]; 319 + 320 + return ((sum == 0) && (len > 0)); 321 + } 322 + 323 + /* 253 324 * bios32_present 254 325 * 255 326 * Routine Description: ··· 333 368 334 369 #define HPWDT_ARCH 64 335 370 336 - asmlinkage void asminline_call(struct cmn_registers *pi86Regs, 337 - unsigned long *pRomEntry) 371 + static void asminline_call(struct cmn_registers *pi86Regs, 372 + unsigned long *pRomEntry) 338 373 { 339 374 asm("pushq %rbp \n\t" 340 375 "movq %rsp, %rbp \n\t" ··· 375 410 * dmi_find_cru 376 411 * 377 412 * Routine Description: 378 - * This function checks wether or not a SMBIOS/DMI record is 413 + * This function checks whether or not a SMBIOS/DMI record is 379 414 * the 64bit CRU info or not 380 - * 381 - * Return Value: 382 - * 0 : SUCCESS - if record found 383 - * <0 : FAILURE - if record not found 384 415 */ 385 416 static void __devinit dmi_find_cru(const struct dmi_header *dm) 386 417 { ··· 395 434 } 396 435 } 397 436 398 - /* 399 - * dmi_table 400 - * 401 - * Routine Description: 402 - * Decode the SMBIOS/DMI table and check if we have a 64bit CRU record 403 - * or not. 404 - * 405 - * We have to be cautious here. We have seen BIOSes with DMI pointers 406 - * pointing to completely the wrong place for example 407 - */ 408 - static void __devinit dmi_table(u8 *buf, int len, int num, 409 - void (*decode)(const struct dmi_header *)) 410 - { 411 - u8 *data = buf; 412 - int i = 0; 413 - 414 - /* 415 - * Stop when we see all the items the table claimed to have 416 - * OR we run off the end of the table (also happens) 417 - */ 418 - while ((i < num) && (data - buf + sizeof(struct dmi_header)) <= len) { 419 - const struct dmi_header *dm = (const struct dmi_header *)data; 420 - 421 - /* 422 - * We want to know the total length (formated area and strings) 423 - * before decoding to make sure we won't run off the table in 424 - * dmi_decode or dmi_string 425 - */ 426 - data += dm->length; 427 - while ((data - buf < len - 1) && (data[0] || data[1])) 428 - data++; 429 - if (data - buf < len - 1) 430 - decode(dm); 431 - data += 2; 432 - i++; 433 - } 434 - } 435 - 436 - /* 437 - * smbios_present 438 - * 439 - * Routine Description: 440 - * This function parses the SMBIOS entry point table to retrieve 441 - * the 64 bit CRU Service. 442 - * 443 - * Return Value: 444 - * 0 : SUCCESS 445 - * <0 : FAILURE 446 - */ 447 - static int __devinit smbios_present(const char __iomem *p) 448 - { 449 - struct smbios_entry_point *eps = 450 - (struct smbios_entry_point *) p; 451 - int length; 452 - u8 *buf; 453 - 454 - /* check if we have indeed the SMBIOS table entry point */ 455 - if ((strncmp((char *)eps->anchor, "_SM_", 456 - sizeof(eps->anchor))) == 0) { 457 - length = eps->length; 458 - 459 - /* SMBIOS v2.1 implementation might use 0x1e */ 460 - if ((length == 0x1e) && 461 - (eps->major_ver == 2) && 462 - (eps->minor_ver == 1)) 463 - length = 0x1f; 464 - 465 - /* 466 - * Now we will check: 467 - * - SMBIOS checksum must be 0 468 - * - intermediate anchor should be _DMI_ 469 - * - intermediate checksum should be 0 470 - */ 471 - if ((bios_checksum(p, length)) && 472 - (strncmp((char *)eps->intermediate_anchor, "_DMI_", 473 - sizeof(eps->intermediate_anchor)) == 0) && 474 - (bios_checksum(p+0x10, 15))) { 475 - buf = ioremap(eps->table_address, eps->table_length); 476 - if (buf == NULL) 477 - return -ENODEV; 478 - 479 - 480 - /* Scan the DMI table for the 64 bit CRU service */ 481 - dmi_table(buf, eps->table_length, 482 - eps->table_num_structs, dmi_find_cru); 483 - 484 - iounmap(buf); 485 - return 0; 486 - } 487 - } 488 - 489 - return -ENODEV; 490 - } 491 - 492 - static int __devinit smbios_scan_machine(void) 493 - { 494 - char __iomem *p, *q; 495 - int rc; 496 - 497 - if (efi_enabled) { 498 - if (efi.smbios == EFI_INVALID_TABLE_ADDR) 499 - return -ENODEV; 500 - 501 - p = ioremap(efi.smbios, 32); 502 - if (p == NULL) 503 - return -ENOMEM; 504 - 505 - rc = smbios_present(p); 506 - iounmap(p); 507 - } else { 508 - /* 509 - * Search from 0x0f0000 through 0x0fffff, inclusive. 510 - */ 511 - p = ioremap(PCI_ROM_BASE1, ROM_SIZE); 512 - if (p == NULL) 513 - return -ENOMEM; 514 - 515 - for (q = p; q < p + ROM_SIZE; q += 16) { 516 - rc = smbios_present(q); 517 - if (!rc) { 518 - break; 519 - } 520 - } 521 - iounmap(p); 522 - } 523 - } 524 - 525 437 static int __devinit detect_cru_service(void) 526 438 { 527 439 cru_rom_addr = NULL; 528 440 529 - smbios_scan_machine(); /* will become dmi_walk(dmi_find_cru); */ 441 + dmi_walk(dmi_find_cru); 530 442 531 443 /* if cru_rom_addr has been set then we found a CRU service */ 532 444 return ((cru_rom_addr != NULL)? 0: -ENODEV);
+63 -13
drivers/watchdog/it8712f_wdt.c
··· 7 7 * 8 8 * drivers/char/watchdog/scx200_wdt.c 9 9 * drivers/hwmon/it87.c 10 - * IT8712F EC-LPC I/O Preliminary Specification 0.9.2.pdf 10 + * IT8712F EC-LPC I/O Preliminary Specification 0.8.2 11 + * IT8712F EC-LPC I/O Preliminary Specification 0.9.3 11 12 * 12 13 * This program is free software; you can redistribute it and/or 13 14 * modify it under the terms of the GNU General Public License as ··· 41 40 MODULE_LICENSE("GPL"); 42 41 MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); 43 42 43 + static int max_units = 255; 44 44 static int margin = 60; /* in seconds */ 45 45 module_param(margin, int, 0); 46 46 MODULE_PARM_DESC(margin, "Watchdog margin in seconds"); ··· 53 51 static struct semaphore it8712f_wdt_sem; 54 52 static unsigned expect_close; 55 53 static spinlock_t io_lock; 54 + static unsigned char revision; 56 55 57 56 /* Dog Food address - We use the game port address */ 58 57 static unsigned short address; ··· 111 108 return val; 112 109 } 113 110 111 + static void 112 + superio_outw(int val, int reg) 113 + { 114 + outb(reg++, REG); 115 + outb((val >> 8) & 0xff, VAL); 116 + outb(reg, REG); 117 + outb(val & 0xff, VAL); 118 + } 119 + 114 120 static inline void 115 121 superio_select(int ldn) 116 122 { ··· 155 143 it8712f_wdt_update_margin(void) 156 144 { 157 145 int config = WDT_OUT_KRST | WDT_OUT_PWROK; 146 + int units = margin; 158 147 159 - printk(KERN_INFO NAME ": timer margin %d seconds\n", margin); 160 - 161 - /* The timeout register only has 8bits wide */ 162 - if (margin < 256) 163 - config |= WDT_UNIT_SEC; /* else UNIT are MINUTES */ 148 + /* Switch to minutes precision if the configured margin 149 + * value does not fit within the register width. 150 + */ 151 + if (units <= max_units) { 152 + config |= WDT_UNIT_SEC; /* else UNIT is MINUTES */ 153 + printk(KERN_INFO NAME ": timer margin %d seconds\n", units); 154 + } else { 155 + units /= 60; 156 + printk(KERN_INFO NAME ": timer margin %d minutes\n", units); 157 + } 164 158 superio_outb(config, WDT_CONFIG); 165 159 166 - superio_outb((margin > 255) ? (margin / 60) : margin, WDT_TIMEOUT); 160 + if (revision >= 0x08) 161 + superio_outw(units, WDT_TIMEOUT); 162 + else 163 + superio_outb(units, WDT_TIMEOUT); 164 + } 165 + 166 + static int 167 + it8712f_wdt_get_status(void) 168 + { 169 + if (superio_inb(WDT_CONTROL) & 0x01) 170 + return WDIOF_CARDRESET; 171 + else 172 + return 0; 167 173 } 168 174 169 175 static void ··· 264 234 .firmware_version = 1, 265 235 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, 266 236 }; 267 - int new_margin; 237 + int value; 268 238 269 239 switch (cmd) { 270 240 default: ··· 274 244 return -EFAULT; 275 245 return 0; 276 246 case WDIOC_GETSTATUS: 247 + superio_enter(); 248 + superio_select(LDN_GPIO); 249 + 250 + value = it8712f_wdt_get_status(); 251 + 252 + superio_exit(); 253 + 254 + return put_user(value, p); 277 255 case WDIOC_GETBOOTSTATUS: 278 256 return put_user(0, p); 279 257 case WDIOC_KEEPALIVE: 280 258 it8712f_wdt_ping(); 281 259 return 0; 282 260 case WDIOC_SETTIMEOUT: 283 - if (get_user(new_margin, p)) 261 + if (get_user(value, p)) 284 262 return -EFAULT; 285 - if (new_margin < 1) 263 + if (value < 1) 286 264 return -EINVAL; 287 - margin = new_margin; 265 + if (value > (max_units * 60)) 266 + return -EINVAL; 267 + margin = value; 288 268 superio_enter(); 289 269 superio_select(LDN_GPIO); 290 270 ··· 302 262 303 263 superio_exit(); 304 264 it8712f_wdt_ping(); 265 + /* Fall through */ 305 266 case WDIOC_GETTIMEOUT: 306 267 if (put_user(margin, p)) 307 268 return -EFAULT; ··· 377 336 } 378 337 379 338 err = 0; 380 - printk(KERN_DEBUG NAME ": Found IT%04xF chip revision %d - " 339 + revision = superio_inb(DEVREV) & 0x0f; 340 + 341 + /* Later revisions have 16-bit values per datasheet 0.9.1 */ 342 + if (revision >= 0x08) 343 + max_units = 65535; 344 + 345 + if (margin > (max_units * 60)) 346 + margin = (max_units * 60); 347 + 348 + printk(KERN_INFO NAME ": Found IT%04xF chip revision %d - " 381 349 "using DogFood address 0x%x\n", 382 - chip_type, superio_inb(DEVREV) & 0x0f, *address); 350 + chip_type, revision, *address); 383 351 384 352 exit: 385 353 superio_exit();
+1 -1
drivers/watchdog/machzwd.c
··· 141 141 #ifndef ZF_DEBUG 142 142 # define dprintk(format, args...) 143 143 #else 144 - # define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __FUNCTION__, __LINE__ , ## args) 144 + # define dprintk(format, args...) printk(KERN_DEBUG PFX ":%s:%d: " format, __func__, __LINE__ , ## args) 145 145 #endif 146 146 147 147
+2 -2
drivers/watchdog/mtx-1_wdt.c
··· 59 59 60 60 static struct { 61 61 struct completion stop; 62 - volatile int running; 62 + int running; 63 63 struct timer_list timer; 64 - volatile int queue; 64 + int queue; 65 65 int default_ticks; 66 66 unsigned long inuse; 67 67 unsigned gpio;
+2 -2
drivers/watchdog/pcwd_usb.c
··· 179 179 case -ENOENT: 180 180 case -ESHUTDOWN: 181 181 /* this urb is terminated, clean up */ 182 - dbg("%s - urb shutting down with status: %d", __FUNCTION__, urb->status); 182 + dbg("%s - urb shutting down with status: %d", __func__, urb->status); 183 183 return; 184 184 /* -EPIPE: should clear the halt */ 185 185 default: /* error */ 186 - dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); 186 + dbg("%s - nonzero urb status received: %d", __func__, urb->status); 187 187 goto resubmit; 188 188 } 189 189
+4 -4
drivers/watchdog/s3c2410_wdt.c
··· 144 144 } 145 145 146 146 DBG("%s: wdt_count=0x%08x, wtcon=%08lx\n", 147 - __FUNCTION__, wdt_count, wtcon); 147 + __func__, wdt_count, wtcon); 148 148 149 149 writel(wdt_count, wdt_base + S3C2410_WTDAT); 150 150 writel(wdt_count, wdt_base + S3C2410_WTCNT); ··· 167 167 count = timeout * freq; 168 168 169 169 DBG("%s: count=%d, timeout=%d, freq=%d\n", 170 - __FUNCTION__, count, timeout, freq); 170 + __func__, count, timeout, freq); 171 171 172 172 /* if the count is bigger than the watchdog register, 173 173 then work out what we need to do (and if) we can ··· 189 189 tmr_margin = timeout; 190 190 191 191 DBG("%s: timeout=%d, divisor=%d, count=%d (%08x)\n", 192 - __FUNCTION__, timeout, divisor, count, count/divisor); 192 + __func__, timeout, divisor, count, count/divisor); 193 193 194 194 count /= divisor; 195 195 wdt_count = count; ··· 355 355 int ret; 356 356 int size; 357 357 358 - DBG("%s: probe=%p\n", __FUNCTION__, pdev); 358 + DBG("%s: probe=%p\n", __func__, pdev); 359 359 360 360 dev = &pdev->dev; 361 361 wdt_dev = &pdev->dev;
+1 -1
drivers/watchdog/shwdt.c
··· 298 298 if (io_remap_pfn_range(vma, vma->vm_start, addr >> PAGE_SHIFT, 299 299 PAGE_SIZE, vma->vm_page_prot)) { 300 300 printk(KERN_ERR PFX "%s: io_remap_pfn_range failed\n", 301 - __FUNCTION__); 301 + __func__); 302 302 return -EAGAIN; 303 303 } 304 304