diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-03-23 17:13:43 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-23 17:13:43 -0500 |
commit | 88e3c1da8b3258a81c5c81d4e7e22557b7d71ba7 (patch) | |
tree | ab518773c0ff4606f1a57d00b5931332a7e1d96e /drivers/char | |
parent | fa4fa40a990f8f4eff65476bef32007c154bbac0 (diff) | |
parent | b0e6e962992b76580f4900b166a337bad7c1e81b (diff) |
Merge branch 'master'
Diffstat (limited to 'drivers/char')
-rw-r--r-- | drivers/char/Kconfig | 2 | ||||
-rw-r--r-- | drivers/char/amiserial.c | 18 | ||||
-rw-r--r-- | drivers/char/generic_serial.c | 14 | ||||
-rw-r--r-- | drivers/char/hvcs.c | 9 | ||||
-rw-r--r-- | drivers/char/istallion.c | 1 | ||||
-rw-r--r-- | drivers/char/n_tty.c | 10 | ||||
-rw-r--r-- | drivers/char/nwflash.c | 11 | ||||
-rw-r--r-- | drivers/char/raw.c | 23 | ||||
-rw-r--r-- | drivers/char/ser_a2232.c | 4 | ||||
-rw-r--r-- | drivers/char/snsc.c | 8 | ||||
-rw-r--r-- | drivers/char/snsc_event.c | 5 | ||||
-rw-r--r-- | drivers/char/stallion.c | 1 | ||||
-rw-r--r-- | drivers/char/sx.c | 2 | ||||
-rw-r--r-- | drivers/char/tty_io.c | 50 | ||||
-rw-r--r-- | drivers/char/vme_scc.c | 2 | ||||
-rw-r--r-- | drivers/char/vt.c | 22 | ||||
-rw-r--r-- | drivers/char/watchdog/pcwd_usb.c | 7 |
17 files changed, 94 insertions, 95 deletions
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index 05ba410682a3..b524f5ba78a9 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -695,7 +695,7 @@ config NVRAM | |||
695 | 695 | ||
696 | config RTC | 696 | config RTC |
697 | tristate "Enhanced Real Time Clock Support" | 697 | tristate "Enhanced Real Time Clock Support" |
698 | depends on !PPC32 && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV | 698 | depends on !PPC && !PARISC && !IA64 && !M68K && (!SPARC || PCI) && !FRV |
699 | ---help--- | 699 | ---help--- |
700 | If you say Y here and create a character special file /dev/rtc with | 700 | If you say Y here and create a character special file /dev/rtc with |
701 | major number 10 and minor number 135 using mknod ("man mknod"), you | 701 | major number 10 and minor number 135 using mknod ("man mknod"), you |
diff --git a/drivers/char/amiserial.c b/drivers/char/amiserial.c index 7ac365b5d9ec..6602b3156df5 100644 --- a/drivers/char/amiserial.c +++ b/drivers/char/amiserial.c | |||
@@ -46,8 +46,6 @@ | |||
46 | 46 | ||
47 | /* Sanity checks */ | 47 | /* Sanity checks */ |
48 | 48 | ||
49 | #define SERIAL_INLINE | ||
50 | |||
51 | #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) | 49 | #if defined(MODULE) && defined(SERIAL_DEBUG_MCOUNT) |
52 | #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ | 50 | #define DBG_CNT(s) printk("(%s): [%x] refc=%d, serc=%d, ttyc=%d -> %s\n", \ |
53 | tty->name, (info->flags), serial_driver->refcount,info->count,tty->count,s) | 51 | tty->name, (info->flags), serial_driver->refcount,info->count,tty->count,s) |
@@ -95,10 +93,6 @@ static char *serial_version = "4.30"; | |||
95 | #include <asm/amigahw.h> | 93 | #include <asm/amigahw.h> |
96 | #include <asm/amigaints.h> | 94 | #include <asm/amigaints.h> |
97 | 95 | ||
98 | #ifdef SERIAL_INLINE | ||
99 | #define _INLINE_ inline | ||
100 | #endif | ||
101 | |||
102 | #define custom amiga_custom | 96 | #define custom amiga_custom |
103 | static char *serial_name = "Amiga-builtin serial driver"; | 97 | static char *serial_name = "Amiga-builtin serial driver"; |
104 | 98 | ||
@@ -253,14 +247,14 @@ static void rs_start(struct tty_struct *tty) | |||
253 | * This routine is used by the interrupt handler to schedule | 247 | * This routine is used by the interrupt handler to schedule |
254 | * processing in the software interrupt portion of the driver. | 248 | * processing in the software interrupt portion of the driver. |
255 | */ | 249 | */ |
256 | static _INLINE_ void rs_sched_event(struct async_struct *info, | 250 | static void rs_sched_event(struct async_struct *info, |
257 | int event) | 251 | int event) |
258 | { | 252 | { |
259 | info->event |= 1 << event; | 253 | info->event |= 1 << event; |
260 | tasklet_schedule(&info->tlet); | 254 | tasklet_schedule(&info->tlet); |
261 | } | 255 | } |
262 | 256 | ||
263 | static _INLINE_ void receive_chars(struct async_struct *info) | 257 | static void receive_chars(struct async_struct *info) |
264 | { | 258 | { |
265 | int status; | 259 | int status; |
266 | int serdatr; | 260 | int serdatr; |
@@ -349,7 +343,7 @@ out: | |||
349 | return; | 343 | return; |
350 | } | 344 | } |
351 | 345 | ||
352 | static _INLINE_ void transmit_chars(struct async_struct *info) | 346 | static void transmit_chars(struct async_struct *info) |
353 | { | 347 | { |
354 | custom.intreq = IF_TBE; | 348 | custom.intreq = IF_TBE; |
355 | mb(); | 349 | mb(); |
@@ -389,7 +383,7 @@ static _INLINE_ void transmit_chars(struct async_struct *info) | |||
389 | } | 383 | } |
390 | } | 384 | } |
391 | 385 | ||
392 | static _INLINE_ void check_modem_status(struct async_struct *info) | 386 | static void check_modem_status(struct async_struct *info) |
393 | { | 387 | { |
394 | unsigned char status = ciab.pra & (SER_DCD | SER_CTS | SER_DSR); | 388 | unsigned char status = ciab.pra & (SER_DCD | SER_CTS | SER_DSR); |
395 | unsigned char dstatus; | 389 | unsigned char dstatus; |
@@ -1959,7 +1953,7 @@ done: | |||
1959 | * number, and identifies which options were configured into this | 1953 | * number, and identifies which options were configured into this |
1960 | * driver. | 1954 | * driver. |
1961 | */ | 1955 | */ |
1962 | static _INLINE_ void show_serial_version(void) | 1956 | static void show_serial_version(void) |
1963 | { | 1957 | { |
1964 | printk(KERN_INFO "%s version %s\n", serial_name, serial_version); | 1958 | printk(KERN_INFO "%s version %s\n", serial_name, serial_version); |
1965 | } | 1959 | } |
diff --git a/drivers/char/generic_serial.c b/drivers/char/generic_serial.c index e38a5f0e07bb..5e59c0b42731 100644 --- a/drivers/char/generic_serial.c +++ b/drivers/char/generic_serial.c | |||
@@ -48,8 +48,8 @@ static int gs_debug; | |||
48 | #define NEW_WRITE_LOCKING 1 | 48 | #define NEW_WRITE_LOCKING 1 |
49 | #if NEW_WRITE_LOCKING | 49 | #if NEW_WRITE_LOCKING |
50 | #define DECL /* Nothing */ | 50 | #define DECL /* Nothing */ |
51 | #define LOCKIT down (& port->port_write_sem); | 51 | #define LOCKIT mutex_lock(& port->port_write_mutex); |
52 | #define RELEASEIT up (&port->port_write_sem); | 52 | #define RELEASEIT mutex_unlock(&port->port_write_mutex); |
53 | #else | 53 | #else |
54 | #define DECL unsigned long flags; | 54 | #define DECL unsigned long flags; |
55 | #define LOCKIT save_flags (flags);cli () | 55 | #define LOCKIT save_flags (flags);cli () |
@@ -124,14 +124,14 @@ int gs_write(struct tty_struct * tty, | |||
124 | /* get exclusive "write" access to this port (problem 3) */ | 124 | /* get exclusive "write" access to this port (problem 3) */ |
125 | /* This is not a spinlock because we can have a disk access (page | 125 | /* This is not a spinlock because we can have a disk access (page |
126 | fault) in copy_from_user */ | 126 | fault) in copy_from_user */ |
127 | down (& port->port_write_sem); | 127 | mutex_lock(& port->port_write_mutex); |
128 | 128 | ||
129 | while (1) { | 129 | while (1) { |
130 | 130 | ||
131 | c = count; | 131 | c = count; |
132 | 132 | ||
133 | /* This is safe because we "OWN" the "head". Noone else can | 133 | /* This is safe because we "OWN" the "head". Noone else can |
134 | change the "head": we own the port_write_sem. */ | 134 | change the "head": we own the port_write_mutex. */ |
135 | /* Don't overrun the end of the buffer */ | 135 | /* Don't overrun the end of the buffer */ |
136 | t = SERIAL_XMIT_SIZE - port->xmit_head; | 136 | t = SERIAL_XMIT_SIZE - port->xmit_head; |
137 | if (t < c) c = t; | 137 | if (t < c) c = t; |
@@ -153,7 +153,7 @@ int gs_write(struct tty_struct * tty, | |||
153 | count -= c; | 153 | count -= c; |
154 | total += c; | 154 | total += c; |
155 | } | 155 | } |
156 | up (& port->port_write_sem); | 156 | mutex_unlock(& port->port_write_mutex); |
157 | 157 | ||
158 | gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", | 158 | gs_dprintk (GS_DEBUG_WRITE, "write: interrupts are %s\n", |
159 | (port->flags & GS_TX_INTEN)?"enabled": "disabled"); | 159 | (port->flags & GS_TX_INTEN)?"enabled": "disabled"); |
@@ -214,7 +214,7 @@ int gs_write(struct tty_struct * tty, | |||
214 | c = count; | 214 | c = count; |
215 | 215 | ||
216 | /* This is safe because we "OWN" the "head". Noone else can | 216 | /* This is safe because we "OWN" the "head". Noone else can |
217 | change the "head": we own the port_write_sem. */ | 217 | change the "head": we own the port_write_mutex. */ |
218 | /* Don't overrun the end of the buffer */ | 218 | /* Don't overrun the end of the buffer */ |
219 | t = SERIAL_XMIT_SIZE - port->xmit_head; | 219 | t = SERIAL_XMIT_SIZE - port->xmit_head; |
220 | if (t < c) c = t; | 220 | if (t < c) c = t; |
@@ -888,7 +888,7 @@ int gs_init_port(struct gs_port *port) | |||
888 | spin_lock_irqsave (&port->driver_lock, flags); | 888 | spin_lock_irqsave (&port->driver_lock, flags); |
889 | if (port->tty) | 889 | if (port->tty) |
890 | clear_bit(TTY_IO_ERROR, &port->tty->flags); | 890 | clear_bit(TTY_IO_ERROR, &port->tty->flags); |
891 | init_MUTEX(&port->port_write_sem); | 891 | mutex_init(&port->port_write_mutex); |
892 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; | 892 | port->xmit_cnt = port->xmit_head = port->xmit_tail = 0; |
893 | spin_unlock_irqrestore(&port->driver_lock, flags); | 893 | spin_unlock_irqrestore(&port->driver_lock, flags); |
894 | gs_set_termios(port->tty, NULL); | 894 | gs_set_termios(port->tty, NULL); |
diff --git a/drivers/char/hvcs.c b/drivers/char/hvcs.c index 831eb4e8d9d3..f7ac31856572 100644 --- a/drivers/char/hvcs.c +++ b/drivers/char/hvcs.c | |||
@@ -118,7 +118,7 @@ | |||
118 | * the hvcs_final_close() function in order to get it out of the spinlock. | 118 | * the hvcs_final_close() function in order to get it out of the spinlock. |
119 | * Rearranged hvcs_close(). Cleaned up some printks and did some housekeeping | 119 | * Rearranged hvcs_close(). Cleaned up some printks and did some housekeeping |
120 | * on the changelog. Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from | 120 | * on the changelog. Removed local CLC_LENGTH and used HVCS_CLC_LENGTH from |
121 | * arch/ppc64/hvcserver.h. | 121 | * include/asm-powerpc/hvcserver.h |
122 | * | 122 | * |
123 | * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to | 123 | * 1.3.2 -> 1.3.3 Replaced yield() in hvcs_close() with tty_wait_until_sent() to |
124 | * prevent possible lockup with realtime scheduling as similarily pointed out by | 124 | * prevent possible lockup with realtime scheduling as similarily pointed out by |
@@ -168,9 +168,10 @@ MODULE_VERSION(HVCS_DRIVER_VERSION); | |||
168 | 168 | ||
169 | /* | 169 | /* |
170 | * The hcall interface involves putting 8 chars into each of two registers. | 170 | * The hcall interface involves putting 8 chars into each of two registers. |
171 | * We load up those 2 registers (in arch/ppc64/hvconsole.c) by casting char[16] | 171 | * We load up those 2 registers (in arch/powerpc/platforms/pseries/hvconsole.c) |
172 | * to long[2]. It would work without __ALIGNED__, but a little (tiny) bit | 172 | * by casting char[16] to long[2]. It would work without __ALIGNED__, but a |
173 | * slower because an unaligned load is slower than aligned load. | 173 | * little (tiny) bit slower because an unaligned load is slower than aligned |
174 | * load. | ||
174 | */ | 175 | */ |
175 | #define __ALIGNED__ __attribute__((__aligned__(8))) | 176 | #define __ALIGNED__ __attribute__((__aligned__(8))) |
176 | 177 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index 28c5a3193b81..ede128356af2 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -181,7 +181,6 @@ static struct tty_driver *stli_serial; | |||
181 | * is already swapping a shared buffer won't make things any worse. | 181 | * is already swapping a shared buffer won't make things any worse. |
182 | */ | 182 | */ |
183 | static char *stli_tmpwritebuf; | 183 | static char *stli_tmpwritebuf; |
184 | static DECLARE_MUTEX(stli_tmpwritesem); | ||
185 | 184 | ||
186 | #define STLI_TXBUFSIZE 4096 | 185 | #define STLI_TXBUFSIZE 4096 |
187 | 186 | ||
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c index ccad7ae94541..ede365d05387 100644 --- a/drivers/char/n_tty.c +++ b/drivers/char/n_tty.c | |||
@@ -132,7 +132,7 @@ static void put_tty_queue(unsigned char c, struct tty_struct *tty) | |||
132 | * We test the TTY_THROTTLED bit first so that it always | 132 | * We test the TTY_THROTTLED bit first so that it always |
133 | * indicates the current state. The decision about whether | 133 | * indicates the current state. The decision about whether |
134 | * it is worth allowing more input has been taken by the caller. | 134 | * it is worth allowing more input has been taken by the caller. |
135 | * Can sleep, may be called under the atomic_read semaphore but | 135 | * Can sleep, may be called under the atomic_read_lock mutex but |
136 | * this is not guaranteed. | 136 | * this is not guaranteed. |
137 | */ | 137 | */ |
138 | 138 | ||
@@ -1132,7 +1132,7 @@ static inline int input_available_p(struct tty_struct *tty, int amt) | |||
1132 | * buffer, and once to drain the space from the (physical) beginning of | 1132 | * buffer, and once to drain the space from the (physical) beginning of |
1133 | * the buffer to head pointer. | 1133 | * the buffer to head pointer. |
1134 | * | 1134 | * |
1135 | * Called under the tty->atomic_read sem and with TTY_DONT_FLIP set | 1135 | * Called under the tty->atomic_read_lock sem and with TTY_DONT_FLIP set |
1136 | * | 1136 | * |
1137 | */ | 1137 | */ |
1138 | 1138 | ||
@@ -1262,11 +1262,11 @@ do_it_again: | |||
1262 | * Internal serialization of reads. | 1262 | * Internal serialization of reads. |
1263 | */ | 1263 | */ |
1264 | if (file->f_flags & O_NONBLOCK) { | 1264 | if (file->f_flags & O_NONBLOCK) { |
1265 | if (down_trylock(&tty->atomic_read)) | 1265 | if (!mutex_trylock(&tty->atomic_read_lock)) |
1266 | return -EAGAIN; | 1266 | return -EAGAIN; |
1267 | } | 1267 | } |
1268 | else { | 1268 | else { |
1269 | if (down_interruptible(&tty->atomic_read)) | 1269 | if (mutex_lock_interruptible(&tty->atomic_read_lock)) |
1270 | return -ERESTARTSYS; | 1270 | return -ERESTARTSYS; |
1271 | } | 1271 | } |
1272 | 1272 | ||
@@ -1393,7 +1393,7 @@ do_it_again: | |||
1393 | timeout = time; | 1393 | timeout = time; |
1394 | } | 1394 | } |
1395 | clear_bit(TTY_DONT_FLIP, &tty->flags); | 1395 | clear_bit(TTY_DONT_FLIP, &tty->flags); |
1396 | up(&tty->atomic_read); | 1396 | mutex_unlock(&tty->atomic_read_lock); |
1397 | remove_wait_queue(&tty->read_wait, &wait); | 1397 | remove_wait_queue(&tty->read_wait, &wait); |
1398 | 1398 | ||
1399 | if (!waitqueue_active(&tty->read_wait)) | 1399 | if (!waitqueue_active(&tty->read_wait)) |
diff --git a/drivers/char/nwflash.c b/drivers/char/nwflash.c index ca41d62b1d9d..8865387d3448 100644 --- a/drivers/char/nwflash.c +++ b/drivers/char/nwflash.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/rwsem.h> | 27 | #include <linux/rwsem.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/smp_lock.h> | 29 | #include <linux/smp_lock.h> |
30 | #include <linux/mutex.h> | ||
30 | 31 | ||
31 | #include <asm/hardware/dec21285.h> | 32 | #include <asm/hardware/dec21285.h> |
32 | #include <asm/io.h> | 33 | #include <asm/io.h> |
@@ -56,7 +57,7 @@ static int gbWriteEnable; | |||
56 | static int gbWriteBase64Enable; | 57 | static int gbWriteBase64Enable; |
57 | static volatile unsigned char *FLASH_BASE; | 58 | static volatile unsigned char *FLASH_BASE; |
58 | static int gbFlashSize = KFLASH_SIZE; | 59 | static int gbFlashSize = KFLASH_SIZE; |
59 | static DECLARE_MUTEX(nwflash_sem); | 60 | static DEFINE_MUTEX(nwflash_mutex); |
60 | 61 | ||
61 | extern spinlock_t gpio_lock; | 62 | extern spinlock_t gpio_lock; |
62 | 63 | ||
@@ -140,7 +141,7 @@ static ssize_t flash_read(struct file *file, char __user *buf, size_t size, | |||
140 | /* | 141 | /* |
141 | * We now lock against reads and writes. --rmk | 142 | * We now lock against reads and writes. --rmk |
142 | */ | 143 | */ |
143 | if (down_interruptible(&nwflash_sem)) | 144 | if (mutex_lock_interruptible(&nwflash_mutex)) |
144 | return -ERESTARTSYS; | 145 | return -ERESTARTSYS; |
145 | 146 | ||
146 | ret = copy_to_user(buf, (void *)(FLASH_BASE + p), count); | 147 | 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, | |||
149 | *ppos += count; | 150 | *ppos += count; |
150 | } else | 151 | } else |
151 | ret = -EFAULT; | 152 | ret = -EFAULT; |
152 | up(&nwflash_sem); | 153 | mutex_unlock(&nwflash_mutex); |
153 | } | 154 | } |
154 | return ret; | 155 | return ret; |
155 | } | 156 | } |
@@ -188,7 +189,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
188 | /* | 189 | /* |
189 | * We now lock against reads and writes. --rmk | 190 | * We now lock against reads and writes. --rmk |
190 | */ | 191 | */ |
191 | if (down_interruptible(&nwflash_sem)) | 192 | if (mutex_lock_interruptible(&nwflash_mutex)) |
192 | return -ERESTARTSYS; | 193 | return -ERESTARTSYS; |
193 | 194 | ||
194 | written = 0; | 195 | written = 0; |
@@ -277,7 +278,7 @@ static ssize_t flash_write(struct file *file, const char __user *buf, | |||
277 | */ | 278 | */ |
278 | leds_event(led_release); | 279 | leds_event(led_release); |
279 | 280 | ||
280 | up(&nwflash_sem); | 281 | mutex_unlock(&nwflash_mutex); |
281 | 282 | ||
282 | return written; | 283 | return written; |
283 | } | 284 | } |
diff --git a/drivers/char/raw.c b/drivers/char/raw.c index 30e4cbe16bb0..15a7b4086524 100644 --- a/drivers/char/raw.c +++ b/drivers/char/raw.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include <linux/uio.h> | 19 | #include <linux/uio.h> |
20 | #include <linux/cdev.h> | 20 | #include <linux/cdev.h> |
21 | #include <linux/device.h> | 21 | #include <linux/device.h> |
22 | #include <linux/mutex.h> | ||
22 | 23 | ||
23 | #include <asm/uaccess.h> | 24 | #include <asm/uaccess.h> |
24 | 25 | ||
@@ -29,7 +30,7 @@ struct raw_device_data { | |||
29 | 30 | ||
30 | static struct class *raw_class; | 31 | static struct class *raw_class; |
31 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; | 32 | static struct raw_device_data raw_devices[MAX_RAW_MINORS]; |
32 | static DECLARE_MUTEX(raw_mutex); | 33 | static DEFINE_MUTEX(raw_mutex); |
33 | static struct file_operations raw_ctl_fops; /* forward declaration */ | 34 | static struct file_operations raw_ctl_fops; /* forward declaration */ |
34 | 35 | ||
35 | /* | 36 | /* |
@@ -53,7 +54,7 @@ static int raw_open(struct inode *inode, struct file *filp) | |||
53 | return 0; | 54 | return 0; |
54 | } | 55 | } |
55 | 56 | ||
56 | down(&raw_mutex); | 57 | mutex_lock(&raw_mutex); |
57 | 58 | ||
58 | /* | 59 | /* |
59 | * All we need to do on open is check that the device is bound. | 60 | * All we need to do on open is check that the device is bound. |
@@ -78,7 +79,7 @@ static int raw_open(struct inode *inode, struct file *filp) | |||
78 | filp->f_dentry->d_inode->i_mapping = | 79 | filp->f_dentry->d_inode->i_mapping = |
79 | bdev->bd_inode->i_mapping; | 80 | bdev->bd_inode->i_mapping; |
80 | filp->private_data = bdev; | 81 | filp->private_data = bdev; |
81 | up(&raw_mutex); | 82 | mutex_unlock(&raw_mutex); |
82 | return 0; | 83 | return 0; |
83 | 84 | ||
84 | out2: | 85 | out2: |
@@ -86,7 +87,7 @@ out2: | |||
86 | out1: | 87 | out1: |
87 | blkdev_put(bdev); | 88 | blkdev_put(bdev); |
88 | out: | 89 | out: |
89 | up(&raw_mutex); | 90 | mutex_unlock(&raw_mutex); |
90 | return err; | 91 | return err; |
91 | } | 92 | } |
92 | 93 | ||
@@ -99,14 +100,14 @@ static int raw_release(struct inode *inode, struct file *filp) | |||
99 | const int minor= iminor(inode); | 100 | const int minor= iminor(inode); |
100 | struct block_device *bdev; | 101 | struct block_device *bdev; |
101 | 102 | ||
102 | down(&raw_mutex); | 103 | mutex_lock(&raw_mutex); |
103 | bdev = raw_devices[minor].binding; | 104 | bdev = raw_devices[minor].binding; |
104 | if (--raw_devices[minor].inuse == 0) { | 105 | if (--raw_devices[minor].inuse == 0) { |
105 | /* Here inode->i_mapping == bdev->bd_inode->i_mapping */ | 106 | /* Here inode->i_mapping == bdev->bd_inode->i_mapping */ |
106 | inode->i_mapping = &inode->i_data; | 107 | inode->i_mapping = &inode->i_data; |
107 | inode->i_mapping->backing_dev_info = &default_backing_dev_info; | 108 | inode->i_mapping->backing_dev_info = &default_backing_dev_info; |
108 | } | 109 | } |
109 | up(&raw_mutex); | 110 | mutex_unlock(&raw_mutex); |
110 | 111 | ||
111 | bd_release(bdev); | 112 | bd_release(bdev); |
112 | blkdev_put(bdev); | 113 | blkdev_put(bdev); |
@@ -187,9 +188,9 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | |||
187 | goto out; | 188 | goto out; |
188 | } | 189 | } |
189 | 190 | ||
190 | down(&raw_mutex); | 191 | mutex_lock(&raw_mutex); |
191 | if (rawdev->inuse) { | 192 | if (rawdev->inuse) { |
192 | up(&raw_mutex); | 193 | mutex_unlock(&raw_mutex); |
193 | err = -EBUSY; | 194 | err = -EBUSY; |
194 | goto out; | 195 | goto out; |
195 | } | 196 | } |
@@ -211,11 +212,11 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | |||
211 | bind_device(&rq); | 212 | bind_device(&rq); |
212 | } | 213 | } |
213 | } | 214 | } |
214 | up(&raw_mutex); | 215 | mutex_unlock(&raw_mutex); |
215 | } else { | 216 | } else { |
216 | struct block_device *bdev; | 217 | struct block_device *bdev; |
217 | 218 | ||
218 | down(&raw_mutex); | 219 | mutex_lock(&raw_mutex); |
219 | bdev = rawdev->binding; | 220 | bdev = rawdev->binding; |
220 | if (bdev) { | 221 | if (bdev) { |
221 | rq.block_major = MAJOR(bdev->bd_dev); | 222 | rq.block_major = MAJOR(bdev->bd_dev); |
@@ -223,7 +224,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file *filp, | |||
223 | } else { | 224 | } else { |
224 | rq.block_major = rq.block_minor = 0; | 225 | rq.block_major = rq.block_minor = 0; |
225 | } | 226 | } |
226 | up(&raw_mutex); | 227 | mutex_unlock(&raw_mutex); |
227 | if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) { | 228 | if (copy_to_user((void __user *)arg, &rq, sizeof(rq))) { |
228 | err = -EFAULT; | 229 | err = -EFAULT; |
229 | goto out; | 230 | goto out; |
diff --git a/drivers/char/ser_a2232.c b/drivers/char/ser_a2232.c index fee68cc895f8..510bd3e0e88b 100644 --- a/drivers/char/ser_a2232.c +++ b/drivers/char/ser_a2232.c | |||
@@ -97,7 +97,7 @@ | |||
97 | #include <asm/amigahw.h> | 97 | #include <asm/amigahw.h> |
98 | #include <linux/zorro.h> | 98 | #include <linux/zorro.h> |
99 | #include <asm/irq.h> | 99 | #include <asm/irq.h> |
100 | #include <asm/semaphore.h> | 100 | #include <linux/mutex.h> |
101 | 101 | ||
102 | #include <linux/delay.h> | 102 | #include <linux/delay.h> |
103 | 103 | ||
@@ -654,7 +654,7 @@ static void a2232_init_portstructs(void) | |||
654 | port->gs.closing_wait = 30 * HZ; | 654 | port->gs.closing_wait = 30 * HZ; |
655 | port->gs.rd = &a2232_real_driver; | 655 | port->gs.rd = &a2232_real_driver; |
656 | #ifdef NEW_WRITE_LOCKING | 656 | #ifdef NEW_WRITE_LOCKING |
657 | init_MUTEX(&(port->gs.port_write_sem)); | 657 | init_MUTEX(&(port->gs.port_write_mutex)); |
658 | #endif | 658 | #endif |
659 | init_waitqueue_head(&port->gs.open_wait); | 659 | init_waitqueue_head(&port->gs.open_wait); |
660 | init_waitqueue_head(&port->gs.close_wait); | 660 | init_waitqueue_head(&port->gs.close_wait); |
diff --git a/drivers/char/snsc.c b/drivers/char/snsc.c index 0e7d216e7eb0..b543821d8cb4 100644 --- a/drivers/char/snsc.c +++ b/drivers/char/snsc.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * License. See the file "COPYING" in the main directory of this archive | 5 | * License. See the file "COPYING" in the main directory of this archive |
6 | * for more details. | 6 | * for more details. |
7 | * | 7 | * |
8 | * Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved. | 8 | * Copyright (C) 2004, 2006 Silicon Graphics, Inc. All rights reserved. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | /* | 11 | /* |
@@ -77,7 +77,7 @@ scdrv_open(struct inode *inode, struct file *file) | |||
77 | scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); | 77 | scd = container_of(inode->i_cdev, struct sysctl_data_s, scd_cdev); |
78 | 78 | ||
79 | /* allocate memory for subchannel data */ | 79 | /* allocate memory for subchannel data */ |
80 | sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); | 80 | sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL); |
81 | if (sd == NULL) { | 81 | if (sd == NULL) { |
82 | printk("%s: couldn't allocate subchannel data\n", | 82 | printk("%s: couldn't allocate subchannel data\n", |
83 | __FUNCTION__); | 83 | __FUNCTION__); |
@@ -85,7 +85,6 @@ scdrv_open(struct inode *inode, struct file *file) | |||
85 | } | 85 | } |
86 | 86 | ||
87 | /* initialize subch_data_s fields */ | 87 | /* initialize subch_data_s fields */ |
88 | memset(sd, 0, sizeof (struct subch_data_s)); | ||
89 | sd->sd_nasid = scd->scd_nasid; | 88 | sd->sd_nasid = scd->scd_nasid; |
90 | sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); | 89 | sd->sd_subch = ia64_sn_irtr_open(scd->scd_nasid); |
91 | 90 | ||
@@ -394,7 +393,7 @@ scdrv_init(void) | |||
394 | sprintf(devnamep, "#%d", geo_slab(geoid)); | 393 | sprintf(devnamep, "#%d", geo_slab(geoid)); |
395 | 394 | ||
396 | /* allocate sysctl device data */ | 395 | /* allocate sysctl device data */ |
397 | scd = kmalloc(sizeof (struct sysctl_data_s), | 396 | scd = kzalloc(sizeof (struct sysctl_data_s), |
398 | GFP_KERNEL); | 397 | GFP_KERNEL); |
399 | if (!scd) { | 398 | if (!scd) { |
400 | printk("%s: failed to allocate device info" | 399 | printk("%s: failed to allocate device info" |
@@ -402,7 +401,6 @@ scdrv_init(void) | |||
402 | SYSCTL_BASENAME, devname); | 401 | SYSCTL_BASENAME, devname); |
403 | continue; | 402 | continue; |
404 | } | 403 | } |
405 | memset(scd, 0, sizeof (struct sysctl_data_s)); | ||
406 | 404 | ||
407 | /* initialize sysctl device data fields */ | 405 | /* initialize sysctl device data fields */ |
408 | scd->scd_nasid = cnodeid_to_nasid(cnode); | 406 | scd->scd_nasid = cnodeid_to_nasid(cnode); |
diff --git a/drivers/char/snsc_event.c b/drivers/char/snsc_event.c index a4fa507eed9e..e234d50e142a 100644 --- a/drivers/char/snsc_event.c +++ b/drivers/char/snsc_event.c | |||
@@ -287,7 +287,7 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
287 | { | 287 | { |
288 | int rv; | 288 | int rv; |
289 | 289 | ||
290 | event_sd = kmalloc(sizeof (struct subch_data_s), GFP_KERNEL); | 290 | event_sd = kzalloc(sizeof (struct subch_data_s), GFP_KERNEL); |
291 | if (event_sd == NULL) { | 291 | if (event_sd == NULL) { |
292 | printk(KERN_WARNING "%s: couldn't allocate subchannel info" | 292 | printk(KERN_WARNING "%s: couldn't allocate subchannel info" |
293 | " for event monitoring\n", __FUNCTION__); | 293 | " for event monitoring\n", __FUNCTION__); |
@@ -295,7 +295,6 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
295 | } | 295 | } |
296 | 296 | ||
297 | /* initialize subch_data_s fields */ | 297 | /* initialize subch_data_s fields */ |
298 | memset(event_sd, 0, sizeof (struct subch_data_s)); | ||
299 | event_sd->sd_nasid = scd->scd_nasid; | 298 | event_sd->sd_nasid = scd->scd_nasid; |
300 | spin_lock_init(&event_sd->sd_rlock); | 299 | spin_lock_init(&event_sd->sd_rlock); |
301 | 300 | ||
@@ -321,5 +320,3 @@ scdrv_event_init(struct sysctl_data_s *scd) | |||
321 | return; | 320 | return; |
322 | } | 321 | } |
323 | } | 322 | } |
324 | |||
325 | |||
diff --git a/drivers/char/stallion.c b/drivers/char/stallion.c index bdaab6992109..3f5d6077f39c 100644 --- a/drivers/char/stallion.c +++ b/drivers/char/stallion.c | |||
@@ -148,7 +148,6 @@ static struct tty_driver *stl_serial; | |||
148 | * is already swapping a shared buffer won't make things any worse. | 148 | * is already swapping a shared buffer won't make things any worse. |
149 | */ | 149 | */ |
150 | static char *stl_tmpwritebuf; | 150 | static char *stl_tmpwritebuf; |
151 | static DECLARE_MUTEX(stl_tmpwritesem); | ||
152 | 151 | ||
153 | /* | 152 | /* |
154 | * Define a local default termios struct. All ports will be created | 153 | * Define a local default termios struct. All ports will be created |
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index a6b4f02bdceb..3b4747230270 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -2318,7 +2318,7 @@ static int sx_init_portstructs (int nboards, int nports) | |||
2318 | port->board = board; | 2318 | port->board = board; |
2319 | port->gs.rd = &sx_real_driver; | 2319 | port->gs.rd = &sx_real_driver; |
2320 | #ifdef NEW_WRITE_LOCKING | 2320 | #ifdef NEW_WRITE_LOCKING |
2321 | port->gs.port_write_sem = MUTEX; | 2321 | port->gs.port_write_mutex = MUTEX; |
2322 | #endif | 2322 | #endif |
2323 | port->gs.driver_lock = SPIN_LOCK_UNLOCKED; | 2323 | port->gs.driver_lock = SPIN_LOCK_UNLOCKED; |
2324 | /* | 2324 | /* |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 53d3d066554e..76592ee1fb38 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -130,7 +130,7 @@ LIST_HEAD(tty_drivers); /* linked list of tty drivers */ | |||
130 | 130 | ||
131 | /* Semaphore to protect creating and releasing a tty. This is shared with | 131 | /* Semaphore to protect creating and releasing a tty. This is shared with |
132 | vt.c for deeply disgusting hack reasons */ | 132 | vt.c for deeply disgusting hack reasons */ |
133 | DECLARE_MUTEX(tty_sem); | 133 | DEFINE_MUTEX(tty_mutex); |
134 | 134 | ||
135 | #ifdef CONFIG_UNIX98_PTYS | 135 | #ifdef CONFIG_UNIX98_PTYS |
136 | extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */ | 136 | extern struct tty_driver *ptm_driver; /* Unix98 pty masters; for /dev/ptmx */ |
@@ -1188,11 +1188,11 @@ void disassociate_ctty(int on_exit) | |||
1188 | 1188 | ||
1189 | lock_kernel(); | 1189 | lock_kernel(); |
1190 | 1190 | ||
1191 | down(&tty_sem); | 1191 | mutex_lock(&tty_mutex); |
1192 | tty = current->signal->tty; | 1192 | tty = current->signal->tty; |
1193 | if (tty) { | 1193 | if (tty) { |
1194 | tty_pgrp = tty->pgrp; | 1194 | tty_pgrp = tty->pgrp; |
1195 | up(&tty_sem); | 1195 | mutex_unlock(&tty_mutex); |
1196 | if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY) | 1196 | if (on_exit && tty->driver->type != TTY_DRIVER_TYPE_PTY) |
1197 | tty_vhangup(tty); | 1197 | tty_vhangup(tty); |
1198 | } else { | 1198 | } else { |
@@ -1200,7 +1200,7 @@ void disassociate_ctty(int on_exit) | |||
1200 | kill_pg(current->signal->tty_old_pgrp, SIGHUP, on_exit); | 1200 | kill_pg(current->signal->tty_old_pgrp, SIGHUP, on_exit); |
1201 | kill_pg(current->signal->tty_old_pgrp, SIGCONT, on_exit); | 1201 | kill_pg(current->signal->tty_old_pgrp, SIGCONT, on_exit); |
1202 | } | 1202 | } |
1203 | up(&tty_sem); | 1203 | mutex_unlock(&tty_mutex); |
1204 | unlock_kernel(); | 1204 | unlock_kernel(); |
1205 | return; | 1205 | return; |
1206 | } | 1206 | } |
@@ -1211,7 +1211,7 @@ void disassociate_ctty(int on_exit) | |||
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | /* Must lock changes to tty_old_pgrp */ | 1213 | /* Must lock changes to tty_old_pgrp */ |
1214 | down(&tty_sem); | 1214 | mutex_lock(&tty_mutex); |
1215 | current->signal->tty_old_pgrp = 0; | 1215 | current->signal->tty_old_pgrp = 0; |
1216 | tty->session = 0; | 1216 | tty->session = 0; |
1217 | tty->pgrp = -1; | 1217 | tty->pgrp = -1; |
@@ -1222,7 +1222,7 @@ void disassociate_ctty(int on_exit) | |||
1222 | p->signal->tty = NULL; | 1222 | p->signal->tty = NULL; |
1223 | } while_each_task_pid(current->signal->session, PIDTYPE_SID, p); | 1223 | } while_each_task_pid(current->signal->session, PIDTYPE_SID, p); |
1224 | read_unlock(&tasklist_lock); | 1224 | read_unlock(&tasklist_lock); |
1225 | up(&tty_sem); | 1225 | mutex_unlock(&tty_mutex); |
1226 | unlock_kernel(); | 1226 | unlock_kernel(); |
1227 | } | 1227 | } |
1228 | 1228 | ||
@@ -1306,7 +1306,7 @@ static inline ssize_t do_tty_write( | |||
1306 | ssize_t ret = 0, written = 0; | 1306 | ssize_t ret = 0, written = 0; |
1307 | unsigned int chunk; | 1307 | unsigned int chunk; |
1308 | 1308 | ||
1309 | if (down_interruptible(&tty->atomic_write)) { | 1309 | if (mutex_lock_interruptible(&tty->atomic_write_lock)) { |
1310 | return -ERESTARTSYS; | 1310 | return -ERESTARTSYS; |
1311 | } | 1311 | } |
1312 | 1312 | ||
@@ -1329,7 +1329,7 @@ static inline ssize_t do_tty_write( | |||
1329 | if (count < chunk) | 1329 | if (count < chunk) |
1330 | chunk = count; | 1330 | chunk = count; |
1331 | 1331 | ||
1332 | /* write_buf/write_cnt is protected by the atomic_write semaphore */ | 1332 | /* write_buf/write_cnt is protected by the atomic_write_lock mutex */ |
1333 | if (tty->write_cnt < chunk) { | 1333 | if (tty->write_cnt < chunk) { |
1334 | unsigned char *buf; | 1334 | unsigned char *buf; |
1335 | 1335 | ||
@@ -1338,7 +1338,7 @@ static inline ssize_t do_tty_write( | |||
1338 | 1338 | ||
1339 | buf = kmalloc(chunk, GFP_KERNEL); | 1339 | buf = kmalloc(chunk, GFP_KERNEL); |
1340 | if (!buf) { | 1340 | if (!buf) { |
1341 | up(&tty->atomic_write); | 1341 | mutex_unlock(&tty->atomic_write_lock); |
1342 | return -ENOMEM; | 1342 | return -ENOMEM; |
1343 | } | 1343 | } |
1344 | kfree(tty->write_buf); | 1344 | kfree(tty->write_buf); |
@@ -1374,7 +1374,7 @@ static inline ssize_t do_tty_write( | |||
1374 | inode->i_mtime = current_fs_time(inode->i_sb); | 1374 | inode->i_mtime = current_fs_time(inode->i_sb); |
1375 | ret = written; | 1375 | ret = written; |
1376 | } | 1376 | } |
1377 | up(&tty->atomic_write); | 1377 | mutex_unlock(&tty->atomic_write_lock); |
1378 | return ret; | 1378 | return ret; |
1379 | } | 1379 | } |
1380 | 1380 | ||
@@ -1442,8 +1442,8 @@ static inline void tty_line_name(struct tty_driver *driver, int index, char *p) | |||
1442 | 1442 | ||
1443 | /* | 1443 | /* |
1444 | * WSH 06/09/97: Rewritten to remove races and properly clean up after a | 1444 | * WSH 06/09/97: Rewritten to remove races and properly clean up after a |
1445 | * failed open. The new code protects the open with a semaphore, so it's | 1445 | * failed open. The new code protects the open with a mutex, so it's |
1446 | * really quite straightforward. The semaphore locking can probably be | 1446 | * really quite straightforward. The mutex locking can probably be |
1447 | * relaxed for the (most common) case of reopening a tty. | 1447 | * relaxed for the (most common) case of reopening a tty. |
1448 | */ | 1448 | */ |
1449 | static int init_dev(struct tty_driver *driver, int idx, | 1449 | static int init_dev(struct tty_driver *driver, int idx, |
@@ -1640,7 +1640,7 @@ fast_track: | |||
1640 | success: | 1640 | success: |
1641 | *ret_tty = tty; | 1641 | *ret_tty = tty; |
1642 | 1642 | ||
1643 | /* All paths come through here to release the semaphore */ | 1643 | /* All paths come through here to release the mutex */ |
1644 | end_init: | 1644 | end_init: |
1645 | return retval; | 1645 | return retval; |
1646 | 1646 | ||
@@ -1837,7 +1837,7 @@ static void release_dev(struct file * filp) | |||
1837 | /* Guard against races with tty->count changes elsewhere and | 1837 | /* Guard against races with tty->count changes elsewhere and |
1838 | opens on /dev/tty */ | 1838 | opens on /dev/tty */ |
1839 | 1839 | ||
1840 | down(&tty_sem); | 1840 | mutex_lock(&tty_mutex); |
1841 | tty_closing = tty->count <= 1; | 1841 | tty_closing = tty->count <= 1; |
1842 | o_tty_closing = o_tty && | 1842 | o_tty_closing = o_tty && |
1843 | (o_tty->count <= (pty_master ? 1 : 0)); | 1843 | (o_tty->count <= (pty_master ? 1 : 0)); |
@@ -1868,7 +1868,7 @@ static void release_dev(struct file * filp) | |||
1868 | 1868 | ||
1869 | printk(KERN_WARNING "release_dev: %s: read/write wait queue " | 1869 | printk(KERN_WARNING "release_dev: %s: read/write wait queue " |
1870 | "active!\n", tty_name(tty, buf)); | 1870 | "active!\n", tty_name(tty, buf)); |
1871 | up(&tty_sem); | 1871 | mutex_unlock(&tty_mutex); |
1872 | schedule(); | 1872 | schedule(); |
1873 | } | 1873 | } |
1874 | 1874 | ||
@@ -1934,7 +1934,7 @@ static void release_dev(struct file * filp) | |||
1934 | read_unlock(&tasklist_lock); | 1934 | read_unlock(&tasklist_lock); |
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | up(&tty_sem); | 1937 | mutex_unlock(&tty_mutex); |
1938 | 1938 | ||
1939 | /* check whether both sides are closing ... */ | 1939 | /* check whether both sides are closing ... */ |
1940 | if (!tty_closing || (o_tty && !o_tty_closing)) | 1940 | if (!tty_closing || (o_tty && !o_tty_closing)) |
@@ -2040,11 +2040,11 @@ retry_open: | |||
2040 | index = -1; | 2040 | index = -1; |
2041 | retval = 0; | 2041 | retval = 0; |
2042 | 2042 | ||
2043 | down(&tty_sem); | 2043 | mutex_lock(&tty_mutex); |
2044 | 2044 | ||
2045 | if (device == MKDEV(TTYAUX_MAJOR,0)) { | 2045 | if (device == MKDEV(TTYAUX_MAJOR,0)) { |
2046 | if (!current->signal->tty) { | 2046 | if (!current->signal->tty) { |
2047 | up(&tty_sem); | 2047 | mutex_unlock(&tty_mutex); |
2048 | return -ENXIO; | 2048 | return -ENXIO; |
2049 | } | 2049 | } |
2050 | driver = current->signal->tty->driver; | 2050 | driver = current->signal->tty->driver; |
@@ -2070,18 +2070,18 @@ retry_open: | |||
2070 | noctty = 1; | 2070 | noctty = 1; |
2071 | goto got_driver; | 2071 | goto got_driver; |
2072 | } | 2072 | } |
2073 | up(&tty_sem); | 2073 | mutex_unlock(&tty_mutex); |
2074 | return -ENODEV; | 2074 | return -ENODEV; |
2075 | } | 2075 | } |
2076 | 2076 | ||
2077 | driver = get_tty_driver(device, &index); | 2077 | driver = get_tty_driver(device, &index); |
2078 | if (!driver) { | 2078 | if (!driver) { |
2079 | up(&tty_sem); | 2079 | mutex_unlock(&tty_mutex); |
2080 | return -ENODEV; | 2080 | return -ENODEV; |
2081 | } | 2081 | } |
2082 | got_driver: | 2082 | got_driver: |
2083 | retval = init_dev(driver, index, &tty); | 2083 | retval = init_dev(driver, index, &tty); |
2084 | up(&tty_sem); | 2084 | mutex_unlock(&tty_mutex); |
2085 | if (retval) | 2085 | if (retval) |
2086 | return retval; | 2086 | return retval; |
2087 | 2087 | ||
@@ -2167,9 +2167,9 @@ static int ptmx_open(struct inode * inode, struct file * filp) | |||
2167 | } | 2167 | } |
2168 | up(&allocated_ptys_lock); | 2168 | up(&allocated_ptys_lock); |
2169 | 2169 | ||
2170 | down(&tty_sem); | 2170 | mutex_lock(&tty_mutex); |
2171 | retval = init_dev(ptm_driver, index, &tty); | 2171 | retval = init_dev(ptm_driver, index, &tty); |
2172 | up(&tty_sem); | 2172 | mutex_unlock(&tty_mutex); |
2173 | 2173 | ||
2174 | if (retval) | 2174 | if (retval) |
2175 | goto out; | 2175 | goto out; |
@@ -2915,8 +2915,8 @@ static void initialize_tty_struct(struct tty_struct *tty) | |||
2915 | init_waitqueue_head(&tty->write_wait); | 2915 | init_waitqueue_head(&tty->write_wait); |
2916 | init_waitqueue_head(&tty->read_wait); | 2916 | init_waitqueue_head(&tty->read_wait); |
2917 | INIT_WORK(&tty->hangup_work, do_tty_hangup, tty); | 2917 | INIT_WORK(&tty->hangup_work, do_tty_hangup, tty); |
2918 | sema_init(&tty->atomic_read, 1); | 2918 | mutex_init(&tty->atomic_read_lock); |
2919 | sema_init(&tty->atomic_write, 1); | 2919 | mutex_init(&tty->atomic_write_lock); |
2920 | spin_lock_init(&tty->read_lock); | 2920 | spin_lock_init(&tty->read_lock); |
2921 | INIT_LIST_HEAD(&tty->tty_files); | 2921 | INIT_LIST_HEAD(&tty->tty_files); |
2922 | INIT_WORK(&tty->SAK_work, NULL, NULL); | 2922 | INIT_WORK(&tty->SAK_work, NULL, NULL); |
diff --git a/drivers/char/vme_scc.c b/drivers/char/vme_scc.c index d9325281e482..fd00822ac145 100644 --- a/drivers/char/vme_scc.c +++ b/drivers/char/vme_scc.c | |||
@@ -184,7 +184,7 @@ static void scc_init_portstructs(void) | |||
184 | port->gs.closing_wait = 30 * HZ; | 184 | port->gs.closing_wait = 30 * HZ; |
185 | port->gs.rd = &scc_real_driver; | 185 | port->gs.rd = &scc_real_driver; |
186 | #ifdef NEW_WRITE_LOCKING | 186 | #ifdef NEW_WRITE_LOCKING |
187 | port->gs.port_write_sem = MUTEX; | 187 | port->gs.port_write_mutex = MUTEX; |
188 | #endif | 188 | #endif |
189 | init_waitqueue_head(&port->gs.open_wait); | 189 | init_waitqueue_head(&port->gs.open_wait); |
190 | init_waitqueue_head(&port->gs.close_wait); | 190 | init_waitqueue_head(&port->gs.close_wait); |
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 0900d1dbee59..ca4844c527da 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -2489,7 +2489,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2489 | } | 2489 | } |
2490 | 2490 | ||
2491 | /* | 2491 | /* |
2492 | * We take tty_sem in here to prevent another thread from coming in via init_dev | 2492 | * We take tty_mutex in here to prevent another thread from coming in via init_dev |
2493 | * and taking a ref against the tty while we're in the process of forgetting | 2493 | * and taking a ref against the tty while we're in the process of forgetting |
2494 | * about it and cleaning things up. | 2494 | * about it and cleaning things up. |
2495 | * | 2495 | * |
@@ -2497,7 +2497,7 @@ static int con_open(struct tty_struct *tty, struct file *filp) | |||
2497 | */ | 2497 | */ |
2498 | static void con_close(struct tty_struct *tty, struct file *filp) | 2498 | static void con_close(struct tty_struct *tty, struct file *filp) |
2499 | { | 2499 | { |
2500 | down(&tty_sem); | 2500 | mutex_lock(&tty_mutex); |
2501 | acquire_console_sem(); | 2501 | acquire_console_sem(); |
2502 | if (tty && tty->count == 1) { | 2502 | if (tty && tty->count == 1) { |
2503 | struct vc_data *vc = tty->driver_data; | 2503 | struct vc_data *vc = tty->driver_data; |
@@ -2507,15 +2507,15 @@ static void con_close(struct tty_struct *tty, struct file *filp) | |||
2507 | tty->driver_data = NULL; | 2507 | tty->driver_data = NULL; |
2508 | release_console_sem(); | 2508 | release_console_sem(); |
2509 | vcs_remove_devfs(tty); | 2509 | vcs_remove_devfs(tty); |
2510 | up(&tty_sem); | 2510 | mutex_unlock(&tty_mutex); |
2511 | /* | 2511 | /* |
2512 | * tty_sem is released, but we still hold BKL, so there is | 2512 | * tty_mutex is released, but we still hold BKL, so there is |
2513 | * still exclusion against init_dev() | 2513 | * still exclusion against init_dev() |
2514 | */ | 2514 | */ |
2515 | return; | 2515 | return; |
2516 | } | 2516 | } |
2517 | release_console_sem(); | 2517 | release_console_sem(); |
2518 | up(&tty_sem); | 2518 | mutex_unlock(&tty_mutex); |
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | static void vc_init(struct vc_data *vc, unsigned int rows, | 2521 | static void vc_init(struct vc_data *vc, unsigned int rows, |
@@ -2869,9 +2869,9 @@ void unblank_screen(void) | |||
2869 | } | 2869 | } |
2870 | 2870 | ||
2871 | /* | 2871 | /* |
2872 | * We defer the timer blanking to work queue so it can take the console semaphore | 2872 | * We defer the timer blanking to work queue so it can take the console mutex |
2873 | * (console operations can still happen at irq time, but only from printk which | 2873 | * (console operations can still happen at irq time, but only from printk which |
2874 | * has the console semaphore. Not perfect yet, but better than no locking | 2874 | * has the console mutex. Not perfect yet, but better than no locking |
2875 | */ | 2875 | */ |
2876 | static void blank_screen_t(unsigned long dummy) | 2876 | static void blank_screen_t(unsigned long dummy) |
2877 | { | 2877 | { |
@@ -3234,6 +3234,14 @@ void vcs_scr_writew(struct vc_data *vc, u16 val, u16 *org) | |||
3234 | } | 3234 | } |
3235 | } | 3235 | } |
3236 | 3236 | ||
3237 | int is_console_suspend_safe(void) | ||
3238 | { | ||
3239 | /* It is unsafe to suspend devices while X has control of the | ||
3240 | * hardware. Make sure we are running on a kernel-controlled console. | ||
3241 | */ | ||
3242 | return vc_cons[fg_console].d->vc_mode == KD_TEXT; | ||
3243 | } | ||
3244 | |||
3237 | /* | 3245 | /* |
3238 | * Visible symbols for modules | 3246 | * Visible symbols for modules |
3239 | */ | 3247 | */ |
diff --git a/drivers/char/watchdog/pcwd_usb.c b/drivers/char/watchdog/pcwd_usb.c index 1533f56baa42..2700c5c45b8a 100644 --- a/drivers/char/watchdog/pcwd_usb.c +++ b/drivers/char/watchdog/pcwd_usb.c | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/completion.h> | 42 | #include <linux/completion.h> |
43 | #include <asm/uaccess.h> | 43 | #include <asm/uaccess.h> |
44 | #include <linux/usb.h> | 44 | #include <linux/usb.h> |
45 | #include <linux/mutex.h> | ||
45 | 46 | ||
46 | 47 | ||
47 | #ifdef CONFIG_USB_DEBUG | 48 | #ifdef CONFIG_USB_DEBUG |
@@ -143,7 +144,7 @@ struct usb_pcwd_private { | |||
143 | static struct usb_pcwd_private *usb_pcwd_device; | 144 | static struct usb_pcwd_private *usb_pcwd_device; |
144 | 145 | ||
145 | /* prevent races between open() and disconnect() */ | 146 | /* prevent races between open() and disconnect() */ |
146 | static DECLARE_MUTEX (disconnect_sem); | 147 | static DEFINE_MUTEX(disconnect_mutex); |
147 | 148 | ||
148 | /* local function prototypes */ | 149 | /* local function prototypes */ |
149 | static int usb_pcwd_probe (struct usb_interface *interface, const struct usb_device_id *id); | 150 | 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) | |||
723 | struct usb_pcwd_private *usb_pcwd; | 724 | struct usb_pcwd_private *usb_pcwd; |
724 | 725 | ||
725 | /* prevent races with open() */ | 726 | /* prevent races with open() */ |
726 | down (&disconnect_sem); | 727 | mutex_lock(&disconnect_mutex); |
727 | 728 | ||
728 | usb_pcwd = usb_get_intfdata (interface); | 729 | usb_pcwd = usb_get_intfdata (interface); |
729 | usb_set_intfdata (interface, NULL); | 730 | usb_set_intfdata (interface, NULL); |
@@ -749,7 +750,7 @@ static void usb_pcwd_disconnect(struct usb_interface *interface) | |||
749 | 750 | ||
750 | cards_found--; | 751 | cards_found--; |
751 | 752 | ||
752 | up (&disconnect_sem); | 753 | mutex_unlock(&disconnect_mutex); |
753 | 754 | ||
754 | printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); | 755 | printk(KERN_INFO PFX "USB PC Watchdog disconnected\n"); |
755 | } | 756 | } |