mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-26 20:30:54 +07:00
[WATCHDOG] i8xx_tco remove pci_find_device.
Use refcounting for pci device obtaining. Use PCI_DEVICE macro. Signed-off-by: Jiri Slaby <jirislaby@gmail.com> Signed-off-by: Wim Van Sebroeck <wim@iguana.be> Cc: Andrew Morton <akpm@osdl.org>
This commit is contained in:
parent
02be2ee9e0
commit
92dd9994c3
@ -406,18 +406,18 @@ static struct notifier_block i8xx_tco_notifier = {
|
|||||||
* want to register another driver on the same PCI id.
|
* want to register another driver on the same PCI id.
|
||||||
*/
|
*/
|
||||||
static struct pci_device_id i8xx_tco_pci_tbl[] = {
|
static struct pci_device_id i8xx_tco_pci_tbl[] = {
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0) },
|
||||||
{ PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, },
|
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1) },
|
||||||
{ 0, }, /* End of list */
|
{ }, /* End of list */
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE (pci, i8xx_tco_pci_tbl);
|
MODULE_DEVICE_TABLE (pci, i8xx_tco_pci_tbl);
|
||||||
|
|
||||||
@ -434,12 +434,11 @@ static unsigned char __init i8xx_tco_getdevice (void)
|
|||||||
* Find the PCI device
|
* Find the PCI device
|
||||||
*/
|
*/
|
||||||
|
|
||||||
while ((dev = pci_find_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
|
for_each_pci_dev(dev)
|
||||||
if (pci_match_id(i8xx_tco_pci_tbl, dev)) {
|
if (pci_match_id(i8xx_tco_pci_tbl, dev)) {
|
||||||
i8xx_tco_pci = dev;
|
i8xx_tco_pci = dev;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (i8xx_tco_pci) {
|
if (i8xx_tco_pci) {
|
||||||
/*
|
/*
|
||||||
@ -454,6 +453,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
|
|||||||
/* Something's wrong here, ACPIBASE has to be set */
|
/* Something's wrong here, ACPIBASE has to be set */
|
||||||
if (badr == 0x0001 || badr == 0x0000) {
|
if (badr == 0x0001 || badr == 0x0000) {
|
||||||
printk (KERN_ERR PFX "failed to get TCOBASE address\n");
|
printk (KERN_ERR PFX "failed to get TCOBASE address\n");
|
||||||
|
pci_dev_put(i8xx_tco_pci);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,6 +465,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
|
|||||||
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1);
|
pci_read_config_byte (i8xx_tco_pci, 0xd4, &val1);
|
||||||
if (val1 & 0x02) {
|
if (val1 & 0x02) {
|
||||||
printk (KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
|
printk (KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
|
||||||
|
pci_dev_put(i8xx_tco_pci);
|
||||||
return 0; /* Cannot reset NO_REBOOT bit */
|
return 0; /* Cannot reset NO_REBOOT bit */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -476,6 +477,7 @@ static unsigned char __init i8xx_tco_getdevice (void)
|
|||||||
if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) {
|
if (!request_region (SMI_EN + 1, 1, "i8xx TCO")) {
|
||||||
printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
|
printk (KERN_ERR PFX "I/O address 0x%04x already in use\n",
|
||||||
SMI_EN + 1);
|
SMI_EN + 1);
|
||||||
|
pci_dev_put(i8xx_tco_pci);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
val1 = inb (SMI_EN + 1);
|
val1 = inb (SMI_EN + 1);
|
||||||
@ -542,6 +544,7 @@ static int __init watchdog_init (void)
|
|||||||
unreg_region:
|
unreg_region:
|
||||||
release_region (TCOBASE, 0x10);
|
release_region (TCOBASE, 0x10);
|
||||||
out:
|
out:
|
||||||
|
pci_dev_put(i8xx_tco_pci);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,6 +558,8 @@ static void __exit watchdog_cleanup (void)
|
|||||||
misc_deregister (&i8xx_tco_miscdev);
|
misc_deregister (&i8xx_tco_miscdev);
|
||||||
unregister_reboot_notifier(&i8xx_tco_notifier);
|
unregister_reboot_notifier(&i8xx_tco_notifier);
|
||||||
release_region (TCOBASE, 0x10);
|
release_region (TCOBASE, 0x10);
|
||||||
|
|
||||||
|
pci_dev_put(i8xx_tco_pci);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(watchdog_init);
|
module_init(watchdog_init);
|
||||||
|
Loading…
Reference in New Issue
Block a user