53 #include <linux/ctype.h>
54 #include <linux/slab.h>
105 if (usb_hcd->state == HC_STATE_QUIESCING)
114 if (size <
sizeof(*notif_hdr)) {
115 missing =
sizeof(*notif_hdr) -
size;
116 goto exhausted_buffer;
120 goto exhausted_buffer;
131 notif_hdr->
bLength -
sizeof(*hwa_dn));
143 dev_err(dev,
"HWA: unknown notification 0x%x, "
144 "%zu bytes; discarding\n",
161 dev_warn(dev,
"HWA: device sent short notification, "
162 "%d bytes missing; discarding %d bytes.\n",
179 static int wa_nep_queue(
struct wahc *wa,
size_t size)
190 if (printk_ratelimit())
191 dev_err(dev,
"Too many notifications queued, "
192 "throttling back\n");
197 if (printk_ratelimit())
198 dev_err(dev,
"No memory to queue notification\n");
218 static void wa_nep_cb(
struct urb *
urb)
221 struct wahc *wa = urb->context;
224 switch (result = urb->status) {
226 result = wa_nep_queue(wa, urb->actual_length);
228 dev_err(dev,
"NEP: unable to process notification(s): "
234 dev_dbg(dev,
"NEP: going down %d\n", urb->status);
239 dev_err(dev,
"NEP: URB max acceptable errors "
240 "exceeded, resetting device\n");
244 dev_err(dev,
"NEP: URB error %d\n", urb->status);
248 dev_err(dev,
"NEP: cannot submit URB: %d\n", result);
265 struct usb_device *usb_dev = interface_to_usbdev(iface);
266 struct device *dev = &iface->dev;
269 epd = &iface->cur_altsetting->endpoint[0].desc;
273 dev_err(dev,
"Unable to allocate notification's read buffer\n");
274 goto error_nep_buffer;
278 dev_err(dev,
"Unable to allocate notification URB\n");
279 goto error_urb_alloc;
281 usb_fill_int_urb(wa->
nep_urb, usb_dev,
287 dev_err(dev,
"Cannot submit notification URB: %d\n", result);