diff options
author | Jiri Slaby <jslaby@suse.cz> | 2013-01-03 09:53:03 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-01-16 01:21:36 -0500 |
commit | 92a19f9cec9a80ad93c06e115822deb729e2c6ad (patch) | |
tree | 80e1550ac1647a1cdf20a0b568554c0c50a63f75 /drivers/tty/hvc | |
parent | 2f69335710884ae6112fc8196ebe29b5cda7b79b (diff) |
TTY: switch tty_insert_flip_char
Now, we start converting tty buffer functions to actually use
tty_port. This will allow us to get rid of the need of tty in many
call sites. Only tty_port will needed and hence no more
tty_port_tty_get in those paths.
tty_insert_flip_char is the next one to proceed. This one is used all
over the code, so the patch is huge.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/hvc')
-rw-r--r-- | drivers/tty/hvc/hvc_console.c | 2 | ||||
-rw-r--r-- | drivers/tty/hvc/hvsi.c | 22 |
2 files changed, 10 insertions, 14 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 3d2ea92b8505..8c2fe3a0e091 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c | |||
@@ -672,7 +672,7 @@ int hvc_poll(struct hvc_struct *hp) | |||
672 | } | 672 | } |
673 | } | 673 | } |
674 | #endif /* CONFIG_MAGIC_SYSRQ */ | 674 | #endif /* CONFIG_MAGIC_SYSRQ */ |
675 | tty_insert_flip_char(tty, buf[i], 0); | 675 | tty_insert_flip_char(&hp->port, buf[i], 0); |
676 | } | 676 | } |
677 | 677 | ||
678 | read_total += n; | 678 | read_total += n; |
diff --git a/drivers/tty/hvc/hvsi.c b/drivers/tty/hvc/hvsi.c index 68357a6e4de9..1f528b8ebf5f 100644 --- a/drivers/tty/hvc/hvsi.c +++ b/drivers/tty/hvc/hvsi.c | |||
@@ -329,8 +329,7 @@ static void hvsi_recv_query(struct hvsi_struct *hp, uint8_t *packet) | |||
329 | } | 329 | } |
330 | } | 330 | } |
331 | 331 | ||
332 | static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, | 332 | static void hvsi_insert_chars(struct hvsi_struct *hp, const char *buf, int len) |
333 | const char *buf, int len) | ||
334 | { | 333 | { |
335 | int i; | 334 | int i; |
336 | 335 | ||
@@ -346,7 +345,7 @@ static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, | |||
346 | continue; | 345 | continue; |
347 | } | 346 | } |
348 | #endif /* CONFIG_MAGIC_SYSRQ */ | 347 | #endif /* CONFIG_MAGIC_SYSRQ */ |
349 | tty_insert_flip_char(tty, c, 0); | 348 | tty_insert_flip_char(&hp->port, c, 0); |
350 | } | 349 | } |
351 | } | 350 | } |
352 | 351 | ||
@@ -359,8 +358,7 @@ static void hvsi_insert_chars(struct hvsi_struct *hp, struct tty_struct *tty, | |||
359 | * revisited. | 358 | * revisited. |
360 | */ | 359 | */ |
361 | #define TTY_THRESHOLD_THROTTLE 128 | 360 | #define TTY_THRESHOLD_THROTTLE 128 |
362 | static bool hvsi_recv_data(struct hvsi_struct *hp, struct tty_struct *tty, | 361 | static bool hvsi_recv_data(struct hvsi_struct *hp, const uint8_t *packet) |
363 | const uint8_t *packet) | ||
364 | { | 362 | { |
365 | const struct hvsi_header *header = (const struct hvsi_header *)packet; | 363 | const struct hvsi_header *header = (const struct hvsi_header *)packet; |
366 | const uint8_t *data = packet + sizeof(struct hvsi_header); | 364 | const uint8_t *data = packet + sizeof(struct hvsi_header); |
@@ -377,7 +375,7 @@ static bool hvsi_recv_data(struct hvsi_struct *hp, struct tty_struct *tty, | |||
377 | datalen = TTY_THRESHOLD_THROTTLE; | 375 | datalen = TTY_THRESHOLD_THROTTLE; |
378 | } | 376 | } |
379 | 377 | ||
380 | hvsi_insert_chars(hp, tty, data, datalen); | 378 | hvsi_insert_chars(hp, data, datalen); |
381 | 379 | ||
382 | if (overflow > 0) { | 380 | if (overflow > 0) { |
383 | /* | 381 | /* |
@@ -438,9 +436,7 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty, | |||
438 | case VS_DATA_PACKET_HEADER: | 436 | case VS_DATA_PACKET_HEADER: |
439 | if (!is_open(hp)) | 437 | if (!is_open(hp)) |
440 | break; | 438 | break; |
441 | if (tty == NULL) | 439 | flip = hvsi_recv_data(hp, packet); |
442 | break; /* no tty buffer to put data in */ | ||
443 | flip = hvsi_recv_data(hp, tty, packet); | ||
444 | break; | 440 | break; |
445 | case VS_CONTROL_PACKET_HEADER: | 441 | case VS_CONTROL_PACKET_HEADER: |
446 | hvsi_recv_control(hp, packet, tty, handshake); | 442 | hvsi_recv_control(hp, packet, tty, handshake); |
@@ -474,12 +470,12 @@ static int hvsi_load_chunk(struct hvsi_struct *hp, struct tty_struct *tty, | |||
474 | return 1; | 470 | return 1; |
475 | } | 471 | } |
476 | 472 | ||
477 | static void hvsi_send_overflow(struct hvsi_struct *hp, struct tty_struct *tty) | 473 | static void hvsi_send_overflow(struct hvsi_struct *hp) |
478 | { | 474 | { |
479 | pr_debug("%s: delivering %i bytes overflow\n", __func__, | 475 | pr_debug("%s: delivering %i bytes overflow\n", __func__, |
480 | hp->n_throttle); | 476 | hp->n_throttle); |
481 | 477 | ||
482 | hvsi_insert_chars(hp, tty, hp->throttle_buf, hp->n_throttle); | 478 | hvsi_insert_chars(hp, hp->throttle_buf, hp->n_throttle); |
483 | hp->n_throttle = 0; | 479 | hp->n_throttle = 0; |
484 | } | 480 | } |
485 | 481 | ||
@@ -514,7 +510,7 @@ static irqreturn_t hvsi_interrupt(int irq, void *arg) | |||
514 | if (tty && hp->n_throttle && !test_bit(TTY_THROTTLED, &tty->flags)) { | 510 | if (tty && hp->n_throttle && !test_bit(TTY_THROTTLED, &tty->flags)) { |
515 | /* we weren't hung up and we weren't throttled, so we can | 511 | /* we weren't hung up and we weren't throttled, so we can |
516 | * deliver the rest now */ | 512 | * deliver the rest now */ |
517 | hvsi_send_overflow(hp, tty); | 513 | hvsi_send_overflow(hp); |
518 | tty_flip_buffer_push(tty); | 514 | tty_flip_buffer_push(tty); |
519 | } | 515 | } |
520 | spin_unlock_irqrestore(&hp->lock, flags); | 516 | spin_unlock_irqrestore(&hp->lock, flags); |
@@ -1001,7 +997,7 @@ static void hvsi_unthrottle(struct tty_struct *tty) | |||
1001 | 997 | ||
1002 | spin_lock_irqsave(&hp->lock, flags); | 998 | spin_lock_irqsave(&hp->lock, flags); |
1003 | if (hp->n_throttle) { | 999 | if (hp->n_throttle) { |
1004 | hvsi_send_overflow(hp, tty); | 1000 | hvsi_send_overflow(hp); |
1005 | tty_flip_buffer_push(tty); | 1001 | tty_flip_buffer_push(tty); |
1006 | } | 1002 | } |
1007 | spin_unlock_irqrestore(&hp->lock, flags); | 1003 | spin_unlock_irqrestore(&hp->lock, flags); |