Date: Mon, 30 Apr 2007 20:06:21 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 119019 for review Message-ID: <200704302006.l3UK6LH8083561@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=119019 Change 119019 by hselasky@hselasky_mini_itx on 2007/04/30 20:05:35 usbd_transfer_stop() is NULL safe now. Take advantage of this to reduce amount of code. Affected files ... .. //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#10 edit .. //depot/projects/usb/src/sys/dev/usb/if_aue.c#22 edit .. //depot/projects/usb/src/sys/dev/usb/if_axe.c#21 edit .. //depot/projects/usb/src/sys/dev/usb/if_cdce.c#14 edit .. //depot/projects/usb/src/sys/dev/usb/if_cue.c#17 edit .. //depot/projects/usb/src/sys/dev/usb/if_kue.c#19 edit .. //depot/projects/usb/src/sys/dev/usb/if_rue.c#18 edit .. //depot/projects/usb/src/sys/dev/usb/if_udav.c#18 edit .. //depot/projects/usb/src/sys/dev/usb/if_zyd.c#9 edit .. //depot/projects/usb/src/sys/dev/usb/ubser.c#12 edit .. //depot/projects/usb/src/sys/dev/usb/ugen.c#14 edit .. //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#10 edit Differences ... ==== //depot/projects/usb/src/sys/dev/sound/usb/uaudio.c#10 (text+ko) ==== @@ -1555,14 +1555,8 @@ #if (UAUDIO_NCHANBUFS != 2) #error "please update code" #endif - - if (ch->xfer[0]) { - usbd_transfer_stop(ch->xfer[0]); - } - - if (ch->xfer[1]) { - usbd_transfer_stop(ch->xfer[1]); - } + usbd_transfer_stop(ch->xfer[0]); + usbd_transfer_stop(ch->xfer[1]); return 0; } @@ -3860,12 +3854,8 @@ mtx_lock(&(chan->mtx)); - if (chan->xfer[3]) { - usbd_transfer_stop(chan->xfer[3]); - } - if (chan->xfer[1]) { - usbd_transfer_stop(chan->xfer[1]); - } + usbd_transfer_stop(chan->xfer[3]); + usbd_transfer_stop(chan->xfer[1]); mtx_unlock(&(chan->mtx)); ==== //depot/projects/usb/src/sys/dev/usb/if_aue.c#22 (text+ko) ==== @@ -1633,24 +1633,12 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } - if (sc->sc_xfer[4]) { - usbd_transfer_stop(sc->sc_xfer[4]); - } - if (sc->sc_xfer[5]) { - usbd_transfer_stop(sc->sc_xfer[5]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); + usbd_transfer_stop(sc->sc_xfer[4]); + usbd_transfer_stop(sc->sc_xfer[5]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_axe.c#21 (text+ko) ==== @@ -1588,24 +1588,12 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } - if (sc->sc_xfer[4]) { - usbd_transfer_stop(sc->sc_xfer[4]); - } - if (sc->sc_xfer[5]) { - usbd_transfer_stop(sc->sc_xfer[5]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); + usbd_transfer_stop(sc->sc_xfer[4]); + usbd_transfer_stop(sc->sc_xfer[5]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_cdce.c#14 (text+ko) ==== @@ -605,19 +605,10 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } - + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_cue.c#17 (text+ko) ==== @@ -1034,18 +1034,10 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_kue.c#19 (text+ko) ==== @@ -1053,18 +1053,10 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_rue.c#18 (text+ko) ==== @@ -1458,24 +1458,12 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } - if (sc->sc_xfer[4]) { - usbd_transfer_stop(sc->sc_xfer[4]); - } - if (sc->sc_xfer[5]) { - usbd_transfer_stop(sc->sc_xfer[5]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); + usbd_transfer_stop(sc->sc_xfer[4]); + usbd_transfer_stop(sc->sc_xfer[5]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_udav.c#18 (text+ko) ==== @@ -1249,24 +1249,12 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[0]) { - usbd_transfer_stop(sc->sc_xfer[0]); - } - if (sc->sc_xfer[1]) { - usbd_transfer_stop(sc->sc_xfer[1]); - } - if (sc->sc_xfer[2]) { - usbd_transfer_stop(sc->sc_xfer[2]); - } - if (sc->sc_xfer[3]) { - usbd_transfer_stop(sc->sc_xfer[3]); - } - if (sc->sc_xfer[4]) { - usbd_transfer_stop(sc->sc_xfer[4]); - } - if (sc->sc_xfer[5]) { - usbd_transfer_stop(sc->sc_xfer[5]); - } + usbd_transfer_stop(sc->sc_xfer[0]); + usbd_transfer_stop(sc->sc_xfer[1]); + usbd_transfer_stop(sc->sc_xfer[2]); + usbd_transfer_stop(sc->sc_xfer[3]); + usbd_transfer_stop(sc->sc_xfer[4]); + usbd_transfer_stop(sc->sc_xfer[5]); return; } ==== //depot/projects/usb/src/sys/dev/usb/if_zyd.c#9 (text+ko) ==== @@ -2826,19 +2826,10 @@ /* stop all the transfers, * if not already stopped: */ - if (sc->sc_xfer[ZYD_TR_BULK_DT_WR]) { - usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_WR]); - } - if (sc->sc_xfer[ZYD_TR_BULK_DT_RD]) { - usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_RD]); - } - if (sc->sc_xfer[ZYD_TR_BULK_CS_WR]) { - usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_WR]); - } - if (sc->sc_xfer[ZYD_TR_BULK_CS_RD]) { - usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_RD]); - } - + usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_WR]); + usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_DT_RD]); + usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_WR]); + usbd_transfer_stop(sc->sc_xfer[ZYD_TR_BULK_CS_RD]); return; } ==== //depot/projects/usb/src/sys/dev/usb/ubser.c#12 (text+ko) ==== @@ -365,9 +365,7 @@ */ mtx_lock(&Giant); for (n = 0; n < UBSER_TR_MAX; n++) { - if (sc->sc_xfer[n]) { - usbd_transfer_stop(sc->sc_xfer[n]); - } + usbd_transfer_stop(sc->sc_xfer[n]); } mtx_unlock(&Giant); ==== //depot/projects/usb/src/sys/dev/usb/ugen.c#14 (text+ko) ==== @@ -530,23 +530,11 @@ sce->state |= UGEN_CLOSING; - if(sce->xfer_in[0]) - { - usbd_transfer_stop(sce->xfer_in[0]); - } - if(sce->xfer_in[1]) - { - usbd_transfer_stop(sce->xfer_in[1]); - } - if(sce->xfer_out[0]) - { - usbd_transfer_stop(sce->xfer_out[0]); - } - if(sce->xfer_out[1]) - { - usbd_transfer_stop(sce->xfer_out[1]); - } - + usbd_transfer_stop(sce->xfer_in[0]); + usbd_transfer_stop(sce->xfer_in[1]); + usbd_transfer_stop(sce->xfer_out[0]); + usbd_transfer_stop(sce->xfer_out[1]); + while(sce->state & (UGEN_RD_CFG|UGEN_RD_SLP|UGEN_RD_WUP|UGEN_RD_UIO| UGEN_WR_CFG|UGEN_WR_SLP|UGEN_WR_WUP|UGEN_WR_UIO| ==== //depot/projects/usb/src/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#10 (text+ko) ====
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200704302006.l3UK6LH8083561>