netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: leiming <tom.leiming@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Adrian Bunk <bunk@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Natalie Protasevich <protasnb@gmail.com>,
	Kernel Testers List <kernel-testers@vger.kernel.org>,
	Network Development <netdev@vger.kernel.org>,
	Linux ACPI <linux-acpi@vger.kernel.org>,
	Linux PM List <linux-pm@lists.linux-foundation.org>,
	Linux SCSI List <linux-scsi@vger.kernel.org>,
	video4linux-list@redhat.com, laurent.pinchart@skynet.be,
	mchehab@infradead.org
Subject: Re: 2.6.30-rc2-git2: Reported regressions from 2.6.29
Date: Sat, 18 Apr 2009 12:51:11 +0800	[thread overview]
Message-ID: <20090418125111.6646e997@linux-lm> (raw)
In-Reply-To: <alpine.LFD.2.00.0904171952260.4042@localhost.localdomain>

On Fri, 17 Apr 2009 19:55:29 -0700 (PDT)
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> > @@ -742,7 +742,7 @@ static int uvc_alloc_urb_buffers(struct
> > uvc_video_device *video, 
> >  	/* Buffers are already allocated, bail out. */
> >  	if (video->urb_size)
> > -		return 0;
> > +		return DIV_ROUND_UP(video->urb_size, psize);
> 
> I don't think this is right. It should round _down_.
> 
> It's supposed to return 'npackets', but if you pass it a different
> packet size than it was passed originally, it can now return a
> potentially bigger number than the already allocated buffer, no?
> 
> So I think it should round down (ie use a regular divide). No?

Yes,you are correct, please ignore my last reply, and following is
the fixed patch.

Thanks.

>From a3b3d72cdd57a0699fb643b41b78eb7beb211ff5 Mon Sep 17 00:00:00 2001
From: Ming Lei <tom.leiming@gmail.com>
Date: Wed, 15 Apr 2009 22:32:51 +0800
Subject: [PATCH] V4L/DVB:usbvideo:fix uvc resume failed(v2)

Now urb buffers is not freed before suspend, so uvc_alloc_urb_buffers
should return packet counts allocated originally during uvc resume
, instead of zero.

This version uses round down to return packet counts on Linus's
suggestions, or else may lead to buffer destructed if packet size
is changed before calling uvc_alloc_urb_buffers() in this kind of
case.

This patch is against v2.6.30-rc2.

Signed-off-by: Ming Lei <tom.leiming@gmail.com>
---
 drivers/media/video/uvc/uvc_video.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index a95e173..6ce974d 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -742,7 +742,7 @@ static int uvc_alloc_urb_buffers(struct uvc_video_device *video,
 
 	/* Buffers are already allocated, bail out. */
 	if (video->urb_size)
-		return 0;
+		return video->urb_size / psize;
 
 	/* Compute the number of packets. Bulk endpoints might transfer UVC
 	 * payloads accross multiple URBs.
-- 
1.6.0.GIT





-- 
Lei Ming

  parent reply	other threads:[~2009-04-18  4:51 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-16 21:42 2.6.30-rc2-git2: Reported regressions from 2.6.29 Rafael J. Wysocki
2009-04-17  0:40 ` Linus Torvalds
2009-04-17  1:25   ` Ingo Molnar
     [not found]     ` <20090417012544.GB16126-X9Un+BFzKDI@public.gmane.org>
2009-04-17 21:25       ` Rafael J. Wysocki
2009-04-17  0:41 ` David Miller
2009-04-17 21:27   ` Rafael J. Wysocki
2009-04-17  0:46 ` Linus Torvalds
2009-04-17 21:31   ` Rafael J. Wysocki
2009-04-17  1:28 ` Jeff Chua
2009-04-17  1:30 ` Zhang Rui
2009-04-17  2:34   ` yakui_zhao
2009-04-17 21:35   ` Rafael J. Wysocki
2009-04-17  1:37 ` Ming Lei
2009-04-17 21:36   ` Rafael J. Wysocki
2009-04-17 23:56     ` Laurent Pinchart
     [not found]       ` <200904180156.24366.laurent.pinchart-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
2009-04-18 12:29         ` Rafael J. Wysocki
2009-04-18  2:32     ` leiming
2009-04-18  2:55       ` Linus Torvalds
2009-04-18  3:50         ` leiming
2009-04-18  4:51         ` leiming [this message]
2009-04-18 12:33           ` Rafael J. Wysocki
2009-04-20 20:08           ` Laurent Pinchart
     [not found]             ` <200904202208.23899.laurent.pinchart-AgBVmzD5pcezQB+pC5nmwQ@public.gmane.org>
2009-04-21  1:47               ` Ming Lei
2009-04-21 23:21                 ` Laurent Pinchart
2009-05-09  3:28                   ` Ming Lei
2009-05-09 16:24                     ` Linus Torvalds
2009-05-09 21:37                       ` Mauro Carvalho Chehab
2009-04-24 13:44 ` Kalle Valo
     [not found]   ` <87ljpqqi89.fsf-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2009-04-25 21:57     ` Rafael J. Wysocki
     [not found] ` <200904170752.48078.edt@aei.ca>
     [not found]   ` <200904171648.38172.rjw@sisk.pl>
2009-04-26 13:35     ` Ed Tomlinson

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=20090418125111.6646e997@linux-lm \
    --to=tom.leiming@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=bunk@kernel.org \
    --cc=kernel-testers@vger.kernel.org \
    --cc=laurent.pinchart@skynet.be \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=netdev@vger.kernel.org \
    --cc=protasnb@gmail.com \
    --cc=rjw@sisk.pl \
    --cc=torvalds@linux-foundation.org \
    --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;
as well as URLs for NNTP newsgroup(s).