All of lore.kernel.org
 help / color / mirror / Atom feed
From: Seung-Woo Kim <sw0312.kim@samsung.com>
To: u-boot@lists.denx.de
Subject: [PATCH RESEND] usbtty: fix possible alignment issues
Date: Wed, 08 Jan 2020 09:32:03 +0900	[thread overview]
Message-ID: <5E152303.9050104@samsung.com> (raw)
In-Reply-To: <20200107132225.GO4866@bill-the-cat>

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.

Regards,
- Seung-Woo Kim

  reply	other threads:[~2020-01-08  0:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20200107052020epcas1p2a5809802832bcf3b8305c6be49e87c00@epcas1p2.samsung.com>
2020-01-07  5:25 ` [PATCH RESEND] usbtty: fix possible alignment issues Seung-Woo Kim
2020-01-07 13:22   ` Tom Rini
2020-01-08  0:32     ` Seung-Woo Kim [this message]
2020-01-08  0:46       ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5E152303.9050104@samsung.com \
    --to=sw0312.kim@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.