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>
This commit is contained in:
Remko Lodder 2007-06-26 13:50:48 +00:00
parent 67c4e28638
commit c6feae7224

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);
}
}
}
@ -933,6 +934,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;
@ -958,7 +969,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