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

From: Mike Frysinger
Date: Tue May 24 2011 - 01:15:06 EST


On Tue, May 24, 2011 at 01:10, Tanya Brokhman wrote:
>> >+ Â Â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
>> >+ Â Â Â Â Â Â*((__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.
>
> Mike answered that you're right in your observation. I'm not familiar with
> blackfin. Could you please elaborate on this? I understand that I need to
> use put_unaligned_le16(), will do, but I would like to better understand why
> and if there is a way to test this so that blackfin won't be broken.

not all arches support unaligned accesses. or they do, but it's done
via (non-trivial) exception processing in software. req->buf is of
type void* and so presumably is not guaranteed to be aligned on a 2
byte boundary.
-mike
--
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/