Commit 72250d44 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by David S. Miller

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: default avatarArnd Bergmann <arnd@arndb.de>
Cc: Karsten Keil <isdn@linux-pingi.de>
Cc: netdev@vger.kernel.org
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0a5f1d47
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include <linux/isdn.h> #include <linux/isdn.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/smp_lock.h> #include <linux/mutex.h>
#include "isdn_common.h" #include "isdn_common.h"
#include "isdn_tty.h" #include "isdn_tty.h"
#ifdef CONFIG_ISDN_AUDIO #ifdef CONFIG_ISDN_AUDIO
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
/* Prototypes */ /* Prototypes */
static DEFINE_MUTEX(modem_info_mutex);
static int isdn_tty_edit_at(const char *, int, modem_info *); static int isdn_tty_edit_at(const char *, int, modem_info *);
static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *); static void isdn_tty_check_esc(const u_char *, u_char, int, int *, u_long *);
static void isdn_tty_modem_reset_regs(modem_info *, int); static void isdn_tty_modem_reset_regs(modem_info *, int);
...@@ -1354,14 +1355,14 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file) ...@@ -1354,14 +1355,14 @@ isdn_tty_tiocmget(struct tty_struct *tty, struct file *file)
if (tty->flags & (1 << TTY_IO_ERROR)) if (tty->flags & (1 << TTY_IO_ERROR))
return -EIO; return -EIO;
lock_kernel(); mutex_lock(&modem_info_mutex);
#ifdef ISDN_DEBUG_MODEM_IOCTL #ifdef ISDN_DEBUG_MODEM_IOCTL
printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line); printk(KERN_DEBUG "ttyI%d ioctl TIOCMGET\n", info->line);
#endif #endif
control = info->mcr; control = info->mcr;
status = info->msr; status = info->msr;
unlock_kernel(); mutex_unlock(&modem_info_mutex);
return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0) return ((control & UART_MCR_RTS) ? TIOCM_RTS : 0)
| ((control & UART_MCR_DTR) ? TIOCM_DTR : 0) | ((control & UART_MCR_DTR) ? TIOCM_DTR : 0)
| ((status & UART_MSR_DCD) ? TIOCM_CAR : 0) | ((status & UART_MSR_DCD) ? TIOCM_CAR : 0)
...@@ -1385,7 +1386,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -1385,7 +1386,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear); printk(KERN_DEBUG "ttyI%d ioctl TIOCMxxx: %x %x\n", info->line, set, clear);
#endif #endif
lock_kernel(); mutex_lock(&modem_info_mutex);
if (set & TIOCM_RTS) if (set & TIOCM_RTS)
info->mcr |= UART_MCR_RTS; info->mcr |= UART_MCR_RTS;
if (set & TIOCM_DTR) { if (set & TIOCM_DTR) {
...@@ -1407,7 +1408,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file, ...@@ -1407,7 +1408,7 @@ isdn_tty_tiocmset(struct tty_struct *tty, struct file *file,
isdn_tty_modem_hup(info, 1); isdn_tty_modem_hup(info, 1);
} }
} }
unlock_kernel(); mutex_unlock(&modem_info_mutex);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment