[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <386072610811091807i6f24d765l89323998ab7d6d40@mail.gmail.com>
Date: Mon, 10 Nov 2008 10:07:34 +0800
From: "Bryan Wu" <cooloney@...nel.org>
To: "Laurent Pinchart" <laurent.pinchart@...net.be>
Cc: linux-uvc-devel@...ts.berlios.de, video4linux-list@...hat.com,
linux-kernel@...r.kernel.org,
"Michael Hennerich" <michael.hennerich@...log.com>
Subject: Re: [PATCH] Video/UVC: Fix unaligned exceptions in uvc video driver.
On Sun, Nov 9, 2008 at 8:55 PM, Laurent Pinchart
<laurent.pinchart@...net.be> wrote:
> Hi Bryan, Michael,
>
> Thanks for the patch.
>
> On Thursday 06 November 2008, Bryan Wu wrote:
>> From: Michael Hennerich <michael.hennerich@...log.com>
>>
>> buffer can be odd aligned on some NOMMU machine such as Blackfin
>
> The comment is a bit misleading. Buffers can be odd-aligned independently off
> the machine type. The issue comes from machines that can't access unaligned
> memory. Something like "Fix access to unaligned memory" would be better.
>
>> Signed-off-by: Michael Hennerich <michael.hennerich@...log.com>
>> Signed-off-by: Bryan Wu <cooloney@...nel.org>
>> ---
>> drivers/media/video/uvc/uvc_driver.c | 37
>> +++++++++++++++++---------------- 1 files changed, 19 insertions(+), 18
>> deletions(-)
>>
>> diff --git a/drivers/media/video/uvc/uvc_driver.c
>> b/drivers/media/video/uvc/uvc_driver.c index d7ad060..9b4f469 100644
>> --- a/drivers/media/video/uvc/uvc_driver.c
>> +++ b/drivers/media/video/uvc/uvc_driver.c
>> @@ -31,6 +31,7 @@
>> #include <linux/videodev2.h>
>> #include <linux/vmalloc.h>
>> #include <linux/wait.h>
>> +#include <asm/unaligned.h>
>> #include <asm/atomic.h>
>>
>> #include <media/v4l2-common.h>
>> @@ -432,20 +433,20 @@ static int uvc_parse_format(struct uvc_device *dev,
>>
>> frame->bFrameIndex = buffer[3];
>> frame->bmCapabilities = buffer[4];
>> - frame->wWidth = le16_to_cpup((__le16 *)&buffer[5]);
>> - frame->wHeight = le16_to_cpup((__le16 *)&buffer[7]);
>> - frame->dwMinBitRate = le32_to_cpup((__le32 *)&buffer[9]);
>> - frame->dwMaxBitRate = le32_to_cpup((__le32 *)&buffer[13]);
>> + frame->wWidth = le16_to_cpu(get_unaligned((__le16 *) &buffer[5]));
>
> What about using get_unaligned_le16 and get_unaligned_le32 directly ? Lines
> would be shorter and could be kept behind the 80 columns limit more easily.
>
> Tell me if you want to resubmit or if I should make the modification myself
> (including the patch description).
>
I guess Michael will update this patch according to you review. Then
we will resubmit it.
Thanks a lot
-Bryan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists