X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=drivers%2Fnet%2Fwan%2Fcosa.c;h=45ddfc9763ccc176004640a3356be0265c6b3dbc;hb=1ff184225b15930ea118ac2130f074c741d34f08;hp=26058b4f8f36b2c5785a9291fd4baf8af10e017d;hpb=d638d4990bfb99998420e78e8fd4607bca5cf8d0;p=linux-2.6-omap-h63xx.git diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index 26058b4f8f3..45ddfc9763c 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c @@ -90,6 +90,7 @@ #include #include #include +#include #include #undef COSA_SLOW_IO /* for testing purposes only */ @@ -127,7 +128,8 @@ struct channel_data { int (*tx_done)(struct channel_data *channel, int size); /* Character device parts */ - struct semaphore rsem, wsem; + struct mutex rlock; + struct semaphore wsem; char *rxdata; int rxsize; wait_queue_head_t txwaitq, rxwaitq; @@ -154,8 +156,8 @@ struct cosa_data { int nchannels; /* # of channels on this card */ 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? */ + unsigned long rxbitmap, txbitmap;/* Bitmap of channels who are willing to send/receive data */ + unsigned long rxtx; /* RX or TX in progress? */ int enabled; int usage; /* usage count */ int txchan, txsize, rxsize; @@ -395,8 +397,7 @@ static int __init cosa_init(void) goto out_chrdev; } for (i=0; irsem); + mutex_init(&chan->rlock); init_MUTEX(&chan->wsem); } @@ -826,12 +827,12 @@ static ssize_t cosa_read(struct file *file, cosa->name, cosa->firmware_status); return -EPERM; } - if (down_interruptible(&chan->rsem)) + if (mutex_lock_interruptible(&chan->rlock)) return -ERESTARTSYS; if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name); - up(&chan->rsem); + mutex_unlock(&chan->rlock); return -ENOMEM; } @@ -849,7 +850,7 @@ static ssize_t cosa_read(struct file *file, remove_wait_queue(&chan->rxwaitq, &wait); current->state = TASK_RUNNING; spin_unlock_irqrestore(&cosa->lock, flags); - up(&chan->rsem); + mutex_unlock(&chan->rlock); return -ERESTARTSYS; } } @@ -858,7 +859,7 @@ static ssize_t cosa_read(struct file *file, kbuf = chan->rxdata; count = chan->rxsize; spin_unlock_irqrestore(&cosa->lock, flags); - up(&chan->rsem); + mutex_unlock(&chan->rlock); if (copy_to_user(buf, kbuf, count)) { kfree(kbuf);