diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/serial_core.h | 64 |
1 files changed, 30 insertions, 34 deletions
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 3cd255f0b211..c1542703fbab 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h | |||
| @@ -186,7 +186,6 @@ | |||
| 186 | #include <linux/sysrq.h> | 186 | #include <linux/sysrq.h> |
| 187 | 187 | ||
| 188 | struct uart_port; | 188 | struct uart_port; |
| 189 | struct uart_info; | ||
| 190 | struct serial_struct; | 189 | struct serial_struct; |
| 191 | struct device; | 190 | struct device; |
| 192 | 191 | ||
| @@ -284,7 +283,7 @@ struct uart_port { | |||
| 284 | 283 | ||
| 285 | unsigned int read_status_mask; /* driver specific */ | 284 | unsigned int read_status_mask; /* driver specific */ |
| 286 | unsigned int ignore_status_mask; /* driver specific */ | 285 | unsigned int ignore_status_mask; /* driver specific */ |
| 287 | struct uart_info *info; /* pointer to parent info */ | 286 | struct uart_state *state; /* pointer to parent state */ |
| 288 | struct uart_icount icount; /* statistics */ | 287 | struct uart_icount icount; /* statistics */ |
| 289 | 288 | ||
| 290 | struct console *cons; /* struct console, if any */ | 289 | struct console *cons; /* struct console, if any */ |
| @@ -343,8 +342,22 @@ struct uart_port { | |||
| 343 | */ | 342 | */ |
| 344 | typedef unsigned int __bitwise__ uif_t; | 343 | typedef unsigned int __bitwise__ uif_t; |
| 345 | 344 | ||
| 346 | struct uart_info { | 345 | |
| 346 | /* | ||
| 347 | * This is the state information which is persistent across opens. | ||
| 348 | * The low level driver must not to touch any elements contained | ||
| 349 | * within. | ||
| 350 | */ | ||
| 351 | struct uart_state { | ||
| 347 | struct tty_port port; | 352 | struct tty_port port; |
| 353 | unsigned int close_delay; /* msec */ | ||
| 354 | unsigned int closing_wait; /* msec */ | ||
| 355 | |||
| 356 | #define USF_CLOSING_WAIT_INF (0) | ||
| 357 | #define USF_CLOSING_WAIT_NONE (~0U) | ||
| 358 | |||
| 359 | int count; | ||
| 360 | int pm_state; | ||
| 348 | struct circ_buf xmit; | 361 | struct circ_buf xmit; |
| 349 | uif_t flags; | 362 | uif_t flags; |
| 350 | 363 | ||
| @@ -362,24 +375,7 @@ struct uart_info { | |||
| 362 | 375 | ||
| 363 | struct tasklet_struct tlet; | 376 | struct tasklet_struct tlet; |
| 364 | wait_queue_head_t delta_msr_wait; | 377 | wait_queue_head_t delta_msr_wait; |
| 365 | }; | 378 | struct uart_port *uart_port; |
| 366 | |||
| 367 | /* | ||
| 368 | * This is the state information which is persistent across opens. | ||
| 369 | * The low level driver must not to touch any elements contained | ||
| 370 | * within. | ||
| 371 | */ | ||
| 372 | struct uart_state { | ||
| 373 | unsigned int close_delay; /* msec */ | ||
| 374 | unsigned int closing_wait; /* msec */ | ||
| 375 | |||
| 376 | #define USF_CLOSING_WAIT_INF (0) | ||
| 377 | #define USF_CLOSING_WAIT_NONE (~0U) | ||
| 378 | |||
| 379 | int count; | ||
| 380 | int pm_state; | ||
| 381 | struct uart_info info; | ||
| 382 | struct uart_port *port; | ||
| 383 | 379 | ||
| 384 | struct mutex mutex; | 380 | struct mutex mutex; |
| 385 | }; | 381 | }; |
| @@ -462,7 +458,7 @@ int uart_resume_port(struct uart_driver *reg, struct uart_port *port); | |||
| 462 | 458 | ||
| 463 | static inline int uart_tx_stopped(struct uart_port *port) | 459 | static inline int uart_tx_stopped(struct uart_port *port) |
| 464 | { | 460 | { |
| 465 | struct tty_struct *tty = port->info->port.tty; | 461 | struct tty_struct *tty = port->state->port.tty; |
| 466 | if(tty->stopped || tty->hw_stopped) | 462 | if(tty->stopped || tty->hw_stopped) |
| 467 | return 1; | 463 | return 1; |
| 468 | return 0; | 464 | return 0; |
| @@ -477,7 +473,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) | |||
| 477 | #ifdef SUPPORT_SYSRQ | 473 | #ifdef SUPPORT_SYSRQ |
| 478 | if (port->sysrq) { | 474 | if (port->sysrq) { |
| 479 | if (ch && time_before(jiffies, port->sysrq)) { | 475 | if (ch && time_before(jiffies, port->sysrq)) { |
| 480 | handle_sysrq(ch, port->info->port.tty); | 476 | handle_sysrq(ch, port->state->port.tty); |
| 481 | port->sysrq = 0; | 477 | port->sysrq = 0; |
| 482 | return 1; | 478 | return 1; |
| 483 | } | 479 | } |
| @@ -495,7 +491,7 @@ uart_handle_sysrq_char(struct uart_port *port, unsigned int ch) | |||
| 495 | */ | 491 | */ |
| 496 | static inline int uart_handle_break(struct uart_port *port) | 492 | static inline int uart_handle_break(struct uart_port *port) |
| 497 | { | 493 | { |
| 498 | struct uart_info *info = port->info; | 494 | struct uart_state *state = port->state; |
| 499 | #ifdef SUPPORT_SYSRQ | 495 | #ifdef SUPPORT_SYSRQ |
| 500 | if (port->cons && port->cons->index == port->line) { | 496 | if (port->cons && port->cons->index == port->line) { |
| 501 | if (!port->sysrq) { | 497 | if (!port->sysrq) { |
| @@ -506,7 +502,7 @@ static inline int uart_handle_break(struct uart_port *port) | |||
| 506 | } | 502 | } |
| 507 | #endif | 503 | #endif |
| 508 | if (port->flags & UPF_SAK) | 504 | if (port->flags & UPF_SAK) |
| 509 | do_SAK(info->port.tty); | 505 | do_SAK(state->port.tty); |
| 510 | return 0; | 506 | return 0; |
| 511 | } | 507 | } |
| 512 | 508 | ||
| @@ -518,7 +514,7 @@ static inline int uart_handle_break(struct uart_port *port) | |||
| 518 | static inline void | 514 | static inline void |
| 519 | uart_handle_dcd_change(struct uart_port *port, unsigned int status) | 515 | uart_handle_dcd_change(struct uart_port *port, unsigned int status) |
| 520 | { | 516 | { |
| 521 | struct uart_info *info = port->info; | 517 | struct uart_state *state = port->state; |
| 522 | 518 | ||
| 523 | port->icount.dcd++; | 519 | port->icount.dcd++; |
| 524 | 520 | ||
| @@ -527,11 +523,11 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status) | |||
| 527 | hardpps(); | 523 | hardpps(); |
| 528 | #endif | 524 | #endif |
| 529 | 525 | ||
| 530 | if (info->flags & UIF_CHECK_CD) { | 526 | if (state->flags & UIF_CHECK_CD) { |
| 531 | if (status) | 527 | if (status) |
| 532 | wake_up_interruptible(&info->port.open_wait); | 528 | wake_up_interruptible(&state->port.open_wait); |
| 533 | else if (info->port.tty) | 529 | else if (state->port.tty) |
| 534 | tty_hangup(info->port.tty); | 530 | tty_hangup(state->port.tty); |
| 535 | } | 531 | } |
| 536 | } | 532 | } |
| 537 | 533 | ||
| @@ -543,12 +539,12 @@ uart_handle_dcd_change(struct uart_port *port, unsigned int status) | |||
| 543 | static inline void | 539 | static inline void |
| 544 | uart_handle_cts_change(struct uart_port *port, unsigned int status) | 540 | uart_handle_cts_change(struct uart_port *port, unsigned int status) |
| 545 | { | 541 | { |
| 546 | struct uart_info *info = port->info; | 542 | struct uart_state *state = port->state; |
| 547 | struct tty_struct *tty = info->port.tty; | 543 | struct tty_struct *tty = state->port.tty; |
| 548 | 544 | ||
| 549 | port->icount.cts++; | 545 | port->icount.cts++; |
| 550 | 546 | ||
| 551 | if (info->flags & UIF_CTS_FLOW) { | 547 | if (state->flags & UIF_CTS_FLOW) { |
| 552 | if (tty->hw_stopped) { | 548 | if (tty->hw_stopped) { |
| 553 | if (status) { | 549 | if (status) { |
| 554 | tty->hw_stopped = 0; | 550 | tty->hw_stopped = 0; |
| @@ -570,7 +566,7 @@ static inline void | |||
| 570 | uart_insert_char(struct uart_port *port, unsigned int status, | 566 | uart_insert_char(struct uart_port *port, unsigned int status, |
| 571 | unsigned int overrun, unsigned int ch, unsigned int flag) | 567 | unsigned int overrun, unsigned int ch, unsigned int flag) |
| 572 | { | 568 | { |
| 573 | struct tty_struct *tty = port->info->port.tty; | 569 | struct tty_struct *tty = port->state->port.tty; |
| 574 | 570 | ||
| 575 | if ((status & port->ignore_status_mask & ~overrun) == 0) | 571 | if ((status & port->ignore_status_mask & ~overrun) == 0) |
| 576 | tty_insert_flip_char(tty, ch, flag); | 572 | tty_insert_flip_char(tty, ch, flag); |
