Skip to content

Commit 6f87f0d

Browse files
Ingo MolnarLinus Torvalds
authored andcommitted
[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>
1 parent b1c82b5 commit 6f87f0d

4 files changed

Lines changed: 10 additions & 10 deletions

File tree

‎drivers/char/istallion.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,6 @@ static struct tty_driver *stli_serial;
181181
* is already swapping a shared buffer won't make things any worse.
182182
*/
183183
static char *stli_tmpwritebuf;
184-
static DECLARE_MUTEX(stli_tmpwritesem);
185184

186185
#define STLI_TXBUFSIZE 4096
187186

‎drivers/char/nwflash.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
#include <linux/rwsem.h>
2828
#include <linux/init.h>
2929
#include <linux/smp_lock.h>
30+
#include <linux/mutex.h>
3031

3132
#include <asm/hardware/dec21285.h>
3233
#include <asm/io.h>
@@ -56,7 +57,7 @@ static int gbWriteEnable;
5657
static int gbWriteBase64Enable;
5758
static volatile unsigned char *FLASH_BASE;
5859
static int gbFlashSize = KFLASH_SIZE;
59-
static DECLARE_MUTEX(nwflash_sem);
60+
static DEFINE_MUTEX(nwflash_mutex);
6061

6162
extern spinlock_t gpio_lock;
6263

@@ -140,7 +141,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
140141
/*
141142
* We now lock against reads and writes. --rmk
142143
*/
143-
if (down_interruptible(&nwflash_sem))
144+
if (mutex_lock_interruptible(&nwflash_mutex))
144145
return -ERESTARTSYS;
145146

146147
ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count);
@@ -149,7 +150,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
149150
*ppos += count;
150151
} else
151152
ret = -EFAULT;
152-
up(&nwflash_sem);
153+
mutex_unlock(&nwflash_mutex);
153154
}
154155
return ret;
155156
}
@@ -188,7 +189,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
188189
/*
189190
* We now lock against reads and writes. --rmk
190191
*/
191-
if (down_interruptible(&nwflash_sem))
192+
if (mutex_lock_interruptible(&nwflash_mutex))
192193
return -ERESTARTSYS;
193194

194195
written = 0;
@@ -277,7 +278,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf,
277278
*/
278279
leds_event(led_release);
279280

280-
up(&nwflash_sem);
281+
mutex_unlock(&nwflash_mutex);
281282

282283
return written;
283284
}

‎drivers/char/stallion.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ static struct tty_driver *stl_serial;
148148
* is already swapping a shared buffer won't make things any worse.
149149
*/
150150
static char *stl_tmpwritebuf;
151-
static DECLARE_MUTEX(stl_tmpwritesem);
152151

153152
/*
154153
* Define a local default termios struct. All ports will be created

‎drivers/char/watchdog/pcwd_usb.c‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <linux/completion.h>
4343
#include <asm/uaccess.h>
4444
#include <linux/usb.h>
45+
#include <linux/mutex.h>
4546

4647

4748
#ifdef CONFIG_USB_DEBUG
@@ -143,7 +144,7 @@ struct usb_pcwd_private {
143144
static struct usb_pcwd_private *usb_pcwd_device;
144145

145146
/* prevent races between open() and disconnect() */
146-
static DECLARE_MUTEX (disconnect_sem);
147+
static DEFINE_MUTEX(disconnect_mutex);
147148

148149
/* local function prototypes */
149150
static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id);
@@ -723,7 +724,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
723724
struct usb_pcwd_private *usb_pcwd;
724725

725726
/* prevent races with open() */
726-
down (&disconnect_sem);
727+
mutex_lock(&disconnect_mutex);
727728

728729
usb_pcwd = usb_get_intfdata (interface);
729730
usb_set_intfdata (interface, NULL);
@@ -749,7 +750,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface)
749750

750751
cards_found--;
751752

752-
up (&disconnect_sem);
753+
mutex_unlock(&disconnect_mutex);
753754

754755
printk(KERN_INFO PFX "USB PC Watchdog disconnected\n");
755756
}

0 commit comments

Comments
 (0)