Commit 68bb089a authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Linus Torvalds

[PATCH] s390: 3270 console

3270 console driver changes:
 - Add error handling in 3270 device startup.
 - Do halt_io if startup has been interrupted.
 - Fix reference counting in tty timers.
 - Simplify set_timer functions.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 55d21e2b
...@@ -73,14 +73,11 @@ void ...@@ -73,14 +73,11 @@ void
con3270_set_timer(struct con3270 *cp, int expires) con3270_set_timer(struct con3270 *cp, int expires)
{ {
if (expires == 0) { if (expires == 0) {
if (timer_pending(&cp->timer))
del_timer(&cp->timer); del_timer(&cp->timer);
return; return;
} }
if (timer_pending(&cp->timer)) {
if (mod_timer(&cp->timer, jiffies + expires)) if (mod_timer(&cp->timer, jiffies + expires))
return; return;
}
cp->timer.function = (void (*)(unsigned long)) con3270_update; cp->timer.function = (void (*)(unsigned long)) con3270_update;
cp->timer.data = (unsigned long) cp; cp->timer.data = (unsigned long) cp;
cp->timer.expires = jiffies + expires; cp->timer.expires = jiffies + expires;
......
...@@ -347,7 +347,10 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb) ...@@ -347,7 +347,10 @@ raw3270_irq (struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
if (IS_ERR(irb)) if (IS_ERR(irb))
rc = RAW3270_IO_RETRY; rc = RAW3270_IO_RETRY;
else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END | else if (irb->scsw.fctl & SCSW_FCTL_HALT_FUNC) {
rq->rc = -EIO;
rc = RAW3270_IO_DONE;
} else if (irb->scsw.dstat == (DEV_STAT_CHN_END | DEV_STAT_DEV_END |
DEV_STAT_UNIT_EXCEP)) { DEV_STAT_UNIT_EXCEP)) {
/* Handle CE-DE-UE and subsequent UDE */ /* Handle CE-DE-UE and subsequent UDE */
set_bit(RAW3270_FLAGS_BUSY, &rp->flags); set_bit(RAW3270_FLAGS_BUSY, &rp->flags);
...@@ -552,6 +555,8 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view, ...@@ -552,6 +555,8 @@ raw3270_start_init(struct raw3270 *rp, struct raw3270_view *view,
rc = wait_event_interruptible(wq, raw3270_request_final(rq)); rc = wait_event_interruptible(wq, raw3270_request_final(rq));
if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */ if (rc == -ERESTARTSYS) { /* Interrupted by a signal. */
raw3270_halt_io(view->dev, rq); raw3270_halt_io(view->dev, rq);
/* No wait for the halt to complete. */
wait_event(wq, raw3270_request_final(rq));
return -ERESTARTSYS; return -ERESTARTSYS;
} }
return rq->rc; return rq->rc;
...@@ -809,9 +814,15 @@ raw3270_setup_console(struct ccw_device *cdev) ...@@ -809,9 +814,15 @@ raw3270_setup_console(struct ccw_device *cdev)
if (rc) if (rc)
return ERR_PTR(rc); return ERR_PTR(rc);
set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags); set_bit(RAW3270_FLAGS_CONSOLE, &rp->flags);
raw3270_reset_device(rp); rc = raw3270_reset_device(rp);
raw3270_size_device(rp); if (rc)
raw3270_reset_device(rp); return ERR_PTR(rc);
rc = raw3270_size_device(rp);
if (rc)
return ERR_PTR(rc);
rc = raw3270_reset_device(rp);
if (rc)
return ERR_PTR(rc);
set_bit(RAW3270_FLAGS_READY, &rp->flags); set_bit(RAW3270_FLAGS_READY, &rp->flags);
return rp; return rp;
} }
...@@ -1030,7 +1041,7 @@ raw3270_del_view(struct raw3270_view *view) ...@@ -1030,7 +1041,7 @@ raw3270_del_view(struct raw3270_view *view)
} }
spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags); spin_unlock_irqrestore(get_ccwdev_lock(rp->cdev), flags);
/* Wait for reference counter to drop to zero. */ /* Wait for reference counter to drop to zero. */
atomic_sub(2, &view->ref_count); atomic_dec(&view->ref_count);
wait_event(raw3270_wait_queue, atomic_read(&view->ref_count) == 0); wait_event(raw3270_wait_queue, atomic_read(&view->ref_count) == 0);
if (view->fn->free) if (view->fn->free)
view->fn->free(view); view->fn->free(view);
...@@ -1165,13 +1176,20 @@ raw3270_set_online (struct ccw_device *cdev) ...@@ -1165,13 +1176,20 @@ raw3270_set_online (struct ccw_device *cdev)
{ {
struct raw3270 *rp; struct raw3270 *rp;
struct raw3270_notifier *np; struct raw3270_notifier *np;
int rc;
rp = raw3270_create_device(cdev); rp = raw3270_create_device(cdev);
if (IS_ERR(rp)) if (IS_ERR(rp))
return PTR_ERR(rp); return PTR_ERR(rp);
raw3270_reset_device(rp); rc = raw3270_reset_device(rp);
raw3270_size_device(rp); if (rc)
raw3270_reset_device(rp); return rc;
rc = raw3270_size_device(rp);
if (rc)
return rc;
rc = raw3270_reset_device(rp);
if (rc)
return rc;
raw3270_create_attributes(rp); raw3270_create_attributes(rp);
set_bit(RAW3270_FLAGS_READY, &rp->flags); set_bit(RAW3270_FLAGS_READY, &rp->flags);
down(&raw3270_sem); down(&raw3270_sem);
......
...@@ -124,16 +124,12 @@ void ...@@ -124,16 +124,12 @@ void
tty3270_set_timer(struct tty3270 *tp, int expires) tty3270_set_timer(struct tty3270 *tp, int expires)
{ {
if (expires == 0) { if (expires == 0) {
if (timer_pending(&tp->timer)) { if (del_timer(&tp->timer))
raw3270_put_view(&tp->view); raw3270_put_view(&tp->view);
del_timer(&tp->timer);
}
return; return;
} }
if (timer_pending(&tp->timer)) {
if (mod_timer(&tp->timer, jiffies + expires)) if (mod_timer(&tp->timer, jiffies + expires))
return; return;
}
raw3270_get_view(&tp->view); raw3270_get_view(&tp->view);
tp->timer.function = (void (*)(unsigned long)) tty3270_update; tp->timer.function = (void (*)(unsigned long)) tty3270_update;
tp->timer.data = (unsigned long) tp; tp->timer.data = (unsigned long) tp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment