From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Rini Date: Tue, 7 Jan 2020 19:46:23 -0500 Subject: [PATCH RESEND] usbtty: fix possible alignment issues In-Reply-To: <5E152303.9050104@samsung.com> References: <20200107052502.803-1-sw0312.kim@samsung.com> <20200107132225.GO4866@bill-the-cat> <5E152303.9050104@samsung.com> Message-ID: <20200108004623.GH31026@bill-the-cat> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On Wed, Jan 08, 2020 at 09:32:03AM +0900, Seung-Woo Kim wrote: > Hi, > > On 2020년 01월 07일 22:22, Tom Rini wrote: > > On Tue, Jan 07, 2020 at 02:25:02PM +0900, Seung-Woo Kim wrote: > > > ... > >> --- > >> drivers/serial/usbtty.c | 9 ++++++--- > >> 1 file changed, 6 insertions(+), 3 deletions(-) > >> > >> diff --git a/drivers/serial/usbtty.c b/drivers/serial/usbtty.c > >> index f1c1a260da..54e67dd0d1 100644 > >> --- a/drivers/serial/usbtty.c > >> +++ b/drivers/serial/usbtty.c > >> @@ -48,6 +48,8 @@ > >> #define CONFIG_USBD_DATA_INTERFACE_STR "Bulk Data Interface" > >> #define CONFIG_USBD_CTRL_INTERFACE_STR "Control Interface" > >> > >> +typedef struct { __le16 val; } __attribute__((aligned(16))) __le16_packed; > >> + > >> /* > >> * Buffers to hold input and output data > >> */ > >> @@ -372,14 +374,15 @@ static int fill_buffer (circbuf_t * buf); > >> void usbtty_poll (void); > >> > >> /* utility function for converting char* to wide string used by USB */ > >> -static void str2wide (char *str, u16 * wide) > >> +static void str2wide (char *str, void *wide) > >> { > >> int i; > >> + __le16_packed *tmp = wide; > >> for (i = 0; i < strlen (str) && str[i]; i++){ > >> #if defined(__LITTLE_ENDIAN) > >> - wide[i] = (u16) str[i]; > >> + tmp[i].val = (u16) str[i]; > >> #elif defined(__BIG_ENDIAN) > >> - wide[i] = ((u16)(str[i])<<8); > >> + tmp[i].val = ((u16)(str[i])<<8); > >> #else > >> #error "__LITTLE_ENDIAN or __BIG_ENDIAN undefined" > >> #endif > > > > We generally don't want packed structs and do need to disable this > > warning in general. Is this _really_ a problem, or are we just > > silencing the compiler here? Thanks! > > The change makes just silence for the warnings as like composite.c in > usb gadget. OK, thanks. NAK on this and I will pick up the general change to disable this warning soon. -- Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: not available URL: