Fix duplicate sc_dying usage.

All drivers which depend on ucom interfaces should use only one
sc_dying.
This commit is contained in:
Shunsuke Akiyama 2003-03-09 11:19:18 +00:00
parent 5ce609f75b
commit 86aa13bdbf
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112039
2 changed files with 8 additions and 13 deletions

View file

@ -115,8 +115,6 @@ struct uftdi_softc {
u_char sc_msr; u_char sc_msr;
u_char sc_lsr; u_char sc_lsr;
u_char sc_dying;
u_int last_lcr; u_int last_lcr;
}; };
@ -289,7 +287,7 @@ uftdi_activate(device_ptr_t self, enum devact act)
case DVACT_DEACTIVATE: case DVACT_DEACTIVATE:
if (sc->sc_subdev != NULL) if (sc->sc_subdev != NULL)
rv = config_deactivate(sc->sc_subdev); rv = config_deactivate(sc->sc_subdev);
sc->sc_dying = 1; sc->sc_ucom.sc_dying = 1;
break; break;
} }
return (rv); return (rv);
@ -303,7 +301,7 @@ USB_DETACH(uftdi)
int rv = 0; int rv = 0;
DPRINTF(("uftdi_detach: sc=%p\n", sc)); DPRINTF(("uftdi_detach: sc=%p\n", sc));
sc->sc_dying = 1; sc->sc_ucom.sc_dying = 1;
rv = ucom_detach(&sc->sc_ucom); rv = ucom_detach(&sc->sc_ucom);
return rv; return rv;
@ -313,14 +311,14 @@ Static int
uftdi_open(void *vsc, int portno) uftdi_open(void *vsc, int portno)
{ {
struct uftdi_softc *sc = vsc; struct uftdi_softc *sc = vsc;
struct ucom_softc *ucom = (struct ucom_softc *) vsc; struct ucom_softc *ucom = &sc->sc_ucom;
usb_device_request_t req; usb_device_request_t req;
usbd_status err; usbd_status err;
struct termios t; struct termios t;
DPRINTF(("uftdi_open: sc=%p\n", sc)); DPRINTF(("uftdi_open: sc=%p\n", sc));
if (sc->sc_dying) if (ucom->sc_dying)
return (EIO); return (EIO);
/* Perform a full reset on the device */ /* Perform a full reset on the device */
@ -439,14 +437,14 @@ Static int
uftdi_param(void *vsc, int portno, struct termios *t) uftdi_param(void *vsc, int portno, struct termios *t)
{ {
struct uftdi_softc *sc = vsc; struct uftdi_softc *sc = vsc;
struct ucom_softc *ucom = vsc; struct ucom_softc *ucom = &sc->sc_ucom;
usb_device_request_t req; usb_device_request_t req;
usbd_status err; usbd_status err;
int rate=0, data, flow; int rate=0, data, flow;
DPRINTF(("uftdi_param: sc=%p\n", sc)); DPRINTF(("uftdi_param: sc=%p\n", sc));
if (sc->sc_dying) if (ucom->sc_dying)
return (EIO); return (EIO);
switch (sc->sc_type) { switch (sc->sc_type) {

View file

@ -145,7 +145,6 @@ struct umodem_softc {
u_char sc_rts; /* current RTS state */ u_char sc_rts; /* current RTS state */
u_char sc_opening; /* lock during open */ u_char sc_opening; /* lock during open */
u_char sc_dying; /* disconnecting */
int sc_ctl_notify; /* Notification endpoint */ int sc_ctl_notify; /* Notification endpoint */
usbd_pipe_handle sc_notify_pipe; /* Notification pipe */ usbd_pipe_handle sc_notify_pipe; /* Notification pipe */
@ -391,7 +390,6 @@ USB_ATTACH(umodem)
bad: bad:
ucom->sc_dying = 1; ucom->sc_dying = 1;
sc->sc_dying = 1;
free(devinfo, M_USBDEV); free(devinfo, M_USBDEV);
USB_ATTACH_ERROR_RETURN; USB_ATTACH_ERROR_RETURN;
} }
@ -447,7 +445,7 @@ umodem_intr(usbd_xfer_handle xfer, usbd_private_handle priv, usbd_status status)
struct umodem_softc *sc = priv; struct umodem_softc *sc = priv;
u_char mstatus; u_char mstatus;
if (sc->sc_dying) if (sc->sc_ucom.sc_dying)
return; return;
if (status != USBD_NORMAL_COMPLETION) { if (status != USBD_NORMAL_COMPLETION) {
@ -588,7 +586,7 @@ umodem_ioctl(void *addr, int portno, u_long cmd, caddr_t data, int flag,
struct umodem_softc *sc = addr; struct umodem_softc *sc = addr;
int error = 0; int error = 0;
if (sc->sc_dying) if (sc->sc_ucom.sc_dying)
return (EIO); return (EIO);
DPRINTF(("umodemioctl: cmd=0x%08lx\n", cmd)); DPRINTF(("umodemioctl: cmd=0x%08lx\n", cmd));
@ -785,7 +783,6 @@ USB_DETACH(umodem)
usbd_close_pipe(sc->sc_notify_pipe); usbd_close_pipe(sc->sc_notify_pipe);
sc->sc_notify_pipe = NULL; sc->sc_notify_pipe = NULL;
} }
sc->sc_dying = 1;
sc->sc_ucom.sc_dying = 1; sc->sc_ucom.sc_dying = 1;
rv = ucom_detach(&sc->sc_ucom); rv = ucom_detach(&sc->sc_ucom);