diff options
author | Jiri Slaby <jslaby@suse.cz> | 2012-04-11 05:14:58 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-13 13:56:12 -0400 |
commit | 8dd360f042387aed5e2472d2246b677b7703274f (patch) | |
tree | de39a941fca4afb35a3c08022b548f7771de9b5a /drivers/s390 | |
parent | a2f892060f174e5f90041167ca00eb9e68badcb8 (diff) |
TTY: con3215, add tty_port
And use flags from that. But first we have to get rid of duplicated
flag names. From now on, for the standard ones that are stored in
tty_port->flags, we use ASYNC_* ones.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: linux390@de.ibm.com
Cc: linux-s390@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/con3215.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/drivers/s390/char/con3215.c b/drivers/s390/char/con3215.c index 7e30f85ee3a5..f7bc23baf540 100644 --- a/drivers/s390/char/con3215.c +++ b/drivers/s390/char/con3215.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/interrupt.h> | 20 | #include <linux/interrupt.h> |
21 | #include <linux/err.h> | 21 | #include <linux/err.h> |
22 | #include <linux/reboot.h> | 22 | #include <linux/reboot.h> |
23 | #include <linux/serial.h> /* ASYNC_* flags */ | ||
23 | #include <linux/slab.h> | 24 | #include <linux/slab.h> |
24 | #include <asm/ccwdev.h> | 25 | #include <asm/ccwdev.h> |
25 | #include <asm/cio.h> | 26 | #include <asm/cio.h> |
@@ -44,14 +45,11 @@ | |||
44 | #define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ | 45 | #define RAW3215_TIMEOUT HZ/10 /* time for delayed output */ |
45 | 46 | ||
46 | #define RAW3215_FIXED 1 /* 3215 console device is not be freed */ | 47 | #define RAW3215_FIXED 1 /* 3215 console device is not be freed */ |
47 | #define RAW3215_ACTIVE 2 /* set if the device is in use */ | ||
48 | #define RAW3215_WORKING 4 /* set if a request is being worked on */ | 48 | #define RAW3215_WORKING 4 /* set if a request is being worked on */ |
49 | #define RAW3215_THROTTLED 8 /* set if reading is disabled */ | 49 | #define RAW3215_THROTTLED 8 /* set if reading is disabled */ |
50 | #define RAW3215_STOPPED 16 /* set if writing is disabled */ | 50 | #define RAW3215_STOPPED 16 /* set if writing is disabled */ |
51 | #define RAW3215_CLOSING 32 /* set while in close process */ | ||
52 | #define RAW3215_TIMER_RUNS 64 /* set if the output delay timer is on */ | 51 | #define RAW3215_TIMER_RUNS 64 /* set if the output delay timer is on */ |
53 | #define RAW3215_FLUSHING 128 /* set to flush buffer (no delay) */ | 52 | #define RAW3215_FLUSHING 128 /* set to flush buffer (no delay) */ |
54 | #define RAW3215_FROZEN 256 /* set if 3215 is frozen for suspend */ | ||
55 | 53 | ||
56 | #define TAB_STOP_SIZE 8 /* tab stop size */ | 54 | #define TAB_STOP_SIZE 8 /* tab stop size */ |
57 | 55 | ||
@@ -76,6 +74,7 @@ struct raw3215_req { | |||
76 | } __attribute__ ((aligned(8))); | 74 | } __attribute__ ((aligned(8))); |
77 | 75 | ||
78 | struct raw3215_info { | 76 | struct raw3215_info { |
77 | struct tty_port port; | ||
79 | struct ccw_device *cdev; /* device for tty driver */ | 78 | struct ccw_device *cdev; /* device for tty driver */ |
80 | spinlock_t *lock; /* pointer to irq lock */ | 79 | spinlock_t *lock; /* pointer to irq lock */ |
81 | int flags; /* state flags */ | 80 | int flags; /* state flags */ |
@@ -293,7 +292,7 @@ static void raw3215_timeout(unsigned long __data) | |||
293 | if (raw->flags & RAW3215_TIMER_RUNS) { | 292 | if (raw->flags & RAW3215_TIMER_RUNS) { |
294 | del_timer(&raw->timer); | 293 | del_timer(&raw->timer); |
295 | raw->flags &= ~RAW3215_TIMER_RUNS; | 294 | raw->flags &= ~RAW3215_TIMER_RUNS; |
296 | if (!(raw->flags & RAW3215_FROZEN)) { | 295 | if (!(raw->port.flags & ASYNC_SUSPENDED)) { |
297 | raw3215_mk_write_req(raw); | 296 | raw3215_mk_write_req(raw); |
298 | raw3215_start_io(raw); | 297 | raw3215_start_io(raw); |
299 | } | 298 | } |
@@ -309,7 +308,8 @@ static void raw3215_timeout(unsigned long __data) | |||
309 | */ | 308 | */ |
310 | static inline void raw3215_try_io(struct raw3215_info *raw) | 309 | static inline void raw3215_try_io(struct raw3215_info *raw) |
311 | { | 310 | { |
312 | if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FROZEN)) | 311 | if (!(raw->port.flags & ASYNC_INITIALIZED) || |
312 | (raw->port.flags & ASYNC_SUSPENDED)) | ||
313 | return; | 313 | return; |
314 | if (raw->queued_read != NULL) | 314 | if (raw->queued_read != NULL) |
315 | raw3215_start_io(raw); | 315 | raw3215_start_io(raw); |
@@ -484,7 +484,7 @@ static void raw3215_make_room(struct raw3215_info *raw, unsigned int length) | |||
484 | /* While console is frozen for suspend we have no other | 484 | /* While console is frozen for suspend we have no other |
485 | * choice but to drop message from the buffer to make | 485 | * choice but to drop message from the buffer to make |
486 | * room for even more messages. */ | 486 | * room for even more messages. */ |
487 | if (raw->flags & RAW3215_FROZEN) { | 487 | if (raw->port.flags & ASYNC_SUSPENDED) { |
488 | raw3215_drop_line(raw); | 488 | raw3215_drop_line(raw); |
489 | continue; | 489 | continue; |
490 | } | 490 | } |
@@ -606,10 +606,10 @@ static int raw3215_startup(struct raw3215_info *raw) | |||
606 | { | 606 | { |
607 | unsigned long flags; | 607 | unsigned long flags; |
608 | 608 | ||
609 | if (raw->flags & RAW3215_ACTIVE) | 609 | if (raw->port.flags & ASYNC_INITIALIZED) |
610 | return 0; | 610 | return 0; |
611 | raw->line_pos = 0; | 611 | raw->line_pos = 0; |
612 | raw->flags |= RAW3215_ACTIVE; | 612 | raw->port.flags |= ASYNC_INITIALIZED; |
613 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 613 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
614 | raw3215_try_io(raw); | 614 | raw3215_try_io(raw); |
615 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 615 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
@@ -625,14 +625,15 @@ static void raw3215_shutdown(struct raw3215_info *raw) | |||
625 | DECLARE_WAITQUEUE(wait, current); | 625 | DECLARE_WAITQUEUE(wait, current); |
626 | unsigned long flags; | 626 | unsigned long flags; |
627 | 627 | ||
628 | if (!(raw->flags & RAW3215_ACTIVE) || (raw->flags & RAW3215_FIXED)) | 628 | if (!(raw->port.flags & ASYNC_INITIALIZED) || |
629 | (raw->flags & RAW3215_FIXED)) | ||
629 | return; | 630 | return; |
630 | /* Wait for outstanding requests, then free irq */ | 631 | /* Wait for outstanding requests, then free irq */ |
631 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 632 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
632 | if ((raw->flags & RAW3215_WORKING) || | 633 | if ((raw->flags & RAW3215_WORKING) || |
633 | raw->queued_write != NULL || | 634 | raw->queued_write != NULL || |
634 | raw->queued_read != NULL) { | 635 | raw->queued_read != NULL) { |
635 | raw->flags |= RAW3215_CLOSING; | 636 | raw->port.flags |= ASYNC_CLOSING; |
636 | add_wait_queue(&raw->empty_wait, &wait); | 637 | add_wait_queue(&raw->empty_wait, &wait); |
637 | set_current_state(TASK_INTERRUPTIBLE); | 638 | set_current_state(TASK_INTERRUPTIBLE); |
638 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 639 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
@@ -640,7 +641,7 @@ static void raw3215_shutdown(struct raw3215_info *raw) | |||
640 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 641 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
641 | remove_wait_queue(&raw->empty_wait, &wait); | 642 | remove_wait_queue(&raw->empty_wait, &wait); |
642 | set_current_state(TASK_RUNNING); | 643 | set_current_state(TASK_RUNNING); |
643 | raw->flags &= ~(RAW3215_ACTIVE | RAW3215_CLOSING); | 644 | raw->port.flags &= ~(ASYNC_INITIALIZED | ASYNC_CLOSING); |
644 | } | 645 | } |
645 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 646 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
646 | } | 647 | } |
@@ -663,6 +664,7 @@ static struct raw3215_info *raw3215_alloc_info(void) | |||
663 | setup_timer(&info->timer, raw3215_timeout, (unsigned long)info); | 664 | setup_timer(&info->timer, raw3215_timeout, (unsigned long)info); |
664 | init_waitqueue_head(&info->empty_wait); | 665 | init_waitqueue_head(&info->empty_wait); |
665 | tasklet_init(&info->tlet, raw3215_wakeup, (unsigned long)info); | 666 | tasklet_init(&info->tlet, raw3215_wakeup, (unsigned long)info); |
667 | tty_port_init(&info->port); | ||
666 | 668 | ||
667 | return info; | 669 | return info; |
668 | } | 670 | } |
@@ -752,7 +754,7 @@ static int raw3215_pm_stop(struct ccw_device *cdev) | |||
752 | raw = dev_get_drvdata(&cdev->dev); | 754 | raw = dev_get_drvdata(&cdev->dev); |
753 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 755 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
754 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); | 756 | raw3215_make_room(raw, RAW3215_BUFFER_SIZE); |
755 | raw->flags |= RAW3215_FROZEN; | 757 | raw->port.flags |= ASYNC_SUSPENDED; |
756 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); | 758 | spin_unlock_irqrestore(get_ccwdev_lock(raw->cdev), flags); |
757 | return 0; | 759 | return 0; |
758 | } | 760 | } |
@@ -765,7 +767,7 @@ static int raw3215_pm_start(struct ccw_device *cdev) | |||
765 | /* Allow I/O again and flush output buffer. */ | 767 | /* Allow I/O again and flush output buffer. */ |
766 | raw = dev_get_drvdata(&cdev->dev); | 768 | raw = dev_get_drvdata(&cdev->dev); |
767 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); | 769 | spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags); |
768 | raw->flags &= ~RAW3215_FROZEN; | 770 | raw->port.flags &= ~ASYNC_SUSPENDED; |
769 | raw->flags |= RAW3215_FLUSHING; | 771 | raw->flags |= RAW3215_FLUSHING; |
770 | raw3215_try_io(raw); | 772 | raw3215_try_io(raw); |
771 | raw->flags &= ~RAW3215_FLUSHING; | 773 | raw->flags &= ~RAW3215_FLUSHING; |
@@ -838,7 +840,7 @@ static void con3215_flush(void) | |||
838 | unsigned long flags; | 840 | unsigned long flags; |
839 | 841 | ||
840 | raw = raw3215[0]; /* console 3215 is the first one */ | 842 | raw = raw3215[0]; /* console 3215 is the first one */ |
841 | if (raw->flags & RAW3215_FROZEN) | 843 | if (raw->port.flags & ASYNC_SUSPENDED) |
842 | /* The console is still frozen for suspend. */ | 844 | /* The console is still frozen for suspend. */ |
843 | if (ccw_device_force_console()) | 845 | if (ccw_device_force_console()) |
844 | /* Forcing didn't work, no panic message .. */ | 846 | /* Forcing didn't work, no panic message .. */ |