aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/ia64/hp/sim/simserial.c64
1 files changed, 5 insertions, 59 deletions
diff --git a/arch/ia64/hp/sim/simserial.c b/arch/ia64/hp/sim/simserial.c
index b3ec91c9fc71..e9c5fb7b923d 100644
--- a/arch/ia64/hp/sim/simserial.c
+++ b/arch/ia64/hp/sim/simserial.c
@@ -473,9 +473,10 @@ static void rs_hangup(struct tty_struct *tty)
473} 473}
474 474
475 475
476static int startup(struct tty_struct *tty, struct serial_state *state) 476static int activate(struct tty_port *port, struct tty_struct *tty)
477{ 477{
478 struct tty_port *port = &state->port; 478 struct serial_state *state = container_of(port, struct serial_state,
479 port);
479 unsigned long flags; 480 unsigned long flags;
480 int retval=0; 481 int retval=0;
481 unsigned long page; 482 unsigned long page;
@@ -486,20 +487,11 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
486 487
487 local_irq_save(flags); 488 local_irq_save(flags);
488 489
489 if (port->flags & ASYNC_INITIALIZED) {
490 free_page(page);
491 goto errout;
492 }
493
494 if (state->xmit.buf) 490 if (state->xmit.buf)
495 free_page(page); 491 free_page(page);
496 else 492 else
497 state->xmit.buf = (unsigned char *) page; 493 state->xmit.buf = (unsigned char *) page;
498 494
499#ifdef SIMSERIAL_DEBUG
500 printk("startup: ttys%d (irq %d)...", state->line, state->irq);
501#endif
502
503 /* 495 /*
504 * Allocate the IRQ if necessary 496 * Allocate the IRQ if necessary
505 */ 497 */
@@ -510,18 +502,8 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
510 goto errout; 502 goto errout;
511 } 503 }
512 504
513 clear_bit(TTY_IO_ERROR, &tty->flags);
514
515 state->xmit.head = state->xmit.tail = 0; 505 state->xmit.head = state->xmit.tail = 0;
516 506
517#if 0
518 /*
519 * Set up serial timers...
520 */
521 timer_table[RS_TIMER].expires = jiffies + 2*HZ/100;
522 timer_active |= 1 << RS_TIMER;
523#endif
524
525 /* 507 /*
526 * Set up the tty->alt_speed kludge 508 * Set up the tty->alt_speed kludge
527 */ 509 */
@@ -534,10 +516,6 @@ static int startup(struct tty_struct *tty, struct serial_state *state)
534 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP) 516 if ((port->flags & ASYNC_SPD_MASK) == ASYNC_SPD_WARP)
535 tty->alt_speed = 460800; 517 tty->alt_speed = 460800;
536 518
537 port->flags |= ASYNC_INITIALIZED;
538 local_irq_restore(flags);
539 return 0;
540
541errout: 519errout:
542 local_irq_restore(flags); 520 local_irq_restore(flags);
543 return retval; 521 return retval;
@@ -554,41 +532,11 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
554{ 532{
555 struct serial_state *info = rs_table + tty->index; 533 struct serial_state *info = rs_table + tty->index;
556 struct tty_port *port = &info->port; 534 struct tty_port *port = &info->port;
557 int retval;
558 535
559 port->count++;
560 tty_port_tty_set(port, tty);
561 tty->driver_data = info; 536 tty->driver_data = info;
562 tty->port = port;
563
564#ifdef SIMSERIAL_DEBUG
565 printk("rs_open %s, count = %d\n", tty->name, port->count);
566#endif
567 tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0; 537 tty->low_latency = (port->flags & ASYNC_LOW_LATENCY) ? 1 : 0;
568 538
569 /* 539 /*
570 * If the port is the middle of closing, bail out now
571 */
572 if (tty_hung_up_p(filp) || (port->flags & ASYNC_CLOSING)) {
573 if (port->flags & ASYNC_CLOSING)
574 interruptible_sleep_on(&port->close_wait);
575#ifdef SERIAL_DO_RESTART
576 return ((port->flags & ASYNC_HUP_NOTIFY) ?
577 -EAGAIN : -ERESTARTSYS);
578#else
579 return -EAGAIN;
580#endif
581 }
582
583 /*
584 * Start up serial port
585 */
586 retval = startup(tty, info);
587 if (retval) {
588 return retval;
589 }
590
591 /*
592 * figure out which console to use (should be one already) 540 * figure out which console to use (should be one already)
593 */ 541 */
594 console = console_drivers; 542 console = console_drivers;
@@ -597,10 +545,7 @@ static int rs_open(struct tty_struct *tty, struct file * filp)
597 console = console->next; 545 console = console->next;
598 } 546 }
599 547
600#ifdef SIMSERIAL_DEBUG 548 return tty_port_open(port, tty, filp);
601 printk("rs_open ttys%d successful\n", info->line);
602#endif
603 return 0;
604} 549}
605 550
606/* 551/*
@@ -669,6 +614,7 @@ static const struct tty_operations hp_ops = {
669}; 614};
670 615
671static const struct tty_port_operations hp_port_ops = { 616static const struct tty_port_operations hp_port_ops = {
617 .activate = activate,
672}; 618};
673 619
674/* 620/*