Commit a2b66515 authored by Jeff Garzik's avatar Jeff Garzik

[ISDN] HiSax enternow: split setup into 3 smaller functions

No behavior changes, just code movement.  Prep for PCI hotplug API.
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 7c60e1ca
...@@ -300,31 +300,9 @@ enpci_interrupt(int intno, void *dev_id) ...@@ -300,31 +300,9 @@ enpci_interrupt(int intno, void *dev_id)
return IRQ_HANDLED; return IRQ_HANDLED;
} }
static int __devinit en_pci_probe(struct pci_dev *dev_netjet,
static struct pci_dev *dev_netjet __devinitdata = NULL; struct IsdnCardState *cs)
/* called by config.c */
int __devinit
setup_enternow_pci(struct IsdnCard *card)
{ {
int bytecnt;
struct IsdnCardState *cs = card->cs;
char tmp[64];
#ifdef CONFIG_PCI
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
strcpy(tmp, enternow_pci_rev);
printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_ENTERNOW)
return(0);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
for ( ;; )
{
if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
if (pci_enable_device(dev_netjet)) if (pci_enable_device(dev_netjet))
return(0); return(0);
cs->irq = dev_netjet->irq; cs->irq = dev_netjet->irq;
...@@ -344,11 +322,13 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -344,11 +322,13 @@ setup_enternow_pci(struct IsdnCard *card)
printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n"); printk(KERN_WARNING "Use type=20 for Traverse NetJet PCI Card.\n");
return(0); return(0);
} }
} else {
printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
return(0);
}
return(1);
}
static void __devinit en_cs_init(struct IsdnCard *card,
struct IsdnCardState *cs)
{
cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA; cs->hw.njet.auxa = cs->hw.njet.base + NETJET_AUXDATA;
cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD cs->hw.njet.isac = cs->hw.njet.base + 0xC0; // Fenster zum AMD
...@@ -368,30 +348,24 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -368,30 +348,24 @@ setup_enternow_pci(struct IsdnCard *card)
outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL); outb(~TJ_AMD_IRQ, cs->hw.njet.base + NETJET_AUXCTRL);
outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1); outb(TJ_AMD_IRQ, cs->hw.njet.base + NETJET_IRQMASK1);
outb(cs->hw.njet.auxd, cs->hw.njet.auxa); outb(cs->hw.njet.auxd, cs->hw.njet.auxa);
}
break; static int __devinit en_cs_init_rest(struct IsdnCard *card,
} struct IsdnCardState *cs)
#else {
const int bytecnt = 256;
printk(KERN_WARNING "enter:now PCI: NO_PCI_BIOS\n");
printk(KERN_WARNING "enter:now PCI: unable to config Formula-n enter:now ISDN PCI ab\n");
return (0);
#endif /* CONFIG_PCI */
bytecnt = 256;
printk(KERN_INFO printk(KERN_INFO
"enter:now PCI: PCI card configured at 0x%lx IRQ %d\n", "enter:now PCI: PCI card configured at 0x%lx IRQ %d\n",
cs->hw.njet.base, cs->irq); cs->hw.njet.base, cs->irq);
if (!request_region(cs->hw.njet.base, bytecnt, "Fn_ISDN")) { if (!request_region(cs->hw.njet.base, bytecnt, "Fn_ISDN")) {
printk(KERN_WARNING printk(KERN_WARNING
"HiSax: %s config port %lx-%lx already in use\n", "HiSax: enter:now config port %lx-%lx already in use\n",
CardType[card->typ],
cs->hw.njet.base, cs->hw.njet.base,
cs->hw.njet.base + bytecnt); cs->hw.njet.base + bytecnt);
return (0); return (0);
} }
setup_Amd7930(cs); setup_Amd7930(cs);
cs->hw.njet.last_is0 = 0; cs->hw.njet.last_is0 = 0;
/* macro rByteAMD */ /* macro rByteAMD */
...@@ -409,3 +383,42 @@ setup_enternow_pci(struct IsdnCard *card) ...@@ -409,3 +383,42 @@ setup_enternow_pci(struct IsdnCard *card)
return (1); return (1);
} }
static struct pci_dev *dev_netjet __devinitdata = NULL;
/* called by config.c */
int __devinit
setup_enternow_pci(struct IsdnCard *card)
{
int ret;
struct IsdnCardState *cs = card->cs;
char tmp[64];
#ifdef __BIG_ENDIAN
#error "not running on big endian machines now"
#endif
strcpy(tmp, enternow_pci_rev);
printk(KERN_INFO "HiSax: Formula-n Europe AG enter:now ISDN PCI driver Rev. %s\n", HiSax_getrev(tmp));
if (cs->typ != ISDN_CTYPE_ENTERNOW)
return(0);
test_and_clear_bit(FLG_LOCK_ATOMIC, &cs->HW_Flags);
for ( ;; )
{
if ((dev_netjet = pci_find_device(PCI_VENDOR_ID_TIGERJET,
PCI_DEVICE_ID_TIGERJET_300, dev_netjet))) {
ret = en_pci_probe(dev_netjet, cs);
if (!ret)
return(0);
} else {
printk(KERN_WARNING "enter:now PCI: No PCI card found\n");
return(0);
}
en_cs_init(card, cs);
break;
}
return en_cs_init_rest(card, cs);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment