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

Parallel port: convert port_mutex to the mutex API

Parallel port: Convert port_mutex to the mutex API

[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Matthias Kaehlcke and committed by
Linus Torvalds
0a5dcb51 8f47f0b6

+7 -7
+5 -5
drivers/char/lp.c
··· 312 312 if (copy_size > LP_BUFFER_SIZE) 313 313 copy_size = LP_BUFFER_SIZE; 314 314 315 - if (down_interruptible (&lp_table[minor].port_mutex)) 315 + if (mutex_lock_interruptible(&lp_table[minor].port_mutex)) 316 316 return -EINTR; 317 317 318 318 if (copy_from_user (kbuf, buf, copy_size)) { ··· 399 399 lp_release_parport (&lp_table[minor]); 400 400 } 401 401 out_unlock: 402 - up (&lp_table[minor].port_mutex); 402 + mutex_unlock(&lp_table[minor].port_mutex); 403 403 404 404 return retv; 405 405 } ··· 421 421 if (count > LP_BUFFER_SIZE) 422 422 count = LP_BUFFER_SIZE; 423 423 424 - if (down_interruptible (&lp_table[minor].port_mutex)) 424 + if (mutex_lock_interruptible(&lp_table[minor].port_mutex)) 425 425 return -EINTR; 426 426 427 427 lp_claim_parport_or_block (&lp_table[minor]); ··· 479 479 if (retval > 0 && copy_to_user (buf, kbuf, retval)) 480 480 retval = -EFAULT; 481 481 482 - up (&lp_table[minor].port_mutex); 482 + mutex_unlock(&lp_table[minor].port_mutex); 483 483 484 484 return retval; 485 485 } ··· 888 888 lp_table[i].last_error = 0; 889 889 init_waitqueue_head (&lp_table[i].waitq); 890 890 init_waitqueue_head (&lp_table[i].dataq); 891 - init_MUTEX (&lp_table[i].port_mutex); 891 + mutex_init(&lp_table[i].port_mutex); 892 892 lp_table[i].timeout = 10 * HZ; 893 893 } 894 894
+2 -2
include/linux/lp.h
··· 99 99 #ifdef __KERNEL__ 100 100 101 101 #include <linux/wait.h> 102 - #include <asm/semaphore.h> 102 + #include <linux/mutex.h> 103 103 104 104 /* Magic numbers for defining port-device mappings */ 105 105 #define LP_PARPORT_UNSPEC -4 ··· 145 145 #endif 146 146 wait_queue_head_t waitq; 147 147 unsigned int last_error; 148 - struct semaphore port_mutex; 148 + struct mutex port_mutex; 149 149 wait_queue_head_t dataq; 150 150 long timeout; 151 151 unsigned int best_mode;