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

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>

authored by

Alan Cox and committed by
Greg Kroah-Hartman
25c3cdf8 f602501d

+9 -11
+9 -11
drivers/char/cyclades.c
··· 65 65 #include <linux/tty.h> 66 66 #include <linux/tty_flip.h> 67 67 #include <linux/serial.h> 68 - #include <linux/smp_lock.h> 69 68 #include <linux/major.h> 70 69 #include <linux/string.h> 71 70 #include <linux/fcntl.h> ··· 1654 1655 return; /* Just in case.... */ 1655 1656 1656 1657 orig_jiffies = jiffies; 1657 - lock_kernel(); 1658 1658 /* 1659 1659 * Set the check interval to be 1/5 of the estimated time to 1660 1660 * send a single character, and make it at least 1. The check ··· 1700 1702 } 1701 1703 /* Run one more char cycle */ 1702 1704 msleep_interruptible(jiffies_to_msecs(char_time * 5)); 1703 - unlock_kernel(); 1704 1705 #ifdef CY_DEBUG_WAIT_UNTIL_SENT 1705 1706 printk(KERN_DEBUG "Clean (jiff=%lu)...done\n", jiffies); 1706 1707 #endif ··· 1956 1959 int char_count; 1957 1960 __u32 tx_put, tx_get, tx_bufsize; 1958 1961 1959 - lock_kernel(); 1960 1962 tx_get = readl(&buf_ctrl->tx_get); 1961 1963 tx_put = readl(&buf_ctrl->tx_put); 1962 1964 tx_bufsize = readl(&buf_ctrl->tx_bufsize); ··· 1967 1971 printk(KERN_DEBUG "cyc:cy_chars_in_buffer ttyC%d %d\n", 1968 1972 info->line, info->xmit_cnt + char_count); 1969 1973 #endif 1970 - unlock_kernel(); 1971 1974 return info->xmit_cnt + char_count; 1972 1975 } 1973 1976 #endif /* Z_EXT_CHARS_IN_BUFFER */ ··· 2354 2359 struct serial_struct __user *new_info) 2355 2360 { 2356 2361 struct serial_struct new_serial; 2362 + int ret; 2357 2363 2358 2364 if (copy_from_user(&new_serial, new_info, sizeof(new_serial))) 2359 2365 return -EFAULT; 2360 2366 2367 + mutex_lock(&info->port.mutex); 2361 2368 if (!capable(CAP_SYS_ADMIN)) { 2362 2369 if (new_serial.close_delay != info->port.close_delay || 2363 2370 new_serial.baud_base != info->baud || 2364 2371 (new_serial.flags & ASYNC_FLAGS & 2365 2372 ~ASYNC_USR_MASK) != 2366 2373 (info->port.flags & ASYNC_FLAGS & ~ASYNC_USR_MASK)) 2374 + { 2375 + mutex_unlock(&info->port.mutex); 2367 2376 return -EPERM; 2377 + } 2368 2378 info->port.flags = (info->port.flags & ~ASYNC_USR_MASK) | 2369 2379 (new_serial.flags & ASYNC_USR_MASK); 2370 2380 info->baud = new_serial.baud_base; ··· 2392 2392 check_and_exit: 2393 2393 if (info->port.flags & ASYNC_INITIALIZED) { 2394 2394 cy_set_line_char(info, tty); 2395 - return 0; 2395 + ret = 0; 2396 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 2401 } /* set_serial_info */ 2400 2402 2401 2403 /* ··· 2440 2438 2441 2439 card = info->card; 2442 2440 2443 - lock_kernel(); 2444 2441 if (!cy_is_Z(card)) { 2445 2442 unsigned long flags; 2446 2443 int channel = info->line - card->first_line; ··· 2479 2478 ((lstatus & C_RS_CTS) ? TIOCM_CTS : 0); 2480 2479 } 2481 2480 end: 2482 - unlock_kernel(); 2483 2481 return result; 2484 2482 } /* cy_tiomget */ 2485 2483 ··· 2696 2696 printk(KERN_DEBUG "cyc:cy_ioctl ttyC%d, cmd = %x arg = %lx\n", 2697 2697 info->line, cmd, arg); 2698 2698 #endif 2699 - lock_kernel(); 2700 2699 2701 2700 switch (cmd) { 2702 2701 case CYGETMON: ··· 2816 2817 default: 2817 2818 ret_val = -ENOIOCTLCMD; 2818 2819 } 2819 - unlock_kernel(); 2820 2820 2821 2821 #ifdef CY_DEBUG_OTHER 2822 2822 printk(KERN_DEBUG "cyc:cy_ioctl done\n");