diff options
-rw-r--r-- | drivers/char/watchdog/alim1535_wdt.c | 10 | ||||
-rw-r--r-- | drivers/char/watchdog/alim7101_wdt.c | 15 |
2 files changed, 17 insertions, 8 deletions
diff --git a/drivers/char/watchdog/alim1535_wdt.c b/drivers/char/watchdog/alim1535_wdt.c index c5c94e4c9495..0b2c8e841c86 100644 --- a/drivers/char/watchdog/alim1535_wdt.c +++ b/drivers/char/watchdog/alim1535_wdt.c | |||
@@ -330,17 +330,20 @@ static int __init ali_find_watchdog(void) | |||
330 | u32 wdog; | 330 | u32 wdog; |
331 | 331 | ||
332 | /* Check for a 1535 series bridge */ | 332 | /* Check for a 1535 series bridge */ |
333 | pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x1535, NULL); | 333 | pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL); |
334 | if(pdev == NULL) | 334 | if(pdev == NULL) |
335 | return -ENODEV; | 335 | return -ENODEV; |
336 | pci_dev_put(pdev); | ||
336 | 337 | ||
337 | /* Check for the a 7101 PMU */ | 338 | /* Check for the a 7101 PMU */ |
338 | pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x7101, NULL); | 339 | pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x7101, NULL); |
339 | if(pdev == NULL) | 340 | if(pdev == NULL) |
340 | return -ENODEV; | 341 | return -ENODEV; |
341 | 342 | ||
342 | if(pci_enable_device(pdev)) | 343 | if(pci_enable_device(pdev)) { |
344 | pci_dev_put(pdev); | ||
343 | return -EIO; | 345 | return -EIO; |
346 | } | ||
344 | 347 | ||
345 | ali_pci = pdev; | 348 | ali_pci = pdev; |
346 | 349 | ||
@@ -447,6 +450,7 @@ static void __exit watchdog_exit(void) | |||
447 | /* Deregister */ | 450 | /* Deregister */ |
448 | unregister_reboot_notifier(&ali_notifier); | 451 | unregister_reboot_notifier(&ali_notifier); |
449 | misc_deregister(&ali_miscdev); | 452 | misc_deregister(&ali_miscdev); |
453 | pci_dev_put(ali_pci); | ||
450 | } | 454 | } |
451 | 455 | ||
452 | module_init(watchdog_init); | 456 | module_init(watchdog_init); |
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 | ||
338 | static int __init alim7101_wdt_init(void) | 339 | static 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) | |||
404 | err_out_miscdev: | 408 | err_out_miscdev: |
405 | misc_deregister(&wdt_miscdev); | 409 | misc_deregister(&wdt_miscdev); |
406 | err_out: | 410 | err_out: |
411 | pci_dev_put(alim7101_pmu); | ||
407 | return rc; | 412 | return rc; |
408 | } | 413 | } |
409 | 414 | ||