static void carl9170_usb_rx_irq_complete(struct urb *urb) { struct ar9170 *ar = urb->context; if (WARN_ON_ONCE(!ar)) return; switch (urb->status) { /* everything is fine */ case 0: break; /* disconnect */ case -ENOENT: case -ECONNRESET: case -ENODEV: case -ESHUTDOWN: return; default: goto resubmit; } carl9170_handle_command_response(ar, urb->transfer_buffer, urb->actual_length); resubmit: usb_anchor_urb(urb, &ar->rx_anch); if (unlikely(usb_submit_urb(urb, GFP_ATOMIC))) usb_unanchor_urb(urb); }
static void carl9170_rx_untie_cmds(struct ar9170 *ar, const u8 *respbuf, const unsigned int resplen) { struct carl9170_rsp *cmd; int i = 0; while (i < resplen) { cmd = (void *) &respbuf[i]; i += cmd->hdr.len + 4; if (unlikely(i > resplen)) break; carl9170_handle_command_response(ar, cmd, cmd->hdr.len + 4); } if (unlikely(i != resplen)) { if (!net_ratelimit()) return; wiphy_err(ar->hw->wiphy, "malformed firmware trap:\n"); print_hex_dump_bytes("rxcmd:", DUMP_PREFIX_OFFSET, respbuf, resplen); } }
static void carl9170_usb_rx_irq_complete(struct urb *urb) { struct ar9170 *ar = urb->context; if (WARN_ON_ONCE(!ar)) return; switch (urb->status) { /* everything is fine */ case 0: break; /* disconnect */ case -ENOENT: case -ECONNRESET: case -ENODEV: case -ESHUTDOWN: return; default: goto resubmit; } /* * While the carl9170 firmware does not use this EP, the * firmware loader in the EEPROM unfortunately does. * Therefore we need to be ready to handle out-of-band * responses and traps in case the firmware crashed and * the loader took over again. */ carl9170_handle_command_response(ar, urb->transfer_buffer, urb->actual_length); resubmit: usb_anchor_urb(urb, &ar->rx_anch); if (unlikely(usb_submit_urb(urb, GFP_ATOMIC))) usb_unanchor_urb(urb); }