1 2#include <linux/slab.h> 3#include "wusbhc.h" 4#include "wa-hc.h" 5 6/** 7 * Assumes 8 * 9 * wa->usb_dev and wa->usb_iface initialized and refcounted, 10 * wa->wa_descr initialized. 11 */ 12int wa_create(struct wahc *wa, struct usb_interface *iface) 13{ 14 int result; 15 struct device *dev = &iface->dev; 16 17 result = wa_rpipes_create(wa); 18 if (result < 0) 19 goto error_rpipes_create; 20 /* Fill up Data Transfer EP pointers */ 21 wa->dti_epd = &iface->cur_altsetting->endpoint[1].desc; 22 wa->dto_epd = &iface->cur_altsetting->endpoint[2].desc; 23 wa->xfer_result_size = le16_to_cpu(wa->dti_epd->wMaxPacketSize); 24 wa->xfer_result = kmalloc(wa->xfer_result_size, GFP_KERNEL); 25 if (wa->xfer_result == NULL) 26 goto error_xfer_result_alloc; 27 result = wa_nep_create(wa, iface); 28 if (result < 0) { 29 dev_err(dev, "WA-CDS: can't initialize notif endpoint: %d\n", 30 result); 31 goto error_nep_create; 32 } 33 return 0; 34 35error_nep_create: 36 kfree(wa->xfer_result); 37error_xfer_result_alloc: 38 wa_rpipes_destroy(wa); 39error_rpipes_create: 40 return result; 41} 42EXPORT_SYMBOL_GPL(wa_create); 43 44 45void __wa_destroy(struct wahc *wa) 46{ 47 if (wa->dti_urb) { 48 usb_kill_urb(wa->dti_urb); 49 usb_put_urb(wa->dti_urb); 50 usb_kill_urb(wa->buf_in_urb); 51 usb_put_urb(wa->buf_in_urb); 52 } 53 kfree(wa->xfer_result); 54 wa_nep_destroy(wa); 55 wa_rpipes_destroy(wa); 56} 57EXPORT_SYMBOL_GPL(__wa_destroy); 58 59/** 60 * wa_reset_all - reset the WA device 61 * @wa: the WA to be reset 62 * 63 * For HWAs the radio controller and all other PALs are also reset. 64 */ 65void wa_reset_all(struct wahc *wa) 66{ 67 wusbhc_reset_all(wa->wusb); 68} 69 70MODULE_AUTHOR("Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>"); 71MODULE_DESCRIPTION("Wireless USB Wire Adapter core"); 72MODULE_LICENSE("GPL"); 73