aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.c77
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb.h6
-rw-r--r--drivers/usb/misc/sisusbvga/sisusb_con.c129
3 files changed, 107 insertions, 105 deletions
diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c
index 196c8794a73c..19aedbc85ea4 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.c
+++ b/drivers/usb/misc/sisusbvga/sisusb.c
@@ -37,6 +37,7 @@
37 */ 37 */
38 38
39#include <linux/config.h> 39#include <linux/config.h>
40#include <linux/mutex.h>
40#include <linux/module.h> 41#include <linux/module.h>
41#include <linux/kernel.h> 42#include <linux/kernel.h>
42#include <linux/signal.h> 43#include <linux/signal.h>
@@ -102,7 +103,7 @@ MODULE_PARM_DESC(last, "Number of last console to take over (1 - MAX_NR_CONSOLES
102 103
103static struct usb_driver sisusb_driver; 104static struct usb_driver sisusb_driver;
104 105
105DECLARE_MUTEX(disconnect_sem); 106DEFINE_MUTEX(disconnect_mutex);
106 107
107static void 108static void
108sisusb_free_buffers(struct sisusb_usb_data *sisusb) 109sisusb_free_buffers(struct sisusb_usb_data *sisusb)
@@ -2552,39 +2553,39 @@ sisusb_open(struct inode *inode, struct file *file)
2552 struct usb_interface *interface; 2553 struct usb_interface *interface;
2553 int subminor = iminor(inode); 2554 int subminor = iminor(inode);
2554 2555
2555 down(&disconnect_sem); 2556 mutex_lock(&disconnect_mutex);
2556 2557
2557 if (!(interface = usb_find_interface(&sisusb_driver, subminor))) { 2558 if (!(interface = usb_find_interface(&sisusb_driver, subminor))) {
2558 printk(KERN_ERR "sisusb[%d]: Failed to find interface\n", 2559 printk(KERN_ERR "sisusb[%d]: Failed to find interface\n",
2559 subminor); 2560 subminor);
2560 up(&disconnect_sem); 2561 mutex_unlock(&disconnect_mutex);
2561 return -ENODEV; 2562 return -ENODEV;
2562 } 2563 }
2563 2564
2564 if (!(sisusb = usb_get_intfdata(interface))) { 2565 if (!(sisusb = usb_get_intfdata(interface))) {
2565 up(&disconnect_sem); 2566 mutex_unlock(&disconnect_mutex);
2566 return -ENODEV; 2567 return -ENODEV;
2567 } 2568 }
2568 2569
2569 down(&sisusb->lock); 2570 mutex_lock(&sisusb->lock);
2570 2571
2571 if (!sisusb->present || !sisusb->ready) { 2572 if (!sisusb->present || !sisusb->ready) {
2572 up(&sisusb->lock); 2573 mutex_unlock(&sisusb->lock);
2573 up(&disconnect_sem); 2574 mutex_unlock(&disconnect_mutex);
2574 return -ENODEV; 2575 return -ENODEV;
2575 } 2576 }
2576 2577
2577 if (sisusb->isopen) { 2578 if (sisusb->isopen) {
2578 up(&sisusb->lock); 2579 mutex_unlock(&sisusb->lock);
2579 up(&disconnect_sem); 2580 mutex_unlock(&disconnect_mutex);
2580 return -EBUSY; 2581 return -EBUSY;
2581 } 2582 }
2582 2583
2583 if (!sisusb->devinit) { 2584 if (!sisusb->devinit) {
2584 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) { 2585 if (sisusb->sisusb_dev->speed == USB_SPEED_HIGH) {
2585 if (sisusb_init_gfxdevice(sisusb, 0)) { 2586 if (sisusb_init_gfxdevice(sisusb, 0)) {
2586 up(&sisusb->lock); 2587 mutex_unlock(&sisusb->lock);
2587 up(&disconnect_sem); 2588 mutex_unlock(&disconnect_mutex);
2588 printk(KERN_ERR 2589 printk(KERN_ERR
2589 "sisusbvga[%d]: Failed to initialize " 2590 "sisusbvga[%d]: Failed to initialize "
2590 "device\n", 2591 "device\n",
@@ -2592,8 +2593,8 @@ sisusb_open(struct inode *inode, struct file *file)
2592 return -EIO; 2593 return -EIO;
2593 } 2594 }
2594 } else { 2595 } else {
2595 up(&sisusb->lock); 2596 mutex_unlock(&sisusb->lock);
2596 up(&disconnect_sem); 2597 mutex_unlock(&disconnect_mutex);
2597 printk(KERN_ERR 2598 printk(KERN_ERR
2598 "sisusbvga[%d]: Device not attached to " 2599 "sisusbvga[%d]: Device not attached to "
2599 "USB 2.0 hub\n", 2600 "USB 2.0 hub\n",
@@ -2609,9 +2610,9 @@ sisusb_open(struct inode *inode, struct file *file)
2609 2610
2610 file->private_data = sisusb; 2611 file->private_data = sisusb;
2611 2612
2612 up(&sisusb->lock); 2613 mutex_unlock(&sisusb->lock);
2613 2614
2614 up(&disconnect_sem); 2615 mutex_unlock(&disconnect_mutex);
2615 2616
2616 return 0; 2617 return 0;
2617} 2618}
@@ -2642,14 +2643,14 @@ sisusb_release(struct inode *inode, struct file *file)
2642 struct sisusb_usb_data *sisusb; 2643 struct sisusb_usb_data *sisusb;
2643 int myminor; 2644 int myminor;
2644 2645
2645 down(&disconnect_sem); 2646 mutex_lock(&disconnect_mutex);
2646 2647
2647 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) { 2648 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) {
2648 up(&disconnect_sem); 2649 mutex_unlock(&disconnect_mutex);
2649 return -ENODEV; 2650 return -ENODEV;
2650 } 2651 }
2651 2652
2652 down(&sisusb->lock); 2653 mutex_lock(&sisusb->lock);
2653 2654
2654 if (sisusb->present) { 2655 if (sisusb->present) {
2655 /* Wait for all URBs to finish if device still present */ 2656 /* Wait for all URBs to finish if device still present */
@@ -2662,12 +2663,12 @@ sisusb_release(struct inode *inode, struct file *file)
2662 sisusb->isopen = 0; 2663 sisusb->isopen = 0;
2663 file->private_data = NULL; 2664 file->private_data = NULL;
2664 2665
2665 up(&sisusb->lock); 2666 mutex_unlock(&sisusb->lock);
2666 2667
2667 /* decrement the usage count on our device */ 2668 /* decrement the usage count on our device */
2668 kref_put(&sisusb->kref, sisusb_delete); 2669 kref_put(&sisusb->kref, sisusb_delete);
2669 2670
2670 up(&disconnect_sem); 2671 mutex_unlock(&disconnect_mutex);
2671 2672
2672 return 0; 2673 return 0;
2673} 2674}
@@ -2685,11 +2686,11 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2685 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2686 if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
2686 return -ENODEV; 2687 return -ENODEV;
2687 2688
2688 down(&sisusb->lock); 2689 mutex_lock(&sisusb->lock);
2689 2690
2690 /* Sanity check */ 2691 /* Sanity check */
2691 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { 2692 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
2692 up(&sisusb->lock); 2693 mutex_unlock(&sisusb->lock);
2693 return -ENODEV; 2694 return -ENODEV;
2694 } 2695 }
2695 2696
@@ -2784,7 +2785,7 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2784 (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + 0x5c) { 2785 (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + 0x5c) {
2785 2786
2786 if (count != 4) { 2787 if (count != 4) {
2787 up(&sisusb->lock); 2788 mutex_unlock(&sisusb->lock);
2788 return -EINVAL; 2789 return -EINVAL;
2789 } 2790 }
2790 2791
@@ -2808,7 +2809,7 @@ sisusb_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
2808 2809
2809 (*ppos) += bytes_read; 2810 (*ppos) += bytes_read;
2810 2811
2811 up(&sisusb->lock); 2812 mutex_unlock(&sisusb->lock);
2812 2813
2813 return errno ? errno : bytes_read; 2814 return errno ? errno : bytes_read;
2814} 2815}
@@ -2827,11 +2828,11 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
2827 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2828 if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
2828 return -ENODEV; 2829 return -ENODEV;
2829 2830
2830 down(&sisusb->lock); 2831 mutex_lock(&sisusb->lock);
2831 2832
2832 /* Sanity check */ 2833 /* Sanity check */
2833 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { 2834 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
2834 up(&sisusb->lock); 2835 mutex_unlock(&sisusb->lock);
2835 return -ENODEV; 2836 return -ENODEV;
2836 } 2837 }
2837 2838
@@ -2930,7 +2931,7 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
2930 (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + SISUSB_PCI_PCONFSIZE) { 2931 (*ppos) <= SISUSB_PCI_PSEUDO_PCIBASE + SISUSB_PCI_PCONFSIZE) {
2931 2932
2932 if (count != 4) { 2933 if (count != 4) {
2933 up(&sisusb->lock); 2934 mutex_unlock(&sisusb->lock);
2934 return -EINVAL; 2935 return -EINVAL;
2935 } 2936 }
2936 2937
@@ -2956,7 +2957,7 @@ sisusb_write(struct file *file, const char __user *buffer, size_t count,
2956 2957
2957 (*ppos) += bytes_written; 2958 (*ppos) += bytes_written;
2958 2959
2959 up(&sisusb->lock); 2960 mutex_unlock(&sisusb->lock);
2960 2961
2961 return errno ? errno : bytes_written; 2962 return errno ? errno : bytes_written;
2962} 2963}
@@ -2970,11 +2971,11 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
2970 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 2971 if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
2971 return -ENODEV; 2972 return -ENODEV;
2972 2973
2973 down(&sisusb->lock); 2974 mutex_lock(&sisusb->lock);
2974 2975
2975 /* Sanity check */ 2976 /* Sanity check */
2976 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { 2977 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
2977 up(&sisusb->lock); 2978 mutex_unlock(&sisusb->lock);
2978 return -ENODEV; 2979 return -ENODEV;
2979 } 2980 }
2980 2981
@@ -2994,7 +2995,7 @@ sisusb_lseek(struct file *file, loff_t offset, int orig)
2994 ret = -EINVAL; 2995 ret = -EINVAL;
2995 } 2996 }
2996 2997
2997 up(&sisusb->lock); 2998 mutex_unlock(&sisusb->lock);
2998 return ret; 2999 return ret;
2999} 3000}
3000 3001
@@ -3136,7 +3137,7 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
3136 if (!(sisusb = (struct sisusb_usb_data *)file->private_data)) 3137 if (!(sisusb = (struct sisusb_usb_data *)file->private_data))
3137 return -ENODEV; 3138 return -ENODEV;
3138 3139
3139 down(&sisusb->lock); 3140 mutex_lock(&sisusb->lock);
3140 3141
3141 /* Sanity check */ 3142 /* Sanity check */
3142 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) { 3143 if (!sisusb->present || !sisusb->ready || !sisusb->sisusb_dev) {
@@ -3193,7 +3194,7 @@ sisusb_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
3193 } 3194 }
3194 3195
3195err_out: 3196err_out:
3196 up(&sisusb->lock); 3197 mutex_unlock(&sisusb->lock);
3197 return retval; 3198 return retval;
3198} 3199}
3199 3200
@@ -3258,7 +3259,7 @@ static int sisusb_probe(struct usb_interface *intf,
3258 } 3259 }
3259 kref_init(&sisusb->kref); 3260 kref_init(&sisusb->kref);
3260 3261
3261 init_MUTEX(&(sisusb->lock)); 3262 mutex_init(&(sisusb->lock));
3262 3263
3263 /* Register device */ 3264 /* Register device */
3264 if ((retval = usb_register_dev(intf, &usb_sisusb_class))) { 3265 if ((retval = usb_register_dev(intf, &usb_sisusb_class))) {
@@ -3429,9 +3430,9 @@ static void sisusb_disconnect(struct usb_interface *intf)
3429 * protect all other routines from the disconnect 3430 * protect all other routines from the disconnect
3430 * case, not the other way round. 3431 * case, not the other way round.
3431 */ 3432 */
3432 down(&disconnect_sem); 3433 mutex_lock(&disconnect_mutex);
3433 3434
3434 down(&sisusb->lock); 3435 mutex_lock(&sisusb->lock);
3435 3436
3436 /* Wait for all URBs to complete and kill them in case (MUST do) */ 3437 /* Wait for all URBs to complete and kill them in case (MUST do) */
3437 if (!sisusb_wait_all_out_complete(sisusb)) 3438 if (!sisusb_wait_all_out_complete(sisusb))
@@ -3462,12 +3463,12 @@ static void sisusb_disconnect(struct usb_interface *intf)
3462 sisusb->present = 0; 3463 sisusb->present = 0;
3463 sisusb->ready = 0; 3464 sisusb->ready = 0;
3464 3465
3465 up(&sisusb->lock); 3466 mutex_unlock(&sisusb->lock);
3466 3467
3467 /* decrement our usage count */ 3468 /* decrement our usage count */
3468 kref_put(&sisusb->kref, sisusb_delete); 3469 kref_put(&sisusb->kref, sisusb_delete);
3469 3470
3470 up(&disconnect_sem); 3471 mutex_unlock(&disconnect_mutex);
3471 3472
3472 printk(KERN_INFO "sisusbvga[%d]: Disconnected\n", minor); 3473 printk(KERN_INFO "sisusbvga[%d]: Disconnected\n", minor);
3473} 3474}
diff --git a/drivers/usb/misc/sisusbvga/sisusb.h b/drivers/usb/misc/sisusbvga/sisusb.h
index a716825d1f9b..8e1120a64806 100644
--- a/drivers/usb/misc/sisusbvga/sisusb.h
+++ b/drivers/usb/misc/sisusbvga/sisusb.h
@@ -41,6 +41,8 @@
41#define SISUSB_NEW_CONFIG_COMPAT 41#define SISUSB_NEW_CONFIG_COMPAT
42#endif 42#endif
43 43
44#include <linux/mutex.h>
45
44/* For older kernels, support for text consoles is by default 46/* For older kernels, support for text consoles is by default
45 * off. To ensable text console support, change the following: 47 * off. To ensable text console support, change the following:
46 */ 48 */
@@ -60,11 +62,9 @@
60#define INCL_SISUSB_CON 1 62#define INCL_SISUSB_CON 1
61#endif 63#endif
62 64
63#ifdef INCL_SISUSB_CON
64#include <linux/console.h> 65#include <linux/console.h>
65#include <linux/vt_kern.h> 66#include <linux/vt_kern.h>
66#include "sisusb_struct.h" 67#include "sisusb_struct.h"
67#endif
68 68
69/* USB related */ 69/* USB related */
70 70
@@ -116,7 +116,7 @@ struct sisusb_usb_data {
116 struct usb_interface *interface; 116 struct usb_interface *interface;
117 struct kref kref; 117 struct kref kref;
118 wait_queue_head_t wait_q; /* for syncind and timeouts */ 118 wait_queue_head_t wait_q; /* for syncind and timeouts */
119 struct semaphore lock; /* general race avoidance */ 119 struct mutex lock; /* general race avoidance */
120 unsigned int ifnum; /* interface number of the USB device */ 120 unsigned int ifnum; /* interface number of the USB device */
121 int minor; /* minor (for logging clarity) */ 121 int minor; /* minor (for logging clarity) */
122 int isopen; /* !=0 if open */ 122 int isopen; /* !=0 if open */
diff --git a/drivers/usb/misc/sisusbvga/sisusb_con.c b/drivers/usb/misc/sisusbvga/sisusb_con.c
index be5c1a25ae21..092281c172a1 100644
--- a/drivers/usb/misc/sisusbvga/sisusb_con.c
+++ b/drivers/usb/misc/sisusbvga/sisusb_con.c
@@ -48,6 +48,7 @@
48 */ 48 */
49 49
50#include <linux/config.h> 50#include <linux/config.h>
51#include <linux/mutex.h>
51#include <linux/module.h> 52#include <linux/module.h>
52#include <linux/kernel.h> 53#include <linux/kernel.h>
53#include <linux/signal.h> 54#include <linux/signal.h>
@@ -102,7 +103,7 @@ static struct sisusb_usb_data *mysisusbs[MAX_NR_CONSOLES];
102/* Forward declaration */ 103/* Forward declaration */
103static const struct consw sisusb_con; 104static const struct consw sisusb_con;
104 105
105extern struct semaphore disconnect_sem; 106extern struct mutex disconnect_mutex;
106 107
107static inline void 108static inline void
108sisusbcon_memsetw(u16 *s, u16 c, unsigned int count) 109sisusbcon_memsetw(u16 *s, u16 c, unsigned int count)
@@ -194,11 +195,11 @@ sisusb_get_sisusb_lock_and_check(unsigned short console)
194 if (!(sisusb = sisusb_get_sisusb(console))) 195 if (!(sisusb = sisusb_get_sisusb(console)))
195 return NULL; 196 return NULL;
196 197
197 down(&sisusb->lock); 198 mutex_lock(&sisusb->lock);
198 199
199 if (!sisusb_sisusb_valid(sisusb) || 200 if (!sisusb_sisusb_valid(sisusb) ||
200 !sisusb->havethisconsole[console]) { 201 !sisusb->havethisconsole[console]) {
201 up(&sisusb->lock); 202 mutex_unlock(&sisusb->lock);
202 return NULL; 203 return NULL;
203 } 204 }
204 205
@@ -236,18 +237,18 @@ sisusbcon_init(struct vc_data *c, int init)
236 * are set up/restored. 237 * are set up/restored.
237 */ 238 */
238 239
239 down(&disconnect_sem); 240 mutex_lock(&disconnect_mutex);
240 241
241 if (!(sisusb = sisusb_get_sisusb(c->vc_num))) { 242 if (!(sisusb = sisusb_get_sisusb(c->vc_num))) {
242 up(&disconnect_sem); 243 mutex_unlock(&disconnect_mutex);
243 return; 244 return;
244 } 245 }
245 246
246 down(&sisusb->lock); 247 mutex_lock(&sisusb->lock);
247 248
248 if (!sisusb_sisusb_valid(sisusb)) { 249 if (!sisusb_sisusb_valid(sisusb)) {
249 up(&sisusb->lock); 250 mutex_unlock(&sisusb->lock);
250 up(&disconnect_sem); 251 mutex_unlock(&disconnect_mutex);
251 return; 252 return;
252 } 253 }
253 254
@@ -284,9 +285,9 @@ sisusbcon_init(struct vc_data *c, int init)
284 if (!*c->vc_uni_pagedir_loc) 285 if (!*c->vc_uni_pagedir_loc)
285 con_set_default_unimap(c); 286 con_set_default_unimap(c);
286 287
287 up(&sisusb->lock); 288 mutex_unlock(&sisusb->lock);
288 289
289 up(&disconnect_sem); 290 mutex_unlock(&disconnect_mutex);
290 291
291 if (init) { 292 if (init) {
292 c->vc_cols = cols; 293 c->vc_cols = cols;
@@ -306,14 +307,14 @@ sisusbcon_deinit(struct vc_data *c)
306 * and others, ie not under our control. 307 * and others, ie not under our control.
307 */ 308 */
308 309
309 down(&disconnect_sem); 310 mutex_lock(&disconnect_mutex);
310 311
311 if (!(sisusb = sisusb_get_sisusb(c->vc_num))) { 312 if (!(sisusb = sisusb_get_sisusb(c->vc_num))) {
312 up(&disconnect_sem); 313 mutex_unlock(&disconnect_mutex);
313 return; 314 return;
314 } 315 }
315 316
316 down(&sisusb->lock); 317 mutex_lock(&sisusb->lock);
317 318
318 /* Clear ourselves in mysisusbs */ 319 /* Clear ourselves in mysisusbs */
319 mysisusbs[c->vc_num] = NULL; 320 mysisusbs[c->vc_num] = NULL;
@@ -332,12 +333,12 @@ sisusbcon_deinit(struct vc_data *c)
332 } 333 }
333 } 334 }
334 335
335 up(&sisusb->lock); 336 mutex_unlock(&sisusb->lock);
336 337
337 /* decrement the usage count on our sisusb */ 338 /* decrement the usage count on our sisusb */
338 kref_put(&sisusb->kref, sisusb_delete); 339 kref_put(&sisusb->kref, sisusb_delete);
339 340
340 up(&disconnect_sem); 341 mutex_unlock(&disconnect_mutex);
341} 342}
342 343
343/* interface routine */ 344/* interface routine */
@@ -417,7 +418,7 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x)
417#endif 418#endif
418 419
419 if (sisusb_is_inactive(c, sisusb)) { 420 if (sisusb_is_inactive(c, sisusb)) {
420 up(&sisusb->lock); 421 mutex_unlock(&sisusb->lock);
421 return; 422 return;
422 } 423 }
423 424
@@ -425,7 +426,7 @@ sisusbcon_putc(struct vc_data *c, int ch, int y, int x)
425 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y), 426 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y),
426 (u32)SISUSB_HADDR(x, y), 2, &written); 427 (u32)SISUSB_HADDR(x, y), 2, &written);
427 428
428 up(&sisusb->lock); 429 mutex_unlock(&sisusb->lock);
429} 430}
430 431
431/* Interface routine */ 432/* Interface routine */
@@ -453,14 +454,14 @@ sisusbcon_putcs(struct vc_data *c, const unsigned short *s,
453 sisusbcon_writew(sisusbcon_readw(s++), dest++); 454 sisusbcon_writew(sisusbcon_readw(s++), dest++);
454 455
455 if (sisusb_is_inactive(c, sisusb)) { 456 if (sisusb_is_inactive(c, sisusb)) {
456 up(&sisusb->lock); 457 mutex_unlock(&sisusb->lock);
457 return; 458 return;
458 } 459 }
459 460
460 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y), 461 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(x, y),
461 (u32)SISUSB_HADDR(x, y), count * 2, &written); 462 (u32)SISUSB_HADDR(x, y), count * 2, &written);
462 463
463 up(&sisusb->lock); 464 mutex_unlock(&sisusb->lock);
464} 465}
465 466
466/* Interface routine */ 467/* Interface routine */
@@ -504,7 +505,7 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int height, int width)
504 } 505 }
505 506
506 if (sisusb_is_inactive(c, sisusb)) { 507 if (sisusb_is_inactive(c, sisusb)) {
507 up(&sisusb->lock); 508 mutex_unlock(&sisusb->lock);
508 return; 509 return;
509 } 510 }
510 511
@@ -514,7 +515,7 @@ sisusbcon_clear(struct vc_data *c, int y, int x, int height, int width)
514 sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(x, y), 515 sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(x, y),
515 (u32)SISUSB_HADDR(x, y), length, &written); 516 (u32)SISUSB_HADDR(x, y), length, &written);
516 517
517 up(&sisusb->lock); 518 mutex_unlock(&sisusb->lock);
518} 519}
519 520
520/* Interface routine */ 521/* Interface routine */
@@ -576,7 +577,7 @@ sisusbcon_bmove(struct vc_data *c, int sy, int sx,
576#endif 577#endif
577 578
578 if (sisusb_is_inactive(c, sisusb)) { 579 if (sisusb_is_inactive(c, sisusb)) {
579 up(&sisusb->lock); 580 mutex_unlock(&sisusb->lock);
580 return; 581 return;
581 } 582 }
582 583
@@ -586,7 +587,7 @@ sisusbcon_bmove(struct vc_data *c, int sy, int sx,
586 sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(dx, dy), 587 sisusb_copy_memory(sisusb, (unsigned char *)SISUSB_VADDR(dx, dy),
587 (u32)SISUSB_HADDR(dx, dy), length, &written); 588 (u32)SISUSB_HADDR(dx, dy), length, &written);
588 589
589 up(&sisusb->lock); 590 mutex_unlock(&sisusb->lock);
590} 591}
591 592
592/* interface routine */ 593/* interface routine */
@@ -609,7 +610,7 @@ sisusbcon_switch(struct vc_data *c)
609 610
610 /* Don't write to screen if in gfx mode */ 611 /* Don't write to screen if in gfx mode */
611 if (sisusb_is_inactive(c, sisusb)) { 612 if (sisusb_is_inactive(c, sisusb)) {
612 up(&sisusb->lock); 613 mutex_unlock(&sisusb->lock);
613 return 0; 614 return 0;
614 } 615 }
615 616
@@ -618,7 +619,7 @@ sisusbcon_switch(struct vc_data *c)
618 * as origin. 619 * as origin.
619 */ 620 */
620 if (c->vc_origin == (unsigned long)c->vc_screenbuf) { 621 if (c->vc_origin == (unsigned long)c->vc_screenbuf) {
621 up(&sisusb->lock); 622 mutex_unlock(&sisusb->lock);
622 printk(KERN_DEBUG "sisusb: ASSERT ORIGIN != SCREENBUF!\n"); 623 printk(KERN_DEBUG "sisusb: ASSERT ORIGIN != SCREENBUF!\n");
623 return 0; 624 return 0;
624 } 625 }
@@ -635,7 +636,7 @@ sisusbcon_switch(struct vc_data *c)
635 (u32)SISUSB_HADDR(0, 0), 636 (u32)SISUSB_HADDR(0, 0),
636 length, &written); 637 length, &written);
637 638
638 up(&sisusb->lock); 639 mutex_unlock(&sisusb->lock);
639 640
640 return 0; 641 return 0;
641} 642}
@@ -657,7 +658,7 @@ sisusbcon_save_screen(struct vc_data *c)
657 /* sisusb->lock is down */ 658 /* sisusb->lock is down */
658 659
659 if (sisusb_is_inactive(c, sisusb)) { 660 if (sisusb_is_inactive(c, sisusb)) {
660 up(&sisusb->lock); 661 mutex_unlock(&sisusb->lock);
661 return; 662 return;
662 } 663 }
663 664
@@ -669,7 +670,7 @@ sisusbcon_save_screen(struct vc_data *c)
669 sisusbcon_memcpyw((u16 *)c->vc_screenbuf, (u16 *)c->vc_origin, 670 sisusbcon_memcpyw((u16 *)c->vc_screenbuf, (u16 *)c->vc_origin,
670 length); 671 length);
671 672
672 up(&sisusb->lock); 673 mutex_unlock(&sisusb->lock);
673} 674}
674 675
675/* interface routine */ 676/* interface routine */
@@ -690,7 +691,7 @@ sisusbcon_set_palette(struct vc_data *c, unsigned char *table)
690 /* sisusb->lock is down */ 691 /* sisusb->lock is down */
691 692
692 if (sisusb_is_inactive(c, sisusb)) { 693 if (sisusb_is_inactive(c, sisusb)) {
693 up(&sisusb->lock); 694 mutex_unlock(&sisusb->lock);
694 return -EINVAL; 695 return -EINVAL;
695 } 696 }
696 697
@@ -705,7 +706,7 @@ sisusbcon_set_palette(struct vc_data *c, unsigned char *table)
705 break; 706 break;
706 } 707 }
707 708
708 up(&sisusb->lock); 709 mutex_unlock(&sisusb->lock);
709 710
710 return 0; 711 return 0;
711} 712}
@@ -728,7 +729,7 @@ sisusbcon_blank(struct vc_data *c, int blank, int mode_switch)
728 sisusb->is_gfx = blank ? 1 : 0; 729 sisusb->is_gfx = blank ? 1 : 0;
729 730
730 if (sisusb_is_inactive(c, sisusb)) { 731 if (sisusb_is_inactive(c, sisusb)) {
731 up(&sisusb->lock); 732 mutex_unlock(&sisusb->lock);
732 return 0; 733 return 0;
733 } 734 }
734 735
@@ -777,7 +778,7 @@ sisusbcon_blank(struct vc_data *c, int blank, int mode_switch)
777 cr63 = 0x40; 778 cr63 = 0x40;
778 break; 779 break;
779 default: 780 default:
780 up(&sisusb->lock); 781 mutex_unlock(&sisusb->lock);
781 return -EINVAL; 782 return -EINVAL;
782 } 783 }
783 784
@@ -788,7 +789,7 @@ sisusbcon_blank(struct vc_data *c, int blank, int mode_switch)
788 789
789 } 790 }
790 791
791 up(&sisusb->lock); 792 mutex_unlock(&sisusb->lock);
792 793
793 return ret; 794 return ret;
794} 795}
@@ -809,7 +810,7 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
809 /* sisusb->lock is down */ 810 /* sisusb->lock is down */
810 811
811 if (sisusb_is_inactive(c, sisusb)) { 812 if (sisusb_is_inactive(c, sisusb)) {
812 up(&sisusb->lock); 813 mutex_unlock(&sisusb->lock);
813 return 0; 814 return 0;
814 } 815 }
815 816
@@ -849,7 +850,7 @@ sisusbcon_scrolldelta(struct vc_data *c, int lines)
849 850
850 sisusbcon_set_start_address(sisusb, c); 851 sisusbcon_set_start_address(sisusb, c);
851 852
852 up(&sisusb->lock); 853 mutex_unlock(&sisusb->lock);
853 854
854 return 1; 855 return 1;
855} 856}
@@ -867,7 +868,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
867 /* sisusb->lock is down */ 868 /* sisusb->lock is down */
868 869
869 if (sisusb_is_inactive(c, sisusb)) { 870 if (sisusb_is_inactive(c, sisusb)) {
870 up(&sisusb->lock); 871 mutex_unlock(&sisusb->lock);
871 return; 872 return;
872 } 873 }
873 874
@@ -879,7 +880,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
879 if (mode == CM_ERASE) { 880 if (mode == CM_ERASE) {
880 sisusb_setidxregor(sisusb, SISCR, 0x0a, 0x20); 881 sisusb_setidxregor(sisusb, SISCR, 0x0a, 0x20);
881 sisusb->sisusb_cursor_size_to = -1; 882 sisusb->sisusb_cursor_size_to = -1;
882 up(&sisusb->lock); 883 mutex_unlock(&sisusb->lock);
883 return; 884 return;
884 } 885 }
885 886
@@ -919,7 +920,7 @@ sisusbcon_cursor(struct vc_data *c, int mode)
919 sisusb->sisusb_cursor_size_to = to; 920 sisusb->sisusb_cursor_size_to = to;
920 } 921 }
921 922
922 up(&sisusb->lock); 923 mutex_unlock(&sisusb->lock);
923} 924}
924 925
925static int 926static int
@@ -961,7 +962,7 @@ sisusbcon_scroll_area(struct vc_data *c, struct sisusb_usb_data *sisusb,
961 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(0, t), 962 sisusb_copy_memory(sisusb, (char *)SISUSB_VADDR(0, t),
962 (u32)SISUSB_HADDR(0, t), length, &written); 963 (u32)SISUSB_HADDR(0, t), length, &written);
963 964
964 up(&sisusb->lock); 965 mutex_unlock(&sisusb->lock);
965 966
966 return 1; 967 return 1;
967} 968}
@@ -994,7 +995,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
994 /* sisusb->lock is down */ 995 /* sisusb->lock is down */
995 996
996 if (sisusb_is_inactive(c, sisusb)) { 997 if (sisusb_is_inactive(c, sisusb)) {
997 up(&sisusb->lock); 998 mutex_unlock(&sisusb->lock);
998 return 0; 999 return 0;
999 } 1000 }
1000 1001
@@ -1084,7 +1085,7 @@ sisusbcon_scroll(struct vc_data *c, int t, int b, int dir, int lines)
1084 1085
1085 c->vc_pos = c->vc_pos - oldorigin + c->vc_origin; 1086 c->vc_pos = c->vc_pos - oldorigin + c->vc_origin;
1086 1087
1087 up(&sisusb->lock); 1088 mutex_unlock(&sisusb->lock);
1088 1089
1089 return 1; 1090 return 1;
1090} 1091}
@@ -1106,7 +1107,7 @@ sisusbcon_set_origin(struct vc_data *c)
1106 /* sisusb->lock is down */ 1107 /* sisusb->lock is down */
1107 1108
1108 if (sisusb_is_inactive(c, sisusb) || sisusb->con_blanked) { 1109 if (sisusb_is_inactive(c, sisusb) || sisusb->con_blanked) {
1109 up(&sisusb->lock); 1110 mutex_unlock(&sisusb->lock);
1110 return 0; 1111 return 0;
1111 } 1112 }
1112 1113
@@ -1116,7 +1117,7 @@ sisusbcon_set_origin(struct vc_data *c)
1116 1117
1117 sisusb->con_rolled_over = 0; 1118 sisusb->con_rolled_over = 0;
1118 1119
1119 up(&sisusb->lock); 1120 mutex_unlock(&sisusb->lock);
1120 1121
1121 return 1; 1122 return 1;
1122} 1123}
@@ -1133,7 +1134,7 @@ sisusbcon_resize(struct vc_data *c, unsigned int newcols, unsigned int newrows)
1133 1134
1134 fh = sisusb->current_font_height; 1135 fh = sisusb->current_font_height;
1135 1136
1136 up(&sisusb->lock); 1137 mutex_unlock(&sisusb->lock);
1137 1138
1138 /* We are quite unflexible as regards resizing. The vt code 1139 /* We are quite unflexible as regards resizing. The vt code
1139 * handles sizes where the line length isn't equal the pitch 1140 * handles sizes where the line length isn't equal the pitch
@@ -1167,7 +1168,7 @@ sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
1167 1168
1168 if ((slot != 0 && slot != 2) || !fh) { 1169 if ((slot != 0 && slot != 2) || !fh) {
1169 if (uplock) 1170 if (uplock)
1170 up(&sisusb->lock); 1171 mutex_unlock(&sisusb->lock);
1171 return -EINVAL; 1172 return -EINVAL;
1172 } 1173 }
1173 1174
@@ -1327,7 +1328,7 @@ sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
1327 } 1328 }
1328 1329
1329 if (uplock) 1330 if (uplock)
1330 up(&sisusb->lock); 1331 mutex_unlock(&sisusb->lock);
1331 1332
1332 if (dorecalc && c) { 1333 if (dorecalc && c) {
1333 int i, rows = c->vc_scan_lines / fh; 1334 int i, rows = c->vc_scan_lines / fh;
@@ -1351,7 +1352,7 @@ sisusbcon_do_font_op(struct sisusb_usb_data *sisusb, int set, int slot,
1351 1352
1352font_op_error: 1353font_op_error:
1353 if (uplock) 1354 if (uplock)
1354 up(&sisusb->lock); 1355 mutex_unlock(&sisusb->lock);
1355 1356
1356 return -EIO; 1357 return -EIO;
1357} 1358}
@@ -1417,19 +1418,19 @@ sisusbcon_font_get(struct vc_data *c, struct console_font *font)
1417 font->charcount = 256; 1418 font->charcount = 256;
1418 1419
1419 if (!font->data) { 1420 if (!font->data) {
1420 up(&sisusb->lock); 1421 mutex_unlock(&sisusb->lock);
1421 return 0; 1422 return 0;
1422 } 1423 }
1423 1424
1424 if (!sisusb->font_backup) { 1425 if (!sisusb->font_backup) {
1425 up(&sisusb->lock); 1426 mutex_unlock(&sisusb->lock);
1426 return -ENODEV; 1427 return -ENODEV;
1427 } 1428 }
1428 1429
1429 /* Copy 256 chars only, like vgacon */ 1430 /* Copy 256 chars only, like vgacon */
1430 memcpy(font->data, sisusb->font_backup, 256 * 32); 1431 memcpy(font->data, sisusb->font_backup, 256 * 32);
1431 1432
1432 up(&sisusb->lock); 1433 mutex_unlock(&sisusb->lock);
1433 1434
1434 return 0; 1435 return 0;
1435} 1436}
@@ -1512,14 +1513,14 @@ sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last)
1512{ 1513{
1513 int i, ret, minor = sisusb->minor; 1514 int i, ret, minor = sisusb->minor;
1514 1515
1515 down(&disconnect_sem); 1516 mutex_lock(&disconnect_mutex);
1516 1517
1517 down(&sisusb->lock); 1518 mutex_lock(&sisusb->lock);
1518 1519
1519 /* Erm.. that should not happen */ 1520 /* Erm.. that should not happen */
1520 if (sisusb->haveconsole || !sisusb->SiS_Pr) { 1521 if (sisusb->haveconsole || !sisusb->SiS_Pr) {
1521 up(&sisusb->lock); 1522 mutex_unlock(&sisusb->lock);
1522 up(&disconnect_sem); 1523 mutex_unlock(&disconnect_mutex);
1523 return 1; 1524 return 1;
1524 } 1525 }
1525 1526
@@ -1529,15 +1530,15 @@ sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last)
1529 if (first > last || 1530 if (first > last ||
1530 first > MAX_NR_CONSOLES || 1531 first > MAX_NR_CONSOLES ||
1531 last > MAX_NR_CONSOLES) { 1532 last > MAX_NR_CONSOLES) {
1532 up(&sisusb->lock); 1533 mutex_unlock(&sisusb->lock);
1533 up(&disconnect_sem); 1534 mutex_unlock(&disconnect_mutex);
1534 return 1; 1535 return 1;
1535 } 1536 }
1536 1537
1537 /* If gfxcore not initialized or no consoles given, quit graciously */ 1538 /* If gfxcore not initialized or no consoles given, quit graciously */
1538 if (!sisusb->gfxinit || first < 1 || last < 1) { 1539 if (!sisusb->gfxinit || first < 1 || last < 1) {
1539 up(&sisusb->lock); 1540 mutex_unlock(&sisusb->lock);
1540 up(&disconnect_sem); 1541 mutex_unlock(&disconnect_mutex);
1541 return 0; 1542 return 0;
1542 } 1543 }
1543 1544
@@ -1547,8 +1548,8 @@ sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last)
1547 1548
1548 /* Set up text mode (and upload default font) */ 1549 /* Set up text mode (and upload default font) */
1549 if (sisusb_reset_text_mode(sisusb, 1)) { 1550 if (sisusb_reset_text_mode(sisusb, 1)) {
1550 up(&sisusb->lock); 1551 mutex_unlock(&sisusb->lock);
1551 up(&disconnect_sem); 1552 mutex_unlock(&disconnect_mutex);
1552 printk(KERN_ERR 1553 printk(KERN_ERR
1553 "sisusbvga[%d]: Failed to set up text mode\n", 1554 "sisusbvga[%d]: Failed to set up text mode\n",
1554 minor); 1555 minor);
@@ -1571,16 +1572,16 @@ sisusb_console_init(struct sisusb_usb_data *sisusb, int first, int last)
1571 1572
1572 /* Allocate screen buffer */ 1573 /* Allocate screen buffer */
1573 if (!(sisusb->scrbuf = (unsigned long)vmalloc(sisusb->scrbuf_size))) { 1574 if (!(sisusb->scrbuf = (unsigned long)vmalloc(sisusb->scrbuf_size))) {
1574 up(&sisusb->lock); 1575 mutex_unlock(&sisusb->lock);
1575 up(&disconnect_sem); 1576 mutex_unlock(&disconnect_mutex);
1576 printk(KERN_ERR 1577 printk(KERN_ERR
1577 "sisusbvga[%d]: Failed to allocate screen buffer\n", 1578 "sisusbvga[%d]: Failed to allocate screen buffer\n",
1578 minor); 1579 minor);
1579 return 1; 1580 return 1;
1580 } 1581 }
1581 1582
1582 up(&sisusb->lock); 1583 mutex_unlock(&sisusb->lock);
1583 up(&disconnect_sem); 1584 mutex_unlock(&disconnect_mutex);
1584 1585
1585 /* Now grab the desired console(s) */ 1586 /* Now grab the desired console(s) */
1586 ret = take_over_console(&sisusb_con, first - 1, last - 1, 0); 1587 ret = take_over_console(&sisusb_con, first - 1, last - 1, 0);