aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/applicom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/applicom.c')
-rw-r--r--drivers/char/applicom.c24
1 files changed, 9 insertions, 15 deletions
diff --git a/drivers/char/applicom.c b/drivers/char/applicom.c
index 1f0b752e5de1..a7c4990b5b6b 100644
--- a/drivers/char/applicom.c
+++ b/drivers/char/applicom.c
@@ -57,7 +57,6 @@
57#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002 57#define PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN 0x0002
58#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003 58#define PCI_DEVICE_ID_APPLICOM_PCI2000PFB 0x0003
59#endif 59#endif
60#define MAX_PCI_DEVICE_NUM 3
61 60
62static char *applicom_pci_devnames[] = { 61static char *applicom_pci_devnames[] = {
63 "PCI board", 62 "PCI board",
@@ -66,12 +65,9 @@ static char *applicom_pci_devnames[] = {
66}; 65};
67 66
68static struct pci_device_id applicom_pci_tbl[] = { 67static struct pci_device_id applicom_pci_tbl[] = {
69 { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC, 68 { PCI_VDEVICE(APPLICOM, PCI_DEVICE_ID_APPLICOM_PCIGENERIC) },
70 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, 69 { PCI_VDEVICE(APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN) },
71 { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000IBS_CAN, 70 { PCI_VDEVICE(APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000PFB) },
72 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
73 { PCI_VENDOR_ID_APPLICOM, PCI_DEVICE_ID_APPLICOM_PCI2000PFB,
74 PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 },
75 { 0 } 71 { 0 }
76}; 72};
77MODULE_DEVICE_TABLE(pci, applicom_pci_tbl); 73MODULE_DEVICE_TABLE(pci, applicom_pci_tbl);
@@ -197,31 +193,29 @@ static int __init applicom_init(void)
197 193
198 while ( (dev = pci_get_class(PCI_CLASS_OTHERS << 16, dev))) { 194 while ( (dev = pci_get_class(PCI_CLASS_OTHERS << 16, dev))) {
199 195
200 if (dev->vendor != PCI_VENDOR_ID_APPLICOM) 196 if (!pci_match_id(applicom_pci_tbl, dev))
201 continue;
202
203 if (dev->device > MAX_PCI_DEVICE_NUM || dev->device == 0)
204 continue; 197 continue;
205 198
206 if (pci_enable_device(dev)) 199 if (pci_enable_device(dev))
207 return -EIO; 200 return -EIO;
208 201
209 RamIO = ioremap(dev->resource[0].start, LEN_RAM_IO); 202 RamIO = ioremap(pci_resource_start(dev, 0), LEN_RAM_IO);
210 203
211 if (!RamIO) { 204 if (!RamIO) {
212 printk(KERN_INFO "ac.o: Failed to ioremap PCI memory " 205 printk(KERN_INFO "ac.o: Failed to ioremap PCI memory "
213 "space at 0x%llx\n", 206 "space at 0x%llx\n",
214 (unsigned long long)dev->resource[0].start); 207 (unsigned long long)pci_resource_start(dev, 0));
215 pci_disable_device(dev); 208 pci_disable_device(dev);
216 return -EIO; 209 return -EIO;
217 } 210 }
218 211
219 printk(KERN_INFO "Applicom %s found at mem 0x%llx, irq %d\n", 212 printk(KERN_INFO "Applicom %s found at mem 0x%llx, irq %d\n",
220 applicom_pci_devnames[dev->device-1], 213 applicom_pci_devnames[dev->device-1],
221 (unsigned long long)dev->resource[0].start, 214 (unsigned long long)pci_resource_start(dev, 0),
222 dev->irq); 215 dev->irq);
223 216
224 boardno = ac_register_board(dev->resource[0].start, RamIO,0); 217 boardno = ac_register_board(pci_resource_start(dev, 0),
218 RamIO, 0);
225 if (!boardno) { 219 if (!boardno) {
226 printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n"); 220 printk(KERN_INFO "ac.o: PCI Applicom device doesn't have correct signature.\n");
227 iounmap(RamIO); 221 iounmap(RamIO);