PERFORCE change 132101 for review
Hans Petter Selasky
hselasky at FreeBSD.org
Sun Dec 30 06:48:16 PST 2007
http://perforce.freebsd.org/chv.cgi?CH=132101
Change 132101 by hselasky at hselasky_laptop001 on 2007/12/30 14:47:45
Get rid of more error handling code and "uchcom_close_intr_pipe".
Affected files ...
.. //depot/projects/usb/src/sys/dev/usb/uchcom.c#9 edit
Differences ...
==== //depot/projects/usb/src/sys/dev/usb/uchcom.c#9 (text+ko) ====
@@ -493,33 +493,32 @@
return;
}
-static usbd_status
+static void
uchcom_get_version(struct uchcom_softc *sc, uint8_t *rver)
{
uint8_t buf[UCHCOM_INPUT_BUF_SIZE];
- usbd_status err;
uchcom_ctrl_read(
sc, UCHCOM_REQ_GET_VERSION, 0, 0, buf, sizeof(buf));
if (rver) *rver = buf[0];
- return (USBD_NORMAL_COMPLETION);
+ return;
}
-static usbd_status
+static void
uchcom_get_status(struct uchcom_softc *sc, uint8_t *rval)
{
uchcom_read_reg(sc, UCHCOM_REG_STAT1, rval, UCHCOM_REG_STAT2, NULL);
}
-static usbd_status
+static void
uchcom_set_dtrrts_10(struct uchcom_softc *sc, uint8_t val)
{
uchcom_write_reg(sc, UCHCOM_REG_STAT1, val, UCHCOM_REG_STAT1, val);
}
-static usbd_status
+static void
uchcom_set_dtrrts_20(struct uchcom_softc *sc, uint8_t val)
{
uchcom_ctrl_write(sc, UCHCOM_REQ_SET_DTRRTS, val, 0);
@@ -533,16 +532,7 @@
static int
uchcom_update_version(struct uchcom_softc *sc)
{
- usbd_status err;
-
- err = uchcom_get_version(sc, &sc->sc_version);
- if (err) {
- device_printf(sc->sc_ucom.sc_dev, "cannot get version: %s\n",
- usbd_errstr(err));
- return (EIO);
- }
-
- return (0);
+ uchcom_get_version(sc, &sc->sc_version);
}
static void
@@ -555,44 +545,29 @@
sc->sc_msr = (cur << 4) | ((sc->sc_msr >> 4) ^ cur);
}
-static int
+static void
update_status(struct uchcom_softc *sc)
{
- usbd_status err;
uint8_t cur;
- err = uchcom_get_status(sc, &cur);
- if (err) {
- device_printf(sc->sc_ucom.sc_dev,
- "cannot update status: %s\n",
- usbd_errstr(err));
- return (EIO);
- }
+ uchcom_get_status(sc, &cur);
uchcom_convert_status(sc, cur);
-
- return (0);
+ return;
}
static int
uchcom_set_dtrrts(struct uchcom_softc *sc, int dtr, int rts)
{
- usbd_status err;
uint8_t val = 0;
if (dtr) val |= UCHCOM_DTR_MASK;
if (rts) val |= UCHCOM_RTS_MASK;
if (sc->sc_version < UCHCOM_VER_20)
- err = uchcom_set_dtrrts_10(sc, ~val);
+ uchcom_set_dtrrts_10(sc, ~val);
else
- err = uchcom_set_dtrrts_20(sc, ~val);
-
- if (err) {
- device_printf(sc->sc_ucom.sc_dev, "cannot set DTR/RTS: %s\n",
- usbd_errstr(err));
- return (EIO);
- }
+ uchcom_set_dtrrts_20(sc, ~val);
return (0);
}
@@ -600,7 +575,6 @@
static int
uchcom_set_break(struct uchcom_softc *sc, int onoff)
{
- usbd_status err;
uint8_t brk1, brk2;
uchcom_read_reg(sc, UCHCOM_REG_BREAK1, &brk1, UCHCOM_REG_BREAK2, &brk2);
@@ -755,11 +729,6 @@
uchcom_ctrl_write(sc, UCHCOM_REQ_RESET, val, idx);
return (0);
-
-failed:
- device_printf(sc->sc_ucom.sc_dev, "cannot reset: %s\n",
- usbd_errstr(err));
- return (EIO);
}
static int
@@ -827,31 +796,6 @@
return (0);
}
-static void
-uchcom_close_intr_pipe(struct uchcom_softc *sc)
-{
- usbd_status err;
- struct ucom_softc *ucom = &sc->sc_ucom;
- if (ucom->sc_dying)
- return;
-
- if (sc->sc_intr_pipe != NULL) {
- err = usbd_abort_pipe(sc->sc_intr_pipe);
- if (err)
- device_printf(ucom->sc_dev,
- "abort interrupt pipe failed: %s\n",
- usbd_errstr(err));
- err = usbd_close_pipe(sc->sc_intr_pipe);
- if (err)
- device_printf(ucom->sc_dev,
- " close interrupt pipe failed: %s\n",
- usbd_errstr(err));
- free(sc->sc_intr_buf, M_USBDEV);
- sc->sc_intr_pipe = NULL;
- }
-}
-
-
/* ----------------------------------------------------------------------
* methods for ucom
*/
More information about the p4-projects
mailing list