aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/watchdog/alim7101_wdt.c
diff options
context:
space:
mode:
authorJiri Slaby <jirislaby@gmail.com>2006-07-18 12:30:00 -0400
committerWim Van Sebroeck <wim@iguana.be>2006-10-02 16:55:51 -0400
commit02be2ee9e0797b6f657827e32345f0bfeae4c20e (patch)
tree0e04411b5337763b77c6ddf103cd9bc556d6c103 /drivers/char/watchdog/alim7101_wdt.c
parent95f3eff6997ae4a6754c1d874ec0a414d97c44d1 (diff)
[WATCHDOG] alim remove pci_find_device
Convert pci_find_device to pci_get_device + pci_dev_put in alim watchdog cards' drivers (refcounting). Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Andrew Morton <akpm@osdl.org>
Diffstat (limited to 'drivers/char/watchdog/alim7101_wdt.c')
-rw-r--r--drivers/char/watchdog/alim7101_wdt.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/char/watchdog/alim7101_wdt.c b/drivers/char/watchdog/alim7101_wdt.c
index ffd7684f999b..383f9bf6810c 100644
--- a/drivers/char/watchdog/alim7101_wdt.c
+++ b/drivers/char/watchdog/alim7101_wdt.c
@@ -333,6 +333,7 @@ static void __exit alim7101_wdt_unload(void)
333 /* Deregister */ 333 /* Deregister */
334 misc_deregister(&wdt_miscdev); 334 misc_deregister(&wdt_miscdev);
335 unregister_reboot_notifier(&wdt_notifier); 335 unregister_reboot_notifier(&wdt_notifier);
336 pci_dev_put(alim7101_pmu);
336} 337}
337 338
338static int __init alim7101_wdt_init(void) 339static int __init alim7101_wdt_init(void)
@@ -342,7 +343,8 @@ static int __init alim7101_wdt_init(void)
342 char tmp; 343 char tmp;
343 344
344 printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n"); 345 printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n");
345 alim7101_pmu = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,NULL); 346 alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
347 NULL);
346 if (!alim7101_pmu) { 348 if (!alim7101_pmu) {
347 printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n"); 349 printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n");
348 return -EBUSY; 350 return -EBUSY;
@@ -351,21 +353,23 @@ static int __init alim7101_wdt_init(void)
351 /* Set the WDT in the PMU to 1 second */ 353 /* Set the WDT in the PMU to 1 second */
352 pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02); 354 pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02);
353 355
354 ali1543_south = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL); 356 ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
357 NULL);
355 if (!ali1543_south) { 358 if (!ali1543_south) {
356 printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n"); 359 printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n");
357 return -EBUSY; 360 goto err_out;
358 } 361 }
359 pci_read_config_byte(ali1543_south, 0x5e, &tmp); 362 pci_read_config_byte(ali1543_south, 0x5e, &tmp);
363 pci_dev_put(ali1543_south);
360 if ((tmp & 0x1e) == 0x00) { 364 if ((tmp & 0x1e) == 0x00) {
361 if (!use_gpio) { 365 if (!use_gpio) {
362 printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n"); 366 printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n");
363 return -EBUSY; 367 goto err_out;
364 } 368 }
365 nowayout = 1; 369 nowayout = 1;
366 } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) { 370 } else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
367 printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n"); 371 printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
368 return -EBUSY; 372 goto err_out;
369 } 373 }
370 374
371 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */ 375 if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
@@ -404,6 +408,7 @@ static int __init alim7101_wdt_init(void)
404err_out_miscdev: 408err_out_miscdev:
405 misc_deregister(&wdt_miscdev); 409 misc_deregister(&wdt_miscdev);
406err_out: 410err_out:
411 pci_dev_put(alim7101_pmu);
407 return rc; 412 return rc;
408} 413}
409 414