/* big enough to hold our biggest descriptor */
#define USB_BUFSIZ 512
+typedef struct { __le16 val;} __attribute__((aligned(16))) __le16_packed;
+
static struct usb_composite_driver *composite;
/* Some systems will need runtime overrides for the product identifers
* the host side.
*/
-static void collect_langs(struct usb_gadget_strings **sp, __le16 *buf)
+static void collect_langs(struct usb_gadget_strings **sp, void *buf)
{
const struct usb_gadget_strings *s;
u16 language;
- __le16 *tmp;
+ __le16_packed *tmp;
+ __le16_packed *end = (buf + 252);
while (*sp) {
s = *sp;
language = cpu_to_le16(s->language);
- for (tmp = buf; *tmp && tmp < &buf[126]; tmp++) {
- if (*tmp == language)
+ for (tmp = buf; tmp->val && tmp < end; tmp++) {
+ if (tmp->val == language)
goto repeat;
}
- *tmp++ = language;
+ tmp->val = language;
repeat:
sp++;
}