diff options
author | Alan Cox <alan@linux.intel.com> | 2010-06-01 16:52:47 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-08-10 16:47:40 -0400 |
commit | 25c3cdf80c73156e910a322aba468ddaca0b91ae (patch) | |
tree | 2575584e11d5ccc12caf91f35cb193fae4a774eb /drivers/char/cyclades.c | |
parent | f602501d90e0da28c8e6f5e4569b8bf5d40a9d9c (diff) |
cyclades: Kill off BKL usage
Use the port mutext for config setting, the rest is locked sufficiently
anyway that the BKL makes no odds.
Signed-off-by: Alan Cox <alan@linux.intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/char/cyclades.c')
-rw-r--r-- | drivers/char/cyclades.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/drivers/char/cyclades.c b/drivers/char/cyclades.c index 9824b4162904..51acfe39a438 100644 --- a/drivers/char/cyclades.c +++ b/drivers/char/cyclades.c | |||
@@ -65,7 +65,6 @@ | |||
65 | #include <linux/tty.h> | 65 | #include <linux/tty.h> |
66 | #include <linux/tty_flip.h> | 66 | #include <linux/tty_flip.h> |
67 | #include <linux/serial.h> | 67 | #include <linux/serial.h> |
68 | #include <linux/smp_lock.h> | ||
69 | #include <linux/major.h> | 68 | #include <linux/major.h> |
70 | #include <linux/string.h> | 69 | #include <linux/string.h> |
71 | #include <linux/fcntl.h> | 70 | #include <linux/fcntl.h> |
@@ -1655,7 +1654,6 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1655 | return; /* Just in case.... */ | 1654 | return; /* Just in case.... */ |
1656 | 1655 | ||
1657 | orig_jiffies = jiffies; | 1656 | orig_jiffies = jiffies; |
1658 | lock_kernel(); | ||
1659 | /* | 1657 | /* |
1660 | * Set the check interval to be 1/5 of the estimated time to | 1658 | * Set the check interval to be 1/5 of the estimated time to |
1661 | * send a single character, and make it at least 1. The check | 1659 | * send a single character, and make it at least 1. The check |
@@ -1702,7 +1700,6 @@ static void cy_wait_until_sent(struct tty_struct *tty, int timeout) | |||
1702 | } | 1700 | } |
1703 | /* Run one more char cycle */ | 1701 | /* Run one more char cycle */ |
1704 | msleep_interruptible(jiffies_to_msecs(char_time * 5)); | 1702 | msleep_interruptible(jiffies_to_msecs(char_time * 5)); |
1705 | unlock_kernel(); | ||
1706 | #ifdef CY_DEBUG_WAIT_UNTIL_SENT | 1703 | #ifdef CY_DEBUG_WAIT_UNTIL_SENT |
1707 | printk(KERN_DEBUG "Clean (jiff=%lu)...done\n", jiffies); | 1704 | printk(KERN_DEBUG "Clean (jiff=%lu)...done\n", jiffies); |
1708 | #endif | 1705 | #endif |
@@ -1959,7 +1956,6 @@ static int cy_chars_in_buffer(struct tty_struct *tty) | |||
1959 | int char_count; | 1956 | int char_count; |
1960 | __u32 tx_put, tx_get, tx_bufsize; | 1957 | __u32 tx_put, tx_get, tx_bufsize; |
1961 | 1958 | ||
1962 | lock_kernel(); | ||
1963 | tx_get = readl(&buf_ctrl->tx_get); | 1959 | tx_get = readl(&buf_ctrl->tx_get); |
1964 | tx_put = readl(&buf_ctrl->tx_put); | 1960 | tx_put = readl(&buf_ctrl->tx_put); |
1965 | tx_bufsize = readl(&buf_ctrl->tx_bufsize); | 1961 | tx_bufsize = readl(&buf_ctrl->tx_bufsize); |
@@ -1971,7 +1967,6 @@ static int cy_chars_in_buffer(struct tty_struct *tty) | |||
1971 | printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n", | 1967 | printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n", |
1972 | info->line, info->xmit_cnt + char_count); | 1968 | info->line, info->xmit_cnt + char_count); |
1973 | #endif | 1969 | #endif |
1974 | unlock_kernel(); | ||
1975 | return info->xmit_cnt + char_count; | 1970 | return info->xmit_cnt + char_count; |
1976 | } | 1971 | } |
1977 | #endif /* Z_EXT_CHARS_IN_BUFFER */ | 1972 | #endif /* Z_EXT_CHARS_IN_BUFFER */ |
@@ -2359,17 +2354,22 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty, | |||
2359 | struct serial_struct __user *new_info) | 2354 | struct serial_struct __user *new_info) |
2360 | { | 2355 | { |
2361 | struct serial_struct new_serial; | 2356 | struct serial_struct new_serial; |
2357 | int ret; | ||
2362 | 2358 | ||
2363 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) | 2359 | if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) |
2364 | return -EFAULT; | 2360 | return -EFAULT; |
2365 | 2361 | ||
2362 | mutex_lock(&info->port.mutex); | ||
2366 | if (!capable(CAP_SYS_ADMIN)) { | 2363 | if (!capable(CAP_SYS_ADMIN)) { |
2367 | if (new_serial.close_delay != info->port.close_delay || | 2364 | if (new_serial.close_delay != info->port.close_delay || |
2368 | new_serial.baud_base != info->baud || | 2365 | new_serial.baud_base != info->baud || |
2369 | (new_serial.flags & ASYNC_FLAGS & | 2366 | (new_serial.flags & ASYNC_FLAGS & |
2370 | ~ASYNC_USR_MASK) != | 2367 | ~ASYNC_USR_MASK) != |
2371 | (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) | 2368 | (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) |
2369 | { | ||
2370 | mutex_unlock(&info->port.mutex); | ||
2372 | return -EPERM; | 2371 | return -EPERM; |
2372 | } | ||
2373 | info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) | | 2373 | info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) | |
2374 | (new_serial.flags & ASYNC_USR_MASK); | 2374 | (new_serial.flags & ASYNC_USR_MASK); |
2375 | info->baud = new_serial.baud_base; | 2375 | info->baud = new_serial.baud_base; |
@@ -2392,10 +2392,12 @@ cy_set_serial_info(struct cyclades_port *info, struct tty_struct *tty, | |||
2392 | check_and_exit: | 2392 | check_and_exit: |
2393 | if (info->port.flags & ASYNC_INITIALIZED) { | 2393 | if (info->port.flags & ASYNC_INITIALIZED) { |
2394 | cy_set_line_char(info, tty); | 2394 | cy_set_line_char(info, tty); |
2395 | return 0; | 2395 | ret = 0; |
2396 | } else { | 2396 | } else { |
2397 | return cy_startup(info, tty); | 2397 | ret = cy_startup(info, tty); |
2398 | } | 2398 | } |
2399 | mutex_unlock(&info->port.mutex); | ||
2400 | return ret; | ||
2399 | } /* set_serial_info */ | 2401 | } /* set_serial_info */ |
2400 | 2402 | ||
2401 | /* | 2403 | /* |
@@ -2438,7 +2440,6 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) | |||
2438 | 2440 | ||
2439 | card = info->card; | 2441 | card = info->card; |
2440 | 2442 | ||
2441 | lock_kernel(); | ||
2442 | if (!cy_is_Z(card)) { | 2443 | if (!cy_is_Z(card)) { |
2443 | unsigned long flags; | 2444 | unsigned long flags; |
2444 | int channel = info->line - card->first_line; | 2445 | int channel = info->line - card->first_line; |
@@ -2478,7 +2479,6 @@ static int cy_tiocmget(struct tty_struct *tty, struct file *file) | |||
2478 | ((lstatus & C_RS_CTS) ? TIOCM_CTS : 0); | 2479 | ((lstatus & C_RS_CTS) ? TIOCM_CTS : 0); |
2479 | } | 2480 | } |
2480 | end: | 2481 | end: |
2481 | unlock_kernel(); | ||
2482 | return result; | 2482 | return result; |
2483 | } /* cy_tiomget */ | 2483 | } /* cy_tiomget */ |
2484 | 2484 | ||
@@ -2696,7 +2696,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file, | |||
2696 | printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n", | 2696 | printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n", |
2697 | info->line, cmd, arg); | 2697 | info->line, cmd, arg); |
2698 | #endif | 2698 | #endif |
2699 | lock_kernel(); | ||
2700 | 2699 | ||
2701 | switch (cmd) { | 2700 | switch (cmd) { |
2702 | case CYGETMON: | 2701 | case CYGETMON: |
@@ -2817,7 +2816,6 @@ cy_ioctl(struct tty_struct *tty, struct file *file, | |||
2817 | default: | 2816 | default: |
2818 | ret_val = -ENOIOCTLCMD; | 2817 | ret_val = -ENOIOCTLCMD; |
2819 | } | 2818 | } |
2820 | unlock_kernel(); | ||
2821 | 2819 | ||
2822 | #ifdef CY_DEBUG_OTHER | 2820 | #ifdef CY_DEBUG_OTHER |
2823 | printk(KERN_DEBUG "cyc:cy_ioctl done\n"); | 2821 | printk(KERN_DEBUG "cyc:cy_ioctl done\n"); |