mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
[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>
This commit is contained in:
parent
95f3eff699
commit
02be2ee9e0
@ -330,17 +330,20 @@ static int __init ali_find_watchdog(void)
|
|||||||
u32 wdog;
|
u32 wdog;
|
||||||
|
|
||||||
/* Check for a 1535 series bridge */
|
/* Check for a 1535 series bridge */
|
||||||
pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x1535, NULL);
|
pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x1535, NULL);
|
||||||
if(pdev == NULL)
|
if(pdev == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
pci_dev_put(pdev);
|
||||||
|
|
||||||
/* Check for the a 7101 PMU */
|
/* Check for the a 7101 PMU */
|
||||||
pdev = pci_find_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
|
pdev = pci_get_device(PCI_VENDOR_ID_AL, 0x7101, NULL);
|
||||||
if(pdev == NULL)
|
if(pdev == NULL)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
if(pci_enable_device(pdev))
|
if(pci_enable_device(pdev)) {
|
||||||
|
pci_dev_put(pdev);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
ali_pci = pdev;
|
ali_pci = pdev;
|
||||||
|
|
||||||
@ -447,6 +450,7 @@ static void __exit watchdog_exit(void)
|
|||||||
/* Deregister */
|
/* Deregister */
|
||||||
unregister_reboot_notifier(&ali_notifier);
|
unregister_reboot_notifier(&ali_notifier);
|
||||||
misc_deregister(&ali_miscdev);
|
misc_deregister(&ali_miscdev);
|
||||||
|
pci_dev_put(ali_pci);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(watchdog_init);
|
module_init(watchdog_init);
|
||||||
|
@ -333,6 +333,7 @@ static void __exit alim7101_wdt_unload(void)
|
|||||||
/* Deregister */
|
/* Deregister */
|
||||||
misc_deregister(&wdt_miscdev);
|
misc_deregister(&wdt_miscdev);
|
||||||
unregister_reboot_notifier(&wdt_notifier);
|
unregister_reboot_notifier(&wdt_notifier);
|
||||||
|
pci_dev_put(alim7101_pmu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init alim7101_wdt_init(void)
|
static int __init alim7101_wdt_init(void)
|
||||||
@ -342,7 +343,8 @@ static int __init alim7101_wdt_init(void)
|
|||||||
char tmp;
|
char tmp;
|
||||||
|
|
||||||
printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n");
|
printk(KERN_INFO PFX "Steve Hill <steve@navaho.co.uk>.\n");
|
||||||
alim7101_pmu = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,NULL);
|
alim7101_pmu = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M7101,
|
||||||
|
NULL);
|
||||||
if (!alim7101_pmu) {
|
if (!alim7101_pmu) {
|
||||||
printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n");
|
printk(KERN_INFO PFX "ALi M7101 PMU not present - WDT not set\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
@ -351,21 +353,23 @@ static int __init alim7101_wdt_init(void)
|
|||||||
/* Set the WDT in the PMU to 1 second */
|
/* Set the WDT in the PMU to 1 second */
|
||||||
pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02);
|
pci_write_config_byte(alim7101_pmu, ALI_7101_WDT, 0x02);
|
||||||
|
|
||||||
ali1543_south = pci_find_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
|
ali1543_south = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
|
||||||
|
NULL);
|
||||||
if (!ali1543_south) {
|
if (!ali1543_south) {
|
||||||
printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n");
|
printk(KERN_INFO PFX "ALi 1543 South-Bridge not present - WDT not set\n");
|
||||||
return -EBUSY;
|
goto err_out;
|
||||||
}
|
}
|
||||||
pci_read_config_byte(ali1543_south, 0x5e, &tmp);
|
pci_read_config_byte(ali1543_south, 0x5e, &tmp);
|
||||||
|
pci_dev_put(ali1543_south);
|
||||||
if ((tmp & 0x1e) == 0x00) {
|
if ((tmp & 0x1e) == 0x00) {
|
||||||
if (!use_gpio) {
|
if (!use_gpio) {
|
||||||
printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n");
|
printk(KERN_INFO PFX "Detected old alim7101 revision 'a1d'. If this is a cobalt board, set the 'use_gpio' module parameter.\n");
|
||||||
return -EBUSY;
|
goto err_out;
|
||||||
}
|
}
|
||||||
nowayout = 1;
|
nowayout = 1;
|
||||||
} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
|
} else if ((tmp & 0x1e) != 0x12 && (tmp & 0x1e) != 0x00) {
|
||||||
printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
|
printk(KERN_INFO PFX "ALi 1543 South-Bridge does not have the correct revision number (???1001?) - WDT not set\n");
|
||||||
return -EBUSY;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
|
if(timeout < 1 || timeout > 3600) /* arbitrary upper limit */
|
||||||
@ -404,6 +408,7 @@ static int __init alim7101_wdt_init(void)
|
|||||||
err_out_miscdev:
|
err_out_miscdev:
|
||||||
misc_deregister(&wdt_miscdev);
|
misc_deregister(&wdt_miscdev);
|
||||||
err_out:
|
err_out:
|
||||||
|
pci_dev_put(alim7101_pmu);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user