public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ov511.c: video_register_device() return zero on success
@ 2009-05-31  6:41 Figo.zhang
  2009-06-11  1:39 ` Mauro Carvalho Chehab
  0 siblings, 1 reply; 8+ messages in thread
From: Figo.zhang @ 2009-05-31  6:41 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: linux-media, kraxel, Hans Verkuil, mark, Mark McClelland, cpbotha,
	claudio

video_register_device() return zero on success, it would not return a positive integer.

Signed-off-by: Figo.zhang <figo1802@gmail.com>
--- 
 drivers/media/video/ov511.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/media/video/ov511.c b/drivers/media/video/ov511.c
index 9af5532..816427e 100644
--- a/drivers/media/video/ov511.c
+++ b/drivers/media/video/ov511.c
@@ -5851,7 +5851,7 @@ ov51x_probe(struct usb_interface *intf, const struct usb_device_id *id)
 			break;
 
 		if (video_register_device(ov->vdev, VFL_TYPE_GRABBER,
-			unit_video[i]) >= 0) {
+			unit_video[i]) == 0) {
 			break;
 		}
 	}



^ permalink raw reply related	[flat|nested] 8+ messages in thread
* Re: [PATCH] ov511.c: video_register_device() return zero on success
@ 2009-06-11 11:51 Hans Verkuil
  0 siblings, 0 replies; 8+ messages in thread
From: Hans Verkuil @ 2009-06-11 11:51 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Figo.zhang, linux-media, mark, cpbotha, kraxel, claudio


> Em Thu, 11 Jun 2009 08:36:00 +0200
> Hans Verkuil <hverkuil@xs4all.nl> escreveu:
>
>
>> Since I made that change I'm willing to look at this. Some comments
>> definitely
>> need improving at the least.
>
> Thanks! Since the behavior changed, it is important to better document it.
>
>> Also ivtv and cx18 rely on the current behavior,
>> so any changes need to be done carefully.
>>
>> But one question first: isn't the current approach not better anyway
>> than the
>> old approach? In the past device creation would fail if you specified an
>> explicit device kernel number that was already in use. Now it will
>> attempt
>> to fulfill the request and skip to the next free number otherwise. Seems
>> a
>> pretty good approach to me.
>
> Well, the idea of not failing due to that is interesting. Yet, those force
> parameters are provided to avoid that a different modprobe order would
> change
> the device nodes. By doing something different than requested by the users
> without
> even warning them about that doesn't sound nice. At least a KERN_ERR log
> should be printed if the selected nr is different than the requested one.

KERN_WARNING would be better, I think. It is not an error after all.

> In the specific case of ov511, however, it caused a regression, since the
> used
> logic to get the next value of the array were based on the failure of
> video_register_device(). As it doesn't fail anymore, the current logic is
> broken.
>
>> There haven't been any complaints about this (probably also because
>> nobody is
>> using it).
>>
>> Let me know what you want and I can implement it. It's not that hard.
>
> IMO, what should be done:
>
> 1) better comment the function;
> 2) generate a KERN_ERR at v4l2-dev, if the requested nr is not available;
> 3) replace ov511 logic to restore the old behavior (or improve it a little
> bit);
> 4) double check if similar regressions are present on other drivers. Since
> ov511 is an old driver, I don't doubt that its logic is duplicated on
> other
> devices.

I've just double checked all video_register_device calls and ov511.c is
the only one with this behavior.

Regards,

        Hans

>
> Since ov511 is used for an usb device, extra care should be taken, since
> it
> should be considered the possibility of successive hot plug/unplug. I
> wrote an
> interesting logic for this at em28xx driver, that can be used as an
> alternative
> to the current logic



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-06-11 22:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-31  6:41 [PATCH] ov511.c: video_register_device() return zero on success Figo.zhang
2009-06-11  1:39 ` Mauro Carvalho Chehab
2009-06-11  4:40   ` Mauro Carvalho Chehab
2009-06-11  6:36     ` Hans Verkuil
2009-06-11 11:32       ` Mauro Carvalho Chehab
2009-06-11  6:39     ` Figo.zhang
2009-06-11 22:51       ` Mauro Carvalho Chehab
  -- strict thread matches above, loose matches on Subject: below --
2009-06-11 11:51 Hans Verkuil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox