aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-07-15 19:58:24 -0400
committerJeff Garzik <jeff@garzik.org>2007-07-17 17:24:17 -0400
commitd825a49259a272d2451f0bfb0f789534377ac478 (patch)
tree42518968b8df62b1c49a05e3585e670865b3311d /drivers/isdn
parenta2b66515a7a2df5cbe4627bd355a1f9a73246bdc (diff)
[ISDN] HiSax bkm_a4t: split setup into two smaller functions
No behavior changes, just code movement. Prep for PCI hotplug API. Well, CONFIG_PCI useless ifdef was removed. Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/isdn')
-rw-r--r--drivers/isdn/hisax/bkm_a4t.c108
1 files changed, 63 insertions, 45 deletions
diff --git a/drivers/isdn/hisax/bkm_a4t.c b/drivers/isdn/hisax/bkm_a4t.c
index 871310d56a6e..3d1bdc8431ad 100644
--- a/drivers/isdn/hisax/bkm_a4t.c
+++ b/drivers/isdn/hisax/bkm_a4t.c
@@ -255,54 +255,38 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)
255 return (0); 255 return (0);
256} 256}
257 257
258static struct pci_dev *dev_a4t __devinitdata = NULL; 258static int __devinit a4t_pci_probe(struct pci_dev *dev_a4t,
259 struct IsdnCardState *cs,
260 u_int *found,
261 u_int *pci_memaddr)
262{
263 u16 sub_sys;
264 u16 sub_vendor;
265
266 sub_vendor = dev_a4t->subsystem_vendor;
267 sub_sys = dev_a4t->subsystem_device;
268 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
269 if (pci_enable_device(dev_a4t))
270 return (0); /* end loop & function */
271 *found = 1;
272 *pci_memaddr = pci_resource_start(dev_a4t, 0);
273 cs->irq = dev_a4t->irq;
274 return (1); /* end loop */
275 }
259 276
260int __devinit 277 return (-1); /* continue looping */
261setup_bkm_a4t(struct IsdnCard *card) 278}
279
280static int __devinit a4t_cs_init(struct IsdnCard *card,
281 struct IsdnCardState *cs,
282 u_int pci_memaddr)
262{ 283{
263 struct IsdnCardState *cs = card->cs;
264 char tmp[64];
265 u_int pci_memaddr = 0, found = 0;
266 I20_REGISTER_FILE *pI20_Regs; 284 I20_REGISTER_FILE *pI20_Regs;
267#ifdef CONFIG_PCI
268#endif
269
270 strcpy(tmp, bkm_a4t_revision);
271 printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
272 if (cs->typ == ISDN_CTYPE_BKM_A4T) {
273 cs->subtyp = BKM_A4T;
274 } else
275 return (0);
276 285
277#ifdef CONFIG_PCI
278 while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
279 PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
280 u16 sub_sys;
281 u16 sub_vendor;
282
283 sub_vendor = dev_a4t->subsystem_vendor;
284 sub_sys = dev_a4t->subsystem_device;
285 if ((sub_sys == PCI_DEVICE_ID_BERKOM_A4T) && (sub_vendor == PCI_VENDOR_ID_BERKOM)) {
286 if (pci_enable_device(dev_a4t))
287 return(0);
288 found = 1;
289 pci_memaddr = pci_resource_start(dev_a4t, 0);
290 cs->irq = dev_a4t->irq;
291 break;
292 }
293 }
294 if (!found) {
295 printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
296 return (0);
297 }
298 if (!cs->irq) { /* IRQ range check ?? */ 286 if (!cs->irq) { /* IRQ range check ?? */
299 printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]); 287 printk(KERN_WARNING "HiSax: %s: No IRQ\n", CardType[card->typ]);
300 return (0); 288 return (0);
301 } 289 }
302 if (!pci_memaddr) {
303 printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
304 return (0);
305 }
306 cs->hw.ax.base = (long) ioremap(pci_memaddr, 4096); 290 cs->hw.ax.base = (long) ioremap(pci_memaddr, 4096);
307 /* Check suspecious address */ 291 /* Check suspecious address */
308 pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base); 292 pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
@@ -317,11 +301,7 @@ setup_bkm_a4t(struct IsdnCard *card)
317 cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET; 301 cs->hw.ax.jade_adr = cs->hw.ax.base + PO_OFFSET;
318 cs->hw.ax.isac_ale = GCS_1; 302 cs->hw.ax.isac_ale = GCS_1;
319 cs->hw.ax.jade_ale = GCS_3; 303 cs->hw.ax.jade_ale = GCS_3;
320#else 304
321 printk(KERN_WARNING "HiSax: %s: NO_PCI_BIOS\n", CardType[card->typ]);
322 printk(KERN_WARNING "HiSax: %s: unable to configure\n", CardType[card->typ]);
323 return (0);
324#endif /* CONFIG_PCI */
325 printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n", 305 printk(KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n",
326 CardType[card->typ], cs->hw.ax.base, cs->irq); 306 CardType[card->typ], cs->hw.ax.base, cs->irq);
327 307
@@ -339,5 +319,43 @@ setup_bkm_a4t(struct IsdnCard *card)
339 ISACVersion(cs, "Telekom A4T:"); 319 ISACVersion(cs, "Telekom A4T:");
340 /* Jade version */ 320 /* Jade version */
341 JadeVersion(cs, "Telekom A4T:"); 321 JadeVersion(cs, "Telekom A4T:");
322
342 return (1); 323 return (1);
343} 324}
325
326static struct pci_dev *dev_a4t __devinitdata = NULL;
327
328int __devinit
329setup_bkm_a4t(struct IsdnCard *card)
330{
331 struct IsdnCardState *cs = card->cs;
332 char tmp[64];
333 u_int pci_memaddr = 0, found = 0;
334 int ret;
335
336 strcpy(tmp, bkm_a4t_revision);
337 printk(KERN_INFO "HiSax: T-Berkom driver Rev. %s\n", HiSax_getrev(tmp));
338 if (cs->typ == ISDN_CTYPE_BKM_A4T) {
339 cs->subtyp = BKM_A4T;
340 } else
341 return (0);
342
343 while ((dev_a4t = pci_find_device(PCI_VENDOR_ID_ZORAN,
344 PCI_DEVICE_ID_ZORAN_36120, dev_a4t))) {
345 ret = a4t_pci_probe(dev_a4t, cs, &found, &pci_memaddr);
346 if (!ret)
347 return (0);
348 if (ret > 0)
349 break;
350 }
351 if (!found) {
352 printk(KERN_WARNING "HiSax: %s: Card not found\n", CardType[card->typ]);
353 return (0);
354 }
355 if (!pci_memaddr) {
356 printk(KERN_WARNING "HiSax: %s: No Memory base address\n", CardType[card->typ]);
357 return (0);
358 }
359
360 return a4t_cs_init(card, cs, pci_memaddr);
361}