mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bryan Wu" <cooloney@kernel.org>
To: "Laurent Pinchart" <laurent.pinchart@skynet.be>
Cc: linux-uvc-devel@lists.berlios.de, video4linux-list@redhat.com,
	linux-kernel@vger.kernel.org,
	"Michael Hennerich" <michael.hennerich@analog.com>
Subject: Re: [PATCH] Video/UVC: Fix unaligned exceptions in uvc video driver.
Date: Mon, 10 Nov 2008 10:07:34 +0800	[thread overview]
Message-ID: <386072610811091807i6f24d765l89323998ab7d6d40@mail.gmail.com> (raw)
In-Reply-To: <200811091355.05074.laurent.pinchart@skynet.be>

On Sun, Nov 9, 2008 at 8:55 PM, Laurent Pinchart
<laurent.pinchart@skynet.be> wrote:
> Hi Bryan, Michael,
>
> Thanks for the patch.
>
> On Thursday 06 November 2008, Bryan Wu wrote:
>> From: Michael Hennerich <michael.hennerich@analog.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@analog.com>
>> Signed-off-by: Bryan Wu <cooloney@kernel.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

  reply	other threads:[~2008-11-10  2:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-06  9:17 Bryan Wu
2008-11-09 12:55 ` Laurent Pinchart
2008-11-10  2:07   ` Bryan Wu [this message]
2008-11-10 10:51   ` Hennerich, Michael
2008-11-11 17:11     ` Laurent Pinchart

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=386072610811091807i6f24d765l89323998ab7d6d40@mail.gmail.com \
    --to=cooloney@kernel.org \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-uvc-devel@lists.berlios.de \
    --cc=michael.hennerich@analog.com \
    --cc=video4linux-list@redhat.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®