aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/i8xx_tco.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/watchdog/i8xx_tco.c')
-rw-r--r--drivers/char/watchdog/i8xx_tco.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/drivers/char/watchdog/i8xx_tco.c b/drivers/char/watchdog/i8xx_tco.c
index 8385dd36eefe..e0627d79707b 100644
--- a/drivers/char/watchdog/i8xx_tco.c
+++ b/drivers/char/watchdog/i8xx_tco.c
@@ -356,7 +356,7 @@ static int i8xx_tco_ioctl (struct inode *inode, struct file *file,
356 } 356 }
357 357
358 default: 358 default:
359 return -ENOIOCTLCMD; 359 return -ENOTTY;
360 } 360 }
361} 361}
362 362
@@ -406,18 +406,18 @@ static struct notifier_block i8xx_tco_notifier = {
406 * want to register another driver on the same PCI id. 406 * want to register another driver on the same PCI id.
407 */ 407 */
408static struct pci_device_id i8xx_tco_pci_tbl[] = { 408static struct pci_device_id i8xx_tco_pci_tbl[] = {
409 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, }, 409 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0) },
410 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, }, 410 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0) },
411 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, }, 411 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0) },
412 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, }, 412 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10) },
413 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, }, 413 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0) },
414 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, }, 414 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12) },
415 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, }, 415 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0) },
416 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, }, 416 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12) },
417 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, }, 417 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0) },
418 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, }, 418 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0) },
419 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, }, 419 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1) },
420 { 0, }, /* End of list */ 420 { }, /* End of list */
421}; 421};
422MODULE_DEVICE_TABLE (pci, i8xx_tco_pci_tbl); 422MODULE_DEVICE_TABLE (pci, i8xx_tco_pci_tbl);
423 423
@@ -434,12 +434,11 @@ static unsigned char __init i8xx_tco_getdevice (void)
434 * Find the PCI device 434 * Find the PCI device
435 */ 435 */
436 436
437 while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 437 for_each_pci_dev(dev)
438 if (pci_match_id(i8xx_tco_pci_tbl, dev)) { 438 if (pci_match_id(i8xx_tco_pci_tbl, dev)) {
439 i8xx_tco_pci = dev; 439 i8xx_tco_pci = dev;
440 break; 440 break;
441 } 441 }
442 }
443 442
444 if (i8xx_tco_pci) { 443 if (i8xx_tco_pci) {
445 /* 444 /*
@@ -454,6 +453,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
454 /* Something's wrong here, ACPIBASE has to be set */ 453 /* Something's wrong here, ACPIBASE has to be set */
455 if (badr == 0x0001 || badr == 0x0000) { 454 if (badr == 0x0001 || badr == 0x0000) {
456 printk (KERN_ERR PFX "failed to get TCOBASE address\n"); 455 printk (KERN_ERR PFX "failed to get TCOBASE address\n");
456 pci_dev_put(i8xx_tco_pci);
457 return 0; 457 return 0;
458 } 458 }
459 459
@@ -465,6 +465,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
465 pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1); 465 pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1);
466 if (val1 & 0x02) { 466 if (val1 & 0x02) {
467 printk (KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n"); 467 printk (KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
468 pci_dev_put(i8xx_tco_pci);
468 return 0; /* Cannot reset NO_REBOOT bit */ 469 return 0; /* Cannot reset NO_REBOOT bit */
469 } 470 }
470 } 471 }
@@ -476,6 +477,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
476 if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) { 477 if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) {
477 printk (KERN_ERR PFX "I/O address 0x%04x already in use\n", 478 printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
478 SMI_EN + 1); 479 SMI_EN + 1);
480 pci_dev_put(i8xx_tco_pci);
479 return 0; 481 return 0;
480 } 482 }
481 val1 = inb (SMI_EN + 1); 483 val1 = inb (SMI_EN + 1);
@@ -542,6 +544,7 @@ unreg_notifier:
542unreg_region: 544unreg_region:
543 release_region (TCOBASE, 0x10); 545 release_region (TCOBASE, 0x10);
544out: 546out:
547 pci_dev_put(i8xx_tco_pci);
545 return ret; 548 return ret;
546} 549}
547 550
@@ -555,6 +558,8 @@ static void __exit watchdog_cleanup (void)
555 misc_deregister (&i8xx_tco_miscdev); 558 misc_deregister (&i8xx_tco_miscdev);
556 unregister_reboot_notifier(&i8xx_tco_notifier); 559 unregister_reboot_notifier(&i8xx_tco_notifier);
557 release_region (TCOBASE, 0x10); 560 release_region (TCOBASE, 0x10);
561
562 pci_dev_put(i8xx_tco_pci);
558} 563}
559 564
560module_init(watchdog_init); 565module_init(watchdog_init);