aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/specialix.c
diff options
context:
space:
mode:
authorAlan Cox <alan@redhat.com>2008-07-22 06:19:05 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-22 16:03:28 -0400
commitfaa7612c09ae4519ad4659c8417aaaba81183833 (patch)
tree132db1199de3e7102557349f9855acc165d20902 /drivers/char/specialix.c
parent4a56122297ac7a4a3bf09fb66c0a365a13abe707 (diff)
specialix: restore driver using new break functionality
Use the hardware break support on the specialix driver Signed-off-by: Alan Cox <alan@redhat.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/char/specialix.c')
-rw-r--r--drivers/char/specialix.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/drivers/char/specialix.c b/drivers/char/specialix.c
index f3184a8a75d6..242fd46fda22 100644
--- a/drivers/char/specialix.c
+++ b/drivers/char/specialix.c
@@ -1818,13 +1818,15 @@ static int sx_tiocmset(struct tty_struct *tty, struct file *file,
1818} 1818}
1819 1819
1820 1820
1821static void sx_send_break(struct specialix_port *port, 1821static int sx_send_break(struct tty_struct *tty, int length)
1822 unsigned long length)
1823{ 1822{
1823 struct specialix_port *port = (struct specialix_port *)tty->driver_data;
1824 struct specialix_board *bp = port_Board(port); 1824 struct specialix_board *bp = port_Board(port);
1825 unsigned long flags; 1825 unsigned long flags;
1826 1826
1827 func_enter(); 1827 func_enter();
1828 if (length == 0 || length == -1)
1829 return -EOPNOTSUPP;
1828 1830
1829 spin_lock_irqsave(&port->lock, flags); 1831 spin_lock_irqsave(&port->lock, flags);
1830 port->break_length = SPECIALIX_TPS / HZ * length; 1832 port->break_length = SPECIALIX_TPS / HZ * length;
@@ -1843,6 +1845,7 @@ static void sx_send_break(struct specialix_port *port,
1843 sx_wait_CCR(bp); 1845 sx_wait_CCR(bp);
1844 1846
1845 func_exit(); 1847 func_exit();
1848 return 0;
1846} 1849}
1847 1850
1848 1851
@@ -1929,7 +1932,6 @@ static int sx_ioctl(struct tty_struct *tty, struct file *filp,
1929 unsigned int cmd, unsigned long arg) 1932 unsigned int cmd, unsigned long arg)
1930{ 1933{
1931 struct specialix_port *port = (struct specialix_port *)tty->driver_data; 1934 struct specialix_port *port = (struct specialix_port *)tty->driver_data;
1932 int retval;
1933 void __user *argp = (void __user *)arg; 1935 void __user *argp = (void __user *)arg;
1934 1936
1935 func_enter(); 1937 func_enter();
@@ -1940,34 +1942,14 @@ static int sx_ioctl(struct tty_struct *tty, struct file *filp,
1940 } 1942 }
1941 1943
1942 switch (cmd) { 1944 switch (cmd) {
1943 case TCSBRK: /* SVID version: non-zero arg --> no break */
1944 retval = tty_check_change(tty);
1945 if (retval) {
1946 func_exit();
1947 return retval;
1948 }
1949 tty_wait_until_sent(tty, 0);
1950 if (!arg)
1951 sx_send_break(port, HZ/4); /* 1/4 second */
1952 return 0;
1953 case TCSBRKP: /* support for POSIX tcsendbreak() */
1954 retval = tty_check_change(tty);
1955 if (retval) {
1956 func_exit();
1957 return retval;
1958 }
1959 tty_wait_until_sent(tty, 0);
1960 sx_send_break(port, arg ? arg*(HZ/10) : HZ/4);
1961 func_exit();
1962 return 0;
1963 case TIOCGSERIAL: 1945 case TIOCGSERIAL:
1964 func_exit(); 1946 func_exit();
1965 return sx_get_serial_info(port, argp); 1947 return sx_get_serial_info(port, argp);
1966 case TIOCSSERIAL: 1948 case TIOCSSERIAL:
1967 func_exit(); 1949 func_exit();
1968 return sx_set_serial_info(port, argp); 1950 return sx_set_serial_info(port, argp);
1969 default: 1951 default:
1970 func_exit(); 1952 func_exit();
1971 return -ENOIOCTLCMD; 1953 return -ENOIOCTLCMD;
1972 } 1954 }
1973 func_exit(); 1955 func_exit();
@@ -2190,6 +2172,7 @@ static const struct tty_operations sx_ops = {
2190 .hangup = sx_hangup, 2172 .hangup = sx_hangup,
2191 .tiocmget = sx_tiocmget, 2173 .tiocmget = sx_tiocmget,
2192 .tiocmset = sx_tiocmset, 2174 .tiocmset = sx_tiocmset,
2175 .break_ctl = sx_send_break,
2193}; 2176};
2194 2177
2195static int sx_init_drivers(void) 2178static int sx_init_drivers(void)
@@ -2216,7 +2199,8 @@ static int sx_init_drivers(void)
2216 B9600 | CS8 | CREAD | HUPCL | CLOCAL; 2199 B9600 | CS8 | CREAD | HUPCL | CLOCAL;
2217 specialix_driver->init_termios.c_ispeed = 9600; 2200 specialix_driver->init_termios.c_ispeed = 9600;
2218 specialix_driver->init_termios.c_ospeed = 9600; 2201 specialix_driver->init_termios.c_ospeed = 9600;
2219 specialix_driver->flags = TTY_DRIVER_REAL_RAW; 2202 specialix_driver->flags = TTY_DRIVER_REAL_RAW |
2203 TTY_DRIVER_HARDWARE_BREAK;
2220 tty_set_operations(specialix_driver, &sx_ops); 2204 tty_set_operations(specialix_driver, &sx_ops);
2221 2205
2222 error = tty_register_driver(specialix_driver); 2206 error = tty_register_driver(specialix_driver);