Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / drivers / net / wan / cosa.c
index dbd7901..e392ee8 100644 (file)
@@ -156,7 +156,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 +235,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, <kas@fi.muni.cz>");
@@ -394,19 +394,19 @@ static int __init cosa_init(void)
                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; i<nr_cards; i++) {
-               class_simple_device_add(cosa_class, MKDEV(cosa_major, i),
+               class_device_create(cosa_class, NULL, MKDEV(cosa_major, i),
                                NULL, "cosa%d", i);
                err = devfs_mk_cdev(MKDEV(cosa_major, i),
                                S_IFCHR|S_IRUSR|S_IWUSR,
                                "cosa/%d", i);
                if (err) {
-                       class_simple_device_remove(MKDEV(cosa_major, i));
+                       class_device_destroy(cosa_class, MKDEV(cosa_major, i));
                        goto out_chrdev;                
                }
        }
@@ -427,10 +427,10 @@ static void __exit cosa_exit(void)
        printk(KERN_INFO "Unloading the cosa module\n");
 
        for (i=0; i<nr_cards; i++) {
-               class_simple_device_remove(MKDEV(cosa_major, i));
+               class_device_destroy(cosa_class, MKDEV(cosa_major, i));
                devfs_remove("cosa/%d", i);
        }
-       class_simple_destroy(cosa_class);
+       class_destroy(cosa_class);
        devfs_remove("cosa");
        for (cosa=cosa_cards; nr_cards--; cosa++) {
                /* Clean up the per-channel data */
@@ -543,7 +543,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 +642,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);
@@ -1564,8 +1564,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 +1617,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 +1643,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",