diff options
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/char/tty3270.c | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/drivers/s390/char/tty3270.c b/drivers/s390/char/tty3270.c index f3837da7ceab..bb1514a27f50 100644 --- a/drivers/s390/char/tty3270.c +++ b/drivers/s390/char/tty3270.c | |||
@@ -324,9 +324,8 @@ tty3270_blank_line(struct tty3270 *tp) | |||
324 | static void | 324 | static void |
325 | tty3270_write_callback(struct raw3270_request *rq, void *data) | 325 | tty3270_write_callback(struct raw3270_request *rq, void *data) |
326 | { | 326 | { |
327 | struct tty3270 *tp; | 327 | struct tty3270 *tp = container_of(rq->view, struct tty3270, view); |
328 | 328 | ||
329 | tp = (struct tty3270 *) rq->view; | ||
330 | if (rq->rc != 0) { | 329 | if (rq->rc != 0) { |
331 | /* Write wasn't successful. Refresh all. */ | 330 | /* Write wasn't successful. Refresh all. */ |
332 | tp->update_flags = TTY_UPDATE_ALL; | 331 | tp->update_flags = TTY_UPDATE_ALL; |
@@ -537,11 +536,10 @@ static void | |||
537 | tty3270_read_tasklet(struct raw3270_request *rrq) | 536 | tty3270_read_tasklet(struct raw3270_request *rrq) |
538 | { | 537 | { |
539 | static char kreset_data = TW_KR; | 538 | static char kreset_data = TW_KR; |
540 | struct tty3270 *tp; | 539 | struct tty3270 *tp = container_of(rrq->view, struct tty3270, view); |
541 | char *input; | 540 | char *input; |
542 | int len; | 541 | int len; |
543 | 542 | ||
544 | tp = (struct tty3270 *) rrq->view; | ||
545 | spin_lock_bh(&tp->view.lock); | 543 | spin_lock_bh(&tp->view.lock); |
546 | /* | 544 | /* |
547 | * Two AID keys are special: For 0x7d (enter) the input line | 545 | * Two AID keys are special: For 0x7d (enter) the input line |
@@ -596,9 +594,10 @@ tty3270_read_tasklet(struct raw3270_request *rrq) | |||
596 | static void | 594 | static void |
597 | tty3270_read_callback(struct raw3270_request *rq, void *data) | 595 | tty3270_read_callback(struct raw3270_request *rq, void *data) |
598 | { | 596 | { |
597 | struct tty3270 *tp = container_of(rq->view, struct tty3270, view); | ||
599 | raw3270_get_view(rq->view); | 598 | raw3270_get_view(rq->view); |
600 | /* Schedule tasklet to pass input to tty. */ | 599 | /* Schedule tasklet to pass input to tty. */ |
601 | tasklet_schedule(&((struct tty3270 *) rq->view)->readlet); | 600 | tasklet_schedule(&tp->readlet); |
602 | } | 601 | } |
603 | 602 | ||
604 | /* | 603 | /* |
@@ -635,9 +634,8 @@ tty3270_issue_read(struct tty3270 *tp, int lock) | |||
635 | static int | 634 | static int |
636 | tty3270_activate(struct raw3270_view *view) | 635 | tty3270_activate(struct raw3270_view *view) |
637 | { | 636 | { |
638 | struct tty3270 *tp; | 637 | struct tty3270 *tp = container_of(view, struct tty3270, view); |
639 | 638 | ||
640 | tp = (struct tty3270 *) view; | ||
641 | tp->update_flags = TTY_UPDATE_ALL; | 639 | tp->update_flags = TTY_UPDATE_ALL; |
642 | tty3270_set_timer(tp, 1); | 640 | tty3270_set_timer(tp, 1); |
643 | return 0; | 641 | return 0; |
@@ -646,9 +644,8 @@ tty3270_activate(struct raw3270_view *view) | |||
646 | static void | 644 | static void |
647 | tty3270_deactivate(struct raw3270_view *view) | 645 | tty3270_deactivate(struct raw3270_view *view) |
648 | { | 646 | { |
649 | struct tty3270 *tp; | 647 | struct tty3270 *tp = container_of(view, struct tty3270, view); |
650 | 648 | ||
651 | tp = (struct tty3270 *) view; | ||
652 | del_timer(&tp->timer); | 649 | del_timer(&tp->timer); |
653 | } | 650 | } |
654 | 651 | ||
@@ -804,10 +801,9 @@ tty3270_free_screen(struct tty3270 *tp) | |||
804 | static void | 801 | static void |
805 | tty3270_release(struct raw3270_view *view) | 802 | tty3270_release(struct raw3270_view *view) |
806 | { | 803 | { |
807 | struct tty3270 *tp; | 804 | struct tty3270 *tp = container_of(view, struct tty3270, view); |
808 | struct tty_struct *tty; | 805 | struct tty_struct *tty; |
809 | 806 | ||
810 | tp = (struct tty3270 *) view; | ||
811 | tty = tp->tty; | 807 | tty = tp->tty; |
812 | if (tty) { | 808 | if (tty) { |
813 | tty->driver_data = NULL; | 809 | tty->driver_data = NULL; |
@@ -823,8 +819,9 @@ tty3270_release(struct raw3270_view *view) | |||
823 | static void | 819 | static void |
824 | tty3270_free(struct raw3270_view *view) | 820 | tty3270_free(struct raw3270_view *view) |
825 | { | 821 | { |
826 | tty3270_free_screen((struct tty3270 *) view); | 822 | struct tty3270 *tp = container_of(view, struct tty3270, view); |
827 | tty3270_free_view((struct tty3270 *) view); | 823 | tty3270_free_screen(tp); |
824 | tty3270_free_view(tp); | ||
828 | } | 825 | } |
829 | 826 | ||
830 | /* | 827 | /* |
@@ -833,14 +830,13 @@ tty3270_free(struct raw3270_view *view) | |||
833 | static void | 830 | static void |
834 | tty3270_del_views(void) | 831 | tty3270_del_views(void) |
835 | { | 832 | { |
836 | struct tty3270 *tp; | ||
837 | int i; | 833 | int i; |
838 | 834 | ||
839 | for (i = 0; i < tty3270_max_index; i++) { | 835 | for (i = 0; i < tty3270_max_index; i++) { |
840 | tp = (struct tty3270 *) | 836 | struct raw3270_view *view = |
841 | raw3270_find_view(&tty3270_fn, i + RAW3270_FIRSTMINOR); | 837 | raw3270_find_view(&tty3270_fn, i + RAW3270_FIRSTMINOR); |
842 | if (!IS_ERR(tp)) | 838 | if (!IS_ERR(view)) |
843 | raw3270_del_view(&tp->view); | 839 | raw3270_del_view(view); |
844 | } | 840 | } |
845 | } | 841 | } |
846 | 842 | ||
@@ -858,16 +854,17 @@ static struct raw3270_fn tty3270_fn = { | |||
858 | static int | 854 | static int |
859 | tty3270_open(struct tty_struct *tty, struct file * filp) | 855 | tty3270_open(struct tty_struct *tty, struct file * filp) |
860 | { | 856 | { |
857 | struct raw3270_view *view; | ||
861 | struct tty3270 *tp; | 858 | struct tty3270 *tp; |
862 | int i, rc; | 859 | int i, rc; |
863 | 860 | ||
864 | if (tty->count > 1) | 861 | if (tty->count > 1) |
865 | return 0; | 862 | return 0; |
866 | /* Check if the tty3270 is already there. */ | 863 | /* Check if the tty3270 is already there. */ |
867 | tp = (struct tty3270 *) | 864 | view = raw3270_find_view(&tty3270_fn, |
868 | raw3270_find_view(&tty3270_fn, | ||
869 | tty->index + RAW3270_FIRSTMINOR); | 865 | tty->index + RAW3270_FIRSTMINOR); |
870 | if (!IS_ERR(tp)) { | 866 | if (!IS_ERR(view)) { |
867 | tp = container_of(view, struct tty3270, view); | ||
871 | tty->driver_data = tp; | 868 | tty->driver_data = tp; |
872 | tty->winsize.ws_row = tp->view.rows - 2; | 869 | tty->winsize.ws_row = tp->view.rows - 2; |
873 | tty->winsize.ws_col = tp->view.cols; | 870 | tty->winsize.ws_col = tp->view.cols; |
@@ -881,7 +878,7 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
881 | tty3270_max_index = tty->index + 1; | 878 | tty3270_max_index = tty->index + 1; |
882 | 879 | ||
883 | /* Quick exit if there is no device for tty->index. */ | 880 | /* Quick exit if there is no device for tty->index. */ |
884 | if (PTR_ERR(tp) == -ENODEV) | 881 | if (PTR_ERR(view) == -ENODEV) |
885 | return -ENODEV; | 882 | return -ENODEV; |
886 | 883 | ||
887 | /* Allocate tty3270 structure on first open. */ | 884 | /* Allocate tty3270 structure on first open. */ |
@@ -935,11 +932,10 @@ tty3270_open(struct tty_struct *tty, struct file * filp) | |||
935 | static void | 932 | static void |
936 | tty3270_close(struct tty_struct *tty, struct file * filp) | 933 | tty3270_close(struct tty_struct *tty, struct file * filp) |
937 | { | 934 | { |
938 | struct tty3270 *tp; | 935 | struct tty3270 *tp = tty->driver_data; |
939 | 936 | ||
940 | if (tty->count > 1) | 937 | if (tty->count > 1) |
941 | return; | 938 | return; |
942 | tp = (struct tty3270 *) tty->driver_data; | ||
943 | if (tp) { | 939 | if (tp) { |
944 | tty->driver_data = NULL; | 940 | tty->driver_data = NULL; |
945 | tp->tty = tp->kbd->tty = NULL; | 941 | tp->tty = tp->kbd->tty = NULL; |