Lines Matching full:urbs
261 /* Context Information for transmission URBs */
860 static void ucan_cleanup_rx_urbs(struct ucan_priv *up, struct urb **urbs) in ucan_cleanup_rx_urbs() argument
865 if (urbs[i]) { in ucan_cleanup_rx_urbs()
866 usb_unanchor_urb(urbs[i]); in ucan_cleanup_rx_urbs()
869 urbs[i]->transfer_buffer, in ucan_cleanup_rx_urbs()
870 urbs[i]->transfer_dma); in ucan_cleanup_rx_urbs()
871 usb_free_urb(urbs[i]); in ucan_cleanup_rx_urbs()
875 memset(urbs, 0, sizeof(*urbs) * UCAN_MAX_RX_URBS); in ucan_cleanup_rx_urbs()
879 struct urb **urbs) in ucan_prepare_and_anchor_rx_urbs() argument
883 memset(urbs, 0, sizeof(*urbs) * UCAN_MAX_RX_URBS); in ucan_prepare_and_anchor_rx_urbs()
888 urbs[i] = usb_alloc_urb(0, GFP_KERNEL); in ucan_prepare_and_anchor_rx_urbs()
889 if (!urbs[i]) in ucan_prepare_and_anchor_rx_urbs()
894 GFP_KERNEL, &urbs[i]->transfer_dma); in ucan_prepare_and_anchor_rx_urbs()
897 usb_free_urb(urbs[i]); in ucan_prepare_and_anchor_rx_urbs()
898 urbs[i] = NULL; in ucan_prepare_and_anchor_rx_urbs()
902 usb_fill_bulk_urb(urbs[i], up->udev, in ucan_prepare_and_anchor_rx_urbs()
910 urbs[i]->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in ucan_prepare_and_anchor_rx_urbs()
912 usb_anchor_urb(urbs[i], &up->rx_urbs); in ucan_prepare_and_anchor_rx_urbs()
917 /* cleanup other unsubmitted urbs */ in ucan_prepare_and_anchor_rx_urbs()
918 ucan_cleanup_rx_urbs(up, urbs); in ucan_prepare_and_anchor_rx_urbs()
922 /* Submits rx urbs with the semantic: Either submit all, or cleanup
923 * everything. I case of errors submitted urbs are killed and all urbs in
927 static int ucan_submit_rx_urbs(struct ucan_priv *up, struct urb **urbs) in ucan_submit_rx_urbs() argument
931 /* Iterate over all urbs to submit. On success remove the urb in ucan_submit_rx_urbs()
935 ret = usb_submit_urb(urbs[i], GFP_KERNEL); in ucan_submit_rx_urbs()
946 usb_free_urb(urbs[i]); in ucan_submit_rx_urbs()
947 urbs[i] = NULL; in ucan_submit_rx_urbs()
952 /* Cleanup unsubmitted urbs */ in ucan_submit_rx_urbs()
953 ucan_cleanup_rx_urbs(up, urbs); in ucan_submit_rx_urbs()
955 /* Kill urbs that are already submitted */ in ucan_submit_rx_urbs()
966 struct urb *urbs[UCAN_MAX_RX_URBS]; in ucan_open() local
973 /* Allocate and prepare IN URBS - allocated and anchored in ucan_open()
974 * urbs are stored in urbs[] for clean in ucan_open()
976 ret = ucan_prepare_and_anchor_rx_urbs(up, urbs); in ucan_open()
1011 /* Driver is ready to receive data. Submit RX URBS */ in ucan_open()
1012 ret = ucan_submit_rx_urbs(up, urbs); in ucan_open()
1041 /* clean up unsubmitted urbs */ in ucan_open()
1042 ucan_cleanup_rx_urbs(up, urbs); in ucan_open()
1061 netdev_err(up->netdev, "no memory left for URBs\n"); in ucan_prepare_tx_urb()