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

[PATCH] sem2mutex: drivers/char/

Semaphore to mutex conversion.

The conversion was generated via scripts, and the result was validated
automatically via a script as well.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Wim Van Sebroeck <wim@iguana.be>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Ingo Molnar and committed by
Linus Torvalds
6f87f0de b1c82b5c

+10 -10
-1
drivers/char/istallion.c
··· 181 181 * is already swapping a shared buffer won't make things any worse. 182 182 */ 183 183 static char *stli_tmpwritebuf; 184 - static DECLARE_MUTEX(stli_tmpwritesem); 185 184 186 185 #define STLI_TXBUFSIZE 4096 187 186
+6 -5
drivers/char/nwflash.c
··· 27 27 #include <linux/rwsem.h> 28 28 #include <linux/init.h> 29 29 #include <linux/smp_lock.h> 30 + #include <linux/mutex.h> 30 31 31 32 #include <asm/hardware/dec21285.h> 32 33 #include <asm/io.h> ··· 57 56 static int gbWriteBase64Enable; 58 57 static volatile unsigned char *FLASH_BASE; 59 58 static int gbFlashSize = KFLASH_SIZE; 60 - static DECLARE_MUTEX(nwflash_sem); 59 + static DEFINE_MUTEX(nwflash_mutex); 61 60 62 61 extern spinlock_t gpio_lock; 63 62 ··· 141 140 /* 142 141 * We now lock against reads and writes. --rmk 143 142 */ 144 - if (down_interruptible(&nwflash_sem)) 143 + if (mutex_lock_interruptible(&nwflash_mutex)) 145 144 return -ERESTARTSYS; 146 145 147 146 ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count); ··· 150 149 *ppos += count; 151 150 } else 152 151 ret = -EFAULT; 153 - up(&nwflash_sem); 152 + mutex_unlock(&nwflash_mutex); 154 153 } 155 154 return ret; 156 155 } ··· 189 188 /* 190 189 * We now lock against reads and writes. --rmk 191 190 */ 192 - if (down_interruptible(&nwflash_sem)) 191 + if (mutex_lock_interruptible(&nwflash_mutex)) 193 192 return -ERESTARTSYS; 194 193 195 194 written = 0; ··· 278 277 */ 279 278 leds_event(led_release); 280 279 281 - up(&nwflash_sem); 280 + mutex_unlock(&nwflash_mutex); 282 281 283 282 return written; 284 283 }
-1
drivers/char/stallion.c
··· 148 148 * is already swapping a shared buffer won't make things any worse. 149 149 */ 150 150 static char *stl_tmpwritebuf; 151 - static DECLARE_MUTEX(stl_tmpwritesem); 152 151 153 152 /* 154 153 * Define a local default termios struct. All ports will be created
+4 -3
drivers/char/watchdog/pcwd_usb.c
··· 42 42 #include <linux/completion.h> 43 43 #include <asm/uaccess.h> 44 44 #include <linux/usb.h> 45 + #include <linux/mutex.h> 45 46 46 47 47 48 #ifdef CONFIG_USB_DEBUG ··· 144 143 static struct usb_pcwd_private *usb_pcwd_device; 145 144 146 145 /* prevent races between open() and disconnect() */ 147 - static DECLARE_MUTEX (disconnect_sem); 146 + static DEFINE_MUTEX(disconnect_mutex); 148 147 149 148 /* local function prototypes */ 150 149 static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id); ··· 724 723 struct usb_pcwd_private *usb_pcwd; 725 724 726 725 /* prevent races with open() */ 727 - down (&disconnect_sem); 726 + mutex_lock(&disconnect_mutex); 728 727 729 728 usb_pcwd = usb_get_intfdata (interface); 730 729 usb_set_intfdata (interface, NULL); ··· 750 749 751 750 cards_found--; 752 751 753 - up (&disconnect_sem); 752 + mutex_unlock(&disconnect_mutex); 754 753 755 754 printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); 756 755 }