Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

COSA/SRP: convert channel_data.rsem to mutex

COSA/SRP driver: The semaphore channel_data.rsem is used as a mutex,
convert it to the mutex API

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Matthias Kaehlcke and committed by
David S. Miller
6387c4be ee6b9673

+8 -6
+8 -6
drivers/net/wan/cosa.c
··· 90 90 #include <linux/ioport.h> 91 91 #include <linux/netdevice.h> 92 92 #include <linux/spinlock.h> 93 + #include <linux/mutex.h> 93 94 #include <linux/device.h> 94 95 95 96 #undef COSA_SLOW_IO /* for testing purposes only */ ··· 128 127 int (*tx_done)(struct channel_data *channel, int size); 129 128 130 129 /* Character device parts */ 131 - struct semaphore rsem, wsem; 130 + struct mutex rlock; 131 + struct semaphore wsem; 132 132 char *rxdata; 133 133 int rxsize; 134 134 wait_queue_head_t txwaitq, rxwaitq; ··· 809 807 810 808 static void chardev_channel_init(struct channel_data *chan) 811 809 { 812 - init_MUTEX(&chan->rsem); 810 + mutex_init(&chan->rlock); 813 811 init_MUTEX(&chan->wsem); 814 812 } 815 813 ··· 827 825 cosa->name, cosa->firmware_status); 828 826 return -EPERM; 829 827 } 830 - if (down_interruptible(&chan->rsem)) 828 + if (mutex_lock_interruptible(&chan->rlock)) 831 829 return -ERESTARTSYS; 832 830 833 831 if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { 834 832 printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name); 835 - up(&chan->rsem); 833 + mutex_unlock(&chan->rlock); 836 834 return -ENOMEM; 837 835 } 838 836 ··· 850 848 remove_wait_queue(&chan->rxwaitq, &wait); 851 849 current->state = TASK_RUNNING; 852 850 spin_unlock_irqrestore(&cosa->lock, flags); 853 - up(&chan->rsem); 851 + mutex_unlock(&chan->rlock); 854 852 return -ERESTARTSYS; 855 853 } 856 854 } ··· 859 857 kbuf = chan->rxdata; 860 858 count = chan->rxsize; 861 859 spin_unlock_irqrestore(&cosa->lock, flags); 862 - up(&chan->rsem); 860 + mutex_unlock(&chan->rlock); 863 861 864 862 if (copy_to_user(buf, kbuf, count)) { 865 863 kfree(kbuf);