MFC rp.c rev 1.73

Fix Rocketport so that it does not crash the system when a device pointer
  changes for example:

  (From Craig Leres):

  tip to a rocketport line
  run "/etc/rc.d/devfs restart"
  exit tip
  (wait for the system to reboot)

  Thanks to Robert Watson for poking me to fix this.

  PR:		kern/109152
  Approved by:	imp (mentor)
  Approved by:	re (kensmith)
  Reviewed by:	jhb
  Submitted by:	Craig Leres <leres@ee dot lbl dot gov>

Approved by:	imp (mentor, implicit)
This commit is contained in:
remko 2007-07-03 20:35:07 +00:00
parent 136ee0a895
commit c757a99726

View File

@ -573,6 +573,7 @@ static struct rp_port *p_rp_table[MAX_RP_PORTS];
static void rpbreak(struct tty *, int);
static void rpclose(struct tty *tp);
static void rphardclose(struct tty *tp);
static int rpmodem(struct tty *, int, int);
static int rpparam(struct tty *, struct termios *);
static void rpstart(struct tty *);
@ -697,7 +698,7 @@ static void rp_handle_port(struct rp_port *rp)
if((tp->t_state & TS_CARR_ON)) {
(void)ttyld_modem(tp, 0);
if(ttyld_modem(tp, 0) == 0) {
rpclose(tp);
rphardclose(tp);
}
}
}
@ -934,6 +935,16 @@ rpopen(struct tty *tp, struct cdev *dev)
static void
rpclose(struct tty *tp)
{
struct rp_port *rp;
rp = tp->t_sc;
rphardclose(tp);
device_unbusy(rp->rp_ctlp->dev);
}
static void
rphardclose(struct tty *tp)
{
struct rp_port *rp;
CHANNEL_t *cp;
@ -959,7 +970,6 @@ rpclose(struct tty *tp)
tp->t_actout = FALSE;
wakeup(&tp->t_actout);
wakeup(TSA_CARR_ON(tp));
device_unbusy(rp->rp_ctlp->dev);
}
static void