ISDN code movement
PATCH 1/1 ISDN code movement
ISDN holds the largest concentrated block of drivers using pci_find_device() rather than PCI hotplug API, or at least the properly-refcounted pci_get_device().
Over the weekend I converted several of these drivers to the PCI hotplug API. That approach still needs verifying by ISDN people, but I feel that pure code movement, no-code-change style patches should be pushed upstream sooner rather than later.
Thus, speaking strictly, the only code changes are
* that which is necessary to call split-out functions from the old code site
* removal of CONFIG_PCI ifdefs, and !CONFIG_PCI dead code guaranteed as such by Kconfig dependencies
* hfc_pci: removal of "return;" at the tail of some functions
The code should behave precisely the same as before. Any bug or change
in behavior is an easily bisectable regression. But hopefully this is
as close to an equivalent-transformation change as there can be.
This sets us up to be in great shape to support PCI hotplug API, and I've already done that work (branch isdn-pci, DO NOT PULL that one).
Please pull from 'isdn-cleanup' branch of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git isdn-cleanup
to receive the following updates:
drivers/isdn/hisax/bkm_a4t.c | 108 ++++++++++------- drivers/isdn/hisax/config.c | 233 ++++++++++++++++++++++--------------- drivers/isdn/hisax/enternow_pci.c | 165 ++++++++++++++------------ drivers/isdn/hisax/hfc_pci.c | 191 +++++++++++++++---------------- drivers/isdn/hisax/nj_s.c | 194 +++++++++++++++++-------------- drivers/isdn/hisax/nj_u.c | 167 +++++++++++++++------------ 6 files changed, 586 insertions(+), 472 deletions(-)
Jeff Garzik (7):
[ISDN] HiSax: move card setup into separate function [ISDN] HiSax: move card state alloc/setup code into separate functions [ISDN] HiSax netjet_s: code movement, prep for hotplug [ISDN] HiSax netjet_u: split setup into 3 smaller functions [ISDN] HiSax enternow: split setup into 3 smaller functions [ISDN] HiSax bkm_a4t: split setup into two smaller functions [ISDN] HiSax hfc_pci: minor cleanups
drivers/isdn/hisax/bkm_a4t.c +63 -45
@@ -255,54 +255,38 @@ BKM_card_msg(struct IsdnCardState *cs, int mt, void *arg)return (0 ); } -static struct pci_dev *dev_a4t__devinitdata =NULL ; +static int __devinit a4t_pci_probe (struct pci_dev *dev_a4t, +struct IsdnCardState *cs, +u_int *found, +u_int *pci_memaddr) +{ +u16 sub_sys; +u16 sub_vendor; + + sub_vendor = dev_a4t->subsystem_vendor; + sub_sys = dev_a4t->subsystem_device; +if ((sub_sys ==PCI_DEVICE_ID_BERKOM_A4T ) && (sub_vendor ==PCI_VENDOR_ID_BERKOM )) { +if (pci_enable_device (dev_a4t)) +return (0 );/* end loop & function */ + *found =1 ; + *pci_memaddr =pci_resource_start (dev_a4t,0 ); + cs->irq = dev_a4t->irq; +return (1 );/* end loop */ + } -int __devinit -setup_bkm_a4t (struct IsdnCard *card) +return (-1 );/* continue looping */ +} + +static int __devinit a4t_cs_init (struct IsdnCard *card, +struct IsdnCardState *cs, +u_int pci_memaddr) { -struct IsdnCardState *cs = card->cs; -char tmp[64 ]; -u_int pci_memaddr =0 , found =0 ;I20_REGISTER_FILE *pI20_Regs; -#ifdef CONFIG_PCI -#endif - -strcpy (tmp, bkm_a4t_revision); -printk (KERN_INFO "HiSax: T-Berkom driver Rev. %s\n" ,HiSax_getrev (tmp)); -if (cs->typ ==ISDN_CTYPE_BKM_A4T ) { - cs->subtyp =BKM_A4T ; - }else -return (0 ); -#ifdef CONFIG_PCI -while ((dev_a4t =pci_find_device (PCI_VENDOR_ID_ZORAN , -PCI_DEVICE_ID_ZORAN_36120 , dev_a4t))) { -u16 sub_sys; -u16 sub_vendor; - - sub_vendor = dev_a4t->subsystem_vendor; - sub_sys = dev_a4t->subsystem_device; -if ((sub_sys ==PCI_DEVICE_ID_BERKOM_A4T ) && (sub_vendor ==PCI_VENDOR_ID_BERKOM )) { -if (pci_enable_device (dev_a4t)) -return (0 ); - found =1 ; - pci_memaddr =pci_resource_start (dev_a4t,0 ); - cs->irq = dev_a4t->irq; -break ; - } - } -if (!found) { -printk (KERN_WARNING "HiSax: %s: Card not found\n" , CardType[card->typ]); -return (0 ); - }if (!cs->irq) {/* IRQ range check ?? */ printk (KERN_WARNING "HiSax: %s: No IRQ\n" , CardType[card->typ]);return (0 ); } -if (!pci_memaddr) { -printk (KERN_WARNING "HiSax: %s: No Memory base address\n" , CardType[card->typ]); -return (0 ); - } cs->hw.ax.base = (long )ioremap (pci_memaddr,4096 );/* Check suspecious address */ pI20_Regs = (I20_REGISTER_FILE *) (cs->hw.ax.base);
@@ -317,11 +301,7 @@ setup_bkm_a4t(struct IsdnCard *card) cs->hw.ax.jade_adr = cs->hw.ax.base +PO_OFFSET ; cs->hw.ax.isac_ale =GCS_1 ; cs->hw.ax.jade_ale =GCS_3 ; -#else -printk (KERN_WARNING "HiSax: %s: NO_PCI_BIOS\n" , CardType[card->typ]); -printk (KERN_WARNING "HiSax: %s: unable to configure\n" , CardType[card->typ]); -return (0 ); -#endif /* CONFIG_PCI */ +printk (KERN_INFO "HiSax: %s: Card configured at 0x%lX IRQ %d\n" , CardType[card->typ], cs->hw.ax.base, cs->irq);
@@ -339,5 +319,43 @@ setup_bkm_a4t(struct IsdnCard *card)ISACVersion (cs,"Telekom A4T:" );/* Jade version */ JadeVersion (cs,"Telekom A4T:" ); +return (1 ); } + +static struct pci_dev *dev_a4t__devinitdata =NULL ; + +int __devinit +setup_bkm_a4t (struct IsdnCard *card) +{ +struct IsdnCardState *cs = card->cs; +char tmp[64 ]; +u_int pci_memaddr =0 , found =0 ; +int ret; + +strcpy (tmp, bkm_a4t_revision); +printk (KERN_INFO "HiSax: T-Berkom driver Rev. %s\n" ,HiSax_getrev (tmp)); +if (cs->typ ==ISDN_CTYPE_BKM_A4T ) { + cs->subtyp =BKM_A4T ; + }else +return (0 ); + +while ((dev_a4t =pci_find_device (PCI_VENDOR_ID_ZORAN , +PCI_DEVICE_ID_ZORAN_36120 , dev_a4t))) { + ret =a4t_pci_probe (dev_a4t, cs, &found, &pci_memaddr); +if (!ret) +return (0 ); +if (ret >0 ) +break ; + } +if (!found) { +printk (KERN_WARNING "HiSax: %s: Card not found\n" , CardType[card->typ]); +return (0 ); + } +if (!pci_memaddr) { +printk (KERN_WARNING "HiSax: %s: No Memory base address\n" , CardType[card->typ]); +return (0 ); + } + +return a4t_cs_init (card, cs, pci_memaddr); +}
drivers/isdn/hisax/config.c +140 -93
259 lines not on this page · raw message
drivers/isdn/hisax/enternow_pci.c +89 -76
192 lines not on this page · raw message
drivers/isdn/hisax/hfc_pci.c +93 -98
267 lines not on this page · raw message
drivers/isdn/hisax/nj_s.c +108 -86
220 lines not on this page · raw message
drivers/isdn/hisax/nj_u.c +93 -74
191 lines not on this page · raw message