static int brcmf_usb_up(struct device *dev) { struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); brcmf_dbg(USB, "Enter\n"); if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_UP) return 0; /* Success, indicate devinfo is fully up */ brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_UP); if (devinfo->ctl_urb) { devinfo->ctl_in_pipe = usb_rcvctrlpipe(devinfo->usbdev, 0); devinfo->ctl_out_pipe = usb_sndctrlpipe(devinfo->usbdev, 0); /* CTL Write */ devinfo->ctl_write.bRequestType = USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; devinfo->ctl_write.bRequest = 0; devinfo->ctl_write.wValue = cpu_to_le16(0); devinfo->ctl_write.wIndex = cpu_to_le16(devinfo->ifnum); /* CTL Read */ devinfo->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; devinfo->ctl_read.bRequest = 1; devinfo->ctl_read.wValue = cpu_to_le16(0); devinfo->ctl_read.wIndex = cpu_to_le16(devinfo->ifnum); } brcmf_usb_rx_fill_all(devinfo); return 0; }
static void brcmf_usb_intr_complete(struct urb *urb) { struct brcmf_usbdev_info *devinfo = (struct brcmf_usbdev_info *)urb->context; bool killed; if (devinfo == NULL) return; if (unlikely(urb->status)) { if (devinfo->suspend_state == USBOS_SUSPEND_STATE_SUSPEND_PENDING) killed = true; if ((urb->status == -ENOENT && (!killed)) || urb->status == -ESHUTDOWN || urb->status == -ENODEV) { brcmf_usb_state_change(devinfo, BCMFMAC_USB_STATE_DOWN); } } if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_DOWN) { brcmf_dbg(ERROR, "intr cb when DBUS down, ignoring\n"); return; } if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP) usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); }
static void brcmf_usb_down(struct device *dev) { struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); brcmf_dbg(USB, "Enter\n"); if (devinfo == NULL) return; if (devinfo->bus_pub.state == BRCMFMAC_USB_STATE_DOWN) return; brcmf_usb_state_change(devinfo, BRCMFMAC_USB_STATE_DOWN); brcmf_cancel_all_urbs(devinfo); }
static void brcmf_usb_down(struct device *dev) { struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); if (devinfo == NULL) return; brcmf_dbg(TRACE, "enter\n"); if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_DOWN) return; brcmf_usb_state_change(devinfo, BCMFMAC_USB_STATE_DOWN); if (devinfo->intr_urb) usb_kill_urb(devinfo->intr_urb); if (devinfo->ctl_urb) usb_kill_urb(devinfo->ctl_urb); if (devinfo->bulk_urb) usb_kill_urb(devinfo->bulk_urb); brcmf_usb_free_q(&devinfo->tx_postq, true); brcmf_usb_free_q(&devinfo->rx_postq, true); }
static int brcmf_usb_up(struct device *dev) { struct brcmf_usbdev_info *devinfo = brcmf_usb_get_businfo(dev); u16 ifnum; if (devinfo->bus_pub.state == BCMFMAC_USB_STATE_UP) return 0; /* If the USB/HSIC bus in sleep state, wake it up */ if (devinfo->suspend_state == USBOS_SUSPEND_STATE_SUSPENDED) { if (brcmf_usb_pnp(devinfo, BCMFMAC_USB_PNP_RESUME) != 0) { brcmf_dbg(ERROR, "Could not Resume the bus!\n"); return -EIO; } } devinfo->activity = true; /* Success, indicate devinfo is fully up */ brcmf_usb_state_change(devinfo, BCMFMAC_USB_STATE_UP); if (devinfo->intr_urb) { int ret; usb_fill_int_urb(devinfo->intr_urb, devinfo->usbdev, devinfo->intr_pipe, &devinfo->intr, devinfo->intr_size, (usb_complete_t)brcmf_usb_intr_complete, devinfo, devinfo->interval); ret = usb_submit_urb(devinfo->intr_urb, GFP_ATOMIC); if (ret) { brcmf_dbg(ERROR, "USB_SUBMIT_URB failed with status %d\n", ret); return -EINVAL; } } if (devinfo->ctl_urb) { devinfo->ctl_in_pipe = usb_rcvctrlpipe(devinfo->usbdev, 0); devinfo->ctl_out_pipe = usb_sndctrlpipe(devinfo->usbdev, 0); ifnum = IFDESC(devinfo->usbdev, CONTROL_IF).bInterfaceNumber; /* CTL Write */ devinfo->ctl_write.bRequestType = USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE; devinfo->ctl_write.bRequest = 0; devinfo->ctl_write.wValue = cpu_to_le16(0); devinfo->ctl_write.wIndex = cpu_to_le16p(&ifnum); /* CTL Read */ devinfo->ctl_read.bRequestType = USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; devinfo->ctl_read.bRequest = 1; devinfo->ctl_read.wValue = cpu_to_le16(0); devinfo->ctl_read.wIndex = cpu_to_le16p(&ifnum); } brcmf_usb_rx_fill_all(devinfo); return 0; }