Re: [PATCH v12 4/8] usb:gadget: Add SuperSpeed support to theGadget Framework

From: Sebastian Andrzej Siewior
Date: Mon May 23 2011 - 08:32:04 EST


* Tatyana Brokhman | 2011-05-23 09:41:13 [+0300]:
>diff --git a/drivers/usb/gadget/composite.c
>b/drivers/usb/gadget/composite.c
>index 1c6bd66..7738302 100644
>--- a/drivers/usb/gadget/composite.c
>+++ b/drivers/usb/gadget/composite.c
>@@ -1015,6 +1175,62 @@ composite_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
> *((u8 *)req->buf) = value;
> value = min(w_length, (u16) 1);
> break;
>+
>+ /*
>+ * USB 3.0 additions:
>+ * Function driver should handle get_status request. If such cb
>+ * wasn't supplied we respond with default value = 0
>+ * Note: function driver should supply such cb only for the first
>+ * interface of the function
>+ */
>+ case USB_REQ_GET_STATUS:
>+ if (!gadget_is_superspeed(gadget))
>+ goto unknown;
>+ if (ctrl->bRequestType != (USB_DIR_IN | USB_RECIP_INTERFACE))
>+ goto unknown;
>+ value = 2; /* This is the length of the get_status reply */
>+ *((__le16 *)req->buf) = 0;

Mike please correct me if I'm wrong bug this looks like a case for
put_unaligned_le16().
Is someone actually using gadget support on blackfin? I'm asking because
config_buf() (same file, upstream) is using req->buf to build the
descriptors in place and one element is le16 which should be affected.

>+ if (!cdev->config || intf >= MAX_CONFIG_INTERFACES)
>+ break;
>+ f = cdev->config->interface[intf];
>+ if (!f)
>+ break;
>+ status = f->get_status ? f->get_status(f) : 0;
>+ if (status < 0)
>+ break;
>+ *((__le16 *)req->buf) = cpu_to_le16(status & 0x0000ffff);
and here.

>+ break;

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/