aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char/con3270.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-06-15 06:02:23 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-15 06:02:23 -0400
commit9cbc1cb8cd46ce1f7645b9de249b2ce8460129bb (patch)
tree8d104ec2a459346b99413b0b77421ca7b9936c1a /drivers/s390/char/con3270.c
parentca44d6e60f9de26281fda203f58b570e1748c015 (diff)
parent45e3e1935e2857c54783291107d33323b3ef33c8 (diff)
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/torvalds/linux-2.6
Conflicts: Documentation/feature-removal-schedule.txt drivers/scsi/fcoe/fcoe.c net/core/drop_monitor.c net/core/net-traces.c
Diffstat (limited to 'drivers/s390/char/con3270.c')
-rw-r--r--drivers/s390/char/con3270.c38
1 files changed, 14 insertions, 24 deletions
diff --git a/drivers/s390/char/con3270.c b/drivers/s390/char/con3270.c
index d028d2ee83dd..ed5396dae58e 100644
--- a/drivers/s390/char/con3270.c
+++ b/drivers/s390/char/con3270.c
@@ -64,7 +64,7 @@ static struct con3270 *condev;
64#define CON_UPDATE_ERASE 1 /* Use EWRITEA instead of WRITE. */ 64#define CON_UPDATE_ERASE 1 /* Use EWRITEA instead of WRITE. */
65#define CON_UPDATE_LIST 2 /* Update lines in tty3270->update. */ 65#define CON_UPDATE_LIST 2 /* Update lines in tty3270->update. */
66#define CON_UPDATE_STATUS 4 /* Update status line. */ 66#define CON_UPDATE_STATUS 4 /* Update status line. */
67#define CON_UPDATE_ALL 7 67#define CON_UPDATE_ALL 8 /* Recreate screen. */
68 68
69static void con3270_update(struct con3270 *); 69static void con3270_update(struct con3270 *);
70 70
@@ -73,18 +73,10 @@ static void con3270_update(struct con3270 *);
73 */ 73 */
74static void con3270_set_timer(struct con3270 *cp, int expires) 74static void con3270_set_timer(struct con3270 *cp, int expires)
75{ 75{
76 if (expires == 0) { 76 if (expires == 0)
77 if (timer_pending(&cp->timer)) 77 del_timer(&cp->timer);
78 del_timer(&cp->timer); 78 else
79 return; 79 mod_timer(&cp->timer, jiffies + expires);
80 }
81 if (timer_pending(&cp->timer) &&
82 mod_timer(&cp->timer, jiffies + expires))
83 return;
84 cp->timer.function = (void (*)(unsigned long)) con3270_update;
85 cp->timer.data = (unsigned long) cp;
86 cp->timer.expires = jiffies + expires;
87 add_timer(&cp->timer);
88} 80}
89 81
90/* 82/*
@@ -225,6 +217,12 @@ con3270_update(struct con3270 *cp)
225 217
226 spin_lock_irqsave(&cp->view.lock, flags); 218 spin_lock_irqsave(&cp->view.lock, flags);
227 updated = 0; 219 updated = 0;
220 if (cp->update_flags & CON_UPDATE_ALL) {
221 con3270_rebuild_update(cp);
222 con3270_update_status(cp);
223 cp->update_flags = CON_UPDATE_ERASE | CON_UPDATE_LIST |
224 CON_UPDATE_STATUS;
225 }
228 if (cp->update_flags & CON_UPDATE_ERASE) { 226 if (cp->update_flags & CON_UPDATE_ERASE) {
229 /* Use erase write alternate to initialize display. */ 227 /* Use erase write alternate to initialize display. */
230 raw3270_request_set_cmd(wrq, TC_EWRITEA); 228 raw3270_request_set_cmd(wrq, TC_EWRITEA);
@@ -302,7 +300,6 @@ con3270_read_tasklet(struct raw3270_request *rrq)
302 deactivate = 1; 300 deactivate = 1;
303 break; 301 break;
304 case 0x6d: /* clear: start from scratch. */ 302 case 0x6d: /* clear: start from scratch. */
305 con3270_rebuild_update(cp);
306 cp->update_flags = CON_UPDATE_ALL; 303 cp->update_flags = CON_UPDATE_ALL;
307 con3270_set_timer(cp, 1); 304 con3270_set_timer(cp, 1);
308 break; 305 break;
@@ -382,30 +379,21 @@ con3270_issue_read(struct con3270 *cp)
382static int 379static int
383con3270_activate(struct raw3270_view *view) 380con3270_activate(struct raw3270_view *view)
384{ 381{
385 unsigned long flags;
386 struct con3270 *cp; 382 struct con3270 *cp;
387 383
388 cp = (struct con3270 *) view; 384 cp = (struct con3270 *) view;
389 spin_lock_irqsave(&cp->view.lock, flags);
390 cp->nr_up = 0;
391 con3270_rebuild_update(cp);
392 con3270_update_status(cp);
393 cp->update_flags = CON_UPDATE_ALL; 385 cp->update_flags = CON_UPDATE_ALL;
394 con3270_set_timer(cp, 1); 386 con3270_set_timer(cp, 1);
395 spin_unlock_irqrestore(&cp->view.lock, flags);
396 return 0; 387 return 0;
397} 388}
398 389
399static void 390static void
400con3270_deactivate(struct raw3270_view *view) 391con3270_deactivate(struct raw3270_view *view)
401{ 392{
402 unsigned long flags;
403 struct con3270 *cp; 393 struct con3270 *cp;
404 394
405 cp = (struct con3270 *) view; 395 cp = (struct con3270 *) view;
406 spin_lock_irqsave(&cp->view.lock, flags);
407 del_timer(&cp->timer); 396 del_timer(&cp->timer);
408 spin_unlock_irqrestore(&cp->view.lock, flags);
409} 397}
410 398
411static int 399static int
@@ -504,6 +492,7 @@ con3270_write(struct console *co, const char *str, unsigned int count)
504 con3270_cline_end(cp); 492 con3270_cline_end(cp);
505 } 493 }
506 /* Setup timer to output current console buffer after 1/10 second */ 494 /* Setup timer to output current console buffer after 1/10 second */
495 cp->nr_up = 0;
507 if (cp->view.dev && !timer_pending(&cp->timer)) 496 if (cp->view.dev && !timer_pending(&cp->timer))
508 con3270_set_timer(cp, HZ/10); 497 con3270_set_timer(cp, HZ/10);
509 spin_unlock_irqrestore(&cp->view.lock,flags); 498 spin_unlock_irqrestore(&cp->view.lock,flags);
@@ -624,7 +613,8 @@ con3270_init(void)
624 613
625 INIT_LIST_HEAD(&condev->lines); 614 INIT_LIST_HEAD(&condev->lines);
626 INIT_LIST_HEAD(&condev->update); 615 INIT_LIST_HEAD(&condev->update);
627 init_timer(&condev->timer); 616 setup_timer(&condev->timer, (void (*)(unsigned long)) con3270_update,
617 (unsigned long) condev);
628 tasklet_init(&condev->readlet, 618 tasklet_init(&condev->readlet,
629 (void (*)(unsigned long)) con3270_read_tasklet, 619 (void (*)(unsigned long)) con3270_read_tasklet,
630 (unsigned long) condev->read); 620 (unsigned long) condev->read);