aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan/cosa.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wan/cosa.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wan/cosa.c')
-rw-r--r--drivers/net/wan/cosa.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 8e25ca7080c7..f0bd70fb650c 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -297,8 +297,8 @@ static ssize_t cosa_write(struct file *file,
297static unsigned int cosa_poll(struct file *file, poll_table *poll); 297static unsigned int cosa_poll(struct file *file, poll_table *poll);
298static int cosa_open(struct inode *inode, struct file *file); 298static int cosa_open(struct inode *inode, struct file *file);
299static int cosa_release(struct inode *inode, struct file *file); 299static int cosa_release(struct inode *inode, struct file *file);
300static int cosa_chardev_ioctl(struct inode *inode, struct file *file, 300static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
301 unsigned int cmd, unsigned long arg); 301 unsigned long arg);
302#ifdef COSA_FASYNC_WORKING 302#ifdef COSA_FASYNC_WORKING
303static int cosa_fasync(struct inode *inode, struct file *file, int on); 303static int cosa_fasync(struct inode *inode, struct file *file, int on);
304#endif 304#endif
@@ -309,7 +309,7 @@ static const struct file_operations cosa_fops = {
309 .read = cosa_read, 309 .read = cosa_read,
310 .write = cosa_write, 310 .write = cosa_write,
311 .poll = cosa_poll, 311 .poll = cosa_poll,
312 .ioctl = cosa_chardev_ioctl, 312 .unlocked_ioctl = cosa_chardev_ioctl,
313 .open = cosa_open, 313 .open = cosa_open,
314 .release = cosa_release, 314 .release = cosa_release,
315#ifdef COSA_FASYNC_WORKING 315#ifdef COSA_FASYNC_WORKING
@@ -811,7 +811,7 @@ static ssize_t cosa_read(struct file *file,
811 cosa_enable_rx(chan); 811 cosa_enable_rx(chan);
812 spin_lock_irqsave(&cosa->lock, flags); 812 spin_lock_irqsave(&cosa->lock, flags);
813 add_wait_queue(&chan->rxwaitq, &wait); 813 add_wait_queue(&chan->rxwaitq, &wait);
814 while(!chan->rx_status) { 814 while (!chan->rx_status) {
815 current->state = TASK_INTERRUPTIBLE; 815 current->state = TASK_INTERRUPTIBLE;
816 spin_unlock_irqrestore(&cosa->lock, flags); 816 spin_unlock_irqrestore(&cosa->lock, flags);
817 schedule(); 817 schedule();
@@ -896,7 +896,7 @@ static ssize_t cosa_write(struct file *file,
896 896
897 spin_lock_irqsave(&cosa->lock, flags); 897 spin_lock_irqsave(&cosa->lock, flags);
898 add_wait_queue(&chan->txwaitq, &wait); 898 add_wait_queue(&chan->txwaitq, &wait);
899 while(!chan->tx_status) { 899 while (!chan->tx_status) {
900 current->state = TASK_INTERRUPTIBLE; 900 current->state = TASK_INTERRUPTIBLE;
901 spin_unlock_irqrestore(&cosa->lock, flags); 901 spin_unlock_irqrestore(&cosa->lock, flags);
902 schedule(); 902 schedule();
@@ -1153,7 +1153,7 @@ static int cosa_ioctl_common(struct cosa_data *cosa,
1153 struct channel_data *channel, unsigned int cmd, unsigned long arg) 1153 struct channel_data *channel, unsigned int cmd, unsigned long arg)
1154{ 1154{
1155 void __user *argp = (void __user *)arg; 1155 void __user *argp = (void __user *)arg;
1156 switch(cmd) { 1156 switch (cmd) {
1157 case COSAIORSET: /* Reset the device */ 1157 case COSAIORSET: /* Reset the device */
1158 if (!capable(CAP_NET_ADMIN)) 1158 if (!capable(CAP_NET_ADMIN))
1159 return -EACCES; 1159 return -EACCES;
@@ -1205,12 +1205,18 @@ static int cosa_net_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
1205 return hdlc_ioctl(dev, ifr, cmd); 1205 return hdlc_ioctl(dev, ifr, cmd);
1206} 1206}
1207 1207
1208static int cosa_chardev_ioctl(struct inode *inode, struct file *file, 1208static long cosa_chardev_ioctl(struct file *file, unsigned int cmd,
1209 unsigned int cmd, unsigned long arg) 1209 unsigned long arg)
1210{ 1210{
1211 struct channel_data *channel = file->private_data; 1211 struct channel_data *channel = file->private_data;
1212 struct cosa_data *cosa = channel->cosa; 1212 struct cosa_data *cosa;
1213 return cosa_ioctl_common(cosa, channel, cmd, arg); 1213 long ret;
1214
1215 lock_kernel();
1216 cosa = channel->cosa;
1217 ret = cosa_ioctl_common(cosa, channel, cmd, arg);
1218 unlock_kernel();
1219 return ret;
1214} 1220}
1215 1221
1216 1222
@@ -1698,7 +1704,7 @@ static inline void tx_interrupt(struct cosa_data *cosa, int status)
1698 spin_unlock_irqrestore(&cosa->lock, flags); 1704 spin_unlock_irqrestore(&cosa->lock, flags);
1699 return; 1705 return;
1700 } 1706 }
1701 while(1) { 1707 while (1) {
1702 cosa->txchan++; 1708 cosa->txchan++;
1703 i++; 1709 i++;
1704 if (cosa->txchan >= cosa->nchannels) 1710 if (cosa->txchan >= cosa->nchannels)
@@ -2004,7 +2010,7 @@ again:
2004static void debug_status_in(struct cosa_data *cosa, int status) 2010static void debug_status_in(struct cosa_data *cosa, int status)
2005{ 2011{
2006 char *s; 2012 char *s;
2007 switch(status & SR_CMD_FROM_SRP_MASK) { 2013 switch (status & SR_CMD_FROM_SRP_MASK) {
2008 case SR_UP_REQUEST: 2014 case SR_UP_REQUEST:
2009 s = "RX_REQ"; 2015 s = "RX_REQ";
2010 break; 2016 break;