aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/esp.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:53:18 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:39 -0400
commit5a4bc8c1bde7bcb7f02950764e37e9d6bbdb3e32 (patch)
tree9c482c6ecd4c7b4b4e0fd2b2c92534e488ef83eb /drivers/char/esp.c
parent37925e050379ef4db9f4ed251786b6d43da6ec71 (diff)
esp: lock_kernel push down
Push the BKL down into a few internal bits of code in this driver. Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/esp.c')
-rw-r--r--drivers/char/esp.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/char/esp.c b/drivers/char/esp.c
index f3fe62067344..5ad11a6716c7 100644
--- a/drivers/char/esp.c
+++ b/drivers/char/esp.c
@@ -1355,6 +1355,7 @@ static int get_serial_info(struct esp_struct * info,
1355{ 1355{
1356 struct serial_struct tmp; 1356 struct serial_struct tmp;
1357 1357
1358 lock_kernel();
1358 memset(&tmp, 0, sizeof(tmp)); 1359 memset(&tmp, 0, sizeof(tmp));
1359 tmp.type = PORT_16550A; 1360 tmp.type = PORT_16550A;
1360 tmp.line = info->line; 1361 tmp.line = info->line;
@@ -1367,6 +1368,7 @@ static int get_serial_info(struct esp_struct * info,
1367 tmp.closing_wait = info->closing_wait; 1368 tmp.closing_wait = info->closing_wait;
1368 tmp.custom_divisor = info->custom_divisor; 1369 tmp.custom_divisor = info->custom_divisor;
1369 tmp.hub6 = 0; 1370 tmp.hub6 = 0;
1371 unlock_kernel();
1370 if (copy_to_user(retinfo,&tmp,sizeof(*retinfo))) 1372 if (copy_to_user(retinfo,&tmp,sizeof(*retinfo)))
1371 return -EFAULT; 1373 return -EFAULT;
1372 return 0; 1374 return 0;
@@ -1381,6 +1383,7 @@ static int get_esp_config(struct esp_struct * info,
1381 return -EFAULT; 1383 return -EFAULT;
1382 1384
1383 memset(&tmp, 0, sizeof(tmp)); 1385 memset(&tmp, 0, sizeof(tmp));
1386 lock_kernel();
1384 tmp.rx_timeout = info->config.rx_timeout; 1387 tmp.rx_timeout = info->config.rx_timeout;
1385 tmp.rx_trigger = info->config.rx_trigger; 1388 tmp.rx_trigger = info->config.rx_trigger;
1386 tmp.tx_trigger = info->config.tx_trigger; 1389 tmp.tx_trigger = info->config.tx_trigger;
@@ -1388,6 +1391,7 @@ static int get_esp_config(struct esp_struct * info,
1388 tmp.flow_on = info->config.flow_on; 1391 tmp.flow_on = info->config.flow_on;
1389 tmp.pio_threshold = info->config.pio_threshold; 1392 tmp.pio_threshold = info->config.pio_threshold;
1390 tmp.dma_channel = (info->stat_flags & ESP_STAT_NEVER_DMA ? 0 : dma); 1393 tmp.dma_channel = (info->stat_flags & ESP_STAT_NEVER_DMA ? 0 : dma);
1394 unlock_kernel();
1391 1395
1392 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0; 1396 return copy_to_user(retinfo, &tmp, sizeof(*retinfo)) ? -EFAULT : 0;
1393} 1397}
@@ -1766,6 +1770,7 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1766 struct serial_icounter_struct __user *p_cuser; /* user space */ 1770 struct serial_icounter_struct __user *p_cuser; /* user space */
1767 void __user *argp = (void __user *)arg; 1771 void __user *argp = (void __user *)arg;
1768 unsigned long flags; 1772 unsigned long flags;
1773 int ret;
1769 1774
1770 if (serial_paranoia_check(info, tty->name, "rs_ioctl")) 1775 if (serial_paranoia_check(info, tty->name, "rs_ioctl"))
1771 return -ENODEV; 1776 return -ENODEV;
@@ -1783,7 +1788,10 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1783 case TIOCGSERIAL: 1788 case TIOCGSERIAL:
1784 return get_serial_info(info, argp); 1789 return get_serial_info(info, argp);
1785 case TIOCSSERIAL: 1790 case TIOCSSERIAL:
1786 return set_serial_info(info, argp); 1791 lock_kernel();
1792 ret = set_serial_info(info, argp);
1793 unlock_kernel();
1794 return ret;
1787 case TIOCSERCONFIG: 1795 case TIOCSERCONFIG:
1788 /* do not reconfigure after initial configuration */ 1796 /* do not reconfigure after initial configuration */
1789 return 0; 1797 return 0;
@@ -1855,11 +1863,13 @@ static int rs_ioctl(struct tty_struct *tty, struct file * file,
1855 return -EFAULT; 1863 return -EFAULT;
1856 1864
1857 return 0; 1865 return 0;
1858 case TIOCGHAYESESP: 1866 case TIOCGHAYESESP:
1859 return get_esp_config(info, argp); 1867 return get_esp_config(info, argp);
1860 case TIOCSHAYESESP: 1868 case TIOCSHAYESESP:
1861 return set_esp_config(info, argp); 1869 lock_kernel();
1862 1870 ret = set_esp_config(info, argp);
1871 unlock_kernel();
1872 return ret;
1863 default: 1873 default:
1864 return -ENOIOCTLCMD; 1874 return -ENOIOCTLCMD;
1865 } 1875 }