aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/i4l/isdn_tty.c
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2010-09-14 05:35:04 -0400
committerDavid S. Miller <davem@davemloft.net>2010-09-15 22:29:55 -0400
commit72250d44bc76d3d7fa9253aeeb063a467e2458fa (patch)
tree55e926467b3bc7a50e213c357e295225457072ff /drivers/isdn/i4l/isdn_tty.c
parent0a5f1d476aef43916abb2b8634ebff23ef2c05f6 (diff)
i4l: kill big kernel lock
The isdn4linux driver uses the big kernel lock only to serialize access to a few fields in its own modem_info structure. The easiest replacement is a driver-wide mutex. More fine-grained locking would be more appropriate here, but likely harder to implement. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Cc: Karsten Keil <isdn@linux-pingi.de> Cc: netdev@vger.kernel.org Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/i4l/isdn_tty.c')
-rw-r--r--drivers/isdn/i4l/isdn_tty.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c
index f013ee15327..c463162843b 100644
--- a/drivers/isdn/i4l/isdn_tty.c
+++ b/drivers/isdn/i4l/isdn_tty.c
@@ -14,7 +14,7 @@
14#include <linux/isdn.h> 14#include <linux/isdn.h>
15#include <linux/slab.h> 15#include <linux/slab.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/smp_lock.h> 17#include <linux/mutex.h>
18#include "isdn_common.h" 18#include "isdn_common.h"
19#include "isdn_tty.h" 19#include "isdn_tty.h"
20#ifdef CONFIG_ISDN_AUDIO 20#ifdef CONFIG_ISDN_AUDIO
@@ -28,6 +28,7 @@
28 28
29/* Prototypes */ 29/* Prototypes */
30 30
31static DEFINE_MUTEX(modem_info_mutex);
31static int isdn_tty_edit_at(const char *, int, modem_info *); 32static int isdn_tty_edit_at(const char *, int, modem_info *);
32static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *); 33static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *);
33static void isdn_tty_modem_reset_regs(modem_info *, int); 34static void isdn_tty_modem_reset_regs(modem_info *, int);
@@ -1354,14 +1355,14 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file)
1354 if (tty->flags & (1 << TTY_IO_ERROR)) 1355 if (tty->flags & (1 << TTY_IO_ERROR))
1355 return -EIO; 1356 return -EIO;
1356 1357
1357 lock_kernel(); 1358 mutex_lock(&modem_info_mutex);
1358#ifdef ISDN_DEBUG_MODEM_IOCTL 1359#ifdef ISDN_DEBUG_MODEM_IOCTL
1359 printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line); 1360 printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line);
1360#endif 1361#endif
1361 1362
1362 control = info->mcr; 1363 control = info->mcr;
1363 status = info->msr; 1364 status = info->msr;
1364 unlock_kernel(); 1365 mutex_unlock(&modem_info_mutex);
1365 return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) 1366 return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
1366 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) 1367 | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
1367 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) 1368 | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
@@ -1385,7 +1386,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
1385 printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear); 1386 printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear);
1386#endif 1387#endif
1387 1388
1388 lock_kernel(); 1389 mutex_lock(&modem_info_mutex);
1389 if (set & TIOCM_RTS) 1390 if (set & TIOCM_RTS)
1390 info->mcr |= UART_MCR_RTS; 1391 info->mcr |= UART_MCR_RTS;
1391 if (set & TIOCM_DTR) { 1392 if (set & TIOCM_DTR) {
@@ -1407,7 +1408,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
1407 isdn_tty_modem_hup(info, 1); 1408 isdn_tty_modem_hup(info, 1);
1408 } 1409 }
1409 } 1410 }
1410 unlock_kernel(); 1411 mutex_unlock(&modem_info_mutex);
1411 return 0; 1412 return 0;
1412} 1413}
1413 1414