mirror of
https://github.com/linux-sunxi/u-boot-sunxi.git
synced 2024-02-12 11:16:03 +08:00
USB: Use (get|put)_unaligned for accessing wMaxPacketSize
In 9792987721
Stefan describes a usecase
where the previous behavior of leaving wMaxPacketSize be unaligned
caused fatal problems. The initial fix for this problem was incomplete
however as it showed another cases of non-aligned access that previously
worked implicitly. This switches to making sure that all access of
wMaxPacketSize are done via (get|put)_unaligned.
In order to maintain a level of readability to the code in some cases
we now use a variable for the value of wMaxPacketSize and in others, a
macro.
Cc: Minkyu Kang <mk7.kang@samsung.com>
Cc: Remy Bohmer <linux@bohmer.net>
OpenRISC:
Tested-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Beagleboard xM, Pandaboard run-tested, s5p_goni build-tested.
Signed-off-by: Tom Rini <trini@ti.com>
This commit is contained in:
@ -28,6 +28,7 @@
|
||||
#include <common.h>
|
||||
#include <command.h>
|
||||
#include <asm/byteorder.h>
|
||||
#include <asm/unaligned.h>
|
||||
#include <part.h>
|
||||
#include <usb.h>
|
||||
|
||||
@ -240,7 +241,7 @@ void usb_display_ep_desc(struct usb_endpoint_descriptor *epdesc)
|
||||
printf("Interrupt");
|
||||
break;
|
||||
}
|
||||
printf(" MaxPacket %d", epdesc->wMaxPacketSize);
|
||||
printf(" MaxPacket %d", get_unaligned(&epdesc->wMaxPacketSize));
|
||||
if ((epdesc->bmAttributes & 0x03) == 0x3)
|
||||
printf(" Interval %dms", epdesc->bInterval);
|
||||
printf("\n");
|
||||
|
Reference in New Issue
Block a user