ISDN simple cleanups - hotplug API prep
PATCH 1/1 ISDN simple cleanups - hotplug API prep
Karsten,
As I mentioned in previous emails, I would like to send these upstream for 2.6.24. These are the first step in converting the hisax driver over to the modular, hotplug-friendly ISA/PNP/PCI APIs.
The second step in that conversion is 95% complete (one more driver), and is stored in branch 'isdn-pci' of the repository below.
The changes below were posted as patches many weeks ago, without comment. I also propagated these to the 'ALL' branch that gets copied into -mm for testing, though some changes have been there longer than others.
All these changes are code movement changes, without any changes to the logic -- even the existing whitespace funnies were kept in many cases.
Would you mind pulling these, or permitting me to push them upstream?
Thanks,
Jeff
The 'isdn-cleanups' branch ofgit://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git isdn-cleanups
contains the following changes:
Jeff Garzik (5):
[ISDN] Remove CONFIG_PCI ifdefs from 100% PCI source code [ISDN] HiSax avm_pci: split setup into three smaller functions [ISDN] HiSax elsa: split huge setup function into four smaller functions [ISDN] HiSax sedlbauer: move ISAPNP and PCI code into functions of their own [ISDN] HiSax diva: split setup into three smaller functions
drivers/isdn/hisax/avm_pci.c | 224 ++++++++++------- drivers/isdn/hisax/bkm_a8.c | 8 drivers/isdn/hisax/diva.c | 513 +++++++++++++++++++++++------------------ drivers/isdn/hisax/elsa.c | 494 ++++++++++++++++++++++----------------- drivers/isdn/hisax/sedlbauer.c | 276 ++++++++++++---------- drivers/isdn/hisax/telespci.c | 8 drivers/isdn/hisax/w6692.c | 7 7 files changed, 868 insertions(+), 662 deletions(-)
drivers/isdn/hisax/avm_pci.c +136 -88
@@ -20,7 +20,6 @@#include <linux/isapnp.h> #include <linux/interrupt.h> -extern const char *CardType[];static const char *avm_pci_rev ="$Revision: 1.29.2.4 $" ;#define AVM_FRITZ_PCI 1
@@ -726,100 +725,15 @@ AVM_card_msg(struct IsdnCardState *cs, int mt, void *arg)return (0 ); } -#ifdef CONFIG_PCI -static struct pci_dev *dev_avm__devinitdata =NULL ; -#endif -#ifdef __ISAPNP__ -static struct pnp_card *pnp_avm_c__devinitdata =NULL ; -#endif - -int __devinit -setup_avm_pcipnp (struct IsdnCard *card) +static int __devinit avm_setup_rest (struct IsdnCardState *cs) {u_int val, ver; -struct IsdnCardState *cs = card->cs; -char tmp[64 ]; -strcpy (tmp, avm_pci_rev); -printk (KERN_INFO "HiSax: AVM PCI driver Rev. %s\n" ,HiSax_getrev (tmp)); -if (cs->typ !=ISDN_CTYPE_FRITZPCI ) -return (0 ); -if (card->para[1 ]) { -/* old manual method */ - cs->hw.avm.cfg_reg = card->para[1 ]; - cs->irq = card->para[0 ]; - cs->subtyp =AVM_FRITZ_PNP ; - goto ready; - } -#ifdef __ISAPNP__ -if (isapnp_present ()) { -struct pnp_dev *pnp_avm_d =NULL ; -if ((pnp_avm_c =pnp_find_card ( -ISAPNP_VENDOR ('A' ,'V' ,'M' ), -ISAPNP_FUNCTION (0x0900 ), pnp_avm_c))) { -if ((pnp_avm_d =pnp_find_dev (pnp_avm_c, -ISAPNP_VENDOR ('A' ,'V' ,'M' ), -ISAPNP_FUNCTION (0x0900 ), pnp_avm_d))) { -int err; - -pnp_disable_dev (pnp_avm_d); - err =pnp_activate_dev (pnp_avm_d); -if (err<0 ) { -printk (KERN_WARNING "%s: pnp_activate_dev ret(%d)\n" , - __FUNCTION__, err); -return (0 ); - } - cs->hw.avm.cfg_reg = -pnp_port_start (pnp_avm_d,0 ); - cs->irq =pnp_irq (pnp_avm_d,0 ); -if (!cs->irq) { -printk (KERN_ERR "FritzPnP:No IRQ\n" ); -return (0 ); - } -if (!cs->hw.avm.cfg_reg) { -printk (KERN_ERR "FritzPnP:No IO address\n" ); -return (0 ); - } - cs->subtyp =AVM_FRITZ_PNP ; - goto ready; - } - } - }else { -printk (KERN_INFO "FritzPnP: no ISA PnP present\n" ); - } -#endif -#ifdef CONFIG_PCI -if ((dev_avm =pci_find_device (PCI_VENDOR_ID_AVM , -PCI_DEVICE_ID_AVM_A1 , dev_avm))) { -if (pci_enable_device (dev_avm)) -return (0 ); - cs->irq = dev_avm->irq; -if (!cs->irq) { -printk (KERN_ERR "FritzPCI: No IRQ for PCI card found\n" ); -return (0 ); - } - cs->hw.avm.cfg_reg =pci_resource_start (dev_avm,1 ); -if (!cs->hw.avm.cfg_reg) { -printk (KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n" ); -return (0 ); - } - cs->subtyp =AVM_FRITZ_PCI ; - }else { -printk (KERN_WARNING "FritzPCI: No PCI card found\n" ); -return (0 ); - } - cs->irq_flags |=IRQF_SHARED ; -#else -printk (KERN_WARNING "FritzPCI: NO_PCI_BIOS\n" ); -return (0 ); -#endif /* CONFIG_PCI */ -ready: cs->hw.avm.isac = cs->hw.avm.cfg_reg +0x10 ;if (!request_region (cs->hw.avm.cfg_reg,32 , (cs->subtyp ==AVM_FRITZ_PCI ) ?"avm PCI" :"avm PnP" )) {printk (KERN_WARNING -"HiSax: %s config port %x-%x already in use\n" , - CardType[card->typ], +"HiSax: Fritz!PCI/PNP config port %x-%x already in use\n" , cs->hw.avm.cfg_reg, cs->hw.avm.cfg_reg +31 );return (0 );
@@ -860,3 +774,137 @@ ready:ISACVersion (cs, (cs->subtyp ==AVM_FRITZ_PCI ) ?"AVM PCI:" :"AVM PnP:" );return (1 ); } + +#ifndef __ISAPNP__ + +static int __devinit avm_pnp_setup (struct IsdnCardState *cs) +{ +return (1 );/* no-op: success */ +} + +#else + +static struct pnp_card *pnp_avm_c__devinitdata =NULL ; + +static int __devinit avm_pnp_setup (struct IsdnCardState *cs) +{ +struct pnp_dev *pnp_avm_d =NULL ; + +if (!isapnp_present ()) +return (1 );/* no-op: success */ + +if ((pnp_avm_c =pnp_find_card ( +ISAPNP_VENDOR ('A' ,'V' ,'M' ), +ISAPNP_FUNCTION (0x0900 ), pnp_avm_c))) { +if ((pnp_avm_d =pnp_find_dev (pnp_avm_c, +ISAPNP_VENDOR ('A' ,'V' ,'M' ), +ISAPNP_FUNCTION (0x0900 ), pnp_avm_d))) { +int err; + +pnp_disable_dev (pnp_avm_d); + err =pnp_activate_dev (pnp_avm_d); +if (err<0 ) { +printk (KERN_WARNING "%s: pnp_activate_dev ret(%d)\n" , + __FUNCTION__, err); +return (0 ); + } + cs->hw.avm.cfg_reg = +pnp_port_start (pnp_avm_d,0 ); + cs->irq =pnp_irq (pnp_avm_d,0 ); +if (!cs->irq) { +printk (KERN_ERR "FritzPnP:No IRQ\n" ); +return (0 ); + } +if (!cs->hw.avm.cfg_reg) { +printk (KERN_ERR "FritzPnP:No IO address\n" ); +return (0 ); + } + cs->subtyp =AVM_FRITZ_PNP ; + +return (2 );/* goto 'ready' label */ + } + } + +return (1 ); +} + +#endif /* __ISAPNP__ */ + +#ifndef CONFIG_PCI + +static int __devinit avm_pci_setup (struct IsdnCardState *cs) +{ +return (1 );/* no-op: success */ +} + +#else + +static struct pci_dev *dev_avm__devinitdata =NULL ; + +static int __devinit avm_pci_setup (struct IsdnCardState *cs) +{ +if ((dev_avm =pci_find_device (PCI_VENDOR_ID_AVM , +PCI_DEVICE_ID_AVM_A1 , dev_avm))) { + +if (pci_enable_device (dev_avm)) +return (0 ); + + cs->irq = dev_avm->irq; +if (!cs->irq) { +printk (KERN_ERR "FritzPCI: No IRQ for PCI card found\n" ); +return (0 ); + } + + cs->hw.avm.cfg_reg =pci_resource_start (dev_avm,1 ); +if (!cs->hw.avm.cfg_reg) { +printk (KERN_ERR "FritzPCI: No IO-Adr for PCI card found\n" ); +return (0 ); + } + + cs->subtyp =AVM_FRITZ_PCI ; + }else { +printk (KERN_WARNING "FritzPCI: No PCI card found\n" ); +return (0 ); + } + + cs->irq_flags |=IRQF_SHARED ; + +return (1 ); +} + +#endif /* CONFIG_PCI */ + +int __devinit +setup_avm_pcipnp (struct IsdnCard *card) +{ +struct IsdnCardState *cs = card->cs; +char tmp[64 ]; +int rc; + +strcpy (tmp, avm_pci_rev); +printk (KERN_INFO "HiSax: AVM PCI driver Rev. %s\n" ,HiSax_getrev (tmp)); + +if (cs->typ !=ISDN_CTYPE_FRITZPCI ) +return (0 ); + +if (card->para[1 ]) { +/* old manual method */ + cs->hw.avm.cfg_reg = card->para[1 ]; + cs->irq = card->para[0 ]; + cs->subtyp =AVM_FRITZ_PNP ; + goto ready; + } + + rc =avm_pnp_setup (cs); +if (rc <1 ) +return (0 ); +if (rc ==2 ) + goto ready; + + rc =avm_pci_setup (cs); +if (rc <1 ) +return (0 ); + +ready: +return avm_setup_rest (cs); +}
drivers/isdn/hisax/bkm_a8.c +0 -8
@@ -20,8 +20,6 @@#include <linux/pci.h> #include "bkm_ax.h" -#ifdef CONFIG_PCI -#define ATTEMPT_PCI_REMAPPING /* Required for PLX rev 1 */ extern const char *CardType[];
@@ -279,12 +277,9 @@ static u_char pci_bus __devinitdata = 0;static u_char pci_device_fn__devinitdata =0 ;static u_char pci_irq__devinitdata =0 ; -#endif /* CONFIG_PCI */ -int __devinit setup_sct_quadro (struct IsdnCard *card) { -#ifdef CONFIG_PCI struct IsdnCardState *cs = card->cs;char tmp[64 ];u_int found =0 ;
@@ -442,7 +437,4 @@ setup_sct_quadro(struct IsdnCard *card) sct_quadro_subtypes[cs->subtyp], readreg(cs->hw.ax.base, cs->hw.ax.data_adr, IPAC_ID));return (1 ); -#else -printk (KERN_ERR "HiSax: bkm_a8 only supported on PCI Systems\n" ); -#endif /* CONFIG_PCI */ }
drivers/isdn/hisax/diva.c +294 -219
537 lines not on this page · raw message
drivers/isdn/hisax/elsa.c +278 -216
546 lines not on this page · raw message
drivers/isdn/hisax/sedlbauer.c +157 -119
304 lines not on this page · raw message
drivers/isdn/hisax/telespci.c +2 -6
@@ -295,11 +295,12 @@ setup_telespci(struct IsdnCard *card)#ifdef __BIG_ENDIAN#error "not running on big endian machines now"#endif +strcpy (tmp, telespci_revision);printk (KERN_INFO "HiSax: Teles/PCI driver Rev. %s\n" ,HiSax_getrev (tmp));if (cs->typ !=ISDN_CTYPE_TELESPCI )return (0 ); -#ifdef CONFIG_PCI +if ((dev_tel =pci_find_device (PCI_VENDOR_ID_ZORAN ,PCI_DEVICE_ID_ZORAN_36120 , dev_tel))) {if (pci_enable_device (dev_tel))return (0 );
@@ -317,11 +318,6 @@ setup_telespci(struct IsdnCard *card)printk (KERN_WARNING "TelesPCI: No PCI card found\n" );return (0 ); } -#else -printk (KERN_WARNING "HiSax: Teles/PCI and NO_PCI_BIOS\n" ); -printk (KERN_WARNING "HiSax: Teles/PCI unable to config\n" ); -return (0 ); -#endif /* CONFIG_PCI */ /* Initialize Zoran PCI controller */ writel (0x00000000 , cs->hw.teles0.membase +0x28 );
drivers/isdn/hisax/w6692.c +1 -6
@@ -1009,7 +1009,7 @@ setup_w6692(struct IsdnCard *card)printk (KERN_INFO "HiSax: W6692 driver Rev. %s\n" ,HiSax_getrev (tmp));if (cs->typ !=ISDN_CTYPE_W6692 )return (0 ); -#ifdef CONFIG_PCI +while (id_list[id_idx].vendor_id) { dev_w6692 = pci_find_device(id_list[id_idx].vendor_id, id_list[id_idx].device_id,
@@ -1061,11 +1061,6 @@ setup_w6692(struct IsdnCard *card) cs->hw.w6692.iobase + 255);return (0 ); } -#else -printk (KERN_WARNING "HiSax: W6692 and NO_PCI_BIOS\n" ); -printk (KERN_WARNING "HiSax: W6692 unable to config\n" ); -return (0 ); -#endif /* CONFIG_PCI */ printk(KERN_INFO "HiSax: %s config irq:%d I/O:%x\n",
Quoted 14 lines · Jeff Garzik
Karsten,
As I mentioned in previous emails, I would like to send these upstream for 2.6.24. These are the first step in converting the hisax driver over to the modular, hotplug-friendly ISA/PNP/PCI APIs.
The second step in that conversion is 95% complete (one more driver), and is stored in branch 'isdn-pci' of the repository below.
The changes below were posted as patches many weeks ago, without comment. I also propagated these to the 'ALL' branch that gets copied into -mm for testing, though some changes have been there longer than others.
Quoted 5 lines
All these changes are code movement changes, without any changes to the logic -- even the existing whitespace funnies were kept in many cases.
Would you mind pulling these, or permitting me to push them upstream?
Tested and Acked.
Signature · 4 lines
Karsten Keil SuSE Labs ISDN and VOIP development SUSE LINUX Products GmbH, Maxfeldstr.5 90409 Nuernberg, GF: Markus Rex, HRB 16746 (AG Nuernberg)
Quoted 15 lines · Karsten Keil
Quoted 14 lines · Jeff Garzik
Karsten,
As I mentioned in previous emails, I would like to send these upstream for 2.6.24. These are the first step in converting the hisax driver over to the modular, hotplug-friendly ISA/PNP/PCI APIs.
The second step in that conversion is 95% complete (one more driver), and is stored in branch 'isdn-pci' of the repository below.
The changes below were posted as patches many weeks ago, without comment. I also propagated these to the 'ALL' branch that gets copied into -mm for testing, though some changes have been there longer than others.
Quoted 7 lines
Quoted 5 lines
All these changes are code movement changes, without any changes to the logic -- even the existing whitespace funnies were kept in many cases.
Would you mind pulling these, or permitting me to push them upstream?
Tested and Acked.
Thanks (for this, and hysdn)
Jeff