[U-Boot] [PATCH 2/2] usb: gadget: Use unaligned access for wMaxPacketSize

Albert ARIBAUD albert.u.boot at aribaud.net
Mon May 13 13:56:56 CEST 2013


Hi Kyungmin,

On Mon, 13 May 2013 19:50:28 +0900, Kyungmin Park
<kmpark at infradead.org> wrote:

> On Mon, May 13, 2013 at 7:23 PM, Vivek Gautam <gautam.vivek at samsung.com>wrote:
> 
> > Use get_unaligned() while fetching wMaxPacketSize to avoid
> > voilating any alignment rules.
> >
> 
> It's another story, can we get performance gain with unaligned access
> feature? In case of kernel, we got some gains.

Please do not forget that U-Boot does not run on ARMv7+ only; it runs
on many ARM generations and on many non-ARM architectures too. Some of
these targets have a severe penalty on unaligned access; some cannot
even perform unaligned accesses.

File drivers/usb/gadget/f_mass_storage.c is generic and must build and
run for such targets too.

The best approach is to properly align fields wherever possible, and
when not possible, to use unaligned access macros (and if posisble
detect unaligned accesses at runtime).

Amicalement,
-- 
Albert.


More information about the U-Boot mailing list