? ID ? nhusb.diff Index: moscom.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/moscom.c,v retrieving revision 1.11 diff -p -u -r1.11 moscom.c --- moscom.c 26 Jun 2017 20:36:01 -0000 1.11 +++ moscom.c 4 May 2019 06:30:02 -0000 @@ -156,14 +156,10 @@ int moscom_open(void *, int); int moscom_cmd(struct moscom_softc *, int, int); struct ucom_methods moscom_methods = { - .ucom_get_status = NULL, .ucom_set = moscom_set, .ucom_param = moscom_param, - .ucom_ioctl = NULL, .ucom_open = moscom_open, .ucom_close = NULL, - .ucom_read = NULL, - .ucom_write = NULL, }; static const struct usb_devno moscom_devs[] = { Index: u3g.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/u3g.c,v retrieving revision 1.35 diff -p -u -r1.35 u3g.c --- u3g.c 24 Jul 2018 08:15:57 -0000 1.35 +++ u3g.c 4 May 2019 06:30:02 -0000 @@ -166,8 +166,6 @@ static void u3g_write(void *, int, u_cha struct ucom_methods u3g_methods = { .ucom_get_status = u3g_get_status, .ucom_set = u3g_set, - .ucom_param = NULL, - .ucom_ioctl = NULL, .ucom_open = u3g_open, .ucom_close = u3g_close, .ucom_read = u3g_read, @@ -542,10 +540,8 @@ u3g_get_status(void *arg, int portno, u_ { struct u3g_softc *sc = arg; - if (lsr != NULL) - *lsr = 0; /* LSR isn't supported */ - if (msr != NULL) - *msr = sc->sc_com[portno].c_msr; + *lsr = 0; /* LSR isn't supported */ + *msr = sc->sc_com[portno].c_msr; } /*ARGSUSED*/ Index: uark.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uark.c,v retrieving revision 1.12 diff -p -u -r1.12 uark.c --- uark.c 22 Jan 2019 06:47:20 -0000 1.12 +++ uark.c 4 May 2019 06:30:02 -0000 @@ -88,11 +88,6 @@ struct ucom_methods uark_methods = { .ucom_get_status = uark_get_status, .ucom_set = uark_set, .ucom_param = uark_param, - .ucom_ioctl = NULL, - .ucom_open = NULL, - .ucom_close = NULL, - .ucom_read = NULL, - .ucom_write = NULL, }; static const struct usb_devno uark_devs[] = { @@ -325,10 +320,8 @@ uark_get_status(void *vsc, int portno, u { struct uark_softc *sc = vsc; - if (msr != NULL) - *msr = sc->sc_msr; - if (lsr != NULL) - *lsr = sc->sc_lsr; + *msr = sc->sc_msr; + *lsr = sc->sc_lsr; } void Index: ubsa.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ubsa.c,v retrieving revision 1.35 diff -p -u -r1.35 ubsa.c --- ubsa.c 22 Jan 2019 06:47:20 -0000 1.35 +++ ubsa.c 4 May 2019 06:30:02 -0000 @@ -102,11 +102,8 @@ struct ucom_methods ubsa_methods = { .ucom_get_status = ubsa_get_status, .ucom_set = ubsa_set, .ucom_param = ubsa_param, - .ucom_ioctl = NULL, .ucom_open = ubsa_open, .ucom_close = ubsa_close, - .ucom_read = NULL, - .ucom_write = NULL }; Static const struct usb_devno ubsa_devs[] = { Index: ubsa_common.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ubsa_common.c,v retrieving revision 1.10 diff -p -u -r1.10 ubsa_common.c --- ubsa_common.c 23 Apr 2016 10:15:32 -0000 1.10 +++ ubsa_common.c 4 May 2019 06:30:02 -0000 @@ -436,9 +436,7 @@ ubsa_get_status(void *addr, int portno, DPRINTF(("ubsa_get_status\n")); - if (lsr != NULL) - *lsr = sc->sc_lsr; - if (msr != NULL) - *msr = sc->sc_msr; + *lsr = sc->sc_lsr; + *msr = sc->sc_msr; } Index: uchcom.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uchcom.c,v retrieving revision 1.29 diff -p -u -r1.29 uchcom.c --- uchcom.c 27 Apr 2019 01:23:26 -0000 1.29 +++ uchcom.c 4 May 2019 06:30:02 -0000 @@ -192,11 +192,8 @@ struct ucom_methods uchcom_methods = { .ucom_get_status = uchcom_get_status, .ucom_set = uchcom_set, .ucom_param = uchcom_param, - .ucom_ioctl = NULL, .ucom_open = uchcom_open, .ucom_close = uchcom_close, - .ucom_read = NULL, - .ucom_write = NULL, }; int uchcom_match(device_t, cfdata_t, void *); Index: ucomvar.h =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ucomvar.h,v retrieving revision 1.21 diff -p -u -r1.21 ucomvar.h --- ucomvar.h 23 Apr 2016 10:15:32 -0000 1.21 +++ ucomvar.h 4 May 2019 06:30:02 -0000 @@ -36,18 +36,51 @@ struct ucom_softc; +/* + * The first argument to the ucom callbacks is the passed in ucaa_arg + * member of the attach args, typically the parent softc pointer. + * + * All of these are optional. + */ struct ucom_methods { + /* + * arg2: port number + * arg3: pointer to lsr (always non NULL) + * arg4: pointer to msr (always non NULL) + */ void (*ucom_get_status)(void *, int, u_char *, u_char *); + /* + * arg2: port number + * arg3: value to turn on or off (DTR, RTS, BREAK) + * arg4: onoff + */ void (*ucom_set)(void *, int, int, int); #define UCOM_SET_DTR 1 #define UCOM_SET_RTS 2 #define UCOM_SET_BREAK 3 + /* + * arg2: port number + * arg3: termios structure to set parameters from + */ int (*ucom_param)(void *, int, struct termios *); + /* + * arg2: port number + * arg3: ioctl command + * arg4: ioctl data + * arg5: ioctl flags + * arg6: process calling ioctl + */ int (*ucom_ioctl)(void *, int, u_long, void *, int, proc_t *); + /* arg2: port number */ int (*ucom_open)(void *, int); + /* arg2: port number */ void (*ucom_close)(void *, int); /* - * Note: The 'ptr' (2nd arg) and 'count' (3rd arg) pointers can be + * arg2: port number + * arg3: pointer to buffer pointer + * arg4: pointer to buffer count + * + * Note: The 'ptr' (3nd arg) and 'count' (4rd arg) pointers can be * adjusted as follows: * * ptr: If consuming characters from the start of the buffer, @@ -60,6 +93,12 @@ struct ucom_methods { * If consuming all characters, set '*count' to zero. */ void (*ucom_read)(void *, int, u_char **, uint32_t *); + /* + * arg2: port number + * arg3: pointer to source buffer + * arg4: pointer to destination buffer + * arg5: pointer to buffer count + */ void (*ucom_write)(void *, int, u_char *, u_char *, uint32_t *); }; Index: uftdi.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uftdi.c,v retrieving revision 1.67 diff -p -u -r1.67 uftdi.c --- uftdi.c 20 Feb 2018 15:48:37 -0000 1.67 +++ uftdi.c 4 May 2019 06:30:02 -0000 @@ -104,15 +104,13 @@ Static void uftdi_set(void *, int, int, Static int uftdi_param(void *, int, struct termios *); Static int uftdi_open(void *, int); Static void uftdi_read(void *, int, u_char **, uint32_t *); -Static void uftdi_write(void *, int, u_char *, u_char *, - uint32_t *); +Static void uftdi_write(void *, int, u_char *, u_char *, uint32_t *); Static void uftdi_break(void *, int, int); struct ucom_methods uftdi_methods = { .ucom_get_status = uftdi_get_status, .ucom_set = uftdi_set, .ucom_param = uftdi_param, - .ucom_ioctl = NULL, .ucom_open = uftdi_open, .ucom_close = NULL, .ucom_read = uftdi_read, @@ -621,10 +619,8 @@ uftdi_get_status(void *vsc, int portno, DPRINTF(("uftdi_status: msr=0x%02x lsr=0x%02x\n", sc->sc_msr, sc->sc_lsr)); - if (msr != NULL) - *msr = sc->sc_msr; - if (lsr != NULL) - *lsr = sc->sc_lsr; + *msr = sc->sc_msr; + *lsr = sc->sc_lsr; } void Index: ugensa.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ugensa.c,v retrieving revision 1.36 diff -p -u -r1.36 ugensa.c --- ugensa.c 24 Jul 2018 08:15:57 -0000 1.36 +++ ugensa.c 4 May 2019 06:30:02 -0000 @@ -73,13 +73,6 @@ struct ugensa_softc { struct ucom_methods ugensa_methods = { .ucom_get_status = NULL, - .ucom_set = NULL, - .ucom_param = NULL, - .ucom_ioctl = NULL, - .ucom_open = NULL, - .ucom_close = NULL, - .ucom_read = NULL, - .ucom_write = NULL, }; #define UGENSA_CONFIG_INDEX 0 Index: uhmodem.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uhmodem.c,v retrieving revision 1.15 diff -p -u -r1.15 uhmodem.c --- uhmodem.c 25 Nov 2016 12:56:29 -0000 1.15 +++ uhmodem.c 4 May 2019 06:30:02 -0000 @@ -142,11 +142,8 @@ struct ucom_methods uhmodem_methods = { .ucom_get_status = ubsa_get_status, .ucom_set = ubsa_set, .ucom_param = ubsa_param, - .ucom_ioctl = NULL, .ucom_open = uhmodem_open, .ucom_close = ubsa_close, - .ucom_read = NULL, - .ucom_write = NULL }; struct uhmodem_type { Index: uipaq.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uipaq.c,v retrieving revision 1.22 diff -p -u -r1.22 uipaq.c --- uipaq.c 25 Nov 2016 12:56:29 -0000 1.22 +++ uipaq.c 4 May 2019 06:30:02 -0000 @@ -105,14 +105,7 @@ Static void uipaq_break(struct uipaq_sof struct ucom_methods uipaq_methods = { - .ucom_get_status = NULL, .ucom_set = uipaq_set, - .ucom_param = NULL, - .ucom_ioctl = NULL, - .ucom_open = NULL, - .ucom_close = NULL, - .ucom_read = NULL, - .ucom_write = NULL, }; struct uipaq_type { Index: ukyopon.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/ukyopon.c,v retrieving revision 1.20 diff -p -u -r1.20 ukyopon.c --- ukyopon.c 22 Jan 2019 06:47:20 -0000 1.20 +++ ukyopon.c 4 May 2019 06:30:02 -0000 @@ -96,8 +96,6 @@ Static struct ucom_methods ukyopon_metho .ucom_ioctl = ukyopon_ioctl, .ucom_open = umodem_open, .ucom_close = umodem_close, - .ucom_read = NULL, - .ucom_write = NULL, }; int ukyopon_match(device_t, cfdata_t, void *); Index: umct.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/umct.c,v retrieving revision 1.36 diff -p -u -r1.36 umct.c --- umct.c 25 Nov 2016 12:56:29 -0000 1.36 +++ umct.c 4 May 2019 06:30:02 -0000 @@ -131,11 +131,8 @@ struct ucom_methods umct_methods = { .ucom_get_status = umct_get_status, .ucom_set = umct_set, .ucom_param = umct_param, - .ucom_ioctl = NULL, .ucom_open = umct_open, .ucom_close = umct_close, - .ucom_read = NULL, - .ucom_write = NULL, }; static const struct usb_devno umct_devs[] = { @@ -633,8 +630,6 @@ umct_get_status(void *addr, int portno, DPRINTF(("umct_get_status:\n")); - if (lsr != NULL) - *lsr = sc->sc_lsr; - if (msr != NULL) - *msr = sc->sc_msr; + *lsr = sc->sc_lsr; + *msr = sc->sc_msr; } Index: umodem.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v retrieving revision 1.69 diff -p -u -r1.69 umodem.c --- umodem.c 7 Jul 2016 06:55:42 -0000 1.69 +++ umodem.c 4 May 2019 06:30:02 -0000 @@ -77,8 +77,6 @@ Static struct ucom_methods umodem_method .ucom_ioctl = umodem_ioctl, .ucom_open = umodem_open, .ucom_close = umodem_close, - .ucom_read = NULL, - .ucom_write = NULL, }; int umodem_match(device_t, cfdata_t, void *); Index: umodem_common.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/umodem_common.c,v retrieving revision 1.27 diff -p -u -r1.27 umodem_common.c --- umodem_common.c 20 Apr 2019 05:53:18 -0000 1.27 +++ umodem_common.c 4 May 2019 06:30:02 -0000 @@ -454,10 +454,8 @@ umodem_get_status(void *addr, int portno DPRINTF(("umodem_get_status:\n")); - if (lsr != NULL) - *lsr = sc->sc_lsr; - if (msr != NULL) - *msr = sc->sc_msr; + *lsr = sc->sc_lsr; + *msr = sc->sc_msr; } int Index: uplcom.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uplcom.c,v retrieving revision 1.80 diff -p -u -r1.80 uplcom.c --- uplcom.c 4 Dec 2016 10:12:35 -0000 1.80 +++ uplcom.c 4 May 2019 06:30:02 -0000 @@ -146,8 +146,6 @@ struct ucom_methods uplcom_methods = { .ucom_ioctl = NULL, /* TODO */ .ucom_open = uplcom_open, .ucom_close = uplcom_close, - .ucom_read = NULL, - .ucom_write = NULL, }; static const struct usb_devno uplcom_devs[] = { @@ -883,10 +881,8 @@ uplcom_get_status(void *addr, int portno DPRINTF(("uplcom_get_status:\n")); - if (lsr != NULL) - *lsr = sc->sc_lsr; - if (msr != NULL) - *msr = sc->sc_msr; + *lsr = sc->sc_lsr; + *msr = sc->sc_msr; } #if TODO Index: uslsa.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uslsa.c,v retrieving revision 1.26 diff -p -u -r1.26 uslsa.c --- uslsa.c 22 Jan 2019 06:47:20 -0000 1.26 +++ uslsa.c 4 May 2019 06:30:02 -0000 @@ -118,8 +118,6 @@ static const struct ucom_methods uslsa_m .ucom_ioctl = uslsa_ioctl, .ucom_open = uslsa_open, .ucom_close = uslsa_close, - .ucom_read = NULL, - .ucom_write = NULL, }; #define USLSA_CONFIG_INDEX 0 @@ -334,17 +332,12 @@ uslsa_get_status(void *vsc, int portno, DPRINTF((sc->sc_dev, "%s: GET_MDMSTS %#x\n", __func__, mdmsts)); - if (lsr != NULL) { - *lsr = 0; - } + *lsr = 0; - if (msr != NULL) { - *msr = 0; - *msr |= ISSET(mdmsts, SLSA_MDMSTS_CTS) ? UMSR_CTS : 0; - *msr |= ISSET(mdmsts, SLSA_MDMSTS_DSR) ? UMSR_DSR : 0; - *msr |= ISSET(mdmsts, SLSA_MDMSTS_RI) ? UMSR_RI : 0; - *msr |= ISSET(mdmsts, SLSA_MDMSTS_DCD) ? UMSR_DCD : 0; - } + *msr = ISSET(mdmsts, SLSA_MDMSTS_CTS) ? UMSR_CTS : 0; + *msr |= ISSET(mdmsts, SLSA_MDMSTS_DSR) ? UMSR_DSR : 0; + *msr |= ISSET(mdmsts, SLSA_MDMSTS_RI) ? UMSR_RI : 0; + *msr |= ISSET(mdmsts, SLSA_MDMSTS_DCD) ? UMSR_DCD : 0; } static void Index: uvisor.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uvisor.c,v retrieving revision 1.48 diff -p -u -r1.48 uvisor.c --- uvisor.c 25 Nov 2016 12:56:29 -0000 1.48 +++ uvisor.c 4 May 2019 06:30:02 -0000 @@ -153,14 +153,7 @@ Static void uvisor_close(void *, int); struct ucom_methods uvisor_methods = { - .ucom_param = NULL, - .ucom_ioctl = NULL, - .ucom_open = NULL, .ucom_close = uvisor_close, - .ucom_read = NULL, - .ucom_write = NULL, - .ucom_get_status = NULL, - .ucom_set = NULL, }; struct uvisor_type { Index: uvscom.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/uvscom.c,v retrieving revision 1.32 diff -p -u -r1.32 uvscom.c --- uvscom.c 7 Feb 2019 12:41:03 -0000 1.32 +++ uvscom.c 4 May 2019 06:30:02 -0000 @@ -195,8 +195,6 @@ struct ucom_methods uvscom_methods = { .ucom_ioctl = NULL, /* TODO */ .ucom_open = uvscom_open, .ucom_close = uvscom_close, - .ucom_read = NULL, - .ucom_write = NULL }; static const struct usb_devno uvscom_devs [] = { @@ -859,9 +857,7 @@ uvscom_get_status(void *addr, int portno { struct uvscom_softc *sc = addr; - if (lsr != NULL) - *lsr = sc->sc_lsr; - if (msr != NULL) - *msr = sc->sc_msr; + *lsr = sc->sc_lsr; + *msr = sc->sc_msr; }