[Asterisk-cvs] zaptel torisa.c,1.7,1.8 wcfxo.c,1.21,1.22 wcfxs.c,1.39,1.40 wct1xxp.c,1.15,1.16 wct4xxp.c,1.15,1.16 wcusb.c,1.8,1.9 wcusb.h,1.2,1.3 zaptel.c,1.53,1.54 ztd-eth.c,1.3,1.4 ztdynamic.c,1.5,1.6

markster at lists.digium.com markster at lists.digium.com
Tue Jan 6 07:35:03 CST 2004


Update of /usr/cvsroot/zaptel
In directory mongoose.digium.com:/tmp/cvs-serv18785

Modified Files:
	torisa.c wcfxo.c wcfxs.c wct1xxp.c wct4xxp.c wcusb.c wcusb.h 
	zaptel.c ztd-eth.c ztdynamic.c 
Log Message:
Clean build on Linux 2.6, will need lots of testing


Index: torisa.c
===================================================================
RCS file: /usr/cvsroot/zaptel/torisa.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- torisa.c	17 Mar 2003 18:11:45 -0000	1.7
+++ torisa.c	6 Jan 2004 13:26:44 -0000	1.8
@@ -269,10 +269,19 @@
 		}
 		/* Try to get the irq if the user didn't specify one */
 		if (irq < 1) {
+#ifdef LINUX26
+			unsigned long irqs;
+			unsigned long delay = jiffies + 5;
+			irqs = probe_irq_on();
+			setctlreg(MASTERCLOCK|INTENA);
+			while((long)(jiffies - delay) < 0);
+			irq = probe_irq_off(irqs);
+#else			
 			autoirq_setup(0);
 			setctlreg(MASTERCLOCK|INTENA);
 			/* Wait a jiffie -- that's plenty of time */
 			irq = autoirq_report(5);
+#endif			
 		}
 		/* disable interrupts having gotten one */
 		setctlreg(MASTERCLOCK);
@@ -316,7 +325,7 @@
 	u_char m,c;
 	int k,n,b;
 	struct torisa_pvt *p = chan->pvt;
-	unsigned int flags;
+	unsigned long flags;
 #if	0
 	printk("Setting bits to %x hex on channel %s\n", bits, chan->name);
 #endif
@@ -393,7 +402,7 @@
 	int i;
 	int tspan;
 	int wasrunning;
-	unsigned int flags;
+	unsigned long flags;
 
 	tspan = getspan(span);
 	if (tspan < 0) {
@@ -425,7 +434,7 @@
 	unsigned long endjif;
 	int i;
 	int tspan;
-	unsigned int flags;
+	unsigned long flags;
 	char *coding;
 	char *framing;
 	char *crcing;
@@ -609,7 +618,7 @@
 static int torisa_chanconfig(struct zt_chan *chan, int sigtype)
 {
 	int alreadyrunning;
-	unsigned int flags;
+	unsigned long flags;
 	alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING;
 	if (debug) {
 		if (alreadyrunning)
@@ -626,13 +635,17 @@
 
 static int torisa_open(struct zt_chan *chan)
 {
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
 static int torisa_close(struct zt_chan *chan)
 {
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return 0;
 }
 
@@ -723,7 +736,11 @@
 
 static int txerrors;
 
+#ifdef LINUX26
+static irqreturn_t torisa_intr(int irq, void *dev_id, struct pt_regs *regs)
+#else
 static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	static unsigned int passno = 0, mysynccnt = 0, lastsyncsrc = -1;
 	int n, n1, i, j, k, x, mysyncsrc, oldn;
@@ -742,7 +759,11 @@
 	  /* make sure its a real interrupt for us */
 	if (!(getctlreg() & 1)) /* if not, just return */
 	   {
+#ifdef LINUX26
+		return IRQ_NONE;
+#else		
 		return; 
+#endif		
 	   }
 
 	  /* set outbit and put int 16 bit bus mode, reset interrupt enable */
@@ -1008,6 +1029,9 @@
 	/* If this is the last pass, then prepare the next set */
 	  /* clear outbit, restore interrupt enable */
 	setctlreg(clockvals[syncsrc] | INTENA);
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif	
 }
 
 

Index: wcfxo.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxo.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- wcfxo.c	17 Nov 2003 22:09:40 -0000	1.21
+++ wcfxo.c	6 Jan 2004 13:26:44 -0000	1.22
@@ -91,7 +91,7 @@
 #define PEGCOUNT	5		/* 5 cycles of pegging means RING */
 
 struct reg {
-	int flags;
+	unsigned long flags;
 	unsigned char index;
 	unsigned char reg;
 	unsigned char value;
@@ -108,7 +108,7 @@
 	int usecount;
 	int dead;
 	int pos;
-	int flags;
+	unsigned long flags;
 	int freeregion;
 	int ring;
 	int offhook;
@@ -162,7 +162,7 @@
 
 struct wcfxo_desc {
 	char *name;
-	int flags;
+	unsigned long flags;
 };
 
 
@@ -387,7 +387,11 @@
 static void wcfxo_stop_dma(struct wcfxo *wc);
 static void wcfxo_restart_dma(struct wcfxo *wc);
 
+#ifdef LINUX26
+static irqreturn_t wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#else
 static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	struct wcfxo *wc = dev_id;
 	unsigned char ints;
@@ -402,7 +406,11 @@
 
 
 	if (!ints)
+#ifdef LINUX26
+		return IRQ_NONE;
+#else
 		return;
+#endif		
 
 	if (ints & 0x0c) {  /* if there is a rx interrupt pending */
 #ifdef ENABLE_TASKLETS
@@ -425,12 +433,20 @@
 		printk("FXO PCI Master abort\n");
 		/* Stop DMA andlet the watchdog start it again */
 		wcfxo_stop_dma(wc);
+#ifdef LINUX26
+		return IRQ_RETVAL(1);
+#else
 		return;
+#endif		
 	}
 
 	if (ints & 0x20) {
 		printk("PCI Target abort\n");
+#ifdef LINUX26
+		return IRQ_RETVAL(1);
+#else
 		return;
+#endif		
 	}
 	if (1 /* !(wc->report % 0xf) */) {
 		/* Check for BATTERY from register and debounce for 8 ms */
@@ -504,6 +520,9 @@
 #endif
 
 	}
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif		
 }
 
 static int wcfxo_setreg(struct wcfxo *wc, unsigned char reg, unsigned char value)
@@ -527,7 +546,9 @@
 	if (wc->dead)
 		return -ENODEV;
 	wc->usecount++;
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
@@ -542,7 +563,9 @@
 {
 	struct wcfxo *wc = chan->pvt;
 	wc->usecount--;
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	/* If we're dead, release us now */
 	if (!wc->usecount && wc->dead)
 		wcfxo_release(wc);

Index: wcfxs.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcfxs.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- wcfxs.c	23 Nov 2003 23:09:46 -0000	1.39
+++ wcfxs.c	6 Jan 2004 13:26:44 -0000	1.40
@@ -340,7 +340,7 @@
 
 static void wcfxs_setreg(struct wcfxs *wc, int card, unsigned char reg, unsigned char value)
 {
-	long flags;
+	unsigned long flags;
 	spin_lock_irqsave(&wc->lock, flags);
 	__wcfxs_setreg(wc, card, reg, value);
 	spin_unlock_irqrestore(&wc->lock, flags);
@@ -355,7 +355,7 @@
 
 static unsigned char wcfxs_getreg(struct wcfxs *wc, int card, unsigned char reg)
 {
-	long flags;
+	unsigned long flags;
 	unsigned char res;
 	spin_lock_irqsave(&wc->lock, flags);
 	res = __wcfxs_getreg(wc, card, reg);
@@ -390,7 +390,7 @@
 
 static int wcfxs_setreg_indirect(struct wcfxs *wc, int card, unsigned char address, unsigned short data)
 {
-	long flags;
+	unsigned long flags;
 	int res = -1;
 	spin_lock_irqsave(&wc->lock, flags);
 	if(!__wait_access(wc, card)) {
@@ -405,7 +405,7 @@
 
 static int wcfxs_getreg_indirect(struct wcfxs *wc, int card, unsigned char address)
 { 
-	long flags;
+	unsigned long flags;
 	int res = -1;
 	char *p=NULL;
 	spin_lock_irqsave(&wc->lock, flags);
@@ -470,8 +470,11 @@
     }
     return 0;
 }
-
+#ifdef LINUX26
+static irqreturn_t wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#else
 static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	struct wcfxs *wc = dev_id;
 	unsigned char ints;
@@ -481,18 +484,30 @@
 	outb(ints, wc->ioaddr + WC_INTSTAT);
 
 	if (!ints)
+#ifdef LINUX26
+		return IRQ_NONE;
+#else
 		return;
+#endif		
 
 	if (ints & 0x10) {
 		/* Stop DMA, wait for watchdog */
 		printk("FXS PCI Master abort\n");
 		wcfxs_stop_dma(wc);
+#ifdef LINUX26
+		return IRQ_RETVAL(1);
+#else
 		return;
+#endif		
 	}
 	
 	if (ints & 0x20) {
 		printk("PCI Target abort\n");
+#ifdef LINUX26
+		return IRQ_RETVAL(1);
+#else
 		return;
+#endif		
 	}
 
 	for (x=0;x<4;x++) {
@@ -534,7 +549,9 @@
 		wcfxs_receiveprep(wc, ints);
 		wcfxs_transmitprep(wc, ints);
 	}
-	
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif		
 	
 }
 
@@ -1073,7 +1090,9 @@
 	if (wc->dead)
 		return -ENODEV;
 	wc->usecount++;
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
@@ -1089,7 +1108,9 @@
 	struct wcfxs *wc = chan->pvt;
 	int x;
 	wc->usecount--;
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	for (x=0;x<wc->cards;x++)
 		wc->idletxhookstate[x] = 1;
 	/* If we're dead, release us now */

Index: wct1xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct1xxp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- wct1xxp.c	1 Nov 2003 16:45:32 -0000	1.15
+++ wct1xxp.c	6 Jan 2004 13:26:44 -0000	1.16
@@ -212,7 +212,9 @@
 	if (wc->dead)
 		return -ENODEV;
 	wc->usecount++;
+#ifndef LINUX26	
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
@@ -242,7 +244,7 @@
 
 static int control_set_reg(struct t1xxp *wc, int reg, unsigned char val)
 {
-	long flags;
+	unsigned long flags;
 	int res;
 	spin_lock_irqsave(&wc->lock, flags);
 	res = __control_set_reg(wc, reg, val);
@@ -266,7 +268,7 @@
 
 static int control_get_reg(struct t1xxp *wc, int reg)
 {
-	long flags;
+	unsigned long flags;
 	int res;
 	spin_lock_irqsave(&wc->lock, flags);
 	res = __control_get_reg(wc, reg);
@@ -285,7 +287,9 @@
 {
 	struct t1xxp *wc = chan->pvt;
 	wc->usecount--;
+#ifndef LINUX26	
 	MOD_DEC_USE_COUNT;
+#endif
 	/* If we're dead, release us now */
 	if (!wc->usecount && wc->dead) 
 		t1xxp_release(wc);
@@ -351,7 +355,7 @@
 	char *coding, *framing;
 	unsigned long endjiffies;
 	int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING;
-	long flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&wc->lock, flags);
 
@@ -409,7 +413,7 @@
 	char *coding, *framing;
 	unsigned long endjiffies;
 	int alreadyrunning = wc->span.flags & ZT_FLAG_RUNNING;
-	long flags;
+	unsigned long flags;
 	char *crcing = "";
 	unsigned char ccr1, tcr1, tcr2;
 
@@ -479,7 +483,7 @@
 {
 	int res;
 	int chipid;
-	long flags;
+	unsigned long flags;
 	int x;
 
 	/* Sanity check */
@@ -499,7 +503,7 @@
 static int t1xxp_framer_hard_reset(struct t1xxp *wc)
 {
 	int x;
-	long flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&wc->lock, flags);
 	/* Initialize all registers to 0 */
@@ -552,7 +556,7 @@
 static int t1xxp_rbsbits(struct zt_chan *chan, int bits)
 {
 	struct t1xxp *wc = chan->pvt;
-	long flags;
+	unsigned long flags;
 	int b,o;
 	unsigned char mask;
 	
@@ -639,7 +643,7 @@
 static int t1xxp_shutdown(struct zt_span *span)
 {
 	struct t1xxp *wc = span->pvt;
-	long flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&wc->lock, flags);
 	__t1xxp_stop_dma(wc);
@@ -655,7 +659,7 @@
 {
 	struct t1xxp *wc = span->pvt;
 	int res = 0;
-	long flags;
+	unsigned long flags;
 	spin_lock_irqsave(&wc->lock, flags);
 	if (wc->ise1) {
 		switch(cmd) {
@@ -717,7 +721,7 @@
 static int t1xxp_chanconfig(struct zt_chan *chan, int sigtype)
 {
 	struct t1xxp *wc = chan->pvt;
-	int flags;
+	unsigned long flags;
 	int alreadyrunning = chan->span->flags & ZT_FLAG_RUNNING;
 
 	spin_lock_irqsave(&wc->lock, flags);
@@ -1119,18 +1123,26 @@
 	}
 }
 
+#ifdef LINUX26
+static irqreturn_t t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#else
 static void t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	struct t1xxp *wc = dev_id;
 	unsigned char ints;
-	long flags;
+	unsigned long flags;
 	int x;
 
 	ints = inb(wc->ioaddr + WC_INTSTAT);
 	outb(ints, wc->ioaddr + WC_INTSTAT);
 
 	if (!ints)
+#ifdef LINUX26
+		return IRQ_NONE;
+#else
 		return;
+#endif		
 
 	if (!wc->intcount) {
 		if (debug) printk("Got interrupt: 0x%04x\n", ints);
@@ -1176,6 +1188,9 @@
 	if (ints & 0x20)
 		printk("PCI Target abort\n");
 
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif		
 }
 
 static int t1xxp_hardware_init(struct t1xxp *wc)

Index: wct4xxp.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wct4xxp.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- wct4xxp.c	21 Nov 2003 05:34:02 -0000	1.15
+++ wct4xxp.c	6 Jan 2004 13:26:44 -0000	1.16
@@ -191,7 +191,7 @@
 
 static inline void t4_pci_out(struct t4 *wc, const unsigned int addr, const unsigned int value)
 {
-	long flags;
+	unsigned long flags;
 	spin_lock_irqsave(&wc->reglock, flags);
 	__t4_pci_out(wc, addr, value);
 	spin_unlock_irqrestore(&wc->reglock, flags);
@@ -215,7 +215,7 @@
 static inline unsigned int t4_pci_in(struct t4 *wc, const unsigned int addr)
 {
 	unsigned int ret;
-	long flags;
+	unsigned long flags;
 	
 	spin_lock_irqsave(&wc->reglock, flags);
 	ret = __t4_pci_in(wc, addr);
@@ -525,13 +525,17 @@
 
 static int t4_open(struct zt_chan *chan)
 {
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
 static int t4_close(struct zt_chan *chan)
 {
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return 0;
 }
 
@@ -845,7 +849,7 @@
 {
 	int i;
 	int x;
-	long flags;
+	unsigned long flags;
 	int p;
 	int nonzero;
 	int newsyncsrc = 0;			/* Zaptel span number */
@@ -1314,10 +1318,14 @@
 #endif
 }
 
+#ifdef LINUX26
+static irqreturn_t t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#else
 static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+#endif
 {
 	struct t4 *wc = dev_id;
-	long flags;
+	unsigned long flags;
 	int x;
 	
 	unsigned int status;
@@ -1337,11 +1345,19 @@
 
 	/* Ignore if it's not for us */
 	if (!status)
+#ifdef LINUX26
+		return IRQ_NONE;
+#else
 		return;
+#endif		
 
 	if (!wc->spansstarted) {
 		printk("Not prepped yet!\n");
+#ifdef LINUX26
+		return IRQ_NONE;
+#else
 		return;
+#endif		
 	}
 
 	wc->intcount++;
@@ -1388,7 +1404,9 @@
 	}
 
 	spin_unlock_irqrestore(&wc->reglock, flags);
-
+#ifdef LINUX26
+	return IRQ_RETVAL(1);
+#endif		
 }
 
 static int t4_reset_dma(struct t4 *wc)

Index: wcusb.c
===================================================================
RCS file: /usr/cvsroot/zaptel/wcusb.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- wcusb.c	23 Aug 2003 06:13:56 -0000	1.8
+++ wcusb.c	6 Jan 2004 13:26:44 -0000	1.9
@@ -54,6 +54,9 @@
 #include "wcusb.h"
 #include "proslic.h"
 
+#ifndef FILL_CONTROL_URB
+#define FILL_CONTROL_URB usb_fill_control_urb
+#endif
 
 #ifdef DEBUG_WILDCARD
 #define DPRINTK(x) printk x
@@ -179,9 +182,15 @@
 }					  
 
 #ifdef USB2420
+#ifdef LINUX26
+static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs));
+static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs));
+static void wcusb_async_control(struct urb *urb, struct pt_regs *regs);
+#else
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb));
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb));
 static void wcusb_async_control(struct urb *urb);
+#endif /* LINUX26 */
 #else
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb));
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb));
@@ -209,7 +218,11 @@
 }
 
 #ifdef USB2420
+#ifdef LINUX26
+static void wcusb_async_control(struct urb *urb, struct pt_regs *regs)
+#else
 static void wcusb_async_control(struct urb *urb)
+#endif
 #else
 static void wcusb_async_control(urb_t *urb)
 #endif
@@ -297,7 +310,11 @@
 }
 
 #ifdef USB2420
+#ifdef LINUX26
+static void keypad_check_done(struct urb *urb, struct pt_regs *regs)
+#else
 static void keypad_check_done(struct urb *urb)
+#endif
 #else
 static void keypad_check_done(urb_t *urb)
 #endif
@@ -410,7 +427,11 @@
 }
 
 #ifdef USB2420
+#ifdef LINUX26
+static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs))
+#else
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb))
+#endif /* LINUX26 */
 #else
 static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb))
 #endif
@@ -438,7 +459,12 @@
 #endif
 
 	FILL_CONTROL_URB(urb, p->dev, usb_rcvctrlpipe(p->dev, 0), (unsigned char *)&p->dr, data, len, complete, p);
-	if (usb_submit_urb(urb)) {
+#ifdef LINUX26
+	if (usb_submit_urb(urb, GFP_KERNEL)) 
+#else	
+	if (usb_submit_urb(urb)) 
+#endif
+	{
 		printk("wcusb_async_read: control URB died\n");
 		p->timer = 50;
 		return -1;
@@ -449,7 +475,11 @@
 }
 
 #ifdef USB2420
+#ifdef LINUX26
+static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb, struct pt_regs *regs))
+#else
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(struct urb *urb))
+#endif /* LINUX26 */
 #else
 static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned char *data, int len, int state, void (*complete)(urb_t *urb))
 #endif
@@ -477,7 +507,12 @@
 #endif
 
 	FILL_CONTROL_URB(urb, p->dev, usb_sndctrlpipe(p->dev, 0), (unsigned char *)&p->dr, data, len, complete, p);
-	if (usb_submit_urb(urb)) {
+#ifdef LINUX26
+	if (usb_submit_urb(urb, GFP_KERNEL)) 
+#else	
+	if (usb_submit_urb(urb)) 
+#endif	
+	{
 		printk("wcusb_async_write: control URB died\n");
 		return -1;
 	}
@@ -846,7 +881,11 @@
 	return ZT_LIN2MU(linsample);
 }
 
+#ifdef LINUX26
+static void wcusb_read_complete(struct urb *q, struct pt_regs *regs)
+#else
 static void wcusb_read_complete(struct urb *q)
+#endif
 {
 	struct wc_usb_pvt *p = q->context;
 	short *chunk = q->transfer_buffer;
@@ -877,7 +916,12 @@
 
 	q->dev = p->dev;
 	
-	if (usb_submit_urb(q)) {
+#ifdef LINUX26
+	if (usb_submit_urb(q, GFP_KERNEL)) 
+#else	
+	if (usb_submit_urb(q)) 
+#endif	
+	{
 		printk("wcusb: Read cycle failed\n");
 	}
 
@@ -903,7 +947,11 @@
 	return;
 }
 
+#ifdef LINUX26
+static void wcusb_write_complete(struct urb *q, struct pt_regs *regs)
+#else
 static void wcusb_write_complete(struct urb *q)
+#endif
 {
 	struct wc_usb_pvt *p = q->context;
 	short *chunk = q->transfer_buffer;
@@ -921,7 +969,12 @@
 	}
 	q->dev = p->dev;
 	
-	if (usb_submit_urb(q)) {
+#ifdef LINUX26
+	if (usb_submit_urb(q, GFP_KERNEL)) 
+#else	
+	if (usb_submit_urb(q)) 
+#endif	
+	{
 		printk("wcusb: Write cycle failed\n");
 	}
 
@@ -978,7 +1031,11 @@
 	for (x = 0; x < 2; x++) {
 		p->dataread[x].urb.dev = p->dev;
 		p->dataread[x].urb.pipe = readpipe;
+#ifdef LINUX26
+		p->dataread[x].urb.transfer_flags = URB_ISO_ASAP;
+#else
 		p->dataread[x].urb.transfer_flags = USB_ISO_ASAP;
+#endif		
 		p->dataread[x].urb.number_of_packets = 1;
 		p->dataread[x].urb.context = p;
 		p->dataread[x].urb.complete = wcusb_read_complete;
@@ -989,7 +1046,11 @@
 
 		p->datawrite[x].urb.dev = p->dev;
 		p->datawrite[x].urb.pipe = writepipe;
+#ifdef LINUX26
+		p->datawrite[x].urb.transfer_flags = URB_ISO_ASAP;
+#else
 		p->datawrite[x].urb.transfer_flags = USB_ISO_ASAP;
+#endif
 		p->datawrite[x].urb.number_of_packets = 1;
 		p->datawrite[x].urb.context = p;
 		p->datawrite[x].urb.complete = wcusb_write_complete;
@@ -1010,11 +1071,21 @@
 	p->flags |= FLAG_RUNNING;
 
 	for (x = 0; x < 2; x++) {
-		if (usb_submit_urb(&p->dataread[x].urb)) {
+#ifdef LINUX26
+		if (usb_submit_urb(&p->dataread[x].urb, GFP_KERNEL)) 
+#else
+		if (usb_submit_urb(&p->dataread[x].urb)) 
+#endif
+		{
 			printk(KERN_ERR "wcusb: Read submit failed\n");
 			return -1;
 		}
-		if (usb_submit_urb(&p->datawrite[x].urb)) {
+#ifdef LINUX26
+		if (usb_submit_urb(&p->datawrite[x].urb, GFP_KERNEL))
+#else
+		if (usb_submit_urb(&p->datawrite[x].urb)) 
+#endif		
+		{
 			printk(KERN_ERR "wcusb: Write submit failed\n");
 			return -1;
 		}
@@ -1091,7 +1162,9 @@
 		default:
 			break;
 	}
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	p->usecount++;
 	return 0;
 }
@@ -1109,7 +1182,9 @@
 			kfree(p->pvt_data);
 		kfree(p);
 	}
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return 0;
 }
 
@@ -1202,10 +1277,17 @@
 	return 0;
 }
 	
+#ifdef LINUX26
+static int wc_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
+#else
 static void *wc_usb_probe(struct usb_device *dev, unsigned int ifnum, const struct usb_device_id *id)
+#endif
 {
 	struct wc_usb_pvt *p = NULL;
 	struct wc_usb_desc *d = (struct wc_usb_desc *)id->driver_info;
+#ifdef LINUX26
+	struct usb_device *dev = interface_to_usbdev(intf);
+#endif	
 
 	int x;
 	for (x=0;x<WC_MAX_IFACES;x++) {
@@ -1227,13 +1309,19 @@
 
 	if (!(p = wc_detect_device(dev, p))) {
 		printk("wcusb: No wcusb devices found\n");
+#ifdef LINUX26
+		return -ENODEV;
+#else
 		return NULL;
+#endif		
 	}
 
+#ifndef LINUX26
 	if (usb_set_configuration(dev, dev->config[0].bConfigurationValue) < 0) {
 		printk("wcusb: set_configuration failed (ConfigValue 0x%x)\n", dev->config[0].bConfigurationValue);
 		return NULL;
 	}
+#endif
 
 	if (init_hardware(p)) {
 		printk("wcusb: Hardware intialization failed.\n");
@@ -1269,7 +1357,12 @@
 	/* Clear alarms */
 	p->span.alarms = 0;
 	zt_alarm_notify(&p->span);
+#ifdef LINUX26
+	usb_set_intfdata(intf, p);
+	return 0;
+#else
 	return p;
+#endif		
 	
 cleanup:
 	printk("cleanup\n");
@@ -1279,14 +1372,26 @@
 		}
 		kfree(p);
 	}
+#ifdef LINUX26
+	return -ENODEV;
+#else
 	return NULL;
+#endif	
 }
 
+#ifdef LINUX26
+static void wc_usb_disconnect(struct usb_interface *intf)
+#else
 static void wc_usb_disconnect(struct usb_device *dev, void *ptr)
+#endif
 {
 	/* Doesn't handle removal if we're in use right */
+#ifdef LINUX26
+	struct wc_usb_pvt *p = usb_get_intfdata(intf);
+#else
 	struct wc_usb_pvt *p = ptr;
-	if (ptr) {
+#endif	
+	if (p) {
 		StopTransmit(p);
 		p->dev = NULL;
 		if (!p->usecount) {
@@ -1294,7 +1399,7 @@
 			if (p->pvt_data)
 				kfree(p->pvt_data);
 			ifaces[p->pos] = NULL;
-			kfree(ptr);
+			kfree(p);
 		} else {
 			/* Generate alarm and note that we're dead */
 			p->span.alarms = ZT_ALARM_RED;
@@ -1303,6 +1408,9 @@
 		}
 	}
 	printk("wcusb: Removed a Wildcard device\n");
+#ifdef LINUX26
+	usb_set_intfdata(intf, NULL);
+#endif		
 	return;
 }
 
@@ -1337,11 +1445,15 @@
 
 static struct usb_driver wc_usb_driver =
 {
+#ifdef LINUX26
+	owner: THIS_MODULE,
+#else	
+	fops: NULL,
+	minor: 0,
+#endif	
 	name: "wcusb",
 	probe: wc_usb_probe,
 	disconnect: wc_usb_disconnect,
-	fops: NULL,
-	minor: 0,
 	id_table: wc_dev_ids,
 };
 

Index: wcusb.h
===================================================================
RCS file: /usr/cvsroot/zaptel/wcusb.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- wcusb.h	13 Dec 2002 17:45:28 -0000	1.2
+++ wcusb.h	6 Jan 2004 13:26:44 -0000	1.3
@@ -89,7 +89,9 @@
 struct stinky_urb {
 #ifdef USB2420
         struct urb urb;
+#ifndef LINUX26
         struct iso_packet_descriptor isoframe[1];
+#endif		
 #else
         urb_t urb;
         iso_packet_descriptor_t isoframe[1];

Index: zaptel.c
===================================================================
RCS file: /usr/cvsroot/zaptel/zaptel.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- zaptel.c	2 Jan 2004 23:28:52 -0000	1.53
+++ zaptel.c	6 Jan 2004 13:26:44 -0000	1.54
@@ -1184,7 +1184,9 @@
 	fasthdlc_init(&ms->txhdlc);
 	ms->infcs = PPP_INITFCS;
 
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 #if CONFIG_ZAPATA_DEBUG
 	printk("ZAPNET: Opened channel %d name %s\n", ms->channo, ms->name);
 #endif
@@ -1220,7 +1222,9 @@
 	}
 	/* Not much to do here.  Just deallocate the buffers */
 	zt_reallocbufs(ms, 0, 0);
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif	
 #ifdef NEW_HDLC_INTERFACE
 	return 0;
 #else
@@ -1678,28 +1682,36 @@
 static int zt_ctl_open(struct inode *inode, struct file *file)
 {
 	/* Nothing to do, really */
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif
 	return 0;
 }
 
 static int zt_chan_open(struct inode *inode, struct file *file)
 {
 	/* Nothing to do here for now either */
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif
 	return 0;
 }
 
 static int zt_ctl_release(struct inode *inode, struct file *file)
 {
 	/* Nothing to do */
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return 0;
 }
 
 static int zt_chan_release(struct inode *inode, struct file *file)
 {
 	/* Nothing to do for now */
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return 0;
 }
 
@@ -2000,7 +2012,9 @@
 	memset(t, 0, sizeof(struct zt_timer));
 	init_waitqueue_head(&t->sel);
 	file->private_data = t;
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif
 	spin_lock_irqsave(&zaptimerlock, flags);
 	t->next = zaptimers;
 	zaptimers = t;
@@ -2035,7 +2049,9 @@
 			return 0;
 		}
 		kfree(t);
+#ifndef LINUX26
 		MOD_DEC_USE_COUNT;
+#endif		
 	}
 	return 0;
 }
@@ -2063,8 +2079,10 @@
 				res = chans[unit]->span->open(chans[unit]);
 			if (!res) {
 				chans[unit]->file = file;
+#ifndef LINUX26
 				if (inc)
 					MOD_INC_USE_COUNT;
+#endif					
 				chans[unit]->flags |= ZT_FLAG_OPEN;
 			} else {
 				close_channel(chans[unit]);
@@ -2086,7 +2104,9 @@
 			res = chans[unit]->span->close(chans[unit]);
 	} else
 		res = -ENXIO;
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif
 	return res;
 }
 

Index: ztd-eth.c
===================================================================
RCS file: /usr/cvsroot/zaptel/ztd-eth.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ztd-eth.c	21 Jun 2003 19:02:54 -0000	1.3
+++ ztd-eth.c	6 Jan 2004 13:26:44 -0000	1.4
@@ -64,7 +64,7 @@
 
 struct zt_span *ztdeth_getspan(unsigned char *addr, unsigned short subaddr)
 {
-	long flags;
+	unsigned long flags;
 	struct ztdeth *z;
 	struct zt_span *span = NULL;
 	spin_lock_irqsave(&zlock, flags);
@@ -99,7 +99,7 @@
 {
 	struct net_device *dev = ptr;
 	struct ztdeth *z;
-	long flags;
+	unsigned long flags;
 	switch(event) {
 	case NETDEV_GOING_DOWN:
 	case NETDEV_DOWN:
@@ -133,7 +133,7 @@
 	struct ztdeth *z;
 	struct sk_buff *skb;
 	struct ztdeth_header *zh;
-	long flags;
+	unsigned long flags;
 
 	spin_lock_irqsave(&zlock, flags);
 	z = pvt;
@@ -164,11 +164,9 @@
 }
 
 static struct packet_type ztdeth_ptype = {
-	__constant_htons(ETH_P_ZTDETH),		/* Protocol */
-	NULL,					/* Device (NULL = wildcard) */
-	ztdeth_rcv,				/* Receiver */
-	NULL,					/* Data */
-	NULL					/* Next */
+	type: __constant_htons(ETH_P_ZTDETH),		/* Protocol */
+	dev: NULL,					/* Device (NULL = wildcard) */
+	func: ztdeth_rcv,				/* Receiver */
 };
 
 static int digit2int(char d)
@@ -231,7 +229,7 @@
 static void ztdeth_destroy(void *pvt)
 {
 	struct ztdeth *z = pvt;
-	long flags;
+	unsigned long flags;
 	struct ztdeth *prev=NULL, *cur;
 	spin_lock_irqsave(&zlock, flags);
 	cur = zdevs;
@@ -255,7 +253,7 @@
 	char src[256];
 	char tmp[256], *tmp2, *tmp3;
 	int res,x;
-	long flags;
+	unsigned long flags;
 
 	z = kmalloc(sizeof(struct ztdeth), GFP_KERNEL);
 	if (z) {
@@ -264,27 +262,32 @@
 
 		/* Address should be <dev>/<macaddr>[/subaddr] */
 		strncpy(tmp, addr, sizeof(tmp) - 1);
-		tmp2 = strtok(tmp, "/");
+		tmp2 = strchr(tmp, '/');
 		if (tmp2) {
-			strncpy(z->ethdev, tmp2, sizeof(z->ethdev) - 1);
+			*tmp2 = '\0';
+			tmp2++;
+			strncpy(z->ethdev, tmp, sizeof(z->ethdev) - 1);
 		} else {
 			printk("Invalid TDMoE address (no device) '%s'\n", addr);
 			kfree(z);
 			return NULL;
 		}
-		tmp2 = strtok(NULL, "/");
 		if (tmp2) {
 			/* We don't have SSCANF :(  Gotta do this the hard way */
-			tmp3 = strtok(tmp2, ":");
+			tmp3 = strchr(tmp2, ':');
 			for (x=0;x<6;x++) {
-				if (tmp3) {
-					res = hex2int(tmp3);
+				if (tmp2) {
+					if (tmp3) {
+						*tmp3 = '\0';
+						*tmp3++;
+					}
+					res = hex2int(tmp2);
 					if (res < 0)
 						break;
 					z->addr[x] = res & 0xff;
 				} else
 					break;
-				tmp3 = strtok(NULL, ":");
+				tmp2 = tmp3;
 			}
 			if (x != 6) {
 				printk("TDMoE: Invalid MAC address in: %s\n", addr);

Index: ztdynamic.c
===================================================================
RCS file: /usr/cvsroot/zaptel/ztdynamic.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- ztdynamic.c	8 Dec 2003 21:25:26 -0000	1.5
+++ ztdynamic.c	6 Jan 2004 13:26:44 -0000	1.6
@@ -105,7 +105,7 @@
 
 static void checkmaster(void)
 {
-	long flags;
+	unsigned long flags;
 	int newhasmaster=0;
 	int best = 9999999;
 	struct zt_dynamic *z, *master=NULL;
@@ -199,7 +199,7 @@
 
 static void ztdynamic_run(void)
 {
-	long flags;
+	unsigned long flags;
 	struct zt_dynamic *z;
 	int y;
 	spin_lock_irqsave(&dlock, flags);
@@ -225,7 +225,7 @@
 {
 	struct zt_dynamic *ztd = span->pvt;
 	int newerr=0;
-	long flags;
+	unsigned long flags;
 	int sflags;
 	int xlen;
 	int x, bits, sig;
@@ -401,7 +401,7 @@
 
 static int destroy_dynamic(ZT_DYNAMIC_SPAN *zds)
 {
-	long flags;
+	unsigned long flags;
 	struct zt_dynamic *z, *cur, *prev=NULL;
 	spin_lock_irqsave(&dlock, flags);
 	z = find_dynamic(zds);
@@ -445,7 +445,9 @@
 			return -ENODEV;
 		z->usecount++;
 	}
+#ifndef LINUX26
 	MOD_INC_USE_COUNT;
+#endif	
 	return 0;
 }
 
@@ -462,7 +464,9 @@
 		z->usecount--;
 	if (z->dead && !z->usecount)
 		dynamic_destroy(z);
+#ifndef LINUX26
 	MOD_DEC_USE_COUNT;
+#endif	
 	return 0;
 }
 
@@ -470,7 +474,7 @@
 {
 	struct zt_dynamic *z;
 	struct zt_dynamic_driver *ztd;
-	long flags;
+	unsigned long flags;
 	int x;
 	int bufsize;
 
@@ -642,7 +646,7 @@
 
 int zt_dynamic_register(struct zt_dynamic_driver *dri)
 {
-	long flags;
+	unsigned long flags;
 	int res = 0;
 	spin_lock_irqsave(&dlock, flags);
 	if (find_driver(dri->name))
@@ -659,7 +663,7 @@
 {
 	struct zt_dynamic_driver *cur, *prev=NULL;
 	struct zt_dynamic *z, *zp, *zn;
-	long flags;
+	unsigned long flags;
 	spin_lock_irqsave(&dlock, flags);
 	cur = drivers;
 	while(cur) {
@@ -699,7 +703,7 @@
 
 static void check_for_red_alarm(unsigned long ignored)
 {
-	long flags;
+	unsigned long flags;
 	int newalarm;
 	int alarmchanged = 0;
 	struct zt_dynamic *z;




More information about the svn-commits mailing list