From: Hans de Goede <j.w.r.degoede@hhs.nl>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: v4l <video4linux-list@redhat.com>,
Laurent Pinchart <laurent.pinchart@skynet.be>,
david@identd.dyndns.org,
Mauro Carvalho Chehab <mchehab@infradead.org>,
linux-kernel@vger.kernel.org, Mike Isely <isely@isely.net>
Subject: Re: V4L2: switch to register_chrdev_region: needs testing/review of release() handling
Date: Sun, 17 Aug 2008 20:30:19 +0200 [thread overview]
Message-ID: <48A86E3B.4060105@hhs.nl> (raw)
In-Reply-To: <200808171709.51258.hverkuil@xs4all.nl>
Hans Verkuil wrote:
> Hi all,
>
> As part of my ongoing cleanup of the v4l subsystem I've been looking
> into converting v4l from register_chrdev to register_chrdev_region. The
> latter is more flexible and allows for a larger range of minor numbers.
> In addition it allows us to intercept the release callback when the
> char device's refcount reaches 0.
>
Hans,
Thanks for doing this! You rock! I've been planning on cleaning up gspca's
somewhat archaic disconnect handling for a while now and I was sorta waiting
for something like this :) But I guess that that cleanup might be 2.6.28 material.
Anyways I've reviewed your patch and in general I like it, I only see one problem:
@@ -99,7 +130,8 @@ static void video_release(struct device
{
struct video_device *vfd = container_of(cd, struct video_device, dev);
-#if 1 /* keep */
+ return;
+#if 1 /* keep */
/* needed until all drivers are fixed */
if (!vfd->release)
return;
@@ -107,6 +139,7 @@ static void video_release(struct device
vfd->release(vfd);
}
+
static struct class video_class = {
.name = VIDEO_NAME,
#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
Here you basicly make the release callback of the video class device a no-op.
First of all I think it would be better to just delete it then to add a return,
which sort of hides its an empty function now.
More importantly, its wrong to make this a no-op. When a driver unregisters a
v4l device, and all cdev usage has stopped there can still be open references
to sysfs files of the video class device, but in this case currently the
video_unregister_device call will lead to the vfd->release callback getting
called freeing the vfd struct, which contains the class device.
I believe the way to fix this is todo a get on the kobj contained in the cdev
in video_register_device before registering the class device, and then in the
class device release callback do a put on this kobj.
Other then that it looks good!
Regards,
Hans
next prev parent reply other threads:[~2008-08-17 18:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-17 15:09 Hans Verkuil
2008-08-17 18:30 ` Hans de Goede [this message]
2008-08-17 19:46 ` Hans Verkuil
2008-08-17 21:29 ` Hans de Goede
2008-08-17 21:40 ` Hans Verkuil
2008-08-17 22:27 ` David Ellingsworth
2008-08-23 14:01 ` Laurent Pinchart
2008-08-23 14:31 ` 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=48A86E3B.4060105@hhs.nl \
--to=j.w.r.degoede@hhs.nl \
--cc=david@identd.dyndns.org \
--cc=hverkuil@xs4all.nl \
--cc=isely@isely.net \
--cc=laurent.pinchart@skynet.be \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@infradead.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
all inboxes | Powered by JetHome®