diff options
-rwxr-xr-x | torisa.c | 32 | ||||
-rwxr-xr-x | wcfxo.c | 29 | ||||
-rwxr-xr-x | wcfxs.c | 33 | ||||
-rwxr-xr-x | wct1xxp.c | 37 | ||||
-rwxr-xr-x | wct4xxp.c | 28 | ||||
-rwxr-xr-x | wctdm.c | 33 | ||||
-rwxr-xr-x | wcusb.c | 132 | ||||
-rwxr-xr-x | wcusb.h | 2 | ||||
-rwxr-xr-x | zaptel.c | 20 | ||||
-rwxr-xr-x | ztd-eth.c | 37 | ||||
-rwxr-xr-x | ztdynamic.c | 20 |
11 files changed, 333 insertions, 70 deletions
@@ -269,10 +269,19 @@ tor_probe(void) } /* 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 @@ static int torisa_rbsbits(struct zt_chan *chan, int bits) 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 @@ static int torisa_shutdown(struct zt_span *span) int i; int tspan; int wasrunning; - unsigned int flags; + unsigned long flags; tspan = getspan(span); if (tspan < 0) { @@ -425,7 +434,7 @@ static int torisa_startup(struct zt_span *span) 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_spanconfig(struct zt_span *span, struct zt_lineconfig *lc) 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_chanconfig(struct zt_chan *chan, int sigtype) 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 void torisa_tasklet(unsigned long data) 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 @@ static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) /* 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 @@ static void torisa_intr(int irq, void *dev_id, struct pt_regs *regs) /* 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 } @@ -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 @@ struct wcfxo { int usecount; int dead; int pos; - int flags; + unsigned long flags; int freeregion; int ring; int offhook; @@ -162,7 +162,7 @@ struct wcfxo { struct wcfxo_desc { char *name; - int flags; + unsigned long flags; }; @@ -387,7 +387,11 @@ static void wcfxo_tasklet(unsigned long data) 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 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs) 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 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs) 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 @@ static void wcfxo_interrupt(int irq, void *dev_id, struct pt_regs *regs) #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 @@ static int wcfxo_open(struct zt_chan *chan) if (wc->dead) return -ENODEV; wc->usecount++; +#ifndef LINUX26 MOD_INC_USE_COUNT; +#endif return 0; } @@ -542,7 +563,9 @@ static int wcfxo_close(struct zt_chan *chan) { 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); @@ -340,7 +340,7 @@ static void __wcfxs_setreg(struct wcfxs *wc, int card, unsigned char reg, unsign 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 re 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 __wait_access(struct wcfxs *wc, int card) 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_setreg_indirect(struct wcfxs *wc, int card, unsigned char addre 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 @@ static int wcfxs_verify_indirect_regs(struct wcfxs *wc, int card) } 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 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs) 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 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs) wcfxs_receiveprep(wc, ints); wcfxs_transmitprep(wc, ints); } - +#ifdef LINUX26 + return IRQ_RETVAL(1); +#endif } @@ -1073,7 +1090,9 @@ static int wcfxs_open(struct zt_chan *chan) if (wc->dead) return -ENODEV; wc->usecount++; +#ifndef LINUX26 MOD_INC_USE_COUNT; +#endif return 0; } @@ -1089,7 +1108,9 @@ static int wcfxs_close(struct zt_chan *chan) 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 */ @@ -212,7 +212,9 @@ static int t1xxp_open(struct zt_chan *chan) 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) 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) 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 @@ static int t1xxp_close(struct zt_chan *chan) { 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 @@ static void t1xxp_t1_framer_start(struct t1xxp *wc) 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 @@ static void t1xxp_e1_framer_start(struct t1xxp *wc) 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 @@ static int t1xxp_framer_sanity_check(struct t1xxp *wc) { int res; int chipid; - long flags; + unsigned long flags; int x; /* Sanity check */ @@ -499,7 +503,7 @@ static int t1xxp_framer_sanity_check(struct t1xxp *wc) 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_framer_hard_reset(struct t1xxp *wc) 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_startup(struct zt_span *span) 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 @@ static int t1xxp_maint(struct zt_span *span, int cmd) { 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_maint(struct zt_span *span, int cmd) 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 @@ static void __t1xxp_do_counters(struct t1xxp *wc) } } +#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 @@ static void t1xxp_interrupt(int irq, void *dev_id, struct pt_regs *regs) if (ints & 0x20) printk("PCI Target abort\n"); +#ifdef LINUX26 + return IRQ_RETVAL(1); +#endif } static int t1xxp_hardware_init(struct t1xxp *wc) @@ -191,7 +191,7 @@ static inline unsigned int __t4_pci_in(struct t4 *wc, const unsigned int addr) 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 void t4_activate(struct t4 *wc) 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_chanconfig(struct zt_chan *chan, int sigtype) 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 @@ static int t4_findsync(struct t4 *wc) { int i; int x; - long flags; + unsigned long flags; int p; int nonzero; int newsyncsrc = 0; /* Zaptel span number */ @@ -1314,10 +1318,14 @@ static inline void __handle_leds(struct t4 *wc) #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 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs) /* 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 @@ static void t4_interrupt(int irq, void *dev_id, struct pt_regs *regs) } spin_unlock_irqrestore(&wc->reglock, flags); - +#ifdef LINUX26 + return IRQ_RETVAL(1); +#endif } static int t4_reset_dma(struct t4 *wc) @@ -340,7 +340,7 @@ static void __wcfxs_setreg(struct wcfxs *wc, int card, unsigned char reg, unsign 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 re 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 __wait_access(struct wcfxs *wc, int card) 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_setreg_indirect(struct wcfxs *wc, int card, unsigned char addre 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 @@ static int wcfxs_verify_indirect_regs(struct wcfxs *wc, int card) } 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 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs) 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 @@ static void wcfxs_interrupt(int irq, void *dev_id, struct pt_regs *regs) wcfxs_receiveprep(wc, ints); wcfxs_transmitprep(wc, ints); } - +#ifdef LINUX26 + return IRQ_RETVAL(1); +#endif } @@ -1073,7 +1090,9 @@ static int wcfxs_open(struct zt_chan *chan) if (wc->dead) return -ENODEV; wc->usecount++; +#ifndef LINUX26 MOD_INC_USE_COUNT; +#endif return 0; } @@ -1089,7 +1108,9 @@ static int wcfxs_close(struct zt_chan *chan) 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 */ @@ -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 @@ static int Wcusb_ReadWcRegs(struct usb_device *dev, unsigned char index, } #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 @@ static void proslic_write_direct_async(struct wc_usb_pvt *p, unsigned char addre } #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 @@ static void wcusb_async_control(urb_t *urb) } #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 @@ static void wcusb_check_interrupt(struct wc_usb_pvt *p) } #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 @@ static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned #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 @@ static int wcusb_async_read(struct wc_usb_pvt *p, unsigned char index, unsigned } #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 @@ static int wcusb_async_write(struct wc_usb_pvt *p, unsigned char index, unsigned #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 @@ static char wc_dtmf(struct wc_usb_pvt *p) 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 @@ static void wcusb_read_complete(struct urb *q) 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 @@ static void wcusb_read_complete(struct urb *q) 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 @@ static void wcusb_write_complete(struct urb *q) } 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 @@ static int prepare_transfer_urbs(struct wc_usb_pvt *p) 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 @@ static int prepare_transfer_urbs(struct wc_usb_pvt *p) 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 @@ static int begin_transfer(struct wc_usb_pvt *p) 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 @@ static int wc_usb_open(struct zt_chan *chan) default: break; } +#ifndef LINUX26 MOD_INC_USE_COUNT; +#endif p->usecount++; return 0; } @@ -1109,7 +1182,9 @@ static int wc_usb_close(struct zt_chan *chan) kfree(p->pvt_data); kfree(p); } +#ifndef LINUX26 MOD_DEC_USE_COUNT; +#endif return 0; } @@ -1202,10 +1277,17 @@ static int wc_set_zaptel(struct wc_usb_pvt *p) 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 @@ static void *wc_usb_probe(struct usb_device *dev, unsigned int ifnum, const stru 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 @@ static void *wc_usb_probe(struct usb_device *dev, unsigned int ifnum, const stru /* 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 @@ cleanup: } 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 @@ static void wc_usb_disconnect(struct usb_device *dev, void *ptr) 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 @@ static void wc_usb_disconnect(struct usb_device *dev, void *ptr) } } printk("wcusb: Removed a Wildcard device\n"); +#ifdef LINUX26 + usb_set_intfdata(intf, NULL); +#endif return; } @@ -1337,11 +1445,15 @@ static struct usb_device_id wc_dev_ids[] = { 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, }; @@ -89,7 +89,9 @@ struct wc_keypad_data { 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]; @@ -1184,7 +1184,9 @@ static int zt_net_open(hdlc_device *hdlc) 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 @@ static void zt_net_close(hdlc_device *hdlc) } /* 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 ssize_t zt_chan_write(struct file *file, const char *usrbuf, size_t count 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 @@ static int zt_timing_open(struct inode *inode, struct file *file) 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 @@ static int zt_timer_release(struct inode *inode, struct file *file) return 0; } kfree(t); +#ifndef LINUX26 MOD_DEC_USE_COUNT; +#endif } return 0; } @@ -2063,8 +2079,10 @@ static int zt_specchan_open(struct inode *inode, struct file *file, int unit, in 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 @@ static int zt_specchan_release(struct inode *node, struct file *file, int unit) res = chans[unit]->span->close(chans[unit]); } else res = -ENXIO; +#ifndef LINUX26 MOD_DEC_USE_COUNT; +#endif return res; } @@ -64,7 +64,7 @@ static struct ztdeth { 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 @@ static int ztdeth_notifier(struct notifier_block *block, unsigned long event, vo { 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 @@ static int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen) 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 int ztdeth_transmit(void *pvt, unsigned char *msg, int msglen) } 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 int hex2int(char *s) 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 @@ static void *ztdeth_create(struct zt_span *span, char *addr) 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 @@ static void *ztdeth_create(struct zt_span *span, char *addr) /* 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); diff --git a/ztdynamic.c b/ztdynamic.c index 149fdbe..90aa4fa 100755 --- a/ztdynamic.c +++ b/ztdynamic.c @@ -105,7 +105,7 @@ static spinlock_t dlock = SPIN_LOCK_UNLOCKED; 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 ztd_sendmessage(struct zt_dynamic *z) 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 @@ void zt_dynamic_receive(struct zt_span *span, unsigned char *msg, int msglen) { 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 struct zt_dynamic_driver *find_driver(char *name) 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 @@ static int ztd_open(struct zt_chan *chan) return -ENODEV; z->usecount++; } +#ifndef LINUX26 MOD_INC_USE_COUNT; +#endif return 0; } @@ -462,7 +464,9 @@ static int ztd_close(struct zt_chan *chan) z->usecount--; if (z->dead && !z->usecount) dynamic_destroy(z); +#ifndef LINUX26 MOD_DEC_USE_COUNT; +#endif return 0; } @@ -470,7 +474,7 @@ static int create_dynamic(ZT_DYNAMIC_SPAN *zds) { struct zt_dynamic *z; struct zt_dynamic_driver *ztd; - long flags; + unsigned long flags; int x; int bufsize; @@ -642,7 +646,7 @@ static int ztdynamic_ioctl(unsigned int cmd, unsigned long data) 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 @@ void zt_dynamic_unregister(struct zt_dynamic_driver *dri) { 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 @@ struct timer_list alarmcheck; static void check_for_red_alarm(unsigned long ignored) { - long flags; + unsigned long flags; int newalarm; int alarmchanged = 0; struct zt_dynamic *z; |