diff options
author | Len Brown <len.brown@intel.com> | 2009-01-09 03:39:43 -0500 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-01-09 03:39:43 -0500 |
commit | b2576e1d4408e134e2188c967b1f28af39cd79d4 (patch) | |
tree | 004f3c82faab760f304ce031d6d2f572e7746a50 /drivers/char/sx.c | |
parent | 3cc8a5f4ba91f67bbdb81a43a99281a26aab8d77 (diff) | |
parent | 2150edc6c5cf00f7adb54538b9ea2a3e9cedca3f (diff) |
Merge branch 'linus' into release
Diffstat (limited to 'drivers/char/sx.c')
-rw-r--r-- | drivers/char/sx.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/drivers/char/sx.c b/drivers/char/sx.c index ba4e86281fbf..b60be7b0decf 100644 --- a/drivers/char/sx.c +++ b/drivers/char/sx.c | |||
@@ -279,7 +279,7 @@ static void sx_disable_tx_interrupts(void *ptr); | |||
279 | static void sx_enable_tx_interrupts(void *ptr); | 279 | static void sx_enable_tx_interrupts(void *ptr); |
280 | static void sx_disable_rx_interrupts(void *ptr); | 280 | static void sx_disable_rx_interrupts(void *ptr); |
281 | static void sx_enable_rx_interrupts(void *ptr); | 281 | static void sx_enable_rx_interrupts(void *ptr); |
282 | static int sx_get_CD(void *ptr); | 282 | static int sx_carrier_raised(struct tty_port *port); |
283 | static void sx_shutdown_port(void *ptr); | 283 | static void sx_shutdown_port(void *ptr); |
284 | static int sx_set_real_termios(void *ptr); | 284 | static int sx_set_real_termios(void *ptr); |
285 | static void sx_close(void *ptr); | 285 | static void sx_close(void *ptr); |
@@ -360,7 +360,6 @@ static struct real_driver sx_real_driver = { | |||
360 | sx_enable_tx_interrupts, | 360 | sx_enable_tx_interrupts, |
361 | sx_disable_rx_interrupts, | 361 | sx_disable_rx_interrupts, |
362 | sx_enable_rx_interrupts, | 362 | sx_enable_rx_interrupts, |
363 | sx_get_CD, | ||
364 | sx_shutdown_port, | 363 | sx_shutdown_port, |
365 | sx_set_real_termios, | 364 | sx_set_real_termios, |
366 | sx_chars_in_buffer, | 365 | sx_chars_in_buffer, |
@@ -791,7 +790,7 @@ static int sx_getsignals(struct sx_port *port) | |||
791 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "getsignals: %d/%d (%d/%d) " | 790 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "getsignals: %d/%d (%d/%d) " |
792 | "%02x/%02x\n", | 791 | "%02x/%02x\n", |
793 | (o_stat & OP_DTR) != 0, (o_stat & OP_RTS) != 0, | 792 | (o_stat & OP_DTR) != 0, (o_stat & OP_RTS) != 0, |
794 | port->c_dcd, sx_get_CD(port), | 793 | port->c_dcd, tty_port_carrier_raised(&port->gs.port), |
795 | sx_read_channel_byte(port, hi_ip), | 794 | sx_read_channel_byte(port, hi_ip), |
796 | sx_read_channel_byte(port, hi_state)); | 795 | sx_read_channel_byte(port, hi_state)); |
797 | 796 | ||
@@ -1190,7 +1189,7 @@ static inline void sx_check_modem_signals(struct sx_port *port) | |||
1190 | 1189 | ||
1191 | hi_state = sx_read_channel_byte(port, hi_state); | 1190 | hi_state = sx_read_channel_byte(port, hi_state); |
1192 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "Checking modem signals (%d/%d)\n", | 1191 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "Checking modem signals (%d/%d)\n", |
1193 | port->c_dcd, sx_get_CD(port)); | 1192 | port->c_dcd, tty_port_carrier_raised(&port->gs.port)); |
1194 | 1193 | ||
1195 | if (hi_state & ST_BREAK) { | 1194 | if (hi_state & ST_BREAK) { |
1196 | hi_state &= ~ST_BREAK; | 1195 | hi_state &= ~ST_BREAK; |
@@ -1202,11 +1201,11 @@ static inline void sx_check_modem_signals(struct sx_port *port) | |||
1202 | hi_state &= ~ST_DCD; | 1201 | hi_state &= ~ST_DCD; |
1203 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "got a DCD change.\n"); | 1202 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "got a DCD change.\n"); |
1204 | sx_write_channel_byte(port, hi_state, hi_state); | 1203 | sx_write_channel_byte(port, hi_state, hi_state); |
1205 | c_dcd = sx_get_CD(port); | 1204 | c_dcd = tty_port_carrier_raised(&port->gs.port); |
1206 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD is now %d\n", c_dcd); | 1205 | sx_dprintk(SX_DEBUG_MODEMSIGNALS, "DCD is now %d\n", c_dcd); |
1207 | if (c_dcd != port->c_dcd) { | 1206 | if (c_dcd != port->c_dcd) { |
1208 | port->c_dcd = c_dcd; | 1207 | port->c_dcd = c_dcd; |
1209 | if (sx_get_CD(port)) { | 1208 | if (tty_port_carrier_raised(&port->gs.port)) { |
1210 | /* DCD went UP */ | 1209 | /* DCD went UP */ |
1211 | if ((sx_read_channel_byte(port, hi_hstat) != | 1210 | if ((sx_read_channel_byte(port, hi_hstat) != |
1212 | HS_IDLE_CLOSED) && | 1211 | HS_IDLE_CLOSED) && |
@@ -1415,13 +1414,10 @@ static void sx_enable_rx_interrupts(void *ptr) | |||
1415 | } | 1414 | } |
1416 | 1415 | ||
1417 | /* Jeez. Isn't this simple? */ | 1416 | /* Jeez. Isn't this simple? */ |
1418 | static int sx_get_CD(void *ptr) | 1417 | static int sx_carrier_raised(struct tty_port *port) |
1419 | { | 1418 | { |
1420 | struct sx_port *port = ptr; | 1419 | struct sx_port *sp = container_of(port, struct sx_port, gs.port); |
1421 | func_enter2(); | 1420 | return ((sx_read_channel_byte(sp, hi_ip) & IP_DCD) != 0); |
1422 | |||
1423 | func_exit(); | ||
1424 | return ((sx_read_channel_byte(port, hi_ip) & IP_DCD) != 0); | ||
1425 | } | 1421 | } |
1426 | 1422 | ||
1427 | /* Jeez. Isn't this simple? */ | 1423 | /* Jeez. Isn't this simple? */ |
@@ -1536,7 +1532,7 @@ static int sx_open(struct tty_struct *tty, struct file *filp) | |||
1536 | } | 1532 | } |
1537 | /* tty->low_latency = 1; */ | 1533 | /* tty->low_latency = 1; */ |
1538 | 1534 | ||
1539 | port->c_dcd = sx_get_CD(port); | 1535 | port->c_dcd = sx_carrier_raised(&port->gs.port); |
1540 | sx_dprintk(SX_DEBUG_OPEN, "at open: cd=%d\n", port->c_dcd); | 1536 | sx_dprintk(SX_DEBUG_OPEN, "at open: cd=%d\n", port->c_dcd); |
1541 | 1537 | ||
1542 | func_exit(); | 1538 | func_exit(); |
@@ -1945,7 +1941,7 @@ static int sx_ioctl(struct tty_struct *tty, struct file *filp, | |||
1945 | 1941 | ||
1946 | static void sx_throttle(struct tty_struct *tty) | 1942 | static void sx_throttle(struct tty_struct *tty) |
1947 | { | 1943 | { |
1948 | struct sx_port *port = (struct sx_port *)tty->driver_data; | 1944 | struct sx_port *port = tty->driver_data; |
1949 | 1945 | ||
1950 | func_enter2(); | 1946 | func_enter2(); |
1951 | /* If the port is using any type of input flow | 1947 | /* If the port is using any type of input flow |
@@ -1959,7 +1955,7 @@ static void sx_throttle(struct tty_struct *tty) | |||
1959 | 1955 | ||
1960 | static void sx_unthrottle(struct tty_struct *tty) | 1956 | static void sx_unthrottle(struct tty_struct *tty) |
1961 | { | 1957 | { |
1962 | struct sx_port *port = (struct sx_port *)tty->driver_data; | 1958 | struct sx_port *port = tty->driver_data; |
1963 | 1959 | ||
1964 | func_enter2(); | 1960 | func_enter2(); |
1965 | /* Always unthrottle even if flow control is not enabled on | 1961 | /* Always unthrottle even if flow control is not enabled on |
@@ -2354,6 +2350,10 @@ static const struct tty_operations sx_ops = { | |||
2354 | .tiocmset = sx_tiocmset, | 2350 | .tiocmset = sx_tiocmset, |
2355 | }; | 2351 | }; |
2356 | 2352 | ||
2353 | static const struct tty_port_operations sx_port_ops = { | ||
2354 | .carrier_raised = sx_carrier_raised, | ||
2355 | }; | ||
2356 | |||
2357 | static int sx_init_drivers(void) | 2357 | static int sx_init_drivers(void) |
2358 | { | 2358 | { |
2359 | int error; | 2359 | int error; |
@@ -2410,6 +2410,7 @@ static int sx_init_portstructs(int nboards, int nports) | |||
2410 | for (j = 0; j < boards[i].nports; j++) { | 2410 | for (j = 0; j < boards[i].nports; j++) { |
2411 | sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); | 2411 | sx_dprintk(SX_DEBUG_INIT, "initing port %d\n", j); |
2412 | tty_port_init(&port->gs.port); | 2412 | tty_port_init(&port->gs.port); |
2413 | port->gs.port.ops = &sx_port_ops; | ||
2413 | port->gs.magic = SX_MAGIC; | 2414 | port->gs.magic = SX_MAGIC; |
2414 | port->gs.close_delay = HZ / 2; | 2415 | port->gs.close_delay = HZ / 2; |
2415 | port->gs.closing_wait = 30 * HZ; | 2416 | port->gs.closing_wait = 30 * HZ; |