diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:30:29 -0400 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2009-06-16 04:31:12 -0400 |
commit | 77812a27577dba6adb71b1de8ee690ced5002067 (patch) | |
tree | 775f606c9288f49834a187c37343926a7f80b08a /drivers/s390 | |
parent | 6664845cef13b0a224f43f6c46eddd0b3e018c04 (diff) |
[S390] pm: con3215 power management callbacks
Introduce the power management callbacks to the 3215 console. On suspend
the console buffer is flushed to the 3215 device to have an empty console
buffer. Printks done while the 3215 device is suspended are buffered in
the 64K buffer of the 3215 device. If the buffer is full new messages will
push out the oldest messages to make room for the most recent message.
On resume the buffered messages are printed. If the system panics before
the 3215 device is resumed ccw_device_force_console is used to get the
console working again.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/con3215.c | 205 |
1 files changed, 120 insertions, 85 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 9ab06e0dad40..b79f31add39c 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -1,14 +1,12 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/s390/char/con3215.c | 2 | * 3215 line mode terminal driver. |
3 | * 3215 line mode terminal driver. | ||
4 | * | 3 | * |
5 | * S390 version | 4 | * Copyright IBM Corp. 1999, 2009 |
6 | * Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation | 5 | * Author(s): Martin Schwidefsky <schwidefsky@de.ibm.com> |
7 | * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com), | ||
8 | * | 6 | * |
9 | * Updated: | 7 | * Updated: |
10 | * Aug-2000: Added tab support | 8 | * Aug-2000: Added tab support |
11 | * Dan Morrison, IBM Corporation (dmorriso@cse.buffalo.edu) | 9 | * Dan Morrison, IBM Corporation <dmorriso@cse.buffalo.edu> |
12 | */ | 10 | */ |
13 | 11 | ||
14 | #include <linux/module.h> | 12 | #include <linux/module.h> |
@@ -56,6 +54,7 @@ | |||
56 | #define RAW3215_CLOSING 32 /* set while in close process */ | 54 | #define RAW3215_CLOSING 32 /* set while in close process */ |
57 | #define RAW3215_TIMER_RUNS 64 /* set if the output delay timer is on */ | 55 | #define RAW3215_TIMER_RUNS 64 /* set if the output delay timer is on */ |
58 | #define RAW3215_FLUSHING 128 /* set to flush buffer (no delay) */ | 56 | #define RAW3215_FLUSHING 128 /* set to flush buffer (no delay) */ |
57 | #define RAW3215_FROZEN 256 /* set if 3215 is frozen for suspend */ | ||
59 | 58 | ||
60 | #define TAB_STOP_SIZE 8 /* tab stop size */ | 59 | #define TAB_STOP_SIZE 8 /* tab stop size */ |
61 | 60 | ||
@@ -111,8 +110,8 @@ static struct tty_driver *tty3215_driver; | |||
111 | /* | 110 | /* |
112 | * Get a request structure from the free list | 111 | * Get a request structure from the free list |
113 | */ | 112 | */ |
114 | static inline struct raw3215_req * | 113 | static inline struct raw3215_req *raw3215_alloc_req(void) |
115 | raw3215_alloc_req(void) { | 114 | { |
116 | struct raw3215_req *req; | 115 | struct raw3215_req *req; |
117 | unsigned long flags; | 116 | unsigned long flags; |
118 | 117 | ||
@@ -126,8 +125,8 @@ raw3215_alloc_req(void) { | |||
126 | /* | 125 | /* |
127 | * Put a request structure back to the free list | 126 | * Put a request structure back to the free list |
128 | */ | 127 | */ |
129 | static inline void | 128 | static inline void raw3215_free_req(struct raw3215_req *req) |
130 | raw3215_free_req(struct raw3215_req *req) { | 129 | { |
131 | unsigned long flags; | 130 | unsigned long flags; |
132 | 131 | ||
133 | if (req->type == RAW3215_FREE) | 132 | if (req->type == RAW3215_FREE) |
@@ -145,8 +144,7 @@ raw3215_free_req(struct raw3215_req *req) { | |||
145 | * because a 3215 terminal won't accept a new read before the old one is | 144 | * because a 3215 terminal won't accept a new read before the old one is |
146 | * completed. | 145 | * completed. |
147 | */ | 146 | */ |
148 | static void | 147 | static void raw3215_mk_read_req(struct raw3215_info *raw) |
149 | raw3215_mk_read_req(struct raw3215_info *raw) | ||
150 | { | 148 | { |
151 | struct raw3215_req *req; | 149 | struct raw3215_req *req; |
152 | struct ccw1 *ccw; | 150 | struct ccw1 *ccw; |
@@ -174,8 +172,7 @@ raw3215_mk_read_req(struct raw3215_info *raw) | |||
174 | * buffer to the 3215 device. If a queued write exists it is replaced by | 172 | * buffer to the 3215 device. If a queued write exists it is replaced by |
175 | * the new, probably lengthened request. | 173 | * the new, probably lengthened request. |
176 | */ | 174 | */ |
177 | static void | 175 | static void raw3215_mk_write_req(struct raw3215_info *raw) |
178 | raw3215_mk_write_req(struct raw3215_info *raw) | ||
179 | { | 176 | { |
180 | struct raw3215_req *req; | 177 | struct raw3215_req *req; |
181 | struct ccw1 *ccw; | 178 | struct ccw1 *ccw; |
@@ -251,8 +248,7 @@ raw3215_mk_write_req(struct raw3215_info *raw) | |||
251 | /* | 248 | /* |
252 | * Start a read or a write request | 249 | * Start a read or a write request |
253 | */ | 250 | */ |
254 | static void | 251 | static void raw3215_start_io(struct raw3215_info *raw) |
255 | raw3215_start_io(struct raw3215_info *raw) | ||
256 | { | 252 | { |
257 | struct raw3215_req *req; | 253 | struct raw3215_req *req; |
258 | int res; | 254 | int res; |
@@ -290,8 +286,7 @@ raw3215_start_io(struct raw3215_info *raw) | |||
290 | /* | 286 | /* |
291 | * Function to start a delayed output after RAW3215_TIMEOUT seconds | 287 | * Function to start a delayed output after RAW3215_TIMEOUT seconds |
292 | */ | 288 | */ |
293 | static void | 289 | static void raw3215_timeout(unsigned long __data) |
294 | raw3215_timeout(unsigned long __data) | ||
295 | { | 290 | { |
296 | struct raw3215_info *raw = (struct raw3215_info *) __data; | 291 | struct raw3215_info *raw = (struct raw3215_info *) __data; |
297 | unsigned long flags; | 292 | unsigned long flags; |
@@ -300,8 +295,10 @@ raw3215_timeout(unsigned long __data) | |||
300 | if (raw->flags & RAW3215_TIMER_RUNS) { | 295 | if (raw->flags & RAW3215_TIMER_RUNS) { |
301 | del_timer(&raw->timer); | 296 | del_timer(&raw->timer); |
302 | raw->flags &= ~RAW3215_TIMER_RUNS; | 297 | raw->flags &= ~RAW3215_TIMER_RUNS; |
303 | raw3215_mk_write_req(raw); | 298 | if (!(raw->flags & RAW3215_FROZEN)) { |
304 | raw3215_start_io(raw); | 299 | raw3215_mk_write_req(raw); |
300 | raw3215_start_io(raw); | ||
301 | } | ||
305 | } | 302 | } |
306 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 303 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
307 | } | 304 | } |
@@ -312,10 +309,9 @@ raw3215_timeout(unsigned long __data) | |||
312 | * amount of data is bigger than RAW3215_MIN_WRITE. If a write is not | 309 | * amount of data is bigger than RAW3215_MIN_WRITE. If a write is not |
313 | * done immediately a timer is started with a delay of RAW3215_TIMEOUT. | 310 | * done immediately a timer is started with a delay of RAW3215_TIMEOUT. |
314 | */ | 311 | */ |
315 | static inline void | 312 | static inline void raw3215_try_io(struct raw3215_info *raw) |
316 | raw3215_try_io(struct raw3215_info *raw) | ||
317 | { | 313 | { |
318 | if (!(raw->flags & RAW3215_ACTIVE)) | 314 | if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FROZEN)) |
319 | return; | 315 | return; |
320 | if (raw->queued_read != NULL) | 316 | if (raw->queued_read != NULL) |
321 | raw3215_start_io(raw); | 317 | raw3215_start_io(raw); |
@@ -359,8 +355,8 @@ static void raw3215_next_io(struct raw3215_info *raw) | |||
359 | /* | 355 | /* |
360 | * Interrupt routine, called from common io layer | 356 | * Interrupt routine, called from common io layer |
361 | */ | 357 | */ |
362 | static void | 358 | static void raw3215_irq(struct ccw_device *cdev, unsigned long intparm, |
363 | raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | 359 | struct irb *irb) |
364 | { | 360 | { |
365 | struct raw3215_info *raw; | 361 | struct raw3215_info *raw; |
366 | struct raw3215_req *req; | 362 | struct raw3215_req *req; |
@@ -459,14 +455,40 @@ raw3215_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) | |||
459 | } | 455 | } |
460 | 456 | ||
461 | /* | 457 | /* |
458 | * Drop the oldest line from the output buffer. | ||
459 | */ | ||
460 | static void raw3215_drop_line(struct raw3215_info *raw) | ||
461 | { | ||
462 | int ix; | ||
463 | char ch; | ||
464 | |||
465 | BUG_ON(raw->written != 0); | ||
466 | ix = (raw->head - raw->count) & (RAW3215_BUFFER_SIZE - 1); | ||
467 | while (raw->count > 0) { | ||
468 | ch = raw->buffer[ix]; | ||
469 | ix = (ix + 1) & (RAW3215_BUFFER_SIZE - 1); | ||
470 | raw->count--; | ||
471 | if (ch == 0x15) | ||
472 | break; | ||
473 | } | ||
474 | raw->head = ix; | ||
475 | } | ||
476 | |||
477 | /* | ||
462 | * Wait until length bytes are available int the output buffer. | 478 | * Wait until length bytes are available int the output buffer. |
463 | * Has to be called with the s390irq lock held. Can be called | 479 | * Has to be called with the s390irq lock held. Can be called |
464 | * disabled. | 480 | * disabled. |
465 | */ | 481 | */ |
466 | static void | 482 | static void raw3215_make_room(struct raw3215_info *raw, unsigned int length) |
467 | raw3215_make_room(struct raw3215_info *raw, unsigned int length) | ||
468 | { | 483 | { |
469 | while (RAW3215_BUFFER_SIZE - raw->count < length) { | 484 | while (RAW3215_BUFFER_SIZE - raw->count < length) { |
485 | /* While console is frozen for suspend we have no other | ||
486 | * choice but to drop message from the buffer to make | ||
487 | * room for even more messages. */ | ||
488 | if (raw->flags & RAW3215_FROZEN) { | ||
489 | raw3215_drop_line(raw); | ||
490 | continue; | ||
491 | } | ||
470 | /* there might be a request pending */ | 492 | /* there might be a request pending */ |
471 | raw->flags |= RAW3215_FLUSHING; | 493 | raw->flags |= RAW3215_FLUSHING; |
472 | raw3215_mk_write_req(raw); | 494 | raw3215_mk_write_req(raw); |
@@ -488,8 +510,8 @@ raw3215_make_room(struct raw3215_info *raw, unsigned int length) | |||
488 | /* | 510 | /* |
489 | * String write routine for 3215 devices | 511 | * String write routine for 3215 devices |
490 | */ | 512 | */ |
491 | static void | 513 | static void raw3215_write(struct raw3215_info *raw, const char *str, |
492 | raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) | 514 | unsigned int length) |
493 | { | 515 | { |
494 | unsigned long flags; | 516 | unsigned long flags; |
495 | int c, count; | 517 | int c, count; |
@@ -529,8 +551,7 @@ raw3215_write(struct raw3215_info *raw, const char *str, unsigned int length) | |||
529 | /* | 551 | /* |
530 | * Put character routine for 3215 devices | 552 | * Put character routine for 3215 devices |
531 | */ | 553 | */ |
532 | static void | 554 | static void raw3215_putchar(struct raw3215_info *raw, unsigned char ch) |
533 | raw3215_putchar(struct raw3215_info *raw, unsigned char ch) | ||
534 | { | 555 | { |
535 | unsigned long flags; | 556 | unsigned long flags; |
536 | unsigned int length, i; | 557 | unsigned int length, i; |
@@ -566,8 +587,7 @@ raw3215_putchar(struct raw3215_info *raw, unsigned char ch) | |||
566 | * Flush routine, it simply sets the flush flag and tries to start | 587 | * Flush routine, it simply sets the flush flag and tries to start |
567 | * pending IO. | 588 | * pending IO. |
568 | */ | 589 | */ |
569 | static void | 590 | static void raw3215_flush_buffer(struct raw3215_info *raw) |
570 | raw3215_flush_buffer(struct raw3215_info *raw) | ||
571 | { | 591 | { |
572 | unsigned long flags; | 592 | unsigned long flags; |
573 | 593 | ||
@@ -583,8 +603,7 @@ raw3215_flush_buffer(struct raw3215_info *raw) | |||
583 | /* | 603 | /* |
584 | * Fire up a 3215 device. | 604 | * Fire up a 3215 device. |
585 | */ | 605 | */ |
586 | static int | 606 | static int raw3215_startup(struct raw3215_info *raw) |
587 | raw3215_startup(struct raw3215_info *raw) | ||
588 | { | 607 | { |
589 | unsigned long flags; | 608 | unsigned long flags; |
590 | 609 | ||
@@ -602,8 +621,7 @@ raw3215_startup(struct raw3215_info *raw) | |||
602 | /* | 621 | /* |
603 | * Shutdown a 3215 device. | 622 | * Shutdown a 3215 device. |
604 | */ | 623 | */ |
605 | static void | 624 | static void raw3215_shutdown(struct raw3215_info *raw) |
606 | raw3215_shutdown(struct raw3215_info *raw) | ||
607 | { | 625 | { |
608 | DECLARE_WAITQUEUE(wait, current); | 626 | DECLARE_WAITQUEUE(wait, current); |
609 | unsigned long flags; | 627 | unsigned long flags; |
@@ -628,8 +646,7 @@ raw3215_shutdown(struct raw3215_info *raw) | |||
628 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 646 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
629 | } | 647 | } |
630 | 648 | ||
631 | static int | 649 | static int raw3215_probe (struct ccw_device *cdev) |
632 | raw3215_probe (struct ccw_device *cdev) | ||
633 | { | 650 | { |
634 | struct raw3215_info *raw; | 651 | struct raw3215_info *raw; |
635 | int line; | 652 | int line; |
@@ -675,8 +692,7 @@ raw3215_probe (struct ccw_device *cdev) | |||
675 | return 0; | 692 | return 0; |
676 | } | 693 | } |
677 | 694 | ||
678 | static void | 695 | static void raw3215_remove (struct ccw_device *cdev) |
679 | raw3215_remove (struct ccw_device *cdev) | ||
680 | { | 696 | { |
681 | struct raw3215_info *raw; | 697 | struct raw3215_info *raw; |
682 | 698 | ||
@@ -689,8 +705,7 @@ raw3215_remove (struct ccw_device *cdev) | |||
689 | } | 705 | } |
690 | } | 706 | } |
691 | 707 | ||
692 | static int | 708 | static int raw3215_set_online (struct ccw_device *cdev) |
693 | raw3215_set_online (struct ccw_device *cdev) | ||
694 | { | 709 | { |
695 | struct raw3215_info *raw; | 710 | struct raw3215_info *raw; |
696 | 711 | ||
@@ -701,8 +716,7 @@ raw3215_set_online (struct ccw_device *cdev) | |||
701 | return raw3215_startup(raw); | 716 | return raw3215_startup(raw); |
702 | } | 717 | } |
703 | 718 | ||
704 | static int | 719 | static int raw3215_set_offline (struct ccw_device *cdev) |
705 | raw3215_set_offline (struct ccw_device *cdev) | ||
706 | { | 720 | { |
707 | struct raw3215_info *raw; | 721 | struct raw3215_info *raw; |
708 | 722 | ||
@@ -715,6 +729,36 @@ raw3215_set_offline (struct ccw_device *cdev) | |||
715 | return 0; | 729 | return 0; |
716 | } | 730 | } |
717 | 731 | ||
732 | static int raw3215_pm_stop(struct ccw_device *cdev) | ||
733 | { | ||
734 | struct raw3215_info *raw; | ||
735 | unsigned long flags; | ||
736 | |||
737 | /* Empty the output buffer, then prevent new I/O. */ | ||
738 | raw = cdev->dev.driver_data; | ||
739 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | ||
740 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); | ||
741 | raw->flags |= RAW3215_FROZEN; | ||
742 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | ||
743 | return 0; | ||
744 | } | ||
745 | |||
746 | static int raw3215_pm_start(struct ccw_device *cdev) | ||
747 | { | ||
748 | struct raw3215_info *raw; | ||
749 | unsigned long flags; | ||
750 | |||
751 | /* Allow I/O again and flush output buffer. */ | ||
752 | raw = cdev->dev.driver_data; | ||
753 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | ||
754 | raw->flags &= ~RAW3215_FROZEN; | ||
755 | raw->flags |= RAW3215_FLUSHING; | ||
756 | raw3215_try_io(raw); | ||
757 | raw->flags &= ~RAW3215_FLUSHING; | ||
758 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | ||
759 | return 0; | ||
760 | } | ||
761 | |||
718 | static struct ccw_device_id raw3215_id[] = { | 762 | static struct ccw_device_id raw3215_id[] = { |
719 | { CCW_DEVICE(0x3215, 0) }, | 763 | { CCW_DEVICE(0x3215, 0) }, |
720 | { /* end of list */ }, | 764 | { /* end of list */ }, |
@@ -728,14 +772,17 @@ static struct ccw_driver raw3215_ccw_driver = { | |||
728 | .remove = &raw3215_remove, | 772 | .remove = &raw3215_remove, |
729 | .set_online = &raw3215_set_online, | 773 | .set_online = &raw3215_set_online, |
730 | .set_offline = &raw3215_set_offline, | 774 | .set_offline = &raw3215_set_offline, |
775 | .freeze = &raw3215_pm_stop, | ||
776 | .thaw = &raw3215_pm_start, | ||
777 | .restore = &raw3215_pm_start, | ||
731 | }; | 778 | }; |
732 | 779 | ||
733 | #ifdef CONFIG_TN3215_CONSOLE | 780 | #ifdef CONFIG_TN3215_CONSOLE |
734 | /* | 781 | /* |
735 | * Write a string to the 3215 console | 782 | * Write a string to the 3215 console |
736 | */ | 783 | */ |
737 | static void | 784 | static void con3215_write(struct console *co, const char *str, |
738 | con3215_write(struct console *co, const char *str, unsigned int count) | 785 | unsigned int count) |
739 | { | 786 | { |
740 | struct raw3215_info *raw; | 787 | struct raw3215_info *raw; |
741 | int i; | 788 | int i; |
@@ -768,13 +815,17 @@ static struct tty_driver *con3215_device(struct console *c, int *index) | |||
768 | * panic() calls con3215_flush through a panic_notifier | 815 | * panic() calls con3215_flush through a panic_notifier |
769 | * before the system enters a disabled, endless loop. | 816 | * before the system enters a disabled, endless loop. |
770 | */ | 817 | */ |
771 | static void | 818 | static void con3215_flush(void) |
772 | con3215_flush(void) | ||
773 | { | 819 | { |
774 | struct raw3215_info *raw; | 820 | struct raw3215_info *raw; |
775 | unsigned long flags; | 821 | unsigned long flags; |
776 | 822 | ||
777 | raw = raw3215[0]; /* console 3215 is the first one */ | 823 | raw = raw3215[0]; /* console 3215 is the first one */ |
824 | if (raw->flags & RAW3215_FROZEN) | ||
825 | /* The console is still frozen for suspend. */ | ||
826 | if (ccw_device_force_console()) | ||
827 | /* Forcing didn't work, no panic message .. */ | ||
828 | return; | ||
778 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 829 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
779 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); | 830 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); |
780 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 831 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
@@ -811,8 +862,7 @@ static struct console con3215 = { | |||
811 | * 3215 console initialization code called from console_init(). | 862 | * 3215 console initialization code called from console_init(). |
812 | * NOTE: This is called before kmalloc is available. | 863 | * NOTE: This is called before kmalloc is available. |
813 | */ | 864 | */ |
814 | static int __init | 865 | static int __init con3215_init(void) |
815 | con3215_init(void) | ||
816 | { | 866 | { |
817 | struct ccw_device *cdev; | 867 | struct ccw_device *cdev; |
818 | struct raw3215_info *raw; | 868 | struct raw3215_info *raw; |
@@ -875,8 +925,7 @@ console_initcall(con3215_init); | |||
875 | * | 925 | * |
876 | * This routine is called whenever a 3215 tty is opened. | 926 | * This routine is called whenever a 3215 tty is opened. |
877 | */ | 927 | */ |
878 | static int | 928 | static int tty3215_open(struct tty_struct *tty, struct file * filp) |
879 | tty3215_open(struct tty_struct *tty, struct file * filp) | ||
880 | { | 929 | { |
881 | struct raw3215_info *raw; | 930 | struct raw3215_info *raw; |
882 | int retval, line; | 931 | int retval, line; |
@@ -909,8 +958,7 @@ tty3215_open(struct tty_struct *tty, struct file * filp) | |||
909 | * This routine is called when the 3215 tty is closed. We wait | 958 | * This routine is called when the 3215 tty is closed. We wait |
910 | * for the remaining request to be completed. Then we clean up. | 959 | * for the remaining request to be completed. Then we clean up. |
911 | */ | 960 | */ |
912 | static void | 961 | static void tty3215_close(struct tty_struct *tty, struct file * filp) |
913 | tty3215_close(struct tty_struct *tty, struct file * filp) | ||
914 | { | 962 | { |
915 | struct raw3215_info *raw; | 963 | struct raw3215_info *raw; |
916 | 964 | ||
@@ -927,8 +975,7 @@ tty3215_close(struct tty_struct *tty, struct file * filp) | |||
927 | /* | 975 | /* |
928 | * Returns the amount of free space in the output buffer. | 976 | * Returns the amount of free space in the output buffer. |
929 | */ | 977 | */ |
930 | static int | 978 | static int tty3215_write_room(struct tty_struct *tty) |
931 | tty3215_write_room(struct tty_struct *tty) | ||
932 | { | 979 | { |
933 | struct raw3215_info *raw; | 980 | struct raw3215_info *raw; |
934 | 981 | ||
@@ -944,9 +991,8 @@ tty3215_write_room(struct tty_struct *tty) | |||
944 | /* | 991 | /* |
945 | * String write routine for 3215 ttys | 992 | * String write routine for 3215 ttys |
946 | */ | 993 | */ |
947 | static int | 994 | static int tty3215_write(struct tty_struct * tty, |
948 | tty3215_write(struct tty_struct * tty, | 995 | const unsigned char *buf, int count) |
949 | const unsigned char *buf, int count) | ||
950 | { | 996 | { |
951 | struct raw3215_info *raw; | 997 | struct raw3215_info *raw; |
952 | 998 | ||
@@ -960,8 +1006,7 @@ tty3215_write(struct tty_struct * tty, | |||
960 | /* | 1006 | /* |
961 | * Put character routine for 3215 ttys | 1007 | * Put character routine for 3215 ttys |
962 | */ | 1008 | */ |
963 | static int | 1009 | static int tty3215_put_char(struct tty_struct *tty, unsigned char ch) |
964 | tty3215_put_char(struct tty_struct *tty, unsigned char ch) | ||
965 | { | 1010 | { |
966 | struct raw3215_info *raw; | 1011 | struct raw3215_info *raw; |
967 | 1012 | ||
@@ -972,16 +1017,14 @@ tty3215_put_char(struct tty_struct *tty, unsigned char ch) | |||
972 | return 1; | 1017 | return 1; |
973 | } | 1018 | } |
974 | 1019 | ||
975 | static void | 1020 | static void tty3215_flush_chars(struct tty_struct *tty) |
976 | tty3215_flush_chars(struct tty_struct *tty) | ||
977 | { | 1021 | { |
978 | } | 1022 | } |
979 | 1023 | ||
980 | /* | 1024 | /* |
981 | * Returns the number of characters in the output buffer | 1025 | * Returns the number of characters in the output buffer |
982 | */ | 1026 | */ |
983 | static int | 1027 | static int tty3215_chars_in_buffer(struct tty_struct *tty) |
984 | tty3215_chars_in_buffer(struct tty_struct *tty) | ||
985 | { | 1028 | { |
986 | struct raw3215_info *raw; | 1029 | struct raw3215_info *raw; |
987 | 1030 | ||
@@ -989,8 +1032,7 @@ tty3215_chars_in_buffer(struct tty_struct *tty) | |||
989 | return raw->count; | 1032 | return raw->count; |
990 | } | 1033 | } |
991 | 1034 | ||
992 | static void | 1035 | static void tty3215_flush_buffer(struct tty_struct *tty) |
993 | tty3215_flush_buffer(struct tty_struct *tty) | ||
994 | { | 1036 | { |
995 | struct raw3215_info *raw; | 1037 | struct raw3215_info *raw; |
996 | 1038 | ||
@@ -1002,9 +1044,8 @@ tty3215_flush_buffer(struct tty_struct *tty) | |||
1002 | /* | 1044 | /* |
1003 | * Currently we don't have any io controls for 3215 ttys | 1045 | * Currently we don't have any io controls for 3215 ttys |
1004 | */ | 1046 | */ |
1005 | static int | 1047 | static int tty3215_ioctl(struct tty_struct *tty, struct file * file, |
1006 | tty3215_ioctl(struct tty_struct *tty, struct file * file, | 1048 | unsigned int cmd, unsigned long arg) |
1007 | unsigned int cmd, unsigned long arg) | ||
1008 | { | 1049 | { |
1009 | if (tty->flags & (1 << TTY_IO_ERROR)) | 1050 | if (tty->flags & (1 << TTY_IO_ERROR)) |
1010 | return -EIO; | 1051 | return -EIO; |
@@ -1019,8 +1060,7 @@ tty3215_ioctl(struct tty_struct *tty, struct file * file, | |||
1019 | /* | 1060 | /* |
1020 | * Disable reading from a 3215 tty | 1061 | * Disable reading from a 3215 tty |
1021 | */ | 1062 | */ |
1022 | static void | 1063 | static void tty3215_throttle(struct tty_struct * tty) |
1023 | tty3215_throttle(struct tty_struct * tty) | ||
1024 | { | 1064 | { |
1025 | struct raw3215_info *raw; | 1065 | struct raw3215_info *raw; |
1026 | 1066 | ||
@@ -1031,8 +1071,7 @@ tty3215_throttle(struct tty_struct * tty) | |||
1031 | /* | 1071 | /* |
1032 | * Enable reading from a 3215 tty | 1072 | * Enable reading from a 3215 tty |
1033 | */ | 1073 | */ |
1034 | static void | 1074 | static void tty3215_unthrottle(struct tty_struct * tty) |
1035 | tty3215_unthrottle(struct tty_struct * tty) | ||
1036 | { | 1075 | { |
1037 | struct raw3215_info *raw; | 1076 | struct raw3215_info *raw; |
1038 | unsigned long flags; | 1077 | unsigned long flags; |
@@ -1049,8 +1088,7 @@ tty3215_unthrottle(struct tty_struct * tty) | |||
1049 | /* | 1088 | /* |
1050 | * Disable writing to a 3215 tty | 1089 | * Disable writing to a 3215 tty |
1051 | */ | 1090 | */ |
1052 | static void | 1091 | static void tty3215_stop(struct tty_struct *tty) |
1053 | tty3215_stop(struct tty_struct *tty) | ||
1054 | { | 1092 | { |
1055 | struct raw3215_info *raw; | 1093 | struct raw3215_info *raw; |
1056 | 1094 | ||
@@ -1061,8 +1099,7 @@ tty3215_stop(struct tty_struct *tty) | |||
1061 | /* | 1099 | /* |
1062 | * Enable writing to a 3215 tty | 1100 | * Enable writing to a 3215 tty |
1063 | */ | 1101 | */ |
1064 | static void | 1102 | static void tty3215_start(struct tty_struct *tty) |
1065 | tty3215_start(struct tty_struct *tty) | ||
1066 | { | 1103 | { |
1067 | struct raw3215_info *raw; | 1104 | struct raw3215_info *raw; |
1068 | unsigned long flags; | 1105 | unsigned long flags; |
@@ -1096,8 +1133,7 @@ static const struct tty_operations tty3215_ops = { | |||
1096 | * 3215 tty registration code called from tty_init(). | 1133 | * 3215 tty registration code called from tty_init(). |
1097 | * Most kernel services (incl. kmalloc) are available at this poimt. | 1134 | * Most kernel services (incl. kmalloc) are available at this poimt. |
1098 | */ | 1135 | */ |
1099 | static int __init | 1136 | static int __init tty3215_init(void) |
1100 | tty3215_init(void) | ||
1101 | { | 1137 | { |
1102 | struct tty_driver *driver; | 1138 | struct tty_driver *driver; |
1103 | int ret; | 1139 | int ret; |
@@ -1142,8 +1178,7 @@ tty3215_init(void) | |||
1142 | return 0; | 1178 | return 0; |
1143 | } | 1179 | } |
1144 | 1180 | ||
1145 | static void __exit | 1181 | static void __exit tty3215_exit(void) |
1146 | tty3215_exit(void) | ||
1147 | { | 1182 | { |
1148 | tty_unregister_driver(tty3215_driver); | 1183 | tty_unregister_driver(tty3215_driver); |
1149 | put_tty_driver(tty3215_driver); | 1184 | put_tty_driver(tty3215_driver); |