All of lore.kernel.org
 help / color / mirror / Atom feed
From: Troy Kisky <troy.kisky@boundarydevices.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] USB: Fix strict aliasing in ohci-hcd
Date: Tue, 14 Aug 2012 11:47:56 -0700	[thread overview]
Message-ID: <502A9D5C.9060804@boundarydevices.com> (raw)
In-Reply-To: <201208141933.29344.marex@denx.de>

On 8/14/2012 10:33 AM, Marek Vasut wrote:
> Dear Troy Kisky,
>
>> commit 5f6aa03fda2a0a79940765865c1e4266be8a75f8
>>      USB: Fix complaints about strict aliasing in OHCI-HCD
>>
>> tried to fix this, but gcc4.4 still complains. So, this
>> patch basically reverts the above and does a simpler fix.
>>
>> also, the above commit incorrectly changed
>> 	/* corresponds to data_buf[4-7] */
>> 	datab [1] = 0;
>> to
>>
>> 	/* corresponds to databuf.u8[4-7] */
>> 	databuf.u8[1] = 0;
>>
>> This patch also fixes that.
>>
>> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
>> ---
>>   drivers/usb/host/ohci-hcd.c |   70
>> +++++++++++++++++++------------------------ 1 file changed, 31
>> insertions(+), 39 deletions(-)
>>
>> diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
>> index d24f2f1..9f47351 100644
>> --- a/drivers/usb/host/ohci-hcd.c
>> +++ b/drivers/usb/host/ohci-hcd.c
>> @@ -1261,19 +1261,11 @@ static int ohci_submit_rh_msg(struct usb_device
>> *dev, unsigned long pipe, int leni = transfer_len;
>>   	int len = 0;
>>   	int stat = 0;
>> -	__u32 datab[4];
>> -	union {
>> -		void *ptr;
>> -		__u8 *u8;
>> -		__u16 *u16;
>> -		__u32 *u32;
>> -	} databuf;
>>   	__u16 bmRType_bReq;
>>   	__u16 wValue;
>>   	__u16 wIndex;
>>   	__u16 wLength;
>> -
>> -	databuf.u32 = (__u32 *)datab;
>> +	ALLOC_ALIGN_BUFFER(__u8, databuf, 16, sizeof(u32));
> Ok, pardon my sloppiness in reviews ... but why not alloc this cache aligned?
> That way we'd also circumvent the issues with caches we'd eventually hit anyway.
>
> [...]
>
> The rest is OK.
>


Line 1464 has

     if (data != databuf)
         memcpy(data, databuf, len);

So as far as I can tell, databuf is always copied and there are no cache 
issues to circumvent.
But I have no complaint if you desire to cacheline aligned anyway...


Troy

  reply	other threads:[~2012-08-14 18:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-11 21:49 [U-Boot] [PATCH 1/1] USB: Fix strict aliasing in ohci-hcd Troy Kisky
2012-08-12  0:07 ` Marek Vasut
2012-08-14 17:33 ` Marek Vasut
2012-08-14 18:47   ` Troy Kisky [this message]
2012-08-14 19:12     ` Marek Vasut

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=502A9D5C.9060804@boundarydevices.com \
    --to=troy.kisky@boundarydevices.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.