From: "figo.zhang" <figo.zhang@kolorific.com>
To: Laurent Pinchart <laurent.pinchart@skynet.be>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>,
Linux Media Mailing List <linux-media@vger.kernel.org>,
kraxel@bytesex.org, Hans Verkuil <hverkuil@xs4all.nl>,
alan@lxorguk.ukuu.org.uk,
Mauro Carvalho Chehab <mchehab@infradead.org>,
akpm@linux-foundation.org
Subject: Re: [PATCH]V4L:some v4l drivers have error for video_register_device
Date: Thu, 04 Jun 2009 17:31:23 +0800 [thread overview]
Message-ID: <1244107883.3445.38.camel@myhost> (raw)
In-Reply-To: <200906041118.01025.laurent.pinchart@skynet.be>
On Thu, 2009-06-04 at 11:18 +0200, Laurent Pinchart wrote:
> Hi,
>
> On Thursday 04 June 2009 06:20:07 figo.zhang wrote:
> > The function video_register_device() will call the
> > video_register_device_index(). In this function, firtly it will do some
> > argments check , if failed,it will return a negative number such as
> > -EINVAL, and then do cdev_alloc() and device_register(), if success return
> > zero. so video_register_device_index() canot return a a positive number.
> >
> > for example, see the drivers/media/video/stk-webcam.c (line 1325):
> >
> > err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
> > if (err)
> > STK_ERROR("v4l registration failed\n");
> > else
> > STK_INFO("Syntek USB2.0 Camera is now controlling video device"
> > " /dev/video%d\n", dev->vdev.num);
> >
> > in my opinion, it will be cleaner to do something like this:
> >
> > err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1);
> > if (err != 0)
> > STK_ERROR("v4l registration failed\n");
> > else
> > STK_INFO("Syntek USB2.0 Camera is now controlling video device"
> > " /dev/video%d\n", dev->vdev.num);
>
> What's the difference ? (err != 0) and (err) are identical.
>
> Best regards,
>
> Laurent Pinchart
yes, it is the same, but it is easy for reading.
btw, see driver/media/video/ov511.c (line 5853):
if (video_register_device(ov->vdev, VFL_TYPE_GRABBER,
unit_video[i]) >= 0) {
break;
}
it would not return a positive number,i think. pls see my other path:
http://www.spinics.net/lists/linux-media/msg06140.html
next prev parent reply other threads:[~2009-06-04 9:31 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-27 3:25 [PATCH]V4L:some v4l drivers have error for video_register_device Figo.zhang
2009-06-04 4:20 ` figo.zhang
2009-06-04 9:18 ` Laurent Pinchart
2009-06-04 9:20 ` figo.zhang
2009-06-10 14:39 ` Mauro Carvalho Chehab
2009-06-04 9:31 ` figo.zhang [this message]
-- strict thread matches above, loose matches on Subject: below --
2009-06-04 9:27 Hans Verkuil
2009-06-05 2:51 ` Figo.zhang
2009-06-05 6:12 ` Hans Verkuil
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=1244107883.3445.38.camel@myhost \
--to=figo.zhang@kolorific.com \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=hverkuil@xs4all.nl \
--cc=kraxel@bytesex.org \
--cc=laurent.pinchart@skynet.be \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mchehab@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 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.