X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fwan%2Fcosa.c;h=6c7dfb50143f7247a0f11fa2422b5b46e08c4417;hb=refs%2Fheads%2Fvserver;hp=dbd79016897d769691a2cad4ec18644c4d777490;hpb=9bf4aaab3e101692164d49b7ca357651eb691cb6;p=linux-2.6.git diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index dbd790168..6c7dfb501 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -79,13 +79,11 @@ /* ---------- Headers, macros, data structures ---------- */ -#include #include #include #include #include #include -#include #include #include #include @@ -156,7 +154,7 @@ struct cosa_data { unsigned short startaddr; /* Firmware start address */ unsigned short busmaster; /* Use busmastering? */ int nchannels; /* # of channels on this card */ - int driver_status; /* For communicating with firware */ + int driver_status; /* For communicating with firmware */ int firmware_status; /* Downloaded, reseted, etc. */ long int rxbitmap, txbitmap; /* Bitmap of channels who are willing to send/receive data */ long int rxtx; /* RX or TX in progress? */ @@ -235,14 +233,14 @@ static int dma[MAX_CARDS+1]; static int irq[MAX_CARDS+1] = { -1, -1, -1, -1, -1, -1, 0, }; /* for class stuff*/ -static struct class_simple *cosa_class; +static struct class *cosa_class; #ifdef MODULE -MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); +module_param_array(io, int, NULL, 0); MODULE_PARM_DESC(io, "The I/O bases of the COSA or SRP cards"); -MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); +module_param_array(irq, int, NULL, 0); MODULE_PARM_DESC(irq, "The IRQ lines of the COSA or SRP cards"); -MODULE_PARM(dma, "1-" __MODULE_STRING(MAX_CARDS) "i"); +module_param_array(dma, int, NULL, 0); MODULE_PARM_DESC(dma, "The DMA channels of the COSA or SRP cards"); MODULE_AUTHOR("Jan \"Yenya\" Kasprzak, "); @@ -347,7 +345,7 @@ static void put_driver_status(struct cosa_data *cosa); static void put_driver_status_nolock(struct cosa_data *cosa); /* Interrupt handling */ -static irqreturn_t cosa_interrupt(int irq, void *cosa, struct pt_regs *regs); +static irqreturn_t cosa_interrupt(int irq, void *cosa); /* I/O ops debugging */ #ifdef DEBUG_IO @@ -393,22 +391,14 @@ static int __init cosa_init(void) err = -ENODEV; goto out; } - devfs_mk_dir("cosa"); - cosa_class = class_simple_create(THIS_MODULE, "cosa"); + cosa_class = class_create(THIS_MODULE, "cosa"); if (IS_ERR(cosa_class)) { err = PTR_ERR(cosa_class); goto out_chrdev; } for (i=0; inchannels; i++) { @@ -543,7 +530,7 @@ static int cosa_probe(int base, int irq, int dma) * FIXME: When this code is not used as module, we should * probably call udelay() instead of the interruptible sleep. */ - current->state = TASK_INTERRUPTIBLE; + set_current_state(TASK_INTERRUPTIBLE); cosa_putstatus(cosa, SR_TX_INT_ENA); schedule_timeout(30); irq = probe_irq_off(irqs); @@ -642,11 +629,11 @@ static void sppp_channel_init(struct channel_data *chan) return; } chan->pppdev.dev = d; - sppp_attach(&chan->pppdev); d->base_addr = chan->cosa->datareg; d->irq = chan->cosa->irq; d->dma = chan->cosa->dma; d->priv = chan; + sppp_attach(&chan->pppdev); if (register_netdev(d)) { printk(KERN_WARNING "%s: register_netdev failed.\n", d->name); sppp_detach(d); @@ -987,12 +974,12 @@ static int cosa_open(struct inode *inode, struct file *file) unsigned long flags; int n; - if ((n=iminor(file->f_dentry->d_inode)>>CARD_MINOR_BITS) + if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) >= nr_cards) return -ENODEV; cosa = cosa_cards+n; - if ((n=iminor(file->f_dentry->d_inode) + if ((n=iminor(file->f_path.dentry->d_inode) & ((1<= cosa->nchannels) return -ENODEV; chan = cosa->chan + n; @@ -1564,8 +1551,7 @@ static int cosa_reset_and_read_id(struct cosa_data *cosa, char *idstring) cosa_getdata8(cosa); cosa_putstatus(cosa, SR_RST); #ifdef MODULE - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(HZ/2); + msleep(500); #else udelay(5*100000); #endif @@ -1618,8 +1604,7 @@ static int get_wait_data(struct cosa_data *cosa) return r; } /* sleep if not ready to read */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); + schedule_timeout_interruptible(1); } printk(KERN_INFO "cosa: timeout in get_wait_data (status 0x%x)\n", cosa_getstatus(cosa)); @@ -1645,8 +1630,7 @@ static int put_wait_data(struct cosa_data *cosa, int data) } #if 0 /* sleep if not ready to read */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(1); + schedule_timeout_interruptible(1); #endif } printk(KERN_INFO "cosa%d: timeout in put_wait_data (status 0x%x)\n", @@ -1988,7 +1972,7 @@ out: spin_unlock_irqrestore(&cosa->lock, flags); } -static irqreturn_t cosa_interrupt(int irq, void *cosa_, struct pt_regs *regs) +static irqreturn_t cosa_interrupt(int irq, void *cosa_) { unsigned status; int count = 0;