All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH/RFC] V4L core cleanups
@ 2009-11-18  0:38 Laurent Pinchart
  2009-11-18  0:38 ` v4l: Add video_device_node_name function Laurent Pinchart
                   ` (10 more replies)
  0 siblings, 11 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Hi everybody,

this patch sets attemp to clean up the V4L core to remove the
video_device::minor and video_device::num references in most drivers.

There are two reasons for this. The first one is that drivers really
shouldn't care about those fields, especially the minor number. This
doesn't mean a driver can't request a specific device number, that
remains a perfectly valid use case, but most use cases of those fields
after device registration shouldn't be needed.

The second reason is that most drivers use those fields in bogus ways,
making it obvious they shouldn't have cared about them in the first
place :-) We've had a video_drvdata function for a long time, but many
drivers still have their own private minor -> data mapping lists for
historical reasons. That code is error prone and completely unneeded.

So this patch sets tries to clean up the V4L core by porting drivers to
the most "recent" APIs (which are actually quite old) and introducing a
new helper function.

The first two patches add and use the video_device_node_name function.
The function returns a const pointer to the video device name. On
systems using udev, the name is passed as a hint to udev and will likely
become the /dev device node name, unless overwritten by udev rules (I've
heard that some distributions put the V4L device nodes in /dev/v4l).
Some drivers erroneously created the name from the video_device::minor
field instead of video_device::num, which is fixed by the second patch.

This is an example video_device_node_name usage typical from what can be
found in the second patch.

-       printk(KERN_INFO "bttv%d: registered device radio%d\n",
-              btv->c.nr, btv->radio_dev->num);
+       printk(KERN_INFO "bttv%d: registered device %s\n",
+              btv->c.nr, video_device_node_name(btv->radio_dev));

The third patch removes left video_device::num usage from the drivers.
The field was used to create information strings that shouldn't include
the device node name (such as video_device::name) or that should be
created using a stable identifier (such as i2c_adapter::name).

The fourth, fifth and sixth patches replace video_is_unregistered with
video_is_registered and use the new function in device drivers. As
explained in the fourth patch commit message, the rationale behind that
is to have video_is_registered return false when called on an
initialized but not yet registered video_device instance. The function
can be used instead of checking video_device::minor manually, making it
less error-prone as drivers don't need to make sure they
video_device::minor to -1 correctly for all error paths.

A typical use case is

-       if (-1 != dev->radio_dev->minor)
+       if (video_is_registered(dev->radio_dev))
                video_unregister_device(dev->radio_dev);
        else
                video_device_release(dev->radio_dev);

The seventh patch replace local minor to data lists by video_drvdata().
The function has been there for a long time but wasn't used by many
drivers, probably because they were written before it was available, or,
for some of them, because they were written based on drivers that were
not using it. This patch removes lots of identical unneeded code blocks,
making the result less bug-prone.

The eight patch removes now unneeded video_device::minor assignments to
-1, as the previous patches made them unneeded.

The last patch removes a few more video_device::minor users. As
explained in the patch description, the field was used either to

- test for error conditions that can't happen anymore with the current
  v4l-dvb core,
- store the value in a driver private field that isn't used anymore,
- check the video device type where video_device::vfl_type should be
  used, or
- create the name of a kernel thread that should get a stable name.

There are still two video_device::num users and those can easily be
removed. Hans Verkuil is working on a patch, as one of the drivers is
the ivtv driver and the other one is based on the same code.

There are also still a few video_device::minor users. One of them is
the pvrusb2 driver that creates sysfs attributes storing the minor
numbers of the device nodes created by the driver. I'm not sure what to
do about that one. All the others are V4L1 drivers that need the minor
number for the VIDIOCGUNIT ioctl. Hopefully that will die when the
drivers will be ported to V4L2 :-)

I've split the patches into core and device patches to make them easier
to apply on my work trees. I'll merge the core and device code together
when submitting a pull request to avoid bisection errors.

I'll send a pull request after receiving (and incorporating) your
comments, or in a few days if there's no comments.

Regards,

Laurent Pinchart


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

* v4l: Add video_device_node_name function
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  7:06   ` Hans Verkuil
  2009-11-18  0:38 ` v4l: Use the new " Laurent Pinchart
                   ` (9 subsequent siblings)
  10 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Many drivers access the device number (video_device::v4l2_devnode::num)
in order to print the video device node name. Add and use a helper
function to retrieve the video_device node name.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/v4l2-dev.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
@@ -619,8 +619,8 @@ static int __video_register_device(struc
 	vdev->dev.release = v4l2_device_release;
 
 	if (nr != -1 && nr != vdev->num && warn_if_nr_in_use)
-		printk(KERN_WARNING "%s: requested %s%d, got %s%d\n",
-				__func__, name_base, nr, name_base, vdev->num);
+		printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__,
+			name_base, nr, video_device_node_name(vdev));
 
 	/* Part 5: Activate this minor. The char device can now be used. */
 	mutex_lock(&videodev_lock);
Index: v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/include/media/v4l2-dev.h
+++ v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
@@ -153,6 +153,15 @@ static inline void *video_drvdata(struct
 	return video_get_drvdata(video_devdata(file));
 }
 
+static inline const char *video_device_node_name(struct video_device *vdev)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
+	return vdev->dev.class_id;
+#else
+	return dev_name(&vdev->dev);
+#endif
+}
+
 static inline int video_is_unregistered(struct video_device *vdev)
 {
 	return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);

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

* v4l: Use the new video_device_node_name function
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
  2009-11-18  0:38 ` v4l: Add video_device_node_name function Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  6:29   ` Hans Verkuil
  2009-11-18  0:38 ` v4l: Remove video_device::num usage from device drivers Laurent Pinchart
                   ` (8 subsequent siblings)
  10 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Fix all device drivers to use the new video_device_node_name function.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/common/saa7146_fops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
@@ -544,15 +544,13 @@ int saa7146_register_device(struct video
 		return err;
 	}
 
-	if( VFL_TYPE_GRABBER == type ) {
+	if (VFL_TYPE_GRABBER == type)
 		vv->video_minor = vfd->minor;
-		INFO(("%s: registered device video%d [v4l2]\n",
-			dev->name, vfd->num));
-	} else {
+	else
 		vv->vbi_minor = vfd->minor;
-		INFO(("%s: registered device vbi%d [v4l2]\n",
-			dev->name, vfd->num));
-	}
+
+	INFO(("%s: registered device %s [v4l2]\n",
+		dev->name, video_device_node_name(vfd)));
 
 	*vid = vfd;
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -4276,8 +4276,8 @@ static int __devinit bttv_register_video
 	if (video_register_device(btv->video_dev, VFL_TYPE_GRABBER,
 				  video_nr[btv->c.nr]) < 0)
 		goto err;
-	printk(KERN_INFO "bttv%d: registered device video%d\n",
-	       btv->c.nr, btv->video_dev->num);
+	printk(KERN_INFO "bttv%d: registered device %s\n",
+	       btv->c.nr, video_device_node_name(btv->video_dev));
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
 	if (class_device_create_file(&btv->video_dev->dev,
 				     &class_device_attr_card)<0) {
@@ -4298,8 +4298,8 @@ static int __devinit bttv_register_video
 	if (video_register_device(btv->vbi_dev, VFL_TYPE_VBI,
 				  vbi_nr[btv->c.nr]) < 0)
 		goto err;
-	printk(KERN_INFO "bttv%d: registered device vbi%d\n",
-	       btv->c.nr, btv->vbi_dev->num);
+	printk(KERN_INFO "bttv%d: registered device %s\n",
+	       btv->c.nr, video_device_node_name(btv->vbi_dev));
 
 	if (!btv->has_radio)
 		return 0;
@@ -4310,8 +4310,8 @@ static int __devinit bttv_register_video
 	if (video_register_device(btv->radio_dev, VFL_TYPE_RADIO,
 				  radio_nr[btv->c.nr]) < 0)
 		goto err;
-	printk(KERN_INFO "bttv%d: registered device radio%d\n",
-	       btv->c.nr, btv->radio_dev->num);
+	printk(KERN_INFO "bttv%d: registered device %s\n",
+	       btv->c.nr, video_device_node_name(btv->radio_dev));
 
 	/* all done */
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cpia.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cpia.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cpia.c
@@ -1343,15 +1343,13 @@ out:
 
 static void create_proc_cpia_cam(struct cam_data *cam)
 {
-	char name[5 + 1 + 10 + 1];
 	struct proc_dir_entry *ent;
 
 	if (!cpia_proc_root || !cam)
 		return;
 
-	snprintf(name, sizeof(name), "video%d", cam->vdev.num);
-
-	ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root);
+	ent = create_proc_entry(video_device_node_name(&cam->vdev),
+				S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root);
 	if (!ent)
 		return;
 
@@ -1369,13 +1367,10 @@ static void create_proc_cpia_cam(struct 
 
 static void destroy_proc_cpia_cam(struct cam_data *cam)
 {
-	char name[5 + 1 + 10 + 1];
-
 	if (!cam || !cam->proc_entry)
 		return;
 
-	snprintf(name, sizeof(name), "video%d", cam->vdev.num);
-	remove_proc_entry(name, cpia_proc_root);
+	remove_proc_entry(video_device_node_name(&cam->vdev), cpia_proc_root);
 	cam->proc_entry = NULL;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cpia2/cpia2_v4l.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cpia2/cpia2_v4l.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cpia2/cpia2_v4l.c
@@ -1967,9 +1967,9 @@ void cpia2_unregister_camera(struct came
 	if (!cam->open_count) {
 		video_unregister_device(cam->vdev);
 	} else {
-		LOG("/dev/video%d removed while open, "
-		    "deferring video_unregister_device\n",
-		    cam->vdev->num);
+		LOG("/dev/%s removed while open, deferring "
+		    "video_unregister_device\n",
+		    video_device_node_name(cam->vdev));
 	}
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx18/cx18-streams.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx18/cx18-streams.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx18/cx18-streams.c
@@ -219,6 +219,7 @@ static int cx18_reg_dev(struct cx18 *cx,
 {
 	struct cx18_stream *s = &cx->streams[type];
 	int vfl_type = cx18_stream_info[type].vfl_type;
+	const char *name;
 	int num, ret;
 
 	/* TODO: Shouldn't this be a VFL_TYPE_TRANSPORT or something?
@@ -258,29 +259,30 @@ static int cx18_reg_dev(struct cx18 *cx,
 		s->video_dev = NULL;
 		return ret;
 	}
-	num = s->video_dev->num;
+
+	name = video_device_node_name(s->video_dev);
 
 	switch (vfl_type) {
 	case VFL_TYPE_GRABBER:
-		CX18_INFO("Registered device video%d for %s (%d x %d kB)\n",
-			  num, s->name, cx->stream_buffers[type],
+		CX18_INFO("Registered device %s for %s (%d x %d kB)\n",
+			  name, s->name, cx->stream_buffers[type],
 			  cx->stream_buf_size[type]/1024);
 		break;
 
 	case VFL_TYPE_RADIO:
-		CX18_INFO("Registered device radio%d for %s\n",
-			num, s->name);
+		CX18_INFO("Registered device %s for %s\n",
+			name, s->name);
 		break;
 
 	case VFL_TYPE_VBI:
 		if (cx->stream_buffers[type])
-			CX18_INFO("Registered device vbi%d for %s "
+			CX18_INFO("Registered device %s for %s "
 				  "(%d x %d bytes)\n",
-				  num, s->name, cx->stream_buffers[type],
+				  name, s->name, cx->stream_buffers[type],
 				  cx->stream_buf_size[type]);
 		else
-			CX18_INFO("Registered device vbi%d for %s\n",
-				num, s->name);
+			CX18_INFO("Registered device %s for %s\n",
+				name, s->name);
 		break;
 	}
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-cards.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-cards.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -880,8 +880,9 @@ static void cx231xx_usb_disconnect(struc
 
 	if (dev->users) {
 		cx231xx_warn
-		    ("device /dev/video%d is open! Deregistration and memory "
-		     "deallocation are deferred on close.\n", dev->vdev->num);
+		    ("device /dev/%s is open! Deregistration and memory "
+		     "deallocation are deferred on close.\n",
+		     video_device_node_name(dev->vdev));
 
 		dev->state |= DEV_MISCONFIGURED;
 		cx231xx_uninit_isoc(dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2027,8 +2027,8 @@ void cx231xx_release_analog_resources(st
 		dev->radio_dev = NULL;
 	}
 	if (dev->vbi_dev) {
-		cx231xx_info("V4L2 device /dev/vbi%d deregistered\n",
-			     dev->vbi_dev->num);
+		cx231xx_info("V4L2 device /dev/%s deregistered\n",
+			     video_device_node_name(dev->vbi_dev));
 		if (-1 != dev->vbi_dev->minor)
 			video_unregister_device(dev->vbi_dev);
 		else
@@ -2036,8 +2036,8 @@ void cx231xx_release_analog_resources(st
 		dev->vbi_dev = NULL;
 	}
 	if (dev->vdev) {
-		cx231xx_info("V4L2 device /dev/video%d deregistered\n",
-			     dev->vdev->num);
+		cx231xx_info("V4L2 device /dev/%s deregistered\n",
+			     video_device_node_name(dev->vdev));
 		if (-1 != dev->vdev->minor)
 			video_unregister_device(dev->vdev);
 		else
@@ -2374,8 +2374,8 @@ int cx231xx_register_analog_devices(stru
 		return ret;
 	}
 
-	cx231xx_info("%s/0: registered device video%d [v4l2]\n",
-		     dev->name, dev->vdev->num);
+	cx231xx_info("%s/0: registered device %s [v4l2]\n",
+		     dev->name, video_device_node_name(dev->vdev));
 
 	/* Initialize VBI template */
 	memcpy(&cx231xx_vbi_template, &cx231xx_video_template,
@@ -2393,8 +2393,8 @@ int cx231xx_register_analog_devices(stru
 		return ret;
 	}
 
-	cx231xx_info("%s/0: registered device vbi%d\n",
-		     dev->name, dev->vbi_dev->num);
+	cx231xx_info("%s/0: registered device %s\n",
+		     dev->name, video_device_node_name(dev->vbi_dev));
 
 	if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) {
 		dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template,
@@ -2409,12 +2409,13 @@ int cx231xx_register_analog_devices(stru
 			cx231xx_errdev("can't register radio device\n");
 			return ret;
 		}
-		cx231xx_info("Registered radio device as /dev/radio%d\n",
-			     dev->radio_dev->num);
+		cx231xx_info("Registered radio device as /dev/%s\n",
+			     video_device_node_name(dev->radio_dev));
 	}
 
-	cx231xx_info("V4L2 device registered as /dev/video%d and /dev/vbi%d\n",
-		     dev->vdev->num, dev->vbi_dev->num);
+	cx231xx_info("V4L2 device registered as /dev/%s and /dev/%s\n",
+		     video_device_node_name(dev->vdev),
+		     video_device_node_name(dev->vbi_dev));
 
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-417.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
@@ -1817,8 +1817,8 @@ int cx23885_417_register(struct cx23885_
 		return err;
 	}
 
-	printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
-	       dev->name, dev->v4l_device->num);
+	printk(KERN_INFO "%s: registered device video%s [mpeg]\n",
+	       dev->name, video_device_node_name(dev->v4l_device));
 
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -1794,8 +1794,8 @@ int cx23885_video_register(struct cx2388
 			dev->name);
 		goto fail_unreg;
 	}
-	printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n",
-	       dev->name, dev->video_dev->num);
+	printk(KERN_INFO "%s/0: registered device %s [v4l2]\n",
+	       dev->name, video_device_node_name(dev->video_dev));
 #if 0
 	dev->vbi_dev = cx23885_vdev_init(dev, dev->pci,
 		&cx23885_vbi_template, "vbi");
@@ -1806,8 +1806,8 @@ int cx23885_video_register(struct cx2388
 			dev->name);
 		goto fail_unreg;
 	}
-	printk(KERN_INFO "%s/0: registered device vbi%d\n",
-	       dev->name, dev->vbi_dev->num);
+	printk(KERN_INFO "%s/0: registered device %s\n",
+	       dev->name, video_device_node_name(dev));
 
 	if (dev->has_radio) {
 		dev->radio_dev = cx23885_vdev_init(dev, dev->pci,
@@ -1819,8 +1819,8 @@ int cx23885_video_register(struct cx2388
 			       dev->name);
 			goto fail_unreg;
 		}
-		printk(KERN_INFO "%s/0: registered device radio%d\n",
-		       dev->name, dev->radio_dev->num);
+		printk(KERN_INFO "%s/0: registered device %s\n",
+		       dev->name, video_device_node_name(dev));
 	}
 #endif
 	/* initial device configuration */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -1318,8 +1318,8 @@ static int blackbird_register_video(stru
 		       dev->core->name);
 		return err;
 	}
-	printk(KERN_INFO "%s/2: registered device video%d [mpeg]\n",
-	       dev->core->name, dev->mpeg_dev->num);
+	printk(KERN_INFO "%s/2: registered device %s [mpeg]\n",
+	       dev->core->name, video_device_node_name(dev->mpeg_dev));
 	return 0;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
@@ -2194,8 +2194,8 @@ static int __devinit cx8800_initdev(stru
 		       core->name);
 		goto fail_unreg;
 	}
-	printk(KERN_INFO "%s/0: registered device video%d [v4l2]\n",
-	       core->name, dev->video_dev->num);
+	printk(KERN_INFO "%s/0: registered device %s [v4l2]\n",
+	       core->name, video_device_node_name(dev->video_dev));
 
 	dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi");
 	err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
@@ -2205,8 +2205,8 @@ static int __devinit cx8800_initdev(stru
 		       core->name);
 		goto fail_unreg;
 	}
-	printk(KERN_INFO "%s/0: registered device vbi%d\n",
-	       core->name, dev->vbi_dev->num);
+	printk(KERN_INFO "%s/0: registered device %s\n",
+	       core->name, video_device_node_name(dev->vbi_dev));
 
 	if (core->board.radio.type == CX88_RADIO) {
 		dev->radio_dev = cx88_vdev_init(core,dev->pci,
@@ -2218,8 +2218,8 @@ static int __devinit cx8800_initdev(stru
 			       core->name);
 			goto fail_unreg;
 		}
-		printk(KERN_INFO "%s/0: registered device radio%d\n",
-		       core->name, dev->radio_dev->num);
+		printk(KERN_INFO "%s/0: registered device %s\n",
+		       core->name, video_device_node_name(dev->radio_dev));
 	}
 
 	/* everything worked */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-cards.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-cards.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-cards.c
@@ -3017,9 +3017,9 @@ static void em28xx_usb_disconnect(struct
 
 	if (dev->users) {
 		em28xx_warn
-		    ("device /dev/video%d is open! Deregistration and memory "
+		    ("device /dev/%s is open! Deregistration and memory "
 		     "deallocation are deferred on close.\n",
-				dev->vdev->num);
+		     video_device_node_name(dev->vdev));
 
 		dev->state |= DEV_MISCONFIGURED;
 		em28xx_uninit_isoc(dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -2224,8 +2224,8 @@ void em28xx_release_analog_resources(str
 		dev->radio_dev = NULL;
 	}
 	if (dev->vbi_dev) {
-		em28xx_info("V4L2 device /dev/vbi%d deregistered\n",
-			    dev->vbi_dev->num);
+		em28xx_info("V4L2 device /dev/%s deregistered\n",
+			    video_device_node_name(dev->vbi_dev));
 		if (-1 != dev->vbi_dev->minor)
 			video_unregister_device(dev->vbi_dev);
 		else
@@ -2233,8 +2233,8 @@ void em28xx_release_analog_resources(str
 		dev->vbi_dev = NULL;
 	}
 	if (dev->vdev) {
-		em28xx_info("V4L2 device /dev/video%d deregistered\n",
-			    dev->vdev->num);
+		em28xx_info("V4L2 device /dev/%s deregistered\n",
+			    video_device_node_name(dev->vdev));
 		if (-1 != dev->vdev->minor)
 			video_unregister_device(dev->vdev);
 		else
@@ -2597,16 +2597,16 @@ int em28xx_register_analog_devices(struc
 			em28xx_errdev("can't register radio device\n");
 			return ret;
 		}
-		em28xx_info("Registered radio device as /dev/radio%d\n",
-			    dev->radio_dev->num);
+		em28xx_info("Registered radio device as /dev/%s\n",
+			    video_device_node_name(dev->radio_dev));
 	}
 
-	em28xx_info("V4L2 video device registered as /dev/video%d\n",
-				dev->vdev->num);
+	em28xx_info("V4L2 video device registered as /dev/%s\n",
+		    video_device_node_name(dev->vdev));
 
 	if (dev->vbi_dev)
-		em28xx_info("V4L2 VBI device registered as /dev/vbi%d\n",
-			    dev->vbi_dev->num);
+		em28xx_info("V4L2 VBI device registered as /dev/%s\n",
+			    video_device_node_name(dev->vbi_dev));
 
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/et61x251/et61x251_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/et61x251/et61x251_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/et61x251/et61x251_core.c
@@ -591,8 +591,8 @@ static int et61x251_stream_interrupt(str
 	else if (cam->stream != STREAM_OFF) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "URB timeout reached. The camera is misconfigured. To "
-		       "use it, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use it, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -1199,7 +1199,8 @@ static void et61x251_release_resources(s
 
 	cam = container_of(kref, struct et61x251_device, kref);
 
-	DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num);
+	DBG(2, "V4L2 device /dev/%s deregistered",
+	    video_device_node_name(cam->v4ldev));
 	video_set_drvdata(cam->v4ldev, NULL);
 	video_unregister_device(cam->v4ldev);
 	usb_put_dev(cam->usbdev);
@@ -1240,8 +1241,8 @@ static int et61x251_open(struct file *fi
 	}
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is already in use",
-		       cam->v4ldev->num);
+		DBG(2, "Device /dev/%s is already in use",
+		       video_device_node_name(cam->v4ldev));
 		DBG(3, "Simultaneous opens are not supported");
 		if ((filp->f_flags & O_NONBLOCK) ||
 		    (filp->f_flags & O_NDELAY)) {
@@ -1284,7 +1285,8 @@ static int et61x251_open(struct file *fi
 	cam->frame_count = 0;
 	et61x251_empty_framequeues(cam);
 
-	DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s is open",
+	    video_device_node_name(cam->v4ldev));
 
 out:
 	mutex_unlock(&cam->open_mutex);
@@ -1308,7 +1310,8 @@ static int et61x251_release(struct file 
 	cam->users--;
 	wake_up_interruptible_nr(&cam->wait_open, 1);
 
-	DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s closed",
+	    video_device_node_name(cam->v4ldev));
 
 	kref_put(&cam->kref, et61x251_release_resources);
 
@@ -1850,8 +1853,8 @@ et61x251_vidioc_s_crop(struct et61x251_d
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -1863,8 +1866,8 @@ et61x251_vidioc_s_crop(struct et61x251_d
 	    nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -2073,8 +2076,8 @@ et61x251_vidioc_try_s_fmt(struct et61x25
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -2085,8 +2088,8 @@ et61x251_vidioc_try_s_fmt(struct et61x25
 	    nbuffers != et61x251_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -2134,7 +2137,7 @@ et61x251_vidioc_s_jpegcomp(struct et61x2
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware "
 		       "problems. To use the camera, close and open "
-		       "/dev/video%d again.", cam->v4ldev->num);
+		       "/dev/%s again.", video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -2607,7 +2610,8 @@ et61x251_usb_probe(struct usb_interface*
 		goto fail;
 	}
 
-	DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num);
+	DBG(2, "V4L2 device registered as /dev/%s",
+	    video_device_node_name(cam->v4ldev));
 
 	cam->module_param.force_munmap = force_munmap[dev_nr];
 	cam->module_param.frame_timeout = frame_timeout[dev_nr];
@@ -2658,9 +2662,9 @@ static void et61x251_usb_disconnect(stru
 	DBG(2, "Disconnecting %s...", cam->v4ldev->name);
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is open! Deregistration and "
-		       "memory deallocation are deferred.",
-		    cam->v4ldev->num);
+		DBG(2, "Device /dev/%s is open! Deregistration and memory "
+		       "deallocation are deferred.",
+		    video_device_node_name(cam->v4ldev));
 		cam->state |= DEV_MISCONFIGURED;
 		et61x251_stop_transfer(cam);
 		cam->state |= DEV_DISCONNECTED;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gspca.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/gspca/gspca.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gspca.c
@@ -1008,7 +1008,8 @@ static void gspca_release(struct video_d
 {
 	struct gspca_dev *gspca_dev = container_of(vfd, struct gspca_dev, vdev);
 
-	PDEBUG(D_PROBE, "/dev/video%d released", gspca_dev->vdev.num);
+	PDEBUG(D_PROBE, "/dev/%s released",
+		video_device_node_name(&gspca_dev->vdev));
 
 	kfree(gspca_dev->usb_buf);
 	kfree(gspca_dev);
@@ -2091,7 +2092,8 @@ int gspca_dev_probe(struct usb_interface
 	}
 
 	usb_set_intfdata(intf, gspca_dev);
-	PDEBUG(D_PROBE, "/dev/video%d created", gspca_dev->vdev.num);
+	PDEBUG(D_PROBE, "/dev/%s created",
+		video_device_node_name(&gspca_dev->vdev));
 	return 0;
 out:
 	kfree(gspca_dev->usb_buf);
@@ -2110,7 +2112,8 @@ void gspca_disconnect(struct usb_interfa
 {
 	struct gspca_dev *gspca_dev = usb_get_intfdata(intf);
 
-	PDEBUG(D_PROBE, "/dev/video%d disconnect", gspca_dev->vdev.num);
+	PDEBUG(D_PROBE, "/dev/%s disconnect",
+		video_device_node_name(&gspca_dev->vdev));
 	mutex_lock(&gspca_dev->usb_lock);
 	gspca_dev->present = 0;
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/ivtv/ivtv-streams.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/ivtv/ivtv-streams.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/ivtv/ivtv-streams.c
@@ -245,6 +245,7 @@ static int ivtv_reg_dev(struct ivtv *itv
 {
 	struct ivtv_stream *s = &itv->streams[type];
 	int vfl_type = ivtv_stream_info[type].vfl_type;
+	const char *name;
 	int num;
 
 	if (s->vdev == NULL)
@@ -268,24 +269,24 @@ static int ivtv_reg_dev(struct ivtv *itv
 		s->vdev = NULL;
 		return -ENOMEM;
 	}
-	num = s->vdev->num;
+	name = video_device_node_name(s->vdev);
 
 	switch (vfl_type) {
 	case VFL_TYPE_GRABBER:
-		IVTV_INFO("Registered device video%d for %s (%d kB)\n",
-			num, s->name, itv->options.kilobytes[type]);
+		IVTV_INFO("Registered device %s for %s (%d kB)\n",
+			name, s->name, itv->options.kilobytes[type]);
 		break;
 	case VFL_TYPE_RADIO:
-		IVTV_INFO("Registered device radio%d for %s\n",
-			num, s->name);
+		IVTV_INFO("Registered device %s for %s\n",
+			name, s->name);
 		break;
 	case VFL_TYPE_VBI:
 		if (itv->options.kilobytes[type])
-			IVTV_INFO("Registered device vbi%d for %s (%d kB)\n",
-				num, s->name, itv->options.kilobytes[type]);
+			IVTV_INFO("Registered device %s for %s (%d kB)\n",
+				name, s->name, itv->options.kilobytes[type]);
 		else
-			IVTV_INFO("Registered device vbi%d for %s\n",
-				num, s->name);
+			IVTV_INFO("Registered device %s for %s\n",
+				name, s->name);
 		break;
 	}
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -152,17 +152,6 @@ static struct v4l2_format pvr_format [] 
 };
 
 
-static const char *get_v4l_name(int v4l_type)
-{
-	switch (v4l_type) {
-	case VFL_TYPE_GRABBER: return "video";
-	case VFL_TYPE_RADIO: return "radio";
-	case VFL_TYPE_VBI: return "vbi";
-	default: return "?";
-	}
-}
-
-
 /*
  * pvr_ioctl()
  *
@@ -892,10 +881,8 @@ static long pvr2_v4l2_do_ioctl(struct fi
 
 static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
 {
-	int num = dip->devbase.num;
 	struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw;
 	enum pvr2_config cfg = dip->config;
-	int v4l_type = dip->v4l_type;
 
 	pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1);
 
@@ -907,8 +894,8 @@ static void pvr2_v4l2_dev_destroy(struct
 	   are gone. */
 	video_unregister_device(&dip->devbase);
 
-	printk(KERN_INFO "pvrusb2: unregistered device %s%u [%s]\n",
-	       get_v4l_name(v4l_type), num,
+	printk(KERN_INFO "pvrusb2: unregistered device %s [%s]\n",
+	       video_device_node_name(&dip->devbase),
 	       pvr2_config_get_name(cfg));
 
 }
@@ -1322,8 +1309,8 @@ static void pvr2_v4l2_dev_init(struct pv
 			": Failed to register pvrusb2 v4l device\n");
 	}
 
-	printk(KERN_INFO "pvrusb2: registered device %s%u [%s]\n",
-	       get_v4l_name(dip->v4l_type), dip->devbase.num,
+	printk(KERN_INFO "pvrusb2: registered device %s [%s]\n",
+	       video_device_node_name(&dip->devbase),
 	       pvr2_config_get_name(dip->config));
 
 	pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/pwc/pwc-if.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/pwc/pwc-if.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/pwc/pwc-if.c
@@ -1815,7 +1815,8 @@ static int usb_pwc_probe(struct usb_inte
 		goto err_video_release;
 	}
 
-	PWC_INFO("Registered as /dev/video%d.\n", pdev->vdev->num);
+	PWC_INFO("Registered as /dev/%s.\n",
+		 video_device_node_name(pdev->vdev));
 
 	/* occupy slot */
 	if (hint < MAX_DEV_HINTS)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -1107,8 +1107,8 @@ static int __devinit saa7134_initdev(str
 		       dev->name);
 		goto fail4;
 	}
-	printk(KERN_INFO "%s: registered device video%d [v4l2]\n",
-	       dev->name, dev->video_dev->num);
+	printk(KERN_INFO "%s: registered device %s [v4l2]\n",
+	       dev->name, video_device_node_name(dev->video_dev));
 
 	dev->vbi_dev = vdev_init(dev, &saa7134_video_template, "vbi");
 
@@ -1116,8 +1116,8 @@ static int __devinit saa7134_initdev(str
 				    vbi_nr[dev->nr]);
 	if (err < 0)
 		goto fail4;
-	printk(KERN_INFO "%s: registered device vbi%d\n",
-	       dev->name, dev->vbi_dev->num);
+	printk(KERN_INFO "%s: registered device %s\n",
+	       dev->name, video_device_node_name(dev->vbi_dev));
 
 	if (card_has_radio(dev)) {
 		dev->radio_dev = vdev_init(dev,&saa7134_radio_template,"radio");
@@ -1125,8 +1125,8 @@ static int __devinit saa7134_initdev(str
 					    radio_nr[dev->nr]);
 		if (err < 0)
 			goto fail4;
-		printk(KERN_INFO "%s: registered device radio%d\n",
-		       dev->name, dev->radio_dev->num);
+		printk(KERN_INFO "%s: registered device %s\n",
+		       dev->name, video_device_node_name(dev->radio_dev));
 	}
 
 	/* everything worked */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -552,8 +552,8 @@ static int empress_init(struct saa7134_d
 		dev->empress_dev = NULL;
 		return err;
 	}
-	printk(KERN_INFO "%s: registered device video%d [mpeg]\n",
-	       dev->name, dev->empress_dev->num);
+	printk(KERN_INFO "%s: registered device %s [mpeg]\n",
+	       dev->name, video_device_node_name(dev->empress_dev));
 
 	videobuf_queue_sg_init(&dev->empress_tsq, &saa7134_ts_qops,
 			    &dev->pci->dev, &dev->slock,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/se401.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/se401.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/se401.c
@@ -1436,8 +1436,8 @@ static int se401_probe(struct usb_interf
 		err("video_register_device failed");
 		return -EIO;
 	}
-	dev_info(&intf->dev, "registered new video device: video%d\n",
-		 se401->vdev.num);
+	dev_info(&intf->dev, "registered new video device: %s\n",
+		 video_device_node_name(&se401->vdev));
 
 	usb_set_intfdata(intf, se401);
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/sn9c102/sn9c102_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/sn9c102/sn9c102_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/sn9c102/sn9c102_core.c
@@ -1011,8 +1011,8 @@ static int sn9c102_stream_interrupt(stru
 	else if (cam->stream != STREAM_OFF) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "URB timeout reached. The camera is misconfigured. "
-		       "To use it, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "To use it, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -1738,7 +1738,8 @@ static void sn9c102_release_resources(st
 
 	cam = container_of(kref, struct sn9c102_device, kref);
 
-	DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num);
+	DBG(2, "V4L2 device /dev/%s deregistered",
+	    video_device_node_name(cam->v4ldev));
 	video_set_drvdata(cam->v4ldev, NULL);
 	video_unregister_device(cam->v4ldev);
 	usb_put_dev(cam->usbdev);
@@ -1795,8 +1796,8 @@ static int sn9c102_open(struct file *fil
 	}
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is already in use",
-		       cam->v4ldev->num);
+		DBG(2, "Device /dev/%s is already in use",
+		       video_device_node_name(cam->v4ldev));
 		DBG(3, "Simultaneous opens are not supported");
 		/*
 		   open() must follow the open flags and should block
@@ -1849,7 +1850,8 @@ static int sn9c102_open(struct file *fil
 	cam->frame_count = 0;
 	sn9c102_empty_framequeues(cam);
 
-	DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s is open",
+	    video_device_node_name(cam->v4ldev));
 
 out:
 	mutex_unlock(&cam->open_mutex);
@@ -1874,7 +1876,8 @@ static int sn9c102_release(struct file *
 	cam->users--;
 	wake_up_interruptible_nr(&cam->wait_open, 1);
 
-	DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s closed",
+	    video_device_node_name(cam->v4ldev));
 
 	kref_put(&cam->kref, sn9c102_release_resources);
 
@@ -2437,8 +2440,8 @@ sn9c102_vidioc_s_crop(struct sn9c102_dev
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -2450,8 +2453,8 @@ sn9c102_vidioc_s_crop(struct sn9c102_dev
 	    nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -2694,8 +2697,8 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -2706,8 +2709,8 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_
 	    nbuffers != sn9c102_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -2752,9 +2755,9 @@ sn9c102_vidioc_s_jpegcomp(struct sn9c102
 	err += sn9c102_set_compression(cam, &jc);
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
-		DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware "
-		       "problems. To use the camera, close and open "
-		       "/dev/video%d again.", cam->v4ldev->num);
+		DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware problems. "
+		       "To use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -3350,7 +3353,8 @@ sn9c102_usb_probe(struct usb_interface* 
 		goto fail;
 	}
 
-	DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num);
+	DBG(2, "V4L2 device registered as /dev/%s",
+	    video_device_node_name(cam->v4ldev));
 
 	video_set_drvdata(cam->v4ldev, cam);
 	cam->module_param.force_munmap = force_munmap[dev_nr];
@@ -3402,9 +3406,9 @@ static void sn9c102_usb_disconnect(struc
 	DBG(2, "Disconnecting %s...", cam->v4ldev->name);
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is open! Deregistration and "
-		       "memory deallocation are deferred.",
-		    cam->v4ldev->num);
+		DBG(2, "Device /dev/%s is open! Deregistration and memory "
+		       "deallocation are deferred.",
+		    video_device_node_name(cam->v4ldev));
 		cam->state |= DEV_MISCONFIGURED;
 		sn9c102_stop_transfer(cam);
 		cam->state |= DEV_DISCONNECTED;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stk-webcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stk-webcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stk-webcam.c
@@ -1329,7 +1329,7 @@ static int stk_register_video_device(str
 		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);
+			 " /dev/%s\n", video_device_node_name(&dev->vdev));
 	return err;
 }
 
@@ -1420,7 +1420,7 @@ static void stk_camera_disconnect(struct
 	stk_remove_sysfs_files(&dev->vdev);
 
 	STK_INFO("Syntek USB2.0 Camera release resources "
-		"video device /dev/video%d\n", dev->vdev.num);
+		 "video device /dev/%s\n", video_device_node_name(&dev->vdev));
 
 	video_unregister_device(&dev->vdev);
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stv680.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stv680.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stv680.c
@@ -1472,8 +1472,8 @@ static int stv680_probe (struct usb_inte
 		retval = -EIO;
 		goto error_vdev;
 	}
-	PDEBUG(0, "STV(i): registered new video device: video%d",
-		stv680->vdev->num);
+	PDEBUG(0, "STV(i): registered new video device: %s",
+		video_device_node_name(stv680->vdev));
 
 	usb_set_intfdata (intf, stv680);
 	retval = stv680_create_sysfs_files(stv680->vdev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/usbvideo.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvideo/usbvideo.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/usbvideo.c
@@ -1053,9 +1053,9 @@ int usbvideo_RegisterVideoDevice(struct 
 			 "%s: video_register_device() successful\n", __func__);
 	}
 
-	dev_info(&uvd->dev->dev, "%s on /dev/video%d: canvas=%s videosize=%s\n",
+	dev_info(&uvd->dev->dev, "%s on /dev/%s: canvas=%s videosize=%s\n",
 		 (uvd->handle != NULL) ? uvd->handle->drvName : "???",
-		 uvd->vdev.num, tmp2, tmp1);
+		 video_device_node_name(&uvd->vdev), tmp2, tmp1);
 
 	usb_get_dev(uvd->dev);
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/vicam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvideo/vicam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/vicam.c
@@ -1183,8 +1183,8 @@ vicam_probe( struct usb_interface *intf,
 		return -EIO;
 	}
 
-	printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",
-			cam->vdev.num);
+	printk(KERN_INFO "ViCam webcam driver now controlling device %s\n",
+		video_device_node_name(&cam->vdev));
 
 	usb_set_intfdata (intf, cam);
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvision/usbvision-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
@@ -1416,8 +1416,8 @@ static void usbvision_unregister_video(s
 {
 	// vbi Device:
 	if (usbvision->vbi) {
-		PDEBUG(DBG_PROBE, "unregister /dev/vbi%d [v4l2]",
-		       usbvision->vbi->num);
+		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
+		       video_device_node_name(usbvision->vbi));
 		if (usbvision->vbi->minor != -1) {
 			video_unregister_device(usbvision->vbi);
 		} else {
@@ -1428,8 +1428,8 @@ static void usbvision_unregister_video(s
 
 	// Radio Device:
 	if (usbvision->rdev) {
-		PDEBUG(DBG_PROBE, "unregister /dev/radio%d [v4l2]",
-		       usbvision->rdev->num);
+		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
+		       video_device_node_name(usbvision->rdev));
 		if (usbvision->rdev->minor != -1) {
 			video_unregister_device(usbvision->rdev);
 		} else {
@@ -1440,8 +1440,8 @@ static void usbvision_unregister_video(s
 
 	// Video Device:
 	if (usbvision->vdev) {
-		PDEBUG(DBG_PROBE, "unregister /dev/video%d [v4l2]",
-		       usbvision->vdev->num);
+		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
+		       video_device_node_name(usbvision->vdev));
 		if (usbvision->vdev->minor != -1) {
 			video_unregister_device(usbvision->vdev);
 		} else {
@@ -1466,8 +1466,8 @@ static int __devinit usbvision_register_
 				  video_nr)<0) {
 		goto err_exit;
 	}
-	printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/video%d [v4l2]\n",
-	       usbvision->nr, usbvision->vdev->num);
+	printk(KERN_INFO "USBVision[%d]: registered USBVision Video device /dev/%s [v4l2]\n",
+	       usbvision->nr, video_device_node_name(usbvision->vdev));
 
 	// Radio Device:
 	if (usbvision_device_data[usbvision->DevModel].Radio) {
@@ -1483,8 +1483,8 @@ static int __devinit usbvision_register_
 					  radio_nr)<0) {
 			goto err_exit;
 		}
-		printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/radio%d [v4l2]\n",
-		       usbvision->nr, usbvision->rdev->num);
+		printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device /dev/%s [v4l2]\n",
+		       usbvision->nr, video_device_node_name(usbvision->rdev));
 	}
 	// vbi Device:
 	if (usbvision_device_data[usbvision->DevModel].vbi) {
@@ -1499,8 +1499,8 @@ static int __devinit usbvision_register_
 					  vbi_nr)<0) {
 			goto err_exit;
 		}
-		printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/vbi%d [v4l2] (Not Working Yet!)\n",
-		       usbvision->nr, usbvision->vbi->num);
+		printk(KERN_INFO "USBVision[%d]: registered USBVision VBI device /dev/%s [v4l2] (Not Working Yet!)\n",
+		       usbvision->nr, video_device_node_name(usbvision->vbi));
 	}
 	// all done
 	return 0;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/vivi.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
@@ -1151,7 +1151,8 @@ static int vivi_open(struct file *file)
 		return -EBUSY;
 	}
 
-	dprintk(dev, 1, "open /dev/video%d type=%s users=%d\n", dev->vfd->num,
+	dprintk(dev, 1, "open /dev/%s type=%s users=%d\n",
+		video_device_node_name(dev->vfd),
 		v4l2_type_names[V4L2_BUF_TYPE_VIDEO_CAPTURE], dev->users);
 
 	/* allocate + initialize per filehandle data */
@@ -1320,8 +1321,8 @@ static int vivi_release(void)
 		list_del(list);
 		dev = list_entry(list, struct vivi_dev, vivi_devlist);
 
-		v4l2_info(&dev->v4l2_dev, "unregistering /dev/video%d\n",
-			dev->vfd->num);
+		v4l2_info(&dev->v4l2_dev, "unregistering /dev/%s\n",
+			video_device_node_name(dev->vfd));
 		video_unregister_device(dev->vfd);
 		v4l2_device_unregister(&dev->v4l2_dev);
 		kfree(dev);
@@ -1382,8 +1383,8 @@ static int __init vivi_create_instance(i
 		video_nr++;
 
 	dev->vfd = vfd;
-	v4l2_info(&dev->v4l2_dev, "V4L2 device registered as /dev/video%d\n",
-			vfd->num);
+	v4l2_info(&dev->v4l2_dev, "V4L2 device registered as /dev/%s\n",
+			video_device_node_name(vfd));
 	return 0;
 
 rel_vdev:
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/w9968cf.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
@@ -2337,9 +2337,9 @@ static int w9968cf_sensor_init(struct w9
 error:
 	cam->sensor_initialized = 0;
 	cam->sensor = CC_UNKNOWN;
-	DBG(1, "Image sensor initialization failed for %s (/dev/video%d). "
+	DBG(1, "Image sensor initialization failed for %s (/dev/%s). "
 	       "Try to detach and attach this device again",
-	    symbolic(camlist, cam->id), cam->v4ldev->num)
+	    symbolic(camlist, cam->id), video_device_node_name(cam->v4ldev))
 	return err;
 }
 
@@ -2585,7 +2585,8 @@ static void w9968cf_release_resources(st
 {
 	mutex_lock(&w9968cf_devlist_mutex);
 
-	DBG(2, "V4L device deregistered: /dev/video%d", cam->v4ldev->num)
+	DBG(2, "V4L device deregistered: /dev/%s",
+	    video_device_node_name(cam->v4ldev))
 
 	video_unregister_device(cam->v4ldev);
 	list_del(&cam->v4llist);
@@ -2619,17 +2620,19 @@ static int w9968cf_open(struct file *fil
 
 	if (cam->sensor == CC_UNKNOWN) {
 		DBG(2, "No supported image sensor has been detected by the "
-		       "'ovcamchip' module for the %s (/dev/video%d). Make "
-		       "sure it is loaded *before* (re)connecting the camera.",
-		    symbolic(camlist, cam->id), cam->v4ldev->num)
+		       "'ovcamchip' module for the %s (/dev/%s). Make sure "
+		       "it is loaded *before* (re)connecting the camera.",
+		    symbolic(camlist, cam->id),
+		    video_device_node_name(cam->v4ldev))
 		mutex_unlock(&cam->dev_mutex);
 		up_read(&w9968cf_disconnect);
 		return -ENODEV;
 	}
 
 	if (cam->users) {
-		DBG(2, "%s (/dev/video%d) has been already occupied by '%s'",
-		    symbolic(camlist, cam->id), cam->v4ldev->num, cam->command)
+		DBG(2, "%s (/dev/%s) has been already occupied by '%s'",
+		    symbolic(camlist, cam->id),
+		    video_device_node_name(cam->v4ldev), cam->command)
 		if ((filp->f_flags & O_NONBLOCK)||(filp->f_flags & O_NDELAY)) {
 			mutex_unlock(&cam->dev_mutex);
 			up_read(&w9968cf_disconnect);
@@ -2650,8 +2653,8 @@ static int w9968cf_open(struct file *fil
 		mutex_lock(&cam->dev_mutex);
 	}
 
-	DBG(5, "Opening '%s', /dev/video%d ...",
-	    symbolic(camlist, cam->id), cam->v4ldev->num)
+	DBG(5, "Opening '%s', /dev/%s ...",
+	    symbolic(camlist, cam->id), video_device_node_name(cam->v4ldev))
 
 	cam->streaming = 0;
 	cam->misconfigured = 0;
@@ -3515,7 +3518,8 @@ w9968cf_usb_probe(struct usb_interface* 
 		goto fail;
 	}
 
-	DBG(2, "V4L device registered as /dev/video%d", cam->v4ldev->num)
+	DBG(2, "V4L device registered as /dev/%s",
+	    video_device_node_name(cam->v4ldev))
 
 	/* Set some basic constants */
 	w9968cf_configure_camera(cam, udev, mod_id, dev_nr);
@@ -3571,10 +3575,10 @@ static void w9968cf_usb_disconnect(struc
 		wake_up_interruptible_all(&cam->open);
 
 		if (cam->users) {
-			DBG(2, "The device is open (/dev/video%d)! "
+			DBG(2, "The device is open (/dev/%s)! "
 			       "Process name: %s. Deregistration and memory "
 			       "deallocation are deferred on close.",
-			    cam->v4ldev->num, cam->command)
+			    video_device_node_name(cam->v4ldev), cam->command)
 			cam->misconfigured = 1;
 			w9968cf_stop_transfer(cam);
 			wake_up_interruptible(&cam->wait_queue);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/zc0301/zc0301_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/zc0301/zc0301_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/zc0301/zc0301_core.c
@@ -542,8 +542,8 @@ static int zc0301_stream_interrupt(struc
 	else if (cam->stream != STREAM_OFF) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "URB timeout reached. The camera is misconfigured. To "
-		       "use it, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use it, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -644,7 +644,8 @@ static void zc0301_release_resources(str
 {
 	struct zc0301_device *cam = container_of(kref, struct zc0301_device,
 						 kref);
-	DBG(2, "V4L2 device /dev/video%d deregistered", cam->v4ldev->num);
+	DBG(2, "V4L2 device /dev/%s deregistered",
+	    video_device_node_name(cam->v4ldev));
 	video_set_drvdata(cam->v4ldev, NULL);
 	video_unregister_device(cam->v4ldev);
 	usb_put_dev(cam->usbdev);
@@ -683,7 +684,8 @@ static int zc0301_open(struct file *filp
 	}
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is busy...", cam->v4ldev->num);
+		DBG(2, "Device /dev/%s is busy...",
+		    video_device_node_name(cam->v4ldev));
 		DBG(3, "Simultaneous opens are not supported");
 		if ((filp->f_flags & O_NONBLOCK) ||
 		    (filp->f_flags & O_NDELAY)) {
@@ -726,7 +728,8 @@ static int zc0301_open(struct file *filp
 	cam->frame_count = 0;
 	zc0301_empty_framequeues(cam);
 
-	DBG(3, "Video device /dev/video%d is open", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s is open",
+	    video_device_node_name(cam->v4ldev));
 
 out:
 	mutex_unlock(&cam->open_mutex);
@@ -750,7 +753,8 @@ static int zc0301_release(struct file *f
 	cam->users--;
 	wake_up_interruptible_nr(&cam->wait_open, 1);
 
-	DBG(3, "Video device /dev/video%d closed", cam->v4ldev->num);
+	DBG(3, "Video device /dev/%s closed",
+	    video_device_node_name(cam->v4ldev));
 
 	kref_put(&cam->kref, zc0301_release_resources);
 
@@ -1280,8 +1284,8 @@ zc0301_vidioc_s_crop(struct zc0301_devic
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -1293,8 +1297,8 @@ zc0301_vidioc_s_crop(struct zc0301_devic
 	    nbuffers != zc0301_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_CROP failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -1475,8 +1479,8 @@ zc0301_vidioc_try_s_fmt(struct zc0301_de
 	if (err) { /* atomic, no rollback in ioctl() */
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of hardware problems. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -1487,8 +1491,8 @@ zc0301_vidioc_try_s_fmt(struct zc0301_de
 	    nbuffers != zc0301_request_buffers(cam, nbuffers, cam->io)) {
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_FMT failed because of not enough memory. To "
-		       "use the camera, close and open /dev/video%d again.",
-		    cam->v4ldev->num);
+		       "use the camera, close and open /dev/%s again.",
+		    video_device_node_name(cam->v4ldev));
 		return -ENOMEM;
 	}
 
@@ -1535,7 +1539,7 @@ zc0301_vidioc_s_jpegcomp(struct zc0301_d
 		cam->state |= DEV_MISCONFIGURED;
 		DBG(1, "VIDIOC_S_JPEGCOMP failed because of hardware "
 		       "problems. To use the camera, close and open "
-		       "/dev/video%d again.", cam->v4ldev->num);
+		       "/dev/%s again.", video_device_node_name(cam->v4ldev));
 		return -EIO;
 	}
 
@@ -2007,7 +2011,8 @@ zc0301_usb_probe(struct usb_interface* i
 		goto fail;
 	}
 
-	DBG(2, "V4L2 device registered as /dev/video%d", cam->v4ldev->num);
+	DBG(2, "V4L2 device registered as /dev/%s",
+	    video_device_node_name(cam->v4ldev));
 
 	cam->module_param.force_munmap = force_munmap[dev_nr];
 	cam->module_param.frame_timeout = frame_timeout[dev_nr];
@@ -2044,9 +2049,9 @@ static void zc0301_usb_disconnect(struct
 	DBG(2, "Disconnecting %s...", cam->v4ldev->name);
 
 	if (cam->users) {
-		DBG(2, "Device /dev/video%d is open! Deregistration and "
+		DBG(2, "Device /dev/%s is open! Deregistration and "
 		       "memory deallocation are deferred.",
-		    cam->v4ldev->num);
+		    video_device_node_name(cam->v4ldev));
 		cam->state |= DEV_MISCONFIGURED;
 		zc0301_stop_transfer(cam);
 		cam->state |= DEV_DISCONNECTED;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/zr364xx.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/zr364xx.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/zr364xx.c
@@ -1635,8 +1635,8 @@ static int zr364xx_probe(struct usb_inte
 
 	spin_lock_init(&cam->slock);
 
-	dev_info(&udev->dev, DRIVER_DESC " controlling video device %d\n",
-		 cam->vdev->num);
+	dev_info(&udev->dev, DRIVER_DESC " controlling device %s\n",
+		 video_device_node_name(cam->vdev));
 	return 0;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/arv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/arv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/arv.c
@@ -865,8 +865,8 @@ static int __init ar_init(void)
 		goto out_dev;
 	}
 
-	printk("video%d: Found M64278 VGA (IRQ %d, Freq %dMHz).\n",
-		ar->vdev->num, M32R_IRQ_INT3, freq);
+	printk("%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n",
+		video_device_node_name(ar->vdev), M32R_IRQ_INT3, freq);
 
 	return 0;
 
Index: v4l-dvb-mc-uvc/linux/drivers/staging/go7007/go7007-v4l2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/go7007/go7007-v4l2.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/go7007/go7007-v4l2.c
@@ -1837,8 +1837,8 @@ int go7007_v4l2_init(struct go7007 *go)
 	}
 	video_set_drvdata(go->video_dev, go);
 	++go->ref_count;
-	printk(KERN_INFO "%s: registered device video%d [v4l2]\n",
-	       go->video_dev->name, go->video_dev->num);
+	printk(KERN_INFO "%s: registered device %s [v4l2]\n",
+	       go->video_dev->name, video_device_node_name(go->video_dev));
 
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/omap24xxcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
@@ -1678,7 +1678,8 @@ static int omap24xxcam_device_register(s
 
 	omap24xxcam_poweron_reset(cam);
 
-	dev_info(cam->dev, "registered device video%d\n", vfd->minor);
+	dev_info(cam->dev, "registered device %s\n",
+		 video_device_node_name(vfd));
 
 	return 0;
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/hdpvr/hdpvr-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/hdpvr/hdpvr-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/hdpvr/hdpvr-core.c
@@ -376,8 +376,8 @@ static int hdpvr_probe(struct usb_interf
 	usb_set_intfdata(interface, dev);
 
 	/* let the user know what node this device is now attached to */
-	v4l2_info(&dev->v4l2_dev, "device now attached to /dev/video%d\n",
-		  dev->video_dev->minor);
+	v4l2_info(&dev->v4l2_dev, "device now attached to /dev/%s\n",
+		  video_device_node_name(dev->video_dev));
 	return 0;
 
 error:
@@ -391,13 +391,10 @@ error:
 static void hdpvr_disconnect(struct usb_interface *interface)
 {
 	struct hdpvr_device *dev;
-	int minor;
 
 	dev = usb_get_intfdata(interface);
 	usb_set_intfdata(interface, NULL);
 
-	minor = dev->video_dev->minor;
-
 	/* prevent more I/O from starting and stop any ongoing */
 	mutex_lock(&dev->io_mutex);
 	dev->status = STATUS_DISCONNECTED;
@@ -425,7 +422,8 @@ static void hdpvr_disconnect(struct usb_
 
 	atomic_dec(&dev_nr);
 
-	v4l2_info(&dev->v4l2_dev, "device /dev/video%d disconnected\n", minor);
+	v4l2_info(&dev->v4l2_dev, "device /dev/%s disconnected\n",
+		  video_device_node_name(dev->video_dev));
 
 	v4l2_device_unregister(&dev->v4l2_dev);
 	kfree(dev->usbc_buf);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gl860/gl860.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/gspca/gl860/gl860.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gl860/gl860.c
@@ -534,8 +534,8 @@ static int sd_probe(struct usb_interface
 		gspca_dev = usb_get_intfdata(intf);
 
 		PDEBUG(D_PROBE,
-			"Camera is now controlling video device /dev/video%d",
-			gspca_dev->vdev.minor);
+			"Camera is now controlling video device /dev/%s",
+			video_device_node_name(&gspca_dev->vdev));
 	}
 
 	return ret;

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

* v4l: Remove video_device::num usage from device drivers
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
  2009-11-18  0:38 ` v4l: Add video_device_node_name function Laurent Pinchart
  2009-11-18  0:38 ` v4l: Use the new " Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  0:38 ` v4l: Replace video_is_unregistered with video_is_registered Laurent Pinchart
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/vivi.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
@@ -1376,9 +1376,6 @@ static int __init vivi_create_instance(i
 	/* Now that everything is fine, let's add it to device list */
 	list_add_tail(&dev->vivi_devlist, &vivi_devlist);
 
-	snprintf(vfd->name, sizeof(vfd->name), "%s (%i)",
-			vivi_template.name, vfd->num);
-
 	if (video_nr >= 0)
 		video_nr++;
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/w9968cf.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
@@ -2891,8 +2891,7 @@ static long w9968cf_v4l_ioctl(struct fil
 			.minwidth = cam->minwidth,
 			.minheight = cam->minheight,
 		};
-		sprintf(cap.name, "W996[87]CF USB Camera #%d",
-			cam->v4ldev->num);
+		sprintf(cap.name, "W996[87]CF USB Camera");
 		cap.maxwidth = (cam->upscaling && w9968cf_vpp)
 			       ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth)
 				 : cam->maxwidth;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-i2c.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvision/usbvision-i2c.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-i2c.c
@@ -219,8 +219,8 @@ int usbvision_i2c_register(struct usb_us
 	memcpy(&usbvision->i2c_adap, &i2c_adap_template,
 	       sizeof(struct i2c_adapter));
 
-	sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name),
-		" #%d", usbvision->vdev->num);
+	sprintf(usbvision->i2c_adap.name, "%s-%d-%s", i2c_adap_template.name,
+		usbvision->dev->bus->busnum, usbvision->dev->devpath);
 	PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name);
 	usbvision->i2c_adap.dev.parent = &usbvision->dev->dev;
 

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

* v4l: Replace video_is_unregistered with video_is_registered
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (2 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Remove video_device::num usage from device drivers Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  7:15   ` Hans Verkuil
  2009-11-18  0:38 ` hdpvr: " Laurent Pinchart
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Replace the video_is_unregistered function by a video_is_registered
function. The V4L2_FL_UNREGISTERED flag is replaced by a
V4L2_FL_REGISTERED flag.

This change makes the video_is_registered function return coherent
results when called on an initialize but not yet registered video_device
instance. The function can now be used instead of checking
video_device::minor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/v4l2-dev.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
@@ -227,7 +227,7 @@ static ssize_t v4l2_read(struct file *fi
 
 	if (!vdev->fops->read)
 		return -EINVAL;
-	if (video_is_unregistered(vdev))
+	if (!video_is_registered(vdev))
 		return -EIO;
 	return vdev->fops->read(filp, buf, sz, off);
 }
@@ -239,7 +239,7 @@ static ssize_t v4l2_write(struct file *f
 
 	if (!vdev->fops->write)
 		return -EINVAL;
-	if (video_is_unregistered(vdev))
+	if (!video_is_registered(vdev))
 		return -EIO;
 	return vdev->fops->write(filp, buf, sz, off);
 }
@@ -248,7 +248,7 @@ static unsigned int v4l2_poll(struct fil
 {
 	struct video_device *vdev = video_devdata(filp);
 
-	if (!vdev->fops->poll || video_is_unregistered(vdev))
+	if (!vdev->fops->poll || !video_is_registered(vdev))
 		return DEFAULT_POLLMASK;
 	return vdev->fops->poll(filp, poll);
 }
@@ -288,7 +288,7 @@ static unsigned long v4l2_get_unmapped_a
 
 	if (!vdev->fops->get_unmapped_area)
 		return -ENOSYS;
-	if (video_is_unregistered(vdev))
+	if (!video_is_registered(vdev))
 		return -ENODEV;
 	return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags);
 }
@@ -298,8 +298,7 @@ static int v4l2_mmap(struct file *filp, 
 {
 	struct video_device *vdev = video_devdata(filp);
 
-	if (!vdev->fops->mmap ||
-	    video_is_unregistered(vdev))
+	if (!vdev->fops->mmap || !video_is_registered(vdev))
 		return -ENODEV;
 	return vdev->fops->mmap(filp, vm);
 }
@@ -315,7 +314,7 @@ static int v4l2_open(struct inode *inode
 	vdev = video_devdata(filp);
 	/* return ENODEV if the video device has been removed
 	   already or if it is not registered anymore. */
-	if (vdev == NULL || video_is_unregistered(vdev)) {
+	if (vdev == NULL || !video_is_registered(vdev)) {
 		mutex_unlock(&videodev_lock);
 		return -ENODEV;
 	}
@@ -623,6 +622,7 @@ static int __video_register_device(struc
 			name_base, nr, video_device_node_name(vdev));
 
 	/* Part 5: Activate this minor. The char device can now be used. */
+	set_bit(V4L2_FL_REGISTERED, &vdev->flags);
 	mutex_lock(&videodev_lock);
 	video_device[vdev->minor] = vdev;
 	mutex_unlock(&videodev_lock);
@@ -661,11 +661,11 @@ EXPORT_SYMBOL(video_register_device_no_w
 void video_unregister_device(struct video_device *vdev)
 {
 	/* Check if vdev was ever registered at all */
-	if (!vdev || vdev->minor < 0)
+	if (!vdev || !video_is_registered(vdev))
 		return;
 
 	mutex_lock(&videodev_lock);
-	set_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
+	clear_bit(V4L2_FL_REGISTERED, &vdev->flags);
 	mutex_unlock(&videodev_lock);
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
 	class_device_unregister(&vdev->dev);
Index: v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/include/media/v4l2-dev.h
+++ v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
@@ -28,10 +28,10 @@ struct v4l2_ioctl_callbacks;
 struct video_device;
 struct v4l2_device;
 
-/* Flag to mark the video_device struct as unregistered.
-   Drivers can set this flag if they want to block all future
-   device access. It is set by video_unregister_device. */
-#define V4L2_FL_UNREGISTERED	(0)
+/* Flag to mark the video_device struct as registered.
+   Drivers can clear this flag if they want to block all future
+   device access. It is cleared by video_unregister_device. */
+#define V4L2_FL_REGISTERED	(0)
 
 struct v4l2_file_operations {
 	struct module *owner;
@@ -100,9 +100,7 @@ struct video_device
 /* Register video devices. Note that if video_register_device fails,
    the release() callback of the video_device structure is *not* called, so
    the caller is responsible for freeing any data. Usually that means that
-   you call video_device_release() on failure.
-
-   Also note that vdev->minor is set to -1 if the registration failed. */
+   you call video_device_release() on failure. */
 int __must_check video_register_device(struct video_device *vdev, int type, int nr);
 
 /* Same as video_register_device, but no warning is issued if the desired
@@ -110,7 +108,7 @@ int __must_check video_register_device(s
 int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr);
 
 /* Unregister video devices. Will do nothing if vdev == NULL or
-   vdev->minor < 0. */
+   video_is_registered() returns false. */
 void video_unregister_device(struct video_device *vdev);
 
 /* helper functions to alloc/release struct video_device, the
@@ -162,9 +160,9 @@ static inline const char *video_device_n
 #endif
 }
 
-static inline int video_is_unregistered(struct video_device *vdev)
+static inline int video_is_registered(struct video_device *vdev)
 {
-	return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
+	return test_bit(V4L2_FL_REGISTERED, &vdev->flags);
 }
 
 #endif /* _V4L2_DEV_H */

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

* hdpvr: Replace video_is_unregistered with video_is_registered
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (3 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Replace video_is_unregistered with video_is_registered Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  0:38 ` v4l: Use the video_is_registered function in device drivers Laurent Pinchart
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Fix the hdpvr driver to use the video_is_registered function instead of
video_is_unregistered.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/video/hdpvr/hdpvr-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/hdpvr/hdpvr-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/hdpvr/hdpvr-video.c
@@ -519,7 +519,7 @@ static unsigned int hdpvr_poll(struct fi
 
 	mutex_lock(&dev->io_mutex);
 
-	if (video_is_unregistered(dev->video_dev)) {
+	if (!video_is_registered(dev->video_dev)) {
 		mutex_unlock(&dev->io_mutex);
 		return -EIO;
 	}

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

* v4l: Use the video_is_registered function in device drivers
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (4 preceding siblings ...)
  2009-11-18  0:38 ` hdpvr: " Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  0:38 ` v4l: Use the video_drvdata function in drivers Laurent Pinchart
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Fix all device drivers to use the video_is_registered function instead
of checking video_device::minor.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -4240,21 +4240,21 @@ static struct video_device *vdev_init(st
 static void bttv_unregister_video(struct bttv *btv)
 {
 	if (btv->video_dev) {
-		if (-1 != btv->video_dev->minor)
+		if (video_is_registered(btv->video_dev))
 			video_unregister_device(btv->video_dev);
 		else
 			video_device_release(btv->video_dev);
 		btv->video_dev = NULL;
 	}
 	if (btv->vbi_dev) {
-		if (-1 != btv->vbi_dev->minor)
+		if (video_is_registered(btv->vbi_dev))
 			video_unregister_device(btv->vbi_dev);
 		else
 			video_device_release(btv->vbi_dev);
 		btv->vbi_dev = NULL;
 	}
 	if (btv->radio_dev) {
-		if (-1 != btv->radio_dev->minor)
+		if (video_is_registered(btv->radio_dev))
 			video_unregister_device(btv->radio_dev);
 		else
 			video_device_release(btv->radio_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2020,7 +2020,7 @@ void cx231xx_release_analog_resources(st
 	/*FIXME: I2C IR should be disconnected */
 
 	if (dev->radio_dev) {
-		if (-1 != dev->radio_dev->minor)
+		if (video_is_registered(dev->radio_dev))
 			video_unregister_device(dev->radio_dev);
 		else
 			video_device_release(dev->radio_dev);
@@ -2029,7 +2029,7 @@ void cx231xx_release_analog_resources(st
 	if (dev->vbi_dev) {
 		cx231xx_info("V4L2 device /dev/%s deregistered\n",
 			     video_device_node_name(dev->vbi_dev));
-		if (-1 != dev->vbi_dev->minor)
+		if (video_is_registered(dev->vbi_dev))
 			video_unregister_device(dev->vbi_dev);
 		else
 			video_device_release(dev->vbi_dev);
@@ -2038,7 +2038,7 @@ void cx231xx_release_analog_resources(st
 	if (dev->vdev) {
 		cx231xx_info("V4L2 device /dev/%s deregistered\n",
 			     video_device_node_name(dev->vdev));
-		if (-1 != dev->vdev->minor)
+		if (video_is_registered(dev->vdev))
 			video_unregister_device(dev->vdev);
 		else
 			video_device_release(dev->vdev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-417.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
@@ -1753,7 +1753,7 @@ void cx23885_417_unregister(struct cx238
 	dprintk(1, "%s()\n", __func__);
 
 	if (dev->v4l_device) {
-		if (-1 != dev->v4l_device->minor)
+		if (video_is_registered(dev->v4l_device))
 			video_unregister_device(dev->v4l_device);
 		else
 			video_device_release(dev->v4l_device);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -1691,14 +1691,14 @@ void cx23885_video_unregister(struct cx2
 
 #if 0
 	if (dev->radio_dev) {
-		if (-1 != dev->radio_dev->minor)
+		if (video_is_registered(dev->radio_dev))
 			video_unregister_device(dev->radio_dev);
 		else
 			video_device_release(dev->radio_dev);
 		dev->radio_dev = NULL;
 	}
 	if (dev->vbi_dev) {
-		if (-1 != dev->vbi_dev->minor)
+		if (video_is_registered(dev->vbi_dev)
 			video_unregister_device(dev->vbi_dev);
 		else
 			video_device_release(dev->vbi_dev);
@@ -1707,7 +1707,7 @@ void cx23885_video_unregister(struct cx2
 	}
 #endif
 	if (dev->video_dev) {
-		if (-1 != dev->video_dev->minor)
+		if (video_is_registered(dev->video_dev))
 			video_unregister_device(dev->video_dev);
 		else
 			video_device_release(dev->video_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -1298,7 +1298,7 @@ static int cx8802_blackbird_advise_relea
 static void blackbird_unregister_video(struct cx8802_dev *dev)
 {
 	if (dev->mpeg_dev) {
-		if (-1 != dev->mpeg_dev->minor)
+		if (video_is_registered(dev->mpeg_dev))
 			video_unregister_device(dev->mpeg_dev);
 		else
 			video_device_release(dev->mpeg_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
@@ -2048,21 +2048,21 @@ static struct video_device cx8800_radio_
 static void cx8800_unregister_video(struct cx8800_dev *dev)
 {
 	if (dev->radio_dev) {
-		if (-1 != dev->radio_dev->minor)
+		if (video_is_registered(dev->radio_dev))
 			video_unregister_device(dev->radio_dev);
 		else
 			video_device_release(dev->radio_dev);
 		dev->radio_dev = NULL;
 	}
 	if (dev->vbi_dev) {
-		if (-1 != dev->vbi_dev->minor)
+		if (video_is_registered(dev->vbi_dev))
 			video_unregister_device(dev->vbi_dev);
 		else
 			video_device_release(dev->vbi_dev);
 		dev->vbi_dev = NULL;
 	}
 	if (dev->video_dev) {
-		if (-1 != dev->video_dev->minor)
+		if (video_is_registered(dev->video_dev))
 			video_unregister_device(dev->video_dev);
 		else
 			video_device_release(dev->video_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpfe_capture.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/davinci/vpfe_capture.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpfe_capture.c
@@ -2034,7 +2034,7 @@ probe_out_video_unregister:
 probe_out_v4l2_unregister:
 	v4l2_device_unregister(&vpfe_dev->v4l2_dev);
 probe_out_video_release:
-	if (vpfe_dev->video_dev->minor == -1)
+	if (!video_is_registered(vpfe_dev->video_dev))
 		video_device_release(vpfe_dev->video_dev);
 probe_out_release_irq:
 	free_irq(vpfe_dev->ccdc_irq0, vpfe_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -2217,7 +2217,7 @@ void em28xx_release_analog_resources(str
 	/*FIXME: I2C IR should be disconnected */
 
 	if (dev->radio_dev) {
-		if (-1 != dev->radio_dev->minor)
+		if (video_is_registered(dev->radio_dev))
 			video_unregister_device(dev->radio_dev);
 		else
 			video_device_release(dev->radio_dev);
@@ -2226,7 +2226,7 @@ void em28xx_release_analog_resources(str
 	if (dev->vbi_dev) {
 		em28xx_info("V4L2 device /dev/%s deregistered\n",
 			    video_device_node_name(dev->vbi_dev));
-		if (-1 != dev->vbi_dev->minor)
+		if (video_is_registered(dev->vbi_dev))
 			video_unregister_device(dev->vbi_dev);
 		else
 			video_device_release(dev->vbi_dev);
@@ -2235,7 +2235,7 @@ void em28xx_release_analog_resources(str
 	if (dev->vdev) {
 		em28xx_info("V4L2 device /dev/%s deregistered\n",
 			    video_device_node_name(dev->vdev));
-		if (-1 != dev->vdev->minor)
+		if (video_is_registered(dev->vdev))
 			video_unregister_device(dev->vdev);
 		else
 			video_device_release(dev->vdev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/omap24xxcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
@@ -1696,7 +1696,7 @@ static void omap24xxcam_device_unregiste
 	omap24xxcam_sensor_exit(cam);
 
 	if (cam->vfd) {
-		if (cam->vfd->minor == -1) {
+		if (!video_is_registered(cam->vfd)) {
 			/*
 			 * The device was never registered, so release the
 			 * video_device struct directly.
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/ov511.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
@@ -5888,7 +5888,7 @@ ov51x_probe(struct usb_interface *intf, 
 
 error:
 	if (ov->vdev) {
-		if (-1 == ov->vdev->minor)
+		if (!video_is_registered(ov->vdev))
 			video_device_release(ov->vdev);
 		else
 			video_unregister_device(ov->vdev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/s2255drv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
@@ -1881,7 +1881,7 @@ static void s2255_exit_v4l(struct s2255_
 
 	int i;
 	for (i = 0; i < MAX_CHANNELS; i++) {
-		if (-1 != dev->vdev[i]->minor) {
+		if (video_is_registered(dev->vdev[i])) {
 			video_unregister_device(dev->vdev[i]);
 			printk(KERN_INFO "s2255 unregistered\n");
 		} else {
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -864,21 +864,21 @@ static struct video_device *vdev_init(st
 static void saa7134_unregister_video(struct saa7134_dev *dev)
 {
 	if (dev->video_dev) {
-		if (-1 != dev->video_dev->minor)
+		if (video_is_registered(dev->video_dev))
 			video_unregister_device(dev->video_dev);
 		else
 			video_device_release(dev->video_dev);
 		dev->video_dev = NULL;
 	}
 	if (dev->vbi_dev) {
-		if (-1 != dev->vbi_dev->minor)
+		if (video_is_registered(dev->vbi_dev))
 			video_unregister_device(dev->vbi_dev);
 		else
 			video_device_release(dev->vbi_dev);
 		dev->vbi_dev = NULL;
 	}
 	if (dev->radio_dev) {
-		if (-1 != dev->radio_dev->minor)
+		if (video_is_registered(dev->radio_dev))
 			video_unregister_device(dev->radio_dev);
 		else
 			video_device_release(dev->radio_dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stradis.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stradis.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stradis.c
@@ -2139,7 +2139,7 @@ static void stradis_release_saa(struct p
 	free_irq(saa->irq, saa);
 	if (saa->saa7146_mem)
 		iounmap(saa->saa7146_mem);
-	if (saa->video_dev.minor != -1)
+	if (video_is_registered(&saa->video_dev))
 		video_unregister_device(&saa->video_dev);
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvision/usbvision-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
@@ -1418,7 +1418,7 @@ static void usbvision_unregister_video(s
 	if (usbvision->vbi) {
 		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
 		       video_device_node_name(usbvision->vbi));
-		if (usbvision->vbi->minor != -1) {
+		if (video_is_registered(usbvision->vbi)) {
 			video_unregister_device(usbvision->vbi);
 		} else {
 			video_device_release(usbvision->vbi);
@@ -1430,7 +1430,7 @@ static void usbvision_unregister_video(s
 	if (usbvision->rdev) {
 		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
 		       video_device_node_name(usbvision->rdev));
-		if (usbvision->rdev->minor != -1) {
+		if (video_is_registered(usbvision->rdev)) {
 			video_unregister_device(usbvision->rdev);
 		} else {
 			video_device_release(usbvision->rdev);
@@ -1442,7 +1442,7 @@ static void usbvision_unregister_video(s
 	if (usbvision->vdev) {
 		PDEBUG(DBG_PROBE, "unregister /dev/%s [v4l2]",
 		       video_device_node_name(usbvision->vdev));
-		if (usbvision->vdev->minor != -1) {
+		if (video_is_registered(usbvision->vdev)) {
 			video_unregister_device(usbvision->vdev);
 		} else {
 			video_device_release(usbvision->vdev);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
@@ -424,7 +424,7 @@ int cx25821_video_irq(struct cx25821_dev
 void cx25821_videoioctl_unregister(struct cx25821_dev *dev)
 {
 	if (dev->ioctl_dev) {
-		if (dev->ioctl_dev->minor != -1)
+		if (video_is_registered(dev->ioctl_dev))
 			video_unregister_device(dev->ioctl_dev);
 		else
 			video_device_release(dev->ioctl_dev);
@@ -438,7 +438,7 @@ void cx25821_video_unregister(struct cx2
 	cx_clear(PCI_INT_MSK, 1);
 
 	if (dev->video_dev[chan_num]) {
-		if (-1 != dev->video_dev[chan_num]->minor)
+		if (video_is_registered(dev->video_dev[chan_num]))
 			video_unregister_device(dev->video_dev[chan_num]);
 		else
 			video_device_release(dev->video_dev[chan_num]);

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

* v4l: Use the video_drvdata function in drivers
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (5 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Use the video_is_registered function in device drivers Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  7:01   ` Hans Verkuil
  2009-11-18  0:38 ` v4l: Use video_device_node_name() instead of the minor number Laurent Pinchart
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Fix all device drivers to use the video_drvdata function instead of
maintaining a local list of minor to private data mappings. Call
video_set_drvdata to register the driver private pointer when not
already done.

Where applicable, the local list of mappings is completely removed when
it becomes unused.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-audups11.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
-
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH11]
-		    && h->video_dev[SRAM_CH11]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
@@ -189,6 +189,7 @@ struct video_device *cx25821_vdev_init(s
 	vfd->release = video_device_release;
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type,
 		 cx25821_boards[dev->board].name);
+	video_set_drvdata(vfd, dev);
 	return vfd;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video0.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
@@ -95,36 +95,19 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH00]
-		    && h->video_dev[SRAM_CH00]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video1.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
@@ -95,36 +95,19 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH01]
-		    && h->video_dev[SRAM_CH01]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video2.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH02]
-		    && h->video_dev[SRAM_CH02]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video3.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH03]
-		    && h->video_dev[SRAM_CH03]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video4.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH04]
-		    && h->video_dev[SRAM_CH04]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video5.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH05]
-		    && h->video_dev[SRAM_CH05]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video6.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
@@ -95,36 +95,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH06]
-		    && h->video_dev[SRAM_CH06]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video7.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
@@ -94,36 +94,20 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH07]
-		    && h->video_dev[SRAM_CH07]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev = dev;
 	fh->type = type;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-videoioctl.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
@@ -95,35 +95,19 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->ioctl_dev && h->ioctl_dev->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups10.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
-
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH10]
-		    && h->video_dev[SRAM_CH10]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups9.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
@@ -95,35 +95,18 @@ static struct videobuf_queue_ops cx25821
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx25821_dev *h, *dev = NULL;
+	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
-
-	lock_kernel();
-	list_for_each(list, &cx25821_devlist) {
-		h = list_entry(list, struct cx25821_dev, devlist);
-
-		if (h->video_dev[SRAM_CH09]
-		    && h->video_dev[SRAM_CH09]->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
-	}
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
 	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
 
 	file->private_data = fh;
 	fh->dev = dev;
Index: v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/tm6000/tm6000-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
@@ -121,8 +121,6 @@ static struct tm6000_fmt format[] = {
 	}
 };
 
-static LIST_HEAD(tm6000_corelist);
-
 /* ------------------------------------------------------------------
 	DMA and thread functions
    ------------------------------------------------------------------*/
@@ -1362,10 +1360,9 @@ static int vidioc_s_frequency (struct fi
 static int tm6000_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct tm6000_core *h,*dev = NULL;
+	struct tm6000_core *dev = video_drvdata(file);
 	struct tm6000_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	int i,rc;
 
 	printk(KERN_INFO "tm6000: open called (minor=%d)\n",minor);
@@ -1374,16 +1371,6 @@ static int tm6000_open(struct file *file
 	dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called "
 						"(minor=%d)\n",minor);
 
-	list_for_each(list,&tm6000_corelist) {
-		h = list_entry(list, struct tm6000_core, tm6000_corelist);
-		if (h->vfd->minor == minor) {
-			dev  = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-	}
-	if (NULL == dev)
-		return -ENODEV;
-
 #if 0 /* Avoids an oops at read() - seems to be semaphore related */
 	if (dev->users) {
 		printk(KERN_INFO "this driver can be opened only once (users=%d)\n",dev->users);
@@ -1596,8 +1583,6 @@ int tm6000_v4l2_register(struct tm6000_c
 	}
 	dev->vfd = vfd;
 
-	list_add_tail(&dev->tm6000_corelist,&tm6000_corelist);
-
 	/* init video dma queues */
 	INIT_LIST_HEAD(&dev->vidq.active);
 	INIT_LIST_HEAD(&dev->vidq.queued);
@@ -1605,6 +1590,7 @@ int tm6000_v4l2_register(struct tm6000_c
 	memcpy (dev->vfd, &tm6000_template, sizeof(*(dev->vfd)));
 	dev->vfd->debug=tm6000_debug;
 	vfd->v4l2_dev = &dev->v4l2_dev;
+	video_set_drvdata(vfd, dev);
 
 	ret = video_register_device(dev->vfd, VFL_TYPE_GRABBER, video_nr);
 	printk(KERN_INFO "Trident TVMaster TM5600/TM6000 USB2 board (Load status: %d)\n", ret);
@@ -1613,35 +1599,13 @@ int tm6000_v4l2_register(struct tm6000_c
 
 int tm6000_v4l2_unregister(struct tm6000_core *dev)
 {
-	struct tm6000_core *h;
-	struct list_head *pos, *tmp;
-
 	video_unregister_device(dev->vfd);
 
-	list_for_each_safe(pos, tmp, &tm6000_corelist) {
-		h = list_entry(pos, struct tm6000_core, tm6000_corelist);
-		if (h == dev) {
-			list_del(pos);
-		}
-	}
-
 	return 0;
 }
 
 int tm6000_v4l2_exit(void)
 {
-#if 0
-	struct tm6000_core *h;
-	struct list_head *list;
-
-	while (!list_empty(&tm6000_corelist)) {
-		list = tm6000_corelist.next;
-		list_del(list);
-		h = list_entry(list, struct tm6000_core, tm6000_corelist);
-		video_unregister_device(&h->vfd);
-		kfree (h);
-	}
-#endif
 	return 0;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/s2255drv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
@@ -234,7 +234,6 @@ struct s2255_dev {
 
 	struct s2255_dmaqueue	vidq[MAX_CHANNELS];
 	struct video_device	*vdev[MAX_CHANNELS];
-	struct list_head	s2255_devlist;
 	struct timer_list	timer;
 	struct s2255_fw	*fw_data;
 	struct s2255_pipeinfo	pipes[MAX_PIPE_BUFFERS];
@@ -314,8 +313,6 @@ struct s2255_fh {
 /* Channels on box are in reverse order */
 static unsigned long G_chnmap[MAX_CHANNELS] = {3, 2, 1, 0};
 
-static LIST_HEAD(s2255_devlist);
-
 static int debug;
 static int *s2255_debug = &debug;
 
@@ -1535,31 +1532,22 @@ static int vidioc_s_parm(struct file *fi
 static int s2255_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct s2255_dev *h, *dev = NULL;
+	struct video_device *vdev = video_devdata(file);
+	struct s2255_dev *dev = video_drvdata(file);
 	struct s2255_fh *fh;
-	struct list_head *list;
-	enum v4l2_buf_type type = 0;
+	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	int i = 0;
 	int cur_channel = -1;
 	int state;
 	dprintk(1, "s2255: open called (minor=%d)\n", minor);
 
 	lock_kernel();
-	list_for_each(list, &s2255_devlist) {
-		h = list_entry(list, struct s2255_dev, s2255_devlist);
-		for (i = 0; i < MAX_CHANNELS; i++) {
-			if (h->vdev[i]->minor == minor) {
-				cur_channel = i;
-				dev = h;
-				type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-			}
-		}
-	}
 
-	if ((NULL == dev) || (cur_channel == -1)) {
-		unlock_kernel();
-		printk(KERN_INFO "s2255: openv4l no dev\n");
-		return -ENODEV;
+	for (i = 0; i < MAX_CHANNELS; i++) {
+		if (dev->vdev[i] == vdev) {
+			cur_channel = i;
+			break;
+		}
 	}
 
 	if (atomic_read(&dev->fw_data->fw_state) == S2255_FW_DISCONNECTING) {
@@ -1700,7 +1688,6 @@ static unsigned int s2255_poll(struct fi
 static void s2255_destroy(struct kref *kref)
 {
 	struct s2255_dev *dev = to_s2255_dev(kref);
-	struct list_head *list;
 	int i;
 	if (!dev) {
 		printk(KERN_ERR "s2255drv: kref problem\n");
@@ -1734,10 +1721,6 @@ static void s2255_destroy(struct kref *k
 	usb_put_dev(dev->udev);
 	dprintk(1, "%s", __func__);
 
-	while (!list_empty(&s2255_devlist)) {
-		list = s2255_devlist.next;
-		list_del(list);
-	}
 	mutex_unlock(&dev->open_lock);
 	kfree(dev);
 }
@@ -1844,7 +1827,6 @@ static int s2255_probe_v4l(struct s2255_
 	int cur_nr = video_nr;
 
 	/* initialize all video 4 linux */
-	list_add_tail(&dev->s2255_devlist, &s2255_devlist);
 	/* register 4 video devices */
 	for (i = 0; i < MAX_CHANNELS; i++) {
 		INIT_LIST_HEAD(&dev->vidq[i].active);
@@ -1854,6 +1836,7 @@ static int s2255_probe_v4l(struct s2255_
 		dev->vdev[i] = video_device_alloc();
 		memcpy(dev->vdev[i], &template, sizeof(struct video_device));
 		dev->vdev[i]->parent = &dev->interface->dev;
+		video_set_drvdata(dev->vdev[i], dev);
 		if (video_nr == -1)
 			ret = video_register_device(dev->vdev[i],
 						    VFL_TYPE_GRABBER,
Index: v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/common/saa7146_fops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
@@ -196,42 +196,24 @@ void saa7146_buffer_timeout(unsigned lon
 static int fops_open(struct file *file)
 {
 	unsigned int minor = video_devdata(file)->minor;
-	struct saa7146_dev *h = NULL, *dev = NULL;
-	struct list_head *list;
+	struct video_device *vdev = video_devdata(file);
+	struct saa7146_dev *dev = video_drvdata(file);
 	struct saa7146_fh *fh = NULL;
 	int result = 0;
 
-	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	enum v4l2_buf_type type;
 
 	DEB_EE(("file:%p, minor:%d\n", file, minor));
 
 	if (mutex_lock_interruptible(&saa7146_devices_lock))
 		return -ERESTARTSYS;
 
-	list_for_each(list,&saa7146_devices) {
-		h = list_entry(list, struct saa7146_dev, item);
-		if( NULL == h->vv_data ) {
-			DEB_D(("device %p has not registered video devices.\n",h));
-			continue;
-		}
-		DEB_D(("trying: %p @ major %d,%d\n",h,h->vv_data->video_minor,h->vv_data->vbi_minor));
-
-		if (h->vv_data->video_minor == minor) {
-			dev = h;
-		}
-		if (h->vv_data->vbi_minor == minor) {
-			type = V4L2_BUF_TYPE_VBI_CAPTURE;
-			dev = h;
-		}
-	}
-	if (NULL == dev) {
-		DEB_S(("no such video device.\n"));
-		result = -ENODEV;
-		goto out;
-	}
-
 	DEB_D(("using: %p\n",dev));
 
+	type = vdev->vfl_type == VFL_TYPE_VBI
+	     ? V4L2_BUF_TYPE_VIDEO_CAPTURE
+	     : V4L2_BUF_TYPE_VBI_CAPTURE;
+
 	/* check if an extension is registered */
 	if( NULL == dev->ext ) {
 		DEB_S(("no extension registered for this device.\n"));
Index: v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-cards.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/tm6000/tm6000-cards.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-cards.c
@@ -468,7 +468,6 @@ static int tm6000_usb_probe(struct usb_i
 		dev->model=card[nr];
 	}
 
-	INIT_LIST_HEAD(&dev->tm6000_corelist);
 	dev->udev= usbdev;
 	dev->devno=nr;
 
Index: v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/tm6000/tm6000.h
+++ v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000.h
@@ -160,7 +160,6 @@ struct tm6000_core {
 	struct i2c_client		i2c_client;
 
 	/* video for linux */
-	struct list_head		tm6000_corelist;
 	int				users;
 
 	/* various device info */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-417.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
@@ -1575,28 +1575,11 @@ static int vidioc_queryctrl(struct file 
 
 static int mpeg_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
-	struct cx23885_dev *h, *dev = NULL;
-	struct list_head *list;
+	struct cx23885_dev *dev = video_drvdata(file);
 	struct cx23885_fh *fh;
 
 	dprintk(2, "%s()\n", __func__);
 
-	lock_kernel();
-	list_for_each(list, &cx23885_devlist) {
-		h = list_entry(list, struct cx23885_dev, devlist);
-		if (h->v4l_device &&
-		    h->v4l_device->minor == minor) {
-			dev = h;
-			break;
-		}
-	}
-
-	if (dev == NULL) {
-		unlock_kernel();
-		return -ENODEV;
-	}
-
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
 	if (NULL == fh) {
@@ -1604,6 +1587,8 @@ static int mpeg_open(struct file *file)
 		return -ENOMEM;
 	}
 
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev      = dev;
 
@@ -1810,6 +1795,7 @@ int cx23885_417_register(struct cx23885_
 	/* Allocate and initialize V4L video device */
 	dev->v4l_device = cx23885_video_dev_alloc(tsport,
 		dev->pci, &cx23885_mpeg_template, "mpeg");
+	video_set_drvdata(dev->v4l_device, dev);
 	err = video_register_device(dev->v4l_device,
 		VFL_TYPE_GRABBER, -1);
 	if (err < 0) {
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-core.c
@@ -56,9 +56,6 @@ MODULE_PARM_DESC(card, "card type");
 
 static unsigned int cx23885_devcount;
 
-static DEFINE_MUTEX(devlist);
-LIST_HEAD(cx23885_devlist);
-
 #define NO_SYNC_LINE (-1U)
 
 /* FIXME, these allocations will change when
@@ -786,10 +783,6 @@ static int cx23885_dev_setup(struct cx23
 	dev->nr = cx23885_devcount++;
 	sprintf(dev->name, "cx23885[%d]", dev->nr);
 
-	mutex_lock(&devlist);
-	list_add_tail(&dev->devlist, &cx23885_devlist);
-	mutex_unlock(&devlist);
-
 	/* Configure the internal memory */
 	if (dev->pci->device == 0x8880) {
 		/* Could be 887 or 888, assume a default */
@@ -2006,10 +1999,6 @@ static void __devexit cx23885_finidev(st
 	/* unregister stuff */
 	free_irq(pci_dev->irq, dev);
 
-	mutex_lock(&devlist);
-	list_del(&dev->devlist);
-	mutex_unlock(&devlist);
-
 	cx23885_dev_unregister(dev);
 	v4l2_device_unregister(v4l2_dev);
 	kfree(dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -358,6 +358,7 @@ static struct video_device *cx23885_vdev
 	vfd->release = video_device_release;
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
 		 dev->name, type, cx23885_boards[dev->board].name);
+	video_set_drvdata(vfd, dev);
 	return vfd;
 }
 
@@ -772,34 +773,22 @@ static int get_resource(struct cx23885_f
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx23885_dev *h, *dev = NULL;
+	struct video_device *vdev = video_devdata(file);
+	struct cx23885_dev *dev = video_drvdata(file);
 	struct cx23885_fh *fh;
-	struct list_head *list;
 	enum v4l2_buf_type type = 0;
 	int radio = 0;
 
-	lock_kernel();
-	list_for_each(list, &cx23885_devlist) {
-		h = list_entry(list, struct cx23885_dev, devlist);
-		if (h->video_dev &&
-		    h->video_dev->minor == minor) {
-			dev  = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-		if (h->vbi_dev &&
-		    h->vbi_dev->minor == minor) {
-			dev  = h;
-			type = V4L2_BUF_TYPE_VBI_CAPTURE;
-		}
-		if (h->radio_dev &&
-		    h->radio_dev->minor == minor) {
-			radio = 1;
-			dev   = h;
-		}
-	}
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
+	switch (vdev->vfl_type) {
+	case VFL_TYPE_GRABBER:
+		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		break;
+	case VFL_TYPE_VBI:
+		type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		break;
+	case VFL_TYPE_RADIO:
+		radio = 1;
+		break;
 	}
 
 	dprintk(1, "open minor=%d radio=%d type=%s\n",
@@ -807,10 +796,11 @@ static int video_open(struct file *file)
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
-	if (NULL == fh) {
-		unlock_kernel();
+	if (NULL == fh)
 		return -ENOMEM;
-	}
+
+	lock_kernel();
+
 	file->private_data = fh;
 	fh->dev      = dev;
 	fh->radio    = radio;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885.h
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885.h
@@ -303,7 +303,6 @@ struct cx23885_tsport {
 };
 
 struct cx23885_dev {
-	struct list_head           devlist;
 	atomic_t                   refcount;
 	struct v4l2_device 	   v4l2_dev;
 
@@ -399,8 +398,6 @@ static inline struct cx23885_dev *to_cx2
 
 extern struct v4l2_subdev *cx23885_find_hw(struct cx23885_dev *dev, u32 hw);
 
-extern struct list_head cx23885_devlist;
-
 #define SRAM_CH01  0 /* Video A */
 #define SRAM_CH02  1 /* VBI A */
 #define SRAM_CH03  2 /* Video B */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-core.c
@@ -66,32 +66,6 @@ MODULE_PARM_DESC(alt, "alternate setting
 static LIST_HEAD(cx231xx_devlist);
 static DEFINE_MUTEX(cx231xx_devlist_mutex);
 
-struct cx231xx *cx231xx_get_device(int minor,
-				   enum v4l2_buf_type *fh_type, int *has_radio)
-{
-	struct cx231xx *h, *dev = NULL;
-
-	*fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	*has_radio = 0;
-
-	mutex_lock(&cx231xx_devlist_mutex);
-	list_for_each_entry(h, &cx231xx_devlist, devlist) {
-		if (h->vdev->minor == minor)
-			dev = h;
-		if (h->vbi_dev->minor == minor) {
-			dev = h;
-			*fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
-		}
-		if (h->radio_dev && h->radio_dev->minor == minor) {
-			dev = h;
-			*has_radio = 1;
-		}
-	}
-	mutex_unlock(&cx231xx_devlist_mutex);
-
-	return dev;
-}
-
 /*
  * cx231xx_realease_resources()
  * unregisters the v4l2,i2c and usb devices
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -1918,13 +1918,22 @@ static int cx231xx_v4l2_open(struct file
 {
 	int minor = video_devdata(filp)->minor;
 	int errCode = 0, radio = 0;
-	struct cx231xx *dev = NULL;
+	struct video_device *vdev = video_devdata(filp);
+	struct cx231xx *dev = video_drvdata(filp);
 	struct cx231xx_fh *fh;
 	enum v4l2_buf_type fh_type = 0;
 
-	dev = cx231xx_get_device(minor, &fh_type, &radio);
-	if (NULL == dev)
-		return -ENODEV;
+	switch (vdev->vfl_type) {
+	case VFL_TYPE_GRABBER:
+		fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		break;
+	case VFL_TYPE_VBI:
+		fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		break;
+	case VFL_TYPE_RADIO:
+		radio = 1;
+		break;
+	}
 
 	mutex_lock(&dev->lock);
 
@@ -2326,6 +2335,7 @@ static struct video_device *cx231xx_vdev
 
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name);
 
+	video_set_drvdata(vfd, dev);
 	return vfd;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx.h
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx.h
@@ -698,8 +698,6 @@ void cx231xx_release_analog_resources(st
 int cx231xx_register_analog_devices(struct cx231xx *dev);
 void cx231xx_remove_from_devlist(struct cx231xx *dev);
 void cx231xx_add_into_devlist(struct cx231xx *dev);
-struct cx231xx *cx231xx_get_device(int minor,
-				   enum v4l2_buf_type *fh_type, int *has_radio);
 void cx231xx_init_extension(struct cx231xx *dev);
 void cx231xx_close_extension(struct cx231xx *dev);
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/au0828/au0828-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/au0828/au0828-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/au0828/au0828-video.c
@@ -41,7 +41,6 @@
 #include "au0828.h"
 #include "au0828-reg.h"
 
-static LIST_HEAD(au0828_devlist);
 static DEFINE_MUTEX(au0828_sysfs_lock);
 
 #define AU0828_VERSION_CODE KERNEL_VERSION(0, 0, 1)
@@ -742,29 +741,15 @@ static void res_free(struct au0828_fh *f
 
 static int au0828_v4l2_open(struct file *filp)
 {
-	int minor = video_devdata(filp)->minor;
 	int ret = 0;
-	struct au0828_dev *h, *dev = NULL;
+	struct au0828_dev *dev = video_drvdata(filp);
 	struct au0828_fh *fh;
-	int type = 0;
-	struct list_head *list;
+	int type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-	list_for_each(list, &au0828_devlist) {
-		h = list_entry(list, struct au0828_dev, au0828list);
-		if (h->vdev->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
 #ifdef VBI_IS_WORKING
-		if (h->vbi_dev->minor == minor) {
-			dev = h;
-			type = V4L2_BUF_TYPE_VBI_CAPTURE;
-		}
+	if (video_devdata(filp)->vfl_type == VFL_TYPE_GRABBER)
+		type = V4L2_BUF_TYPE_VBI_CAPTURE;
 #endif
-	}
-
-	if (NULL == dev)
-		return -ENODEV;
 
 	fh = kzalloc(sizeof(struct au0828_fh), GFP_KERNEL);
 	if (NULL == fh) {
@@ -1681,9 +1666,8 @@ int au0828_analog_register(struct au0828
 	strcpy(dev->vbi_dev->name, "au0828a vbi");
 #endif
 
-	list_add_tail(&dev->au0828list, &au0828_devlist);
-
 	/* Register the v4l2 device */
+	video_set_drvdata(dev->vdev, dev);
 	retval = video_register_device(dev->vdev, VFL_TYPE_GRABBER, -1);
 	if (retval != 0) {
 		dprintk(1, "unable to register video device (error = %d).\n",
@@ -1695,6 +1679,7 @@ int au0828_analog_register(struct au0828
 
 #ifdef VBI_IS_WORKING
 	/* Register the vbi device */
+	video_set_drvdata(dev->vbi_dev, dev);
 	retval = video_register_device(dev->vbi_dev, VFL_TYPE_VBI, -1);
 	if (retval != 0) {
 		dprintk(1, "unable to register vbi device (error = %d).\n",
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -1068,20 +1068,14 @@ static int vidioc_s_std (struct file *fi
 static int mpeg_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx8802_dev *dev = NULL;
+	struct cx8802_dev *dev = video_drvdata(file);
 	struct cx8802_fh *fh;
 	struct cx8802_driver *drv = NULL;
 	int err;
 
-	lock_kernel();
-	dev = cx8802_get_device(minor);
-
 	dprintk( 1, "%s\n", __func__);
 
-	if (dev == NULL) {
-		unlock_kernel();
-		return -ENODEV;
-	}
+	lock_kernel();
 
 	/* Make sure we can acquire the hardware */
 	drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
@@ -1148,10 +1142,6 @@ static int mpeg_release(struct file *fil
 	kfree(fh);
 
 	/* Make sure we release the hardware */
-	dev = cx8802_get_device(video_devdata(file)->minor);
-	if (dev == NULL)
-		return -ENODEV;
-
 	drv = cx8802_get_driver(dev, CX88_MPEG_BLACKBIRD);
 	if (drv)
 		drv->request_release(drv);
@@ -1312,6 +1302,7 @@ static int blackbird_register_video(stru
 
 	dev->mpeg_dev = cx88_vdev_init(dev->core,dev->pci,
 				       &cx8802_mpeg_template,"mpeg");
+	video_set_drvdata(dev->mpeg_dev, dev);
 	err = video_register_device(dev->mpeg_dev,VFL_TYPE_GRABBER, -1);
 	if (err < 0) {
 		printk(KERN_INFO "%s/2: can't register mpeg device\n",
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-mpeg.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-mpeg.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-mpeg.c
@@ -620,21 +620,6 @@ static int cx8802_resume_common(struct p
 	return 0;
 }
 
-#if defined(CONFIG_VIDEO_CX88_BLACKBIRD) || \
-    defined(CONFIG_VIDEO_CX88_BLACKBIRD_MODULE)
-struct cx8802_dev *cx8802_get_device(int minor)
-{
-	struct cx8802_dev *dev;
-
-	list_for_each_entry(dev, &cx8802_devlist, devlist)
-		if (dev->mpeg_dev && dev->mpeg_dev->minor == minor)
-			return dev;
-
-	return NULL;
-}
-EXPORT_SYMBOL(cx8802_get_device);
-#endif
-
 struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype)
 {
 	struct cx8802_driver *d;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
@@ -76,10 +76,6 @@ MODULE_PARM_DESC(vid_limit,"capture memo
 #define dprintk(level,fmt, arg...)	if (video_debug >= level) \
 	printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
 
-/* ------------------------------------------------------------------ */
-
-static LIST_HEAD(cx8800_devlist);
-
 /* ------------------------------------------------------------------- */
 /* static data                                                         */
 
@@ -980,31 +976,23 @@ static int get_ressource(struct cx8800_f
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct cx8800_dev *h,*dev = NULL;
+	struct video_device *vdev = video_devdata(file);
+	struct cx8800_dev *dev = video_drvdata(file);
 	struct cx88_core *core;
 	struct cx8800_fh *fh;
 	enum v4l2_buf_type type = 0;
 	int radio = 0;
 
-	lock_kernel();
-	list_for_each_entry(h, &cx8800_devlist, devlist) {
-		if (h->video_dev->minor == minor) {
-			dev  = h;
-			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-		}
-		if (h->vbi_dev->minor == minor) {
-			dev  = h;
-			type = V4L2_BUF_TYPE_VBI_CAPTURE;
-		}
-		if (h->radio_dev &&
-		    h->radio_dev->minor == minor) {
-			radio = 1;
-			dev   = h;
-		}
-	}
-	if (NULL == dev) {
-		unlock_kernel();
-		return -ENODEV;
+	switch (vdev->vfl_type) {
+	case VFL_TYPE_GRABBER:
+		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		break;
+	case VFL_TYPE_VBI:
+		type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		break;
+	case VFL_TYPE_RADIO:
+		radio = 1;
+		break;
 	}
 
 	core = dev->core;
@@ -2187,6 +2175,7 @@ static int __devinit cx8800_initdev(stru
 	/* register v4l devices */
 	dev->video_dev = cx88_vdev_init(core,dev->pci,
 					&cx8800_video_template,"video");
+	video_set_drvdata(dev->video_dev, dev);
 	err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER,
 				    video_nr[core->nr]);
 	if (err < 0) {
@@ -2198,6 +2187,7 @@ static int __devinit cx8800_initdev(stru
 	       core->name, video_device_node_name(dev->video_dev));
 
 	dev->vbi_dev = cx88_vdev_init(core,dev->pci,&cx8800_vbi_template,"vbi");
+	video_set_drvdata(dev->vbi_dev, dev);
 	err = video_register_device(dev->vbi_dev,VFL_TYPE_VBI,
 				    vbi_nr[core->nr]);
 	if (err < 0) {
@@ -2211,6 +2201,7 @@ static int __devinit cx8800_initdev(stru
 	if (core->board.radio.type == CX88_RADIO) {
 		dev->radio_dev = cx88_vdev_init(core,dev->pci,
 						&cx8800_radio_template,"radio");
+		video_set_drvdata(dev->radio_dev, dev);
 		err = video_register_device(dev->radio_dev,VFL_TYPE_RADIO,
 					    radio_nr[core->nr]);
 		if (err < 0) {
@@ -2223,7 +2214,6 @@ static int __devinit cx8800_initdev(stru
 	}
 
 	/* everything worked */
-	list_add_tail(&dev->devlist,&cx8800_devlist);
 	pci_set_drvdata(pci_dev,dev);
 
 	/* initial device configuration */
@@ -2279,7 +2269,6 @@ static void __devexit cx8800_finidev(str
 
 	/* free memory */
 	btcx_riscmem_free(dev->pci,&dev->vidq.stopper);
-	list_del(&dev->devlist);
 	cx88_core_put(core,dev->pci);
 	kfree(dev);
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88.h
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88.h
@@ -426,7 +426,6 @@ struct cx8800_suspend_state {
 
 struct cx8800_dev {
 	struct cx88_core           *core;
-	struct list_head           devlist;
 #if 0
 	/* moved to cx88_core */
 	struct semaphore           lock;
@@ -690,7 +689,6 @@ int cx88_audio_thread(void *data);
 
 int cx8802_register_driver(struct cx8802_driver *drv);
 int cx8802_unregister_driver(struct cx8802_driver *drv);
-struct cx8802_dev *cx8802_get_device(int minor);
 struct cx8802_driver * cx8802_get_driver(struct cx8802_dev *dev, enum cx88_board_type btype);
 
 /* ----------------------------------------------------------- */
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-cards.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-cards.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-cards.c
@@ -2744,10 +2744,6 @@ static int em28xx_init_dev(struct em28xx
 	INIT_LIST_HEAD(&dev->vbiq.active);
 	INIT_LIST_HEAD(&dev->vbiq.queued);
 
-#if 0
-	video_set_drvdata(dev->vbi_dev, dev);
-#endif
-
 	if (dev->board.has_msp34xx) {
 		/* Send a reset to other chips via gpio */
 		errCode = em28xx_write_reg(dev, EM28XX_R08_GPIO, 0xf7);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -2124,16 +2124,24 @@ static int radio_queryctrl(struct file *
 static int em28xx_v4l2_open(struct file *filp)
 {
 	int minor = video_devdata(filp)->minor;
-	int errCode = 0, radio;
-	struct em28xx *dev;
-	enum v4l2_buf_type fh_type;
+	int errCode = 0, radio = 0;
+	struct video_device *vdev = video_devdata(filp);
+	struct em28xx *dev = video_drvdata(filp);
+	enum v4l2_buf_type fh_type = 0;
 	struct em28xx_fh *fh;
 	enum v4l2_field field;
 
-	dev = em28xx_get_device(minor, &fh_type, &radio);
-
-	if (NULL == dev)
-		return -ENODEV;
+	switch (vdev->vfl_type) {
+	case VFL_TYPE_GRABBER:
+		fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		break;
+	case VFL_TYPE_VBI:
+		fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		break;
+	case VFL_TYPE_RADIO:
+		radio = 1;
+		break;
+	}
 
 	mutex_lock(&dev->lock);
 
@@ -2516,6 +2524,7 @@ static struct video_device *em28xx_vdev_
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s",
 		 dev->name, type_name);
 
+	video_set_drvdata(vfd, dev);
 	return vfd;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx.h
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx.h
@@ -676,9 +676,6 @@ int em28xx_gpio_set(struct em28xx *dev, 
 void em28xx_wake_i2c(struct em28xx *dev);
 void em28xx_remove_from_devlist(struct em28xx *dev);
 void em28xx_add_into_devlist(struct em28xx *dev);
-struct em28xx *em28xx_get_device(int minor,
-				 enum v4l2_buf_type *fh_type,
-				 int *has_radio);
 int em28xx_register_extension(struct em28xx_ops *dev);
 void em28xx_unregister_extension(struct em28xx_ops *dev);
 void em28xx_init_extension(struct em28xx *dev);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-core.c
@@ -858,6 +858,7 @@ static struct video_device *vdev_init(st
 	vfd->debug   = video_debug;
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
 		 dev->name, type, saa7134_boards[dev->board].name);
+	video_set_drvdata(vfd, dev);
 	return vfd;
 }
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -87,17 +87,9 @@ static int ts_init_encoder(struct saa713
 static int ts_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct saa7134_dev *dev;
+	struct saa7134_dev *dev = video_drvdata(file);
 	int err;
 
-	lock_kernel();
-	list_for_each_entry(dev, &saa7134_devlist, devlist)
-		if (dev->empress_dev && dev->empress_dev->minor == minor)
-			goto found;
-	unlock_kernel();
-	return -ENODEV;
- found:
-
 	dprintk("open minor=%d\n",minor);
 	err = -EBUSY;
 	if (!mutex_trylock(&dev->empress_tsq.vb_lock))
@@ -543,6 +535,7 @@ static int empress_init(struct saa7134_d
 	INIT_WORK(&dev->empress_workqueue, empress_signal_update);
 #endif
 
+	video_set_drvdata(dev->empress_dev, dev);
 	err = video_register_device(dev->empress_dev,VFL_TYPE_GRABBER,
 				    empress_nr[dev->nr]);
 	if (err < 0) {
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -1327,29 +1327,23 @@ static int saa7134_resource(struct saa71
 static int video_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
-	struct saa7134_dev *dev;
+	struct video_device *vdev = video_devdata(file);
+	struct saa7134_dev *dev = video_drvdata(file);
 	struct saa7134_fh *fh;
-	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+	enum v4l2_buf_type type = 0;
 	int radio = 0;
 
-	mutex_lock(&saa7134_devlist_lock);
-	list_for_each_entry(dev, &saa7134_devlist, devlist) {
-		if (dev->video_dev && (dev->video_dev->minor == minor))
-			goto found;
-		if (dev->radio_dev && (dev->radio_dev->minor == minor)) {
-			radio = 1;
-			goto found;
-		}
-		if (dev->vbi_dev && (dev->vbi_dev->minor == minor)) {
-			type = V4L2_BUF_TYPE_VBI_CAPTURE;
-			goto found;
-		}
+	switch (vdev->vfl_type) {
+	case VFL_TYPE_GRABBER:
+		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+		break;
+	case VFL_TYPE_VBI:
+		type = V4L2_BUF_TYPE_VBI_CAPTURE;
+		break;
+	case VFL_TYPE_RADIO:
+		radio = 1;
+		break;
 	}
-	mutex_unlock(&saa7134_devlist_lock);
-	return -ENODEV;
-
-found:
-	mutex_unlock(&saa7134_devlist_lock);
 
 	dprintk("open minor=%d radio=%d type=%s\n",minor,radio,
 		v4l2_type_names[type]);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-core.c
@@ -1138,34 +1138,6 @@ void em28xx_wake_i2c(struct em28xx *dev)
 static LIST_HEAD(em28xx_devlist);
 static DEFINE_MUTEX(em28xx_devlist_mutex);
 
-struct em28xx *em28xx_get_device(int minor,
-				 enum v4l2_buf_type *fh_type,
-				 int *has_radio)
-{
-	struct em28xx *h, *dev = NULL;
-
-	*fh_type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	*has_radio = 0;
-
-	mutex_lock(&em28xx_devlist_mutex);
-	list_for_each_entry(h, &em28xx_devlist, devlist) {
-		if (h->vdev->minor == minor)
-			dev = h;
-		if (h->vbi_dev && h->vbi_dev->minor == minor) {
-			dev = h;
-			*fh_type = V4L2_BUF_TYPE_VBI_CAPTURE;
-		}
-		if (h->radio_dev &&
-		    h->radio_dev->minor == minor) {
-			dev = h;
-			*has_radio = 1;
-		}
-	}
-	mutex_unlock(&em28xx_devlist_mutex);
-
-	return dev;
-}
-
 /*
  * em28xx_realease_resources()
  * unregisters the v4l2,i2c and usb devices

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

* v4l: Use video_device_node_name() instead of the minor number
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (6 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Use the video_drvdata function in drivers Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor assignments Laurent Pinchart
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Instead of using the minor number in kernel log messages, use the device
node name as returned by the video_device_node_name() function. This
makes debug, informational and error messages easier to understand for
end users.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/tm6000/tm6000-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
@@ -1359,17 +1359,17 @@ static int vidioc_s_frequency (struct fi
 
 static int tm6000_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct tm6000_core *dev = video_drvdata(file);
 	struct tm6000_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	int i,rc;
 
-	printk(KERN_INFO "tm6000: open called (minor=%d)\n",minor);
+	printk(KERN_INFO "tm6000: open called (dev=%s)\n",
+		video_device_node_name(vdev));
 
-
-	dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called "
-						"(minor=%d)\n",minor);
+	dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: open called (dev=%s)\n",
+		video_device_node_name(vdev));
 
 #if 0 /* Avoids an oops at read() - seems to be semaphore related */
 	if (dev->users) {
@@ -1381,8 +1381,8 @@ static int tm6000_open(struct file *file
 	/* If more than one user, mutex should be added */
 	dev->users++;
 
-	dprintk(dev, V4L2_DEBUG_OPEN, "open minor=%d type=%s users=%d\n",
-				minor,v4l2_type_names[type],dev->users);
+	dprintk(dev, V4L2_DEBUG_OPEN, "open dev=%s type=%s users=%d\n",
+		video_device_node_name(vdev),v4l2_type_names[type],dev->users);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh),GFP_KERNEL);
@@ -1494,9 +1494,10 @@ static int tm6000_release(struct file *f
 {
 	struct tm6000_fh         *fh = file->private_data;
 	struct tm6000_core      *dev = fh->dev;
-	int minor = video_devdata(file)->minor;
+	struct video_device    *vdev = video_devdata(file);
 
-	dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (minor=%d, users=%d)\n",minor,dev->users);
+	dprintk(dev, V4L2_DEBUG_OPEN, "tm6000: close called (dev=%s, users=%d)\n",
+		video_device_node_name(vdev), dev->users);
 
 	dev->users--;
 
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-audups11.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
@@ -94,12 +94,13 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video0.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video1.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video2.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video3.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video4.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video5.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video6.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video7.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
@@ -93,13 +93,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-videoioctl.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
@@ -94,13 +94,14 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	u32 pix_format;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups10.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
@@ -94,12 +94,13 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups9.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
@@ -94,12 +94,13 @@ static struct videobuf_queue_ops cx25821
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx25821_dev *dev = video_drvdata(file);
 	struct cx25821_fh *fh;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 
-	printk("open minor=%d type=%s\n", minor, v4l2_type_names[type]);
+	printk("open dev=%s type=%s\n", video_device_node_name(vdev),
+		v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/common/saa7146_fops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
@@ -195,7 +195,6 @@ void saa7146_buffer_timeout(unsigned lon
 
 static int fops_open(struct file *file)
 {
-	unsigned int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct saa7146_dev *dev = video_drvdata(file);
 	struct saa7146_fh *fh = NULL;
@@ -203,7 +202,7 @@ static int fops_open(struct file *file)
 
 	enum v4l2_buf_type type;
 
-	DEB_EE(("file:%p, minor:%d\n", file, minor));
+	DEB_EE(("file:%p, dev:%s\n", file, video_device_node_name(vdev)));
 
 	if (mutex_lock_interruptible(&saa7146_devices_lock))
 		return -ERESTARTSYS;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -3235,11 +3235,12 @@ err:
 static int bttv_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct bttv *btv = video_drvdata(file);
 	struct bttv_fh *fh;
 	enum v4l2_buf_type type = 0;
 
-	dprintk(KERN_DEBUG "bttv: open minor=%d\n",minor);
+	dprintk(KERN_DEBUG "bttv: open dev=%s\n", video_device_node_name(vdev));
 
 	lock_kernel();
 	if (btv->video_dev->minor == minor) {
@@ -3437,10 +3438,11 @@ static struct video_device bttv_video_te
 static int radio_open(struct file *file)
 {
 	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct bttv *btv = video_drvdata(file);
 	struct bttv_fh *fh;
 
-	dprintk("bttv: open minor=%d\n",minor);
+	dprintk("bttv: open dev=%s\n", video_device_node_name(vdev));
 
 	lock_kernel();
 	WARN_ON(btv->radio_dev && btv->radio_dev->minor != minor);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx18/cx18-fileops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx18/cx18-fileops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx18/cx18-fileops.c
@@ -730,8 +730,8 @@ int cx18_v4l2_open(struct file *filp)
 
 	mutex_lock(&cx->serialize_lock);
 	if (cx18_init_on_first_open(cx)) {
-		CX18_ERR("Failed to initialize on minor %d\n",
-			 video_dev->minor);
+		CX18_ERR("Failed to initialize on %s\n",
+			 video_device_node_name(video_dev));
 		mutex_unlock(&cx->serialize_lock);
 		return -ENXIO;
 	}
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -1916,7 +1916,6 @@ static int radio_queryctrl(struct file *
  */
 static int cx231xx_v4l2_open(struct file *filp)
 {
-	int minor = video_devdata(filp)->minor;
 	int errCode = 0, radio = 0;
 	struct video_device *vdev = video_devdata(filp);
 	struct cx231xx *dev = video_drvdata(filp);
@@ -1937,8 +1936,9 @@ static int cx231xx_v4l2_open(struct file
 
 	mutex_lock(&dev->lock);
 
-	cx231xx_videodbg("open minor=%d type=%s users=%d\n",
-			 minor, v4l2_type_names[fh_type], dev->users);
+	cx231xx_videodbg("open dev=%s type=%s users=%d\n",
+			 video_device_node_name(vdev), v4l2_type_names[fh_type],
+			 dev->users);
 
 #if 0				/* Keep */
 	errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/ivtv/ivtv-fileops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/ivtv/ivtv-fileops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/ivtv/ivtv-fileops.c
@@ -985,8 +985,8 @@ int ivtv_v4l2_open(struct file *filp)
 
 	mutex_lock(&itv->serialize_lock);
 	if (ivtv_init_on_first_open(itv)) {
-		IVTV_ERR("Failed to initialize on minor %d\n",
-				vdev->minor);
+		IVTV_ERR("Failed to initialize on device %s\n",
+			 video_device_node_name(vdev));
 		mutex_unlock(&itv->serialize_lock);
 		return -ENXIO;
 	}
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/ov511.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
@@ -5871,8 +5871,8 @@ ov51x_probe(struct usb_interface *intf, 
 	ov511_devused |= 1 << nr;
 	ov->nr = nr;
 
-	dev_info(&intf->dev, "Device at %s registered to minor %d\n",
-		 ov->usb_path, ov->vdev->minor);
+	dev_info(&intf->dev, "Device at %s registered to %s\n",
+		 ov->usb_path, video_device_node_name(ov->vdev));
 
 	usb_set_intfdata(intf, ov);
 	if (ov_create_sysfs(ov->vdev)) {
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/s2255drv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
@@ -1531,7 +1531,6 @@ static int vidioc_s_parm(struct file *fi
 }
 static int s2255_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct s2255_dev *dev = video_drvdata(file);
 	struct s2255_fh *fh;
@@ -1539,7 +1538,9 @@ static int s2255_open(struct file *file)
 	int i = 0;
 	int cur_channel = -1;
 	int state;
-	dprintk(1, "s2255: open called (minor=%d)\n", minor);
+
+	dprintk(1, "s2255: open called (dev=%s)\n",
+		video_device_node_name(vdev));
 
 	lock_kernel();
 
@@ -1651,8 +1652,9 @@ static int s2255_open(struct file *file)
 	for (i = 0; i < ARRAY_SIZE(s2255_qctrl); i++)
 		qctl_regs[i] = s2255_qctrl[i].default_value;
 
-	dprintk(1, "s2255drv: open minor=%d type=%s users=%d\n",
-		minor, v4l2_type_names[type], dev->users[cur_channel]);
+	dprintk(1, "s2255drv: open dev=%s type=%s users=%d\n",
+		video_device_node_name(vdev), v4l2_type_names[type],
+		dev->users[cur_channel]);
 	dprintk(2, "s2255drv: open: fh=0x%08lx, dev=0x%08lx, vidq=0x%08lx\n",
 		(unsigned long)fh, (unsigned long)dev,
 		(unsigned long)&dev->vidq[cur_channel]);
@@ -1729,7 +1731,8 @@ static int s2255_close(struct file *file
 {
 	struct s2255_fh *fh = file->private_data;
 	struct s2255_dev *dev = fh->dev;
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
+
 	if (!dev)
 		return -ENODEV;
 
@@ -1749,8 +1752,8 @@ static int s2255_close(struct file *file
 	mutex_unlock(&dev->open_lock);
 
 	kref_put(&dev->kref, s2255_destroy);
-	dprintk(1, "s2255: close called (minor=%d, users=%d)\n",
-		minor, dev->users[fh->channel]);
+	dprintk(1, "s2255: close called (dev=%s, users=%d)\n",
+		video_device_node_name(vdev), dev->users[fh->channel]);
 	kfree(fh);
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/vivi.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
@@ -1225,8 +1225,7 @@ static int vivi_close(struct file *file)
 	struct vivi_fh         *fh = file->private_data;
 	struct vivi_dev *dev       = fh->dev;
 	struct vivi_dmaqueue *vidq = &dev->vidq;
-
-	int minor = video_devdata(file)->minor;
+	struct video_device  *vdev = video_devdata(file);
 
 	vivi_stop_thread(vidq);
 	videobuf_stop(&fh->vb_vidq);
@@ -1238,8 +1237,8 @@ static int vivi_close(struct file *file)
 	dev->users--;
 	mutex_unlock(&dev->mutex);
 
-	dprintk(dev, 1, "close called (minor=%d, users=%d)\n",
-		minor, dev->users);
+	dprintk(dev, 1, "close called (dev=%s, users=%d)\n",
+		video_device_node_name(vdev), dev->users);
 
 	return 0;
 }
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -1067,7 +1067,7 @@ static int vidioc_s_std (struct file *fi
 
 static int mpeg_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct cx8802_dev *dev = video_drvdata(file);
 	struct cx8802_fh *fh;
 	struct cx8802_driver *drv = NULL;
@@ -1094,7 +1094,7 @@ static int mpeg_open(struct file *file)
 		unlock_kernel();
 		return -EINVAL;
 	}
-	dprintk(1,"open minor=%d\n",minor);
+	dprintk(1, "open dev=%s\n", video_device_node_name(vdev));
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh),GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
@@ -975,7 +975,6 @@ static int get_ressource(struct cx8800_f
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct cx8800_dev *dev = video_drvdata(file);
 	struct cx88_core *core;
@@ -997,8 +996,8 @@ static int video_open(struct file *file)
 
 	core = dev->core;
 
-	dprintk(1,"open minor=%d radio=%d type=%s\n",
-		minor,radio,v4l2_type_names[type]);
+	dprintk(1, "open dev=%s radio=%d type=%s\n",
+		video_device_node_name(vdev), radio, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh),GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -2123,7 +2123,6 @@ static int radio_queryctrl(struct file *
  */
 static int em28xx_v4l2_open(struct file *filp)
 {
-	int minor = video_devdata(filp)->minor;
 	int errCode = 0, radio = 0;
 	struct video_device *vdev = video_devdata(filp);
 	struct em28xx *dev = video_drvdata(filp);
@@ -2145,8 +2144,9 @@ static int em28xx_v4l2_open(struct file 
 
 	mutex_lock(&dev->lock);
 
-	em28xx_videodbg("open minor=%d type=%s users=%d\n",
-				minor, v4l2_type_names[fh_type], dev->users);
+	em28xx_videodbg("open dev=%s type=%s users=%d\n",
+			video_device_node_name(vdev), v4l2_type_names[fh_type],
+			dev->users);
 
 #if 0
 	errCode = em28xx_set_mode(dev, EM28XX_ANALOG_MODE);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -86,11 +86,11 @@ static int ts_init_encoder(struct saa713
 
 static int ts_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
+	struct video_device *vdev = video_devdata(file);
 	struct saa7134_dev *dev = video_drvdata(file);
 	int err;
 
-	dprintk("open minor=%d\n",minor);
+	dprintk("open dev=%s\n", video_device_node_name(vdev));
 	err = -EBUSY;
 	if (!mutex_trylock(&dev->empress_tsq.vb_lock))
 		goto done;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -1326,7 +1326,6 @@ static int saa7134_resource(struct saa71
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct saa7134_dev *dev = video_drvdata(file);
 	struct saa7134_fh *fh;
@@ -1345,8 +1344,8 @@ static int video_open(struct file *file)
 		break;
 	}
 
-	dprintk("open minor=%d radio=%d type=%s\n",minor,radio,
-		v4l2_type_names[type]);
+	dprintk("open dev=%s radio=%d type=%s\n", video_device_node_name(vdev),
+		radio, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh),GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -772,7 +772,6 @@ static int get_resource(struct cx23885_f
 
 static int video_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct cx23885_dev *dev = video_drvdata(file);
 	struct cx23885_fh *fh;
@@ -791,8 +790,8 @@ static int video_open(struct file *file)
 		break;
 	}
 
-	dprintk(1, "open minor=%d radio=%d type=%s\n",
-		minor, radio, v4l2_type_names[type]);
+	dprintk(1, "open dev=%s radio=%d type=%s\n",
+		video_device_node_name(vdev), radio, v4l2_type_names[type]);
 
 	/* allocate + initialize per filehandle data */
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);

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

* v4l: Remove unneeded video_device::minor assignments
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (7 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Use video_device_node_name() instead of the minor number Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor usage in drivers Laurent Pinchart
  2009-11-18  1:31 ` [PATCH/RFC] V4L core cleanups Aguirre, Sergio
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Now that the video_device registration is tested using
video_is_registered(), drivers don't need to initialize the
video_device::minor field to -1 anymore.

Remove those unneeded assignments.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx231xx/cx231xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx231xx/cx231xx-video.c
@@ -2277,7 +2277,6 @@ static const struct video_device cx231xx
 	.fops         = &cx231xx_v4l_fops,
 	.release      = video_device_release,
 	.ioctl_ops    = &video_ioctl_ops,
-	.minor        = -1,
 	.tvnorms      = V4L2_STD_ALL,
 	.current_norm = V4L2_STD_PAL,
 };
@@ -2312,7 +2311,6 @@ static struct video_device cx231xx_radio
 	.name      = "cx231xx-radio",
 	.fops      = &radio_fops,
 	.ioctl_ops = &radio_ioctl_ops,
-	.minor     = -1,
 };
 
 /******************************** usb interface ******************************/
@@ -2328,7 +2326,6 @@ static struct video_device *cx231xx_vdev
 		return NULL;
 
 	*vfd = *template;
-	vfd->minor = -1;
 	vfd->v4l2_dev = &dev->v4l2_dev;
 	vfd->release = video_device_release;
 	vfd->debug = video_debug;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-video.c
@@ -353,7 +353,6 @@ static struct video_device *cx23885_vdev
 	if (NULL == vfd)
 		return NULL;
 	*vfd = *template;
-	vfd->minor = -1;
 	vfd->v4l2_dev = &dev->v4l2_dev;
 	vfd->release = video_device_release;
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)",
@@ -1636,7 +1635,6 @@ static struct video_device cx23885_vbi_t
 static struct video_device cx23885_video_template = {
 	.name                 = "cx23885-video",
 	.fops                 = &video_fops,
-	.minor                = -1,
 	.ioctl_ops 	      = &video_ioctl_ops,
 	.tvnorms              = CX23885_NORMS,
 	.current_norm         = V4L2_STD_NTSC_M,
@@ -1669,7 +1667,6 @@ static struct video_device cx23885_radio
 	.name                 = "cx23885-radio",
 	.fops                 = &radio_fops,
 	.ioctl_ops 	      = &radio_ioctl_ops,
-	.minor                = -1,
 };
 #endif
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/em28xx/em28xx-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/em28xx/em28xx-video.c
@@ -2462,8 +2462,6 @@ static const struct video_device em28xx_
 	.release                    = video_device_release,
 	.ioctl_ops 		    = &video_ioctl_ops,
 
-	.minor                      = -1,
-
 	.tvnorms                    = V4L2_STD_ALL,
 	.current_norm               = V4L2_STD_PAL,
 };
@@ -2498,7 +2496,6 @@ static struct video_device em28xx_radio_
 	.name                 = "em28xx-radio",
 	.fops                 = &radio_fops,
 	.ioctl_ops 	      = &radio_ioctl_ops,
-	.minor                = -1,
 };
 
 /******************************** usb interface ******************************/
@@ -2516,7 +2513,6 @@ static struct video_device *em28xx_vdev_
 		return NULL;
 
 	*vfd		= *template;
-	vfd->minor	= -1;
 	vfd->v4l2_dev	= &dev->v4l2_dev;
 	vfd->release	= video_device_release;
 	vfd->debug	= video_debug;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvision/usbvision-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvision/usbvision-video.c
@@ -1328,7 +1328,6 @@ static struct video_device usbvision_vid
 	.ioctl_ops 	= &usbvision_ioctl_ops,
 	.name           = "usbvision-video",
 	.release	= video_device_release,
-	.minor		= -1,
 	.tvnorms              = USBVISION_NORMS,
 	.current_norm         = V4L2_STD_PAL
 };
@@ -1362,7 +1361,6 @@ static struct video_device usbvision_rad
 	.fops		= &usbvision_radio_fops,
 	.name           = "usbvision-radio",
 	.release	= video_device_release,
-	.minor		= -1,
 	.ioctl_ops 	= &usbvision_radio_ioctl_ops,
 
 	.tvnorms              = USBVISION_NORMS,
@@ -1382,7 +1380,6 @@ static struct video_device usbvision_vbi
 	.fops		= &usbvision_vbi_fops,
 	.release	= video_device_release,
 	.name           = "usbvision-vbi",
-	.minor		= -1,
 };
 
 
@@ -1404,7 +1401,6 @@ static struct video_device *usbvision_vd
 		return NULL;
 	}
 	*vdev = *vdev_template;
-//	vdev->minor   = -1;
 	vdev->v4l2_dev = &usbvision->v4l2_dev;
 	snprintf(vdev->name, sizeof(vdev->name), "%s", name);
 	video_set_drvdata(vdev, usbvision);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/uvc/uvc_driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/uvc/uvc_driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/uvc/uvc_driver.c
@@ -1657,7 +1657,6 @@ static int uvc_register_video(struct uvc
 	 * get another one.
 	 */
 	vdev->parent = &dev->intf->dev;
-	vdev->minor = -1;
 	vdev->fops = &uvc_fops;
 	vdev->release = uvc_release;
 	strlcpy(vdev->name, dev->name, sizeof vdev->name);
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video.c
@@ -184,7 +184,6 @@ struct video_device *cx25821_vdev_init(s
 	if (NULL == vfd)
 		return NULL;
 	*vfd = *template;
-	vfd->minor = -1;
 	vfd->v4l2_dev = &dev->v4l2_dev;
 	vfd->release = video_device_release;
 	snprintf(vfd->name, sizeof(vfd->name), "%s %s (%s)", dev->name, type,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/au0828/au0828-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/au0828/au0828-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/au0828/au0828-video.c
@@ -1577,7 +1577,6 @@ static const struct video_device au0828_
 	.fops                       = &au0828_v4l_fops,
 	.release                    = video_device_release,
 	.ioctl_ops 		    = &video_ioctl_ops,
-	.minor                      = -1,
 	.tvnorms                    = V4L2_STD_NTSC_M,
 	.current_norm               = V4L2_STD_NTSC_M,
 };
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -3426,7 +3426,6 @@ static const struct v4l2_ioctl_ops bttv_
 
 static struct video_device bttv_video_template = {
 	.fops         = &bttv_fops,
-	.minor        = -1,
 	.ioctl_ops    = &bttv_ioctl_ops,
 	.tvnorms      = BTTV_NORMS,
 	.current_norm = V4L2_STD_PAL,
@@ -3670,7 +3669,6 @@ static const struct v4l2_ioctl_ops radio
 
 static struct video_device radio_template = {
 	.fops      = &radio_fops,
-	.minor     = -1,
 	.ioctl_ops = &radio_ioctl_ops,
 };
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/omap24xxcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
@@ -1660,7 +1660,6 @@ static int omap24xxcam_device_register(s
 
 	strlcpy(vfd->name, CAM_NAME, sizeof(vfd->name));
 	vfd->fops		 = &omap24xxcam_fops;
-	vfd->minor		 = -1;
 	vfd->ioctl_ops		 = &omap24xxcam_ioctl_fops;
 
 	omap24xxcam_hwinit(cam);
@@ -1671,7 +1670,6 @@ static int omap24xxcam_device_register(s
 
 	if (video_register_device(vfd, VFL_TYPE_GRABBER, video_nr) < 0) {
 		dev_err(cam->dev, "could not register V4L device\n");
-		vfd->minor = -1;
 		rval = -EBUSY;
 		goto err;
 	}
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stk-webcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stk-webcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stk-webcam.c
@@ -1308,7 +1308,6 @@ static void stk_v4l_dev_release(struct v
 
 static struct video_device stk_v4l_data = {
 	.name = "stkwebcam",
-	.minor = -1,
 	.tvnorms = V4L2_STD_UNKNOWN,
 	.current_norm = V4L2_STD_UNKNOWN,
 	.fops = &v4l_stk_fops,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stv680.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stv680.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stv680.c
@@ -1410,7 +1410,6 @@ static struct video_device stv680_templa
 	.name =		"STV0680 USB camera",
 	.fops =         &stv680_fops,
 	.release =	video_device_release,
-	.minor = 	-1,
 };
 
 static int stv680_probe (struct usb_interface *intf, const struct usb_device_id *id)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/arv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/arv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/arv.c
@@ -772,7 +772,6 @@ static struct video_device ar_template =
 	.name		= "Colour AR VGA",
 	.fops		= &ar_fops,
 	.release	= ar_release,
-	.minor		= -1,
 };
 
 #define ALIGN4(x)	((((int)(x)) & 0x3) == 0)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/ov511.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/ov511.c
@@ -4678,7 +4678,6 @@ static struct video_device vdev_template
 	.name =		"OV511 USB Camera",
 	.fops =		&ov511_fops,
 	.release =	video_device_release,
-	.minor =	-1,
 };
 
 /****************************************************************************
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa5246a.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa5246a.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa5246a.c
@@ -1042,7 +1042,6 @@ static struct video_device saa_template 
 	.name	  = "saa5246a",
 	.fops	  = &saa_fops,
 	.release  = video_device_release,
-	.minor    = -1,
 };
 
 static int saa5246a_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/zr364xx.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/zr364xx.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/zr364xx.c
@@ -1455,7 +1455,6 @@ static struct video_device zr364xx_templ
 	.fops = &zr364xx_fops,
 	.ioctl_ops = &zr364xx_ioctl_ops,
 	.release = video_device_release,
-	.minor = -1,
 };
 
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cafe_ccic.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cafe_ccic.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cafe_ccic.c
@@ -1724,7 +1724,6 @@ static const struct v4l2_ioctl_ops cafe_
 
 static struct video_device cafe_v4l_template = {
 	.name = "cafe",
-	.minor = -1, /* Get one dynamically */
 	.tvnorms = V4L2_STD_NTSC_M,
 	.current_norm = V4L2_STD_NTSC_M,  /* make mplayer happy */
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cpia2/cpia2_v4l.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cpia2/cpia2_v4l.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cpia2/cpia2_v4l.c
@@ -1926,7 +1926,6 @@ static const struct v4l2_file_operations
 static struct video_device cpia2_template = {
 	/* I could not find any place for the old .initialize initializer?? */
 	.name=		"CPiA2 Camera",
-	.minor=		-1,
 	.fops=		&fops_template,
 	.release=	video_device_release,
 };
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx23885/cx23885-417.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx23885/cx23885-417.c
@@ -1728,7 +1728,6 @@ static struct video_device cx23885_mpeg_
 	.name          = "cx23885",
 	.fops          = &mpeg_fops,
 	.ioctl_ops     = &mpeg_ioctl_ops,
-	.minor         = -1,
 	.tvnorms       = CX23885_NORMS,
 	.current_norm  = V4L2_STD_NTSC_M,
 };
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-blackbird.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-blackbird.c
@@ -1229,7 +1229,6 @@ static struct video_device cx8802_mpeg_t
 	.name                 = "cx8802",
 	.fops                 = &mpeg_fops,
 	.ioctl_ops 	      = &mpeg_ioctl_ops,
-	.minor                = -1,
 	.tvnorms              = CX88_NORMS,
 	.current_norm         = V4L2_STD_NTSC_M,
 };
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
@@ -1990,7 +1990,6 @@ static struct video_device cx8800_vbi_te
 static struct video_device cx8800_video_template = {
 	.name                 = "cx8800-video",
 	.fops                 = &video_fops,
-	.minor                = -1,
 	.ioctl_ops 	      = &video_ioctl_ops,
 	.tvnorms              = CX88_NORMS,
 	.current_norm         = V4L2_STD_NTSC_M,
@@ -2026,7 +2025,6 @@ static const struct v4l2_ioctl_ops radio
 static struct video_device cx8800_radio_template = {
 	.name                 = "cx8800-radio",
 	.fops                 = &radio_fops,
-	.minor                = -1,
 	.ioctl_ops 	      = &radio_ioctl_ops,
 };
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/meye.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/meye.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/meye.c
@@ -1686,7 +1686,6 @@ static struct video_device meye_template
 	.fops		= &meye_fops,
 	.ioctl_ops 	= &meye_ioctl_ops,
 	.release	= video_device_release,
-	.minor		= -1,
 };
 
 #ifdef CONFIG_PM
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/s2255drv.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/s2255drv.c
@@ -1817,7 +1817,6 @@ static struct video_device template = {
 	.name = "s2255v",
 	.fops = &s2255_fops_v4l,
 	.ioctl_ops = &s2255_ioctl_ops,
-	.minor = -1,
 	.release = video_device_release,
 	.tvnorms = S2255_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/stradis.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/stradis.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/stradis.c
@@ -1926,7 +1926,6 @@ static const struct v4l2_file_operations
 static struct video_device saa_template = {
 	.name = "SAA7146A",
 	.fops = &saa_fops,
-	.minor = -1,
 	.release = video_device_release_empty,
 };
 
@@ -1977,7 +1976,6 @@ static int __devinit configure_saa7146(s
 
 	saa->id = pdev->device;
 	saa->irq = pdev->irq;
-	saa->video_dev.minor = -1;
 	saa->saa7146_adr = pci_resource_start(pdev, 0);
 	pci_read_config_byte(pdev, PCI_CLASS_REVISION, &saa->revision);
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/vicam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/usbvideo/vicam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/usbvideo/vicam.c
@@ -1106,7 +1106,6 @@ static const struct v4l2_file_operations
 static struct video_device vicam_template = {
 	.name 		= "ViCam-based USB Camera",
 	.fops 		= &vicam_fops,
-	.minor 		= -1,
 	.release 	= video_device_release_empty,
 };
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/vino.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/vino.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/vino.c
@@ -4073,7 +4073,6 @@ static struct video_device vdev_template
 	.fops		= &vino_fops,
 	.ioctl_ops 	= &vino_ioctl_ops,
 	.tvnorms 	= V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM,
-	.minor		= -1,
 };
 
 static void vino_module_cleanup(int stage)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/vivi.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/vivi.c
@@ -1299,7 +1299,6 @@ static struct video_device vivi_template
 	.name		= "vivi",
 	.fops           = &vivi_fops,
 	.ioctl_ops 	= &vivi_ioctl_ops,
-	.minor		= -1,
 	.release	= video_device_release,
 
 	.tvnorms              = V4L2_STD_525_60,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gspca.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/gspca/gspca.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/gspca.c
@@ -2007,7 +2007,6 @@ static struct video_device gspca_templat
 	.fops = &dev_fops,
 	.ioctl_ops = &dev_ioctl_ops,
 	.release = gspca_release,
-	.minor = -1,
 };
 
 /*
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/pwc/pwc-if.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/pwc/pwc-if.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/pwc/pwc-if.c
@@ -173,7 +173,6 @@ static struct video_device pwc_template 
 	.name =		"Philips Webcam",	/* Filled in later */
 	.release =	video_device_release,
 	.fops =         &pwc_fops,
-	.minor =        -1,
 };
 
 /***************************************************************************/
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-empress.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-empress.c
@@ -481,7 +481,6 @@ static const struct v4l2_ioctl_ops ts_io
 static struct video_device saa7134_empress_template = {
 	.name          = "saa7134-empress",
 	.fops          = &ts_fops,
-	.minor	       = -1,
 	.ioctl_ops     = &ts_ioctl_ops,
 
 	.tvnorms			= SAA7134_NORMS,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/saa7134/saa7134-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/saa7134/saa7134-video.c
@@ -2502,7 +2502,6 @@ struct video_device saa7134_video_templa
 	.name				= "saa7134-video",
 	.fops				= &video_fops,
 	.ioctl_ops 			= &video_ioctl_ops,
-	.minor				= -1,
 	.tvnorms			= SAA7134_NORMS,
 	.current_norm			= V4L2_STD_PAL,
 };
@@ -2511,7 +2510,6 @@ struct video_device saa7134_radio_templa
 	.name			= "saa7134-radio",
 	.fops			= &radio_fops,
 	.ioctl_ops 		= &radio_ioctl_ops,
-	.minor			= -1,
 };
 
 int saa7134_video_init1(struct saa7134_dev *dev)
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/zoran/zoran_driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/zoran/zoran_driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/zoran/zoran_driver.c
@@ -3395,6 +3395,5 @@ struct video_device zoran_template __dev
 	.ioctl_ops = &zoran_ioctl_ops,
 	.release = &zoran_vdev_release,
 	.tvnorms = V4L2_STD_NTSC | V4L2_STD_PAL | V4L2_STD_SECAM,
-	.minor = -1
 };
 
Index: v4l-dvb-mc-uvc/linux/drivers/staging/go7007/go7007-v4l2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/go7007/go7007-v4l2.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/go7007/go7007-v4l2.c
@@ -1813,7 +1813,6 @@ static const struct v4l2_ioctl_ops video
 static struct video_device go7007_template = {
 	.name		= "go7007",
 	.fops		= &go7007_fops,
-	.minor		= -1,
 	.release	= go7007_vfl_release,
 	.ioctl_ops	= &video_ioctl_ops,
 	.tvnorms	= V4L2_STD_ALL,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/tm6000/tm6000-video.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/tm6000/tm6000-video.c
@@ -1563,7 +1563,6 @@ static struct video_device tm6000_templa
 	.name		= "tm6000",
 	.fops           = &tm6000_fops,
 	.ioctl_ops      = &video_ioctl_ops,
-	.minor		= -1,
 	.release	= video_device_release,
 	.tvnorms        = TM6000_STD,
 	.current_norm   = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-audups11.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-audups11.c
@@ -411,7 +411,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template11 = {
 	.name = "cx25821-audioupstream",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video0.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video0.c
@@ -428,7 +428,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template0 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video1.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video1.c
@@ -428,7 +428,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template1 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video2.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video2.c
@@ -430,7 +430,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template2 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video3.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video3.c
@@ -429,7 +429,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template3 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video4.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video4.c
@@ -428,7 +428,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template4 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video5.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video5.c
@@ -428,7 +428,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template5 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video6.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video6.c
@@ -428,7 +428,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template6 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-video7.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-video7.c
@@ -427,7 +427,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template7 = {
 	.name = "cx25821-video",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-videoioctl.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-videoioctl.c
@@ -474,7 +474,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_videoioctl_template = {
 	.name = "cx25821-videoioctl",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups10.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups10.c
@@ -412,7 +412,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template10 = {
 	.name = "cx25821-upstream10",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/staging/cx25821/cx25821-vidups9.c
+++ v4l-dvb-mc-uvc/linux/drivers/staging/cx25821/cx25821-vidups9.c
@@ -410,7 +410,6 @@ static const struct v4l2_ioctl_ops video
 struct video_device cx25821_video_template9 = {
 	.name = "cx25821-upstream9",
 	.fops = &video_fops,
-	.minor = -1,
 	.ioctl_ops = &video_ioctl_ops,
 	.tvnorms = CX25821_NORMS,
 	.current_norm = V4L2_STD_NTSC_M,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpfe_capture.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/davinci/vpfe_capture.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpfe_capture.c
@@ -1929,7 +1929,6 @@ static __init int vpfe_probe(struct plat
 	vfd->release		= video_device_release;
 	vfd->fops		= &vpfe_fops;
 	vfd->ioctl_ops		= &vpfe_ioctl_ops;
-	vfd->minor		= -1;
 	vfd->tvnorms		= 0;
 	vfd->current_norm	= V4L2_STD_PAL;
 	vfd->v4l2_dev 		= &vpfe_dev->v4l2_dev;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpif_display.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/davinci/vpif_display.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/davinci/vpif_display.c
@@ -1347,7 +1347,6 @@ static const struct v4l2_file_operations
 static struct video_device vpif_video_template = {
 	.name		= "vpif",
 	.fops		= &vpif_fops,
-	.minor		= -1,
 	.ioctl_ops	= &vpif_ioctl_ops,
 	.tvnorms	= DM646X_V4L2_STD,
 	.current_norm	= V4L2_STD_625_50,
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/soc_camera.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/soc_camera.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/soc_camera.c
@@ -1269,7 +1269,6 @@ static int video_dev_create(struct soc_c
 	vdev->fops		= &soc_camera_fops;
 	vdev->ioctl_ops		= &soc_camera_ioctl_ops;
 	vdev->release		= video_device_release;
-	vdev->minor		= -1;
 	vdev->tvnorms		= V4L2_STD_UNKNOWN;
 
 	icd->vdev = vdev;
@@ -1292,8 +1291,7 @@ static int soc_camera_video_start(struct
 	    !icd->ops->set_bus_param)
 		return -EINVAL;
 
-	ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER,
-				    icd->vdev->minor);
+	ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1);
 	if (ret < 0) {
 		dev_err(&icd->dev, "video_register_device failed: %d\n", ret);
 		return ret;
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/zc0301/zc0301_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/zc0301/zc0301_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/zc0301/zc0301_core.c
@@ -1992,7 +1992,6 @@ zc0301_usb_probe(struct usb_interface* i
 
 	strcpy(cam->v4ldev->name, "ZC0301[P] PC Camera");
 	cam->v4ldev->fops = &zc0301_fops;
-	cam->v4ldev->minor = video_nr[dev_nr];
 	cam->v4ldev->release = video_device_release;
 	cam->v4ldev->parent = &udev->dev;
 	video_set_drvdata(cam->v4ldev, cam);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/et61x251/et61x251_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/et61x251/et61x251_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/et61x251/et61x251_core.c
@@ -2591,7 +2591,6 @@ et61x251_usb_probe(struct usb_interface*
 
 	strcpy(cam->v4ldev->name, "ET61X[12]51 PC Camera");
 	cam->v4ldev->fops = &et61x251_fops;
-	cam->v4ldev->minor = video_nr[dev_nr];
 	cam->v4ldev->release = video_device_release;
 	cam->v4ldev->parent = &udev->dev;
 	video_set_drvdata(cam->v4ldev, cam);
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/sn9c102/sn9c102_core.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/sn9c102/sn9c102_core.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/sn9c102/sn9c102_core.c
@@ -3335,7 +3335,6 @@ sn9c102_usb_probe(struct usb_interface* 
 
 	strcpy(cam->v4ldev->name, "SN9C1xx PC Camera");
 	cam->v4ldev->fops = &sn9c102_fops;
-	cam->v4ldev->minor = video_nr[dev_nr];
 	cam->v4ldev->release = video_device_release;
 	cam->v4ldev->parent = &udev->dev;
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/w9968cf.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/w9968cf.c
@@ -3501,7 +3501,6 @@ w9968cf_usb_probe(struct usb_interface* 
 
 	strcpy(cam->v4ldev->name, symbolic(camlist, mod_id));
 	cam->v4ldev->fops = &w9968cf_fops;
-	cam->v4ldev->minor = video_nr[dev_nr];
 	cam->v4ldev->release = video_device_release;
 	video_set_drvdata(cam->v4ldev, cam);
 	cam->v4ldev->v4l2_dev = &cam->v4l2_dev;

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

* v4l: Remove unneeded video_device::minor usage in drivers
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (8 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor assignments Laurent Pinchart
@ 2009-11-18  0:38 ` Laurent Pinchart
  2009-11-18  1:31 ` [PATCH/RFC] V4L core cleanups Aguirre, Sergio
  10 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  0:38 UTC (permalink / raw)
  To: linux-media; +Cc: hverkuil, mchehab, sakari.ailus

The video_device::minor field is used where it shouldn't, either to

- test for error conditions that can't happen anymore with the current
  v4l-dvb core,
- store the value in a driver private field that isn't used anymore,
- check the video device type where video_device::vfl_type should be
  used, or
- create the name of a kernel thread that should get a stable name.

Remove or fix those use cases.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Index: v4l-dvb-mc-uvc/linux/drivers/media/radio/radio-tea5764.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/radio/radio-tea5764.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/radio/radio-tea5764.c
@@ -462,12 +462,8 @@ static int vidioc_s_audio(struct file *f
 static int tea5764_open(struct file *file)
 {
 	/* Currently we support only one device */
-	int minor = video_devdata(file)->minor;
 	struct tea5764_device *radio = video_drvdata(file);
 
-	if (radio->videodev->minor != minor)
-		return -ENODEV;
-
 	mutex_lock(&radio->mutex);
 	/* Only exclusive access */
 	if (radio->users) {
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/bt8xx/bttv-driver.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/bt8xx/bttv-driver.c
@@ -3234,7 +3234,6 @@ err:
 
 static int bttv_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct bttv *btv = video_drvdata(file);
 	struct bttv_fh *fh;
@@ -3242,17 +3241,17 @@ static int bttv_open(struct file *file)
 
 	dprintk(KERN_DEBUG "bttv: open dev=%s\n", video_device_node_name(vdev));
 
-	lock_kernel();
-	if (btv->video_dev->minor == minor) {
+	if (vdev->vfl_type == VFL_TYPE_GRABBER) {
 		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
-	} else if (btv->vbi_dev->minor == minor) {
+	} else if (vdev->vfl_type == VFL_TYPE_VBI) {
 		type = V4L2_BUF_TYPE_VBI_CAPTURE;
 	} else {
 		WARN_ON(1);
-		unlock_kernel();
 		return -ENODEV;
 	}
 
+	lock_kernel();
+
 	dprintk(KERN_DEBUG "bttv%d: open called (type=%s)\n",
 		btv->c.nr,v4l2_type_names[type]);
 
@@ -3436,7 +3435,6 @@ static struct video_device bttv_video_te
 
 static int radio_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct video_device *vdev = video_devdata(file);
 	struct bttv *btv = video_drvdata(file);
 	struct bttv_fh *fh;
@@ -3444,11 +3442,6 @@ static int radio_open(struct file *file)
 	dprintk("bttv: open dev=%s\n", video_device_node_name(vdev));
 
 	lock_kernel();
-	WARN_ON(btv->radio_dev && btv->radio_dev->minor != minor);
-	if (!btv->radio_dev || btv->radio_dev->minor != minor) {
-		unlock_kernel();
-		return -ENODEV;
-	}
 
 	dprintk("bttv%d: open called (radio)\n",btv->c.nr);
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/omap24xxcam.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/omap24xxcam.c
@@ -1450,12 +1450,11 @@ static int omap24xxcam_mmap(struct file 
 
 static int omap24xxcam_open(struct file *file)
 {
-	int minor = video_devdata(file)->minor;
 	struct omap24xxcam_device *cam = omap24xxcam.priv;
 	struct omap24xxcam_fh *fh;
 	struct v4l2_format format;
 
-	if (!cam || !cam->vfd || (cam->vfd->minor != minor))
+	if (!cam || !cam->vfd)
 		return -ENODEV;
 
 	fh = kzalloc(sizeof(*fh), GFP_KERNEL);
Index: v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/common/saa7146_fops.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/common/saa7146_fops.c
@@ -1,8 +1,6 @@
 #include <media/saa7146_vv.h>
 #include "compat.h"
 
-#define BOARD_CAN_DO_VBI(dev)   (dev->revision != 0 && dev->vv_data->vbi_minor != -1)
-
 /****************************************************************************/
 /* resource management functions, shamelessly stolen from saa7134 driver */
 
@@ -456,9 +454,6 @@ int saa7146_vv_init(struct saa7146_dev* 
 	   configuration data) */
 	dev->ext_vv_data = ext_vv;
 
-	vv->video_minor = -1;
-	vv->vbi_minor = -1;
-
 	vv->d_clipping.cpu_addr = pci_alloc_consistent(dev->pci, SAA7146_CLIPPING_MEM, &vv->d_clipping.dma_handle);
 	if( NULL == vv->d_clipping.cpu_addr ) {
 		ERR(("out of memory. aborting.\n"));
@@ -497,7 +492,6 @@ EXPORT_SYMBOL_GPL(saa7146_vv_release);
 int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev,
 			    char *name, int type)
 {
-	struct saa7146_vv *vv = dev->vv_data;
 	struct video_device *vfd;
 	int err;
 	int i;
@@ -525,11 +519,6 @@ int saa7146_register_device(struct video
 		return err;
 	}
 
-	if (VFL_TYPE_GRABBER == type)
-		vv->video_minor = vfd->minor;
-	else
-		vv->vbi_minor = vfd->minor;
-
 	INFO(("%s: registered device %s [v4l2]\n",
 		dev->name, video_device_node_name(vfd)));
 
@@ -540,16 +529,8 @@ EXPORT_SYMBOL_GPL(saa7146_register_devic
 
 int saa7146_unregister_device(struct video_device **vid, struct saa7146_dev* dev)
 {
-	struct saa7146_vv *vv = dev->vv_data;
-
 	DEB_EE(("dev:%p\n",dev));
 
-	if ((*vid)->vfl_type == VFL_TYPE_GRABBER) {
-		vv->video_minor = -1;
-	} else {
-		vv->vbi_minor = -1;
-	}
-
 	video_unregister_device(*vid);
 	*vid = NULL;
 
Index: v4l-dvb-mc-uvc/linux/include/media/saa7146_vv.h
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/include/media/saa7146_vv.h
+++ v4l-dvb-mc-uvc/linux/include/media/saa7146_vv.h
@@ -108,8 +108,6 @@ struct saa7146_fh {
 
 struct saa7146_vv
 {
-	int vbi_minor;
-
 	/* vbi capture */
 	struct saa7146_dmaqueue		vbi_q;
 	/* vbi workaround interrupt queue */
@@ -117,8 +115,6 @@ struct saa7146_vv
 	int				vbi_fieldcount;
 	struct saa7146_fh		*vbi_streaming;
 
-	int video_minor;
-
 	int				video_status;
 	struct saa7146_fh		*video_fh;
 
Index: v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/sn9c20x.c
===================================================================
--- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/gspca/sn9c20x.c
+++ v4l-dvb-mc-uvc/linux/drivers/media/video/gspca/sn9c20x.c
@@ -1479,8 +1479,9 @@ static int sn9c20x_input_init(struct gsp
 	if (input_register_device(sd->input_dev))
 		return -EINVAL;
 
-	sd->input_task = kthread_run(input_kthread, gspca_dev, "sn9c20x/%d",
-				     gspca_dev->vdev.minor);
+	sd->input_task = kthread_run(input_kthread, gspca_dev, "sn9c20x/%s-%s",
+				     gspca_dev->dev->bus->bus_name,
+				     gspca_dev->dev->devpath);
 
 	if (IS_ERR(sd->input_task))
 		return -EINVAL;

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

* RE: [PATCH/RFC] V4L core cleanups
  2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
                   ` (9 preceding siblings ...)
  2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor usage in drivers Laurent Pinchart
@ 2009-11-18  1:31 ` Aguirre, Sergio
  2009-11-18 12:57   ` Laurent Pinchart
  10 siblings, 1 reply; 27+ messages in thread
From: Aguirre, Sergio @ 2009-11-18  1:31 UTC (permalink / raw)
  To: Laurent Pinchart, linux-media; +Cc: hverkuil, mchehab, sakari.ailus

Laurent, 

> -----Original Message-----
> From: linux-media-owner@vger.kernel.org 
> [mailto:linux-media-owner@vger.kernel.org] On Behalf Of 
> Laurent Pinchart
> Sent: Tuesday, November 17, 2009 6:39 PM
> To: linux-media@vger.kernel.org
> Cc: hverkuil@xs4all.nl; mchehab@infradead.org; 
> sakari.ailus@maxwell.research.nokia.com
> Subject: [PATCH/RFC] V4L core cleanups
> 
> Hi everybody,
> 
> this patch sets attemp to clean up the V4L core to remove the
> video_device::minor and video_device::num references in most drivers.

I think you're missing usual subject prefix: [PATCH #/total]

Unless all patches are independent from eachother, which is something
I'll hardly believe.

Regards,
Sergio

> 
> There are two reasons for this. The first one is that drivers really
> shouldn't care about those fields, especially the minor number. This
> doesn't mean a driver can't request a specific device number, that
> remains a perfectly valid use case, but most use cases of those fields
> after device registration shouldn't be needed.
> 
> The second reason is that most drivers use those fields in bogus ways,
> making it obvious they shouldn't have cared about them in the first
> place :-) We've had a video_drvdata function for a long time, but many
> drivers still have their own private minor -> data mapping lists for
> historical reasons. That code is error prone and completely unneeded.
> 
> So this patch sets tries to clean up the V4L core by porting 
> drivers to
> the most "recent" APIs (which are actually quite old) and 
> introducing a
> new helper function.
> 
> The first two patches add and use the video_device_node_name function.
> The function returns a const pointer to the video device name. On
> systems using udev, the name is passed as a hint to udev and 
> will likely
> become the /dev device node name, unless overwritten by udev 
> rules (I've
> heard that some distributions put the V4L device nodes in /dev/v4l).
> Some drivers erroneously created the name from the video_device::minor
> field instead of video_device::num, which is fixed by the 
> second patch.
> 
> This is an example video_device_node_name usage typical from 
> what can be
> found in the second patch.
> 
> -       printk(KERN_INFO "bttv%d: registered device radio%d\n",
> -              btv->c.nr, btv->radio_dev->num);
> +       printk(KERN_INFO "bttv%d: registered device %s\n",
> +              btv->c.nr, video_device_node_name(btv->radio_dev));
> 
> The third patch removes left video_device::num usage from the drivers.
> The field was used to create information strings that 
> shouldn't include
> the device node name (such as video_device::name) or that should be
> created using a stable identifier (such as i2c_adapter::name).
> 
> The fourth, fifth and sixth patches replace video_is_unregistered with
> video_is_registered and use the new function in device drivers. As
> explained in the fourth patch commit message, the rationale 
> behind that
> is to have video_is_registered return false when called on an
> initialized but not yet registered video_device instance. The function
> can be used instead of checking video_device::minor manually, 
> making it
> less error-prone as drivers don't need to make sure they
> video_device::minor to -1 correctly for all error paths.
> 
> A typical use case is
> 
> -       if (-1 != dev->radio_dev->minor)
> +       if (video_is_registered(dev->radio_dev))
>                 video_unregister_device(dev->radio_dev);
>         else
>                 video_device_release(dev->radio_dev);
> 
> The seventh patch replace local minor to data lists by 
> video_drvdata().
> The function has been there for a long time but wasn't used by many
> drivers, probably because they were written before it was 
> available, or,
> for some of them, because they were written based on drivers that were
> not using it. This patch removes lots of identical unneeded 
> code blocks,
> making the result less bug-prone.
> 
> The eight patch removes now unneeded video_device::minor 
> assignments to
> -1, as the previous patches made them unneeded.
> 
> The last patch removes a few more video_device::minor users. As
> explained in the patch description, the field was used either to
> 
> - test for error conditions that can't happen anymore with the current
>   v4l-dvb core,
> - store the value in a driver private field that isn't used anymore,
> - check the video device type where video_device::vfl_type should be
>   used, or
> - create the name of a kernel thread that should get a stable name.
> 
> There are still two video_device::num users and those can easily be
> removed. Hans Verkuil is working on a patch, as one of the drivers is
> the ivtv driver and the other one is based on the same code.
> 
> There are also still a few video_device::minor users. One of them is
> the pvrusb2 driver that creates sysfs attributes storing the minor
> numbers of the device nodes created by the driver. I'm not 
> sure what to
> do about that one. All the others are V4L1 drivers that need the minor
> number for the VIDIOCGUNIT ioctl. Hopefully that will die when the
> drivers will be ported to V4L2 :-)
> 
> I've split the patches into core and device patches to make 
> them easier
> to apply on my work trees. I'll merge the core and device 
> code together
> when submitting a pull request to avoid bisection errors.
> 
> I'll send a pull request after receiving (and incorporating) your
> comments, or in a few days if there's no comments.
> 
> Regards,
> 
> Laurent Pinchart
> 
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

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

* Re: v4l: Use the new video_device_node_name function
  2009-11-18  0:38 ` v4l: Use the new " Laurent Pinchart
@ 2009-11-18  6:29   ` Hans Verkuil
  2009-11-18  9:30     ` Laurent Pinchart
  0 siblings, 1 reply; 27+ messages in thread
From: Hans Verkuil @ 2009-11-18  6:29 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 01:38:43 Laurent Pinchart wrote:
> Fix all device drivers to use the new video_device_node_name function.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 

Using video_device_node_name() is a great improvement! Excellent work!

One suggestion, though: I have to agree with the discussion you had with Mauro
on irc yesterday about the /dev/ prefix. I think that should be removed and
doing that in this patch as well makes a lot of sense. No need for a separate
patch to do that as far as I am concerned.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  0:38 ` v4l: Use the video_drvdata function in drivers Laurent Pinchart
@ 2009-11-18  7:01   ` Hans Verkuil
  2009-11-18  8:56     ` Devin Heitmueller
  2009-11-18  9:32     ` Laurent Pinchart
  0 siblings, 2 replies; 27+ messages in thread
From: Hans Verkuil @ 2009-11-18  7:01 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 01:38:48 Laurent Pinchart wrote:
> Fix all device drivers to use the video_drvdata function instead of
> maintaining a local list of minor to private data mappings. Call
> video_set_drvdata to register the driver private pointer when not
> already done.
> 
> Where applicable, the local list of mappings is completely removed when
> it becomes unused.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Very nice cleanup!

But you need to check the lock_kernel calls carefully, I think one is now
unbalanced:

> Index: v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
> ===================================================================
> --- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/cx88/cx88-video.c
> +++ v4l-dvb-mc-uvc/linux/drivers/media/video/cx88/cx88-video.c
> @@ -76,10 +76,6 @@ MODULE_PARM_DESC(vid_limit,"capture memo
>  #define dprintk(level,fmt, arg...)	if (video_debug >= level) \
>  	printk(KERN_DEBUG "%s/0: " fmt, core->name , ## arg)
>  
> -/* ------------------------------------------------------------------ */
> -
> -static LIST_HEAD(cx8800_devlist);
> -
>  /* ------------------------------------------------------------------- */
>  /* static data                                                         */
>  
> @@ -980,31 +976,23 @@ static int get_ressource(struct cx8800_f
>  static int video_open(struct file *file)
>  {
>  	int minor = video_devdata(file)->minor;
> -	struct cx8800_dev *h,*dev = NULL;
> +	struct video_device *vdev = video_devdata(file);
> +	struct cx8800_dev *dev = video_drvdata(file);
>  	struct cx88_core *core;
>  	struct cx8800_fh *fh;
>  	enum v4l2_buf_type type = 0;
>  	int radio = 0;
>  
> -	lock_kernel();

Lock is removed.

> -	list_for_each_entry(h, &cx8800_devlist, devlist) {
> -		if (h->video_dev->minor == minor) {
> -			dev  = h;
> -			type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> -		}
> -		if (h->vbi_dev->minor == minor) {
> -			dev  = h;
> -			type = V4L2_BUF_TYPE_VBI_CAPTURE;
> -		}
> -		if (h->radio_dev &&
> -		    h->radio_dev->minor == minor) {
> -			radio = 1;
> -			dev   = h;
> -		}
> -	}
> -	if (NULL == dev) {
> -		unlock_kernel();
> -		return -ENODEV;
> +	switch (vdev->vfl_type) {
> +	case VFL_TYPE_GRABBER:
> +		type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> +		break;
> +	case VFL_TYPE_VBI:
> +		type = V4L2_BUF_TYPE_VBI_CAPTURE;
> +		break;
> +	case VFL_TYPE_RADIO:
> +		radio = 1;
> +		break;
>  	}

But not added here. And I assume there is an unlock at the end of this
function as well.

Regards,

	Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

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

* Re: v4l: Add video_device_node_name function
  2009-11-18  0:38 ` v4l: Add video_device_node_name function Laurent Pinchart
@ 2009-11-18  7:06   ` Hans Verkuil
  2009-11-18 12:48     ` Laurent Pinchart
  0 siblings, 1 reply; 27+ messages in thread
From: Hans Verkuil @ 2009-11-18  7:06 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 01:38:42 Laurent Pinchart wrote:
> Many drivers access the device number (video_device::v4l2_devnode::num)
> in order to print the video device node name. Add and use a helper
> function to retrieve the video_device node name.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Can you also add a bit of documentation for this function in
Documentation/video4linux/v4l2-framework.txt? It should go in the section
"video_device helper functions".

And update that file as well when the num and minor fields go away.

The same is also true for the new registration function.

Thanks,

	Hans

> 
> Index: v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
> ===================================================================
> --- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/v4l2-dev.c
> +++ v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
> @@ -619,8 +619,8 @@ static int __video_register_device(struc
>  	vdev->dev.release = v4l2_device_release;
>  
>  	if (nr != -1 && nr != vdev->num && warn_if_nr_in_use)
> -		printk(KERN_WARNING "%s: requested %s%d, got %s%d\n",
> -				__func__, name_base, nr, name_base, vdev->num);
> +		printk(KERN_WARNING "%s: requested %s%d, got %s\n", __func__,
> +			name_base, nr, video_device_node_name(vdev));
>  
>  	/* Part 5: Activate this minor. The char device can now be used. */
>  	mutex_lock(&videodev_lock);
> Index: v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
> ===================================================================
> --- v4l-dvb-mc-uvc.orig/linux/include/media/v4l2-dev.h
> +++ v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
> @@ -153,6 +153,15 @@ static inline void *video_drvdata(struct
>  	return video_get_drvdata(video_devdata(file));
>  }
>  
> +static inline const char *video_device_node_name(struct video_device *vdev)
> +{
> +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
> +	return vdev->dev.class_id;
> +#else
> +	return dev_name(&vdev->dev);
> +#endif
> +}
> +
>  static inline int video_is_unregistered(struct video_device *vdev)
>  {
>  	return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
> 



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

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

* Re: v4l: Replace video_is_unregistered with video_is_registered
  2009-11-18  0:38 ` v4l: Replace video_is_unregistered with video_is_registered Laurent Pinchart
@ 2009-11-18  7:15   ` Hans Verkuil
  0 siblings, 0 replies; 27+ messages in thread
From: Hans Verkuil @ 2009-11-18  7:15 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 01:38:45 Laurent Pinchart wrote:
> Replace the video_is_unregistered function by a video_is_registered
> function. The V4L2_FL_UNREGISTERED flag is replaced by a
> V4L2_FL_REGISTERED flag.
> 
> This change makes the video_is_registered function return coherent
> results when called on an initialize but not yet registered video_device
> instance. The function can now be used instead of checking
> video_device::minor.

Much better than what I wrote originally! I like this!

Regards,

	Hans

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Index: v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
> ===================================================================
> --- v4l-dvb-mc-uvc.orig/linux/drivers/media/video/v4l2-dev.c
> +++ v4l-dvb-mc-uvc/linux/drivers/media/video/v4l2-dev.c
> @@ -227,7 +227,7 @@ static ssize_t v4l2_read(struct file *fi
>  
>  	if (!vdev->fops->read)
>  		return -EINVAL;
> -	if (video_is_unregistered(vdev))
> +	if (!video_is_registered(vdev))
>  		return -EIO;
>  	return vdev->fops->read(filp, buf, sz, off);
>  }
> @@ -239,7 +239,7 @@ static ssize_t v4l2_write(struct file *f
>  
>  	if (!vdev->fops->write)
>  		return -EINVAL;
> -	if (video_is_unregistered(vdev))
> +	if (!video_is_registered(vdev))
>  		return -EIO;
>  	return vdev->fops->write(filp, buf, sz, off);
>  }
> @@ -248,7 +248,7 @@ static unsigned int v4l2_poll(struct fil
>  {
>  	struct video_device *vdev = video_devdata(filp);
>  
> -	if (!vdev->fops->poll || video_is_unregistered(vdev))
> +	if (!vdev->fops->poll || !video_is_registered(vdev))
>  		return DEFAULT_POLLMASK;
>  	return vdev->fops->poll(filp, poll);
>  }
> @@ -288,7 +288,7 @@ static unsigned long v4l2_get_unmapped_a
>  
>  	if (!vdev->fops->get_unmapped_area)
>  		return -ENOSYS;
> -	if (video_is_unregistered(vdev))
> +	if (!video_is_registered(vdev))
>  		return -ENODEV;
>  	return vdev->fops->get_unmapped_area(filp, addr, len, pgoff, flags);
>  }
> @@ -298,8 +298,7 @@ static int v4l2_mmap(struct file *filp, 
>  {
>  	struct video_device *vdev = video_devdata(filp);
>  
> -	if (!vdev->fops->mmap ||
> -	    video_is_unregistered(vdev))
> +	if (!vdev->fops->mmap || !video_is_registered(vdev))
>  		return -ENODEV;
>  	return vdev->fops->mmap(filp, vm);
>  }
> @@ -315,7 +314,7 @@ static int v4l2_open(struct inode *inode
>  	vdev = video_devdata(filp);
>  	/* return ENODEV if the video device has been removed
>  	   already or if it is not registered anymore. */
> -	if (vdev == NULL || video_is_unregistered(vdev)) {
> +	if (vdev == NULL || !video_is_registered(vdev)) {
>  		mutex_unlock(&videodev_lock);
>  		return -ENODEV;
>  	}
> @@ -623,6 +622,7 @@ static int __video_register_device(struc
>  			name_base, nr, video_device_node_name(vdev));
>  
>  	/* Part 5: Activate this minor. The char device can now be used. */
> +	set_bit(V4L2_FL_REGISTERED, &vdev->flags);
>  	mutex_lock(&videodev_lock);
>  	video_device[vdev->minor] = vdev;
>  	mutex_unlock(&videodev_lock);
> @@ -661,11 +661,11 @@ EXPORT_SYMBOL(video_register_device_no_w
>  void video_unregister_device(struct video_device *vdev)
>  {
>  	/* Check if vdev was ever registered at all */
> -	if (!vdev || vdev->minor < 0)
> +	if (!vdev || !video_is_registered(vdev))
>  		return;
>  
>  	mutex_lock(&videodev_lock);
> -	set_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
> +	clear_bit(V4L2_FL_REGISTERED, &vdev->flags);
>  	mutex_unlock(&videodev_lock);
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19)
>  	class_device_unregister(&vdev->dev);
> Index: v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
> ===================================================================
> --- v4l-dvb-mc-uvc.orig/linux/include/media/v4l2-dev.h
> +++ v4l-dvb-mc-uvc/linux/include/media/v4l2-dev.h
> @@ -28,10 +28,10 @@ struct v4l2_ioctl_callbacks;
>  struct video_device;
>  struct v4l2_device;
>  
> -/* Flag to mark the video_device struct as unregistered.
> -   Drivers can set this flag if they want to block all future
> -   device access. It is set by video_unregister_device. */
> -#define V4L2_FL_UNREGISTERED	(0)
> +/* Flag to mark the video_device struct as registered.
> +   Drivers can clear this flag if they want to block all future
> +   device access. It is cleared by video_unregister_device. */
> +#define V4L2_FL_REGISTERED	(0)
>  
>  struct v4l2_file_operations {
>  	struct module *owner;
> @@ -100,9 +100,7 @@ struct video_device
>  /* Register video devices. Note that if video_register_device fails,
>     the release() callback of the video_device structure is *not* called, so
>     the caller is responsible for freeing any data. Usually that means that
> -   you call video_device_release() on failure.
> -
> -   Also note that vdev->minor is set to -1 if the registration failed. */
> +   you call video_device_release() on failure. */
>  int __must_check video_register_device(struct video_device *vdev, int type, int nr);
>  
>  /* Same as video_register_device, but no warning is issued if the desired
> @@ -110,7 +108,7 @@ int __must_check video_register_device(s
>  int __must_check video_register_device_no_warn(struct video_device *vdev, int type, int nr);
>  
>  /* Unregister video devices. Will do nothing if vdev == NULL or
> -   vdev->minor < 0. */
> +   video_is_registered() returns false. */
>  void video_unregister_device(struct video_device *vdev);
>  
>  /* helper functions to alloc/release struct video_device, the
> @@ -162,9 +160,9 @@ static inline const char *video_device_n
>  #endif
>  }
>  
> -static inline int video_is_unregistered(struct video_device *vdev)
> +static inline int video_is_registered(struct video_device *vdev)
>  {
> -	return test_bit(V4L2_FL_UNREGISTERED, &vdev->flags);
> +	return test_bit(V4L2_FL_REGISTERED, &vdev->flags);
>  }
>  
>  #endif /* _V4L2_DEV_H */
> 



-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  7:01   ` Hans Verkuil
@ 2009-11-18  8:56     ` Devin Heitmueller
  2009-11-18  9:13       ` Hans Verkuil
  2009-11-18  9:38       ` Laurent Pinchart
  2009-11-18  9:32     ` Laurent Pinchart
  1 sibling, 2 replies; 27+ messages in thread
From: Devin Heitmueller @ 2009-11-18  8:56 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Laurent Pinchart, linux-media, mchehab, sakari.ailus

On Wed, Nov 18, 2009 at 2:01 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> Very nice cleanup!

The last time I saw one of these relatively innocent-looking changes
being done across all drivers without testing, it introduced a rather
nasty and hard to find OOPS into one of my drivers and I had to fix
it:

http://linuxtv.org/hg/v4l-dvb/rev/5a54038a66c9

Is there some reason this is one massive patch instead of individual
patches for each driver?  How confident are we that this *really*
isn't going to break some bridge without anyone realizing it?  Is this
going to be some situation where it just "goes in" and then the
maintainers of individual bridges are going to have to clean up the
mess when users start complaining?

If there are going to be a series of cleanups such as this, perhaps it
makes sense for Laurent to setup a tree with all the proposed fixes,
and put out a call for testers so we can be more confident that it
doesn't screw anything up.

Don't get me wrong, I'm all for seeing these things cleaned up, and
the more functionality in the core the better.  But I am admittedly a
bit nervous to see huge patches touching all the drivers where I am
pretty sure that the developer probably only tested it on a couple of
drivers and is assuming it works across all.

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  8:56     ` Devin Heitmueller
@ 2009-11-18  9:13       ` Hans Verkuil
  2009-11-18  9:36         ` Devin Heitmueller
  2009-11-18  9:42         ` Laurent Pinchart
  2009-11-18  9:38       ` Laurent Pinchart
  1 sibling, 2 replies; 27+ messages in thread
From: Hans Verkuil @ 2009-11-18  9:13 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: Laurent Pinchart, linux-media, mchehab, sakari.ailus


> On Wed, Nov 18, 2009 at 2:01 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
>> Very nice cleanup!
>
> The last time I saw one of these relatively innocent-looking changes
> being done across all drivers without testing, it introduced a rather
> nasty and hard to find OOPS into one of my drivers and I had to fix
> it:
>
> http://linuxtv.org/hg/v4l-dvb/rev/5a54038a66c9
>
> Is there some reason this is one massive patch instead of individual
> patches for each driver?  How confident are we that this *really*
> isn't going to break some bridge without anyone realizing it?  Is this
> going to be some situation where it just "goes in" and then the
> maintainers of individual bridges are going to have to clean up the
> mess when users start complaining?
>
> If there are going to be a series of cleanups such as this, perhaps it
> makes sense for Laurent to setup a tree with all the proposed fixes,
> and put out a call for testers so we can be more confident that it
> doesn't screw anything up.
>
> Don't get me wrong, I'm all for seeing these things cleaned up, and
> the more functionality in the core the better.  But I am admittedly a
> bit nervous to see huge patches touching all the drivers where I am
> pretty sure that the developer probably only tested it on a couple of
> drivers and is assuming it works across all.

I agree that it would help to split this patch up. Some cases are trivial,
so they can be put together in one patch. When things get more complex it
makes sense to put it in a separate patch for easier reviewing by the
relevant maintainers.

This is a very nice cleanup and improves the driver code significantly.
Especially since so many drivers keep copying the same useless code time
and again :-(

Reducing driver code complexity is a very important goal since that is the
weakest point of many of the existing drivers. But it should be done
carefully of course and in such a manner that people can review it easily.

Regards,

         Hans

-- 
Hans Verkuil - video4linux developer - sponsored by TANDBERG Telecom


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

* Re: v4l: Use the new video_device_node_name function
  2009-11-18  6:29   ` Hans Verkuil
@ 2009-11-18  9:30     ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  9:30 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, mchehab, sakari.ailus

Hi Hans,

On Wednesday 18 November 2009 07:29:40 Hans Verkuil wrote:
> On Wednesday 18 November 2009 01:38:43 Laurent Pinchart wrote:
> > Fix all device drivers to use the new video_device_node_name function.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Using video_device_node_name() is a great improvement! Excellent work!

Thanks.

> One suggestion, though: I have to agree with the discussion you had with
>  Mauro on irc yesterday about the /dev/ prefix. I think that should be
>  removed and doing that in this patch as well makes a lot of sense. No need
>  for a separate patch to do that as far as I am concerned.

Ok, I'll update the patch.

-- 
Regards,

Laurent Pinchart

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  7:01   ` Hans Verkuil
  2009-11-18  8:56     ` Devin Heitmueller
@ 2009-11-18  9:32     ` Laurent Pinchart
  1 sibling, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  9:32 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 08:01:48 Hans Verkuil wrote:
> On Wednesday 18 November 2009 01:38:48 Laurent Pinchart wrote:
> > Fix all device drivers to use the video_drvdata function instead of
> > maintaining a local list of minor to private data mappings. Call
> > video_set_drvdata to register the driver private pointer when not
> > already done.
> >
> > Where applicable, the local list of mappings is completely removed when
> > it becomes unused.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Very nice cleanup!

Thank you.

> But you need to check the lock_kernel calls carefully, I think one is now
> unbalanced:

[snip]

Thanks for catching this. I tried to be quite careful but this one slipped in. 
I was planning to recheck all the patches for this kind of issue, so now is a 
good time to do so :-)

-- 
Regards,

Laurent Pinchart

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  9:13       ` Hans Verkuil
@ 2009-11-18  9:36         ` Devin Heitmueller
  2009-11-18 12:41           ` Laurent Pinchart
  2009-11-18  9:42         ` Laurent Pinchart
  1 sibling, 1 reply; 27+ messages in thread
From: Devin Heitmueller @ 2009-11-18  9:36 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Laurent Pinchart, linux-media, mchehab, sakari.ailus

On Wed, Nov 18, 2009 at 4:13 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> I agree that it would help to split this patch up. Some cases are trivial,
> so they can be put together in one patch. When things get more complex it
> makes sense to put it in a separate patch for easier reviewing by the
> relevant maintainers.
>
> This is a very nice cleanup and improves the driver code significantly.
> Especially since so many drivers keep copying the same useless code time
> and again :-(
>
> Reducing driver code complexity is a very important goal since that is the
> weakest point of many of the existing drivers. But it should be done
> carefully of course and in such a manner that people can review it easily.

Hello Hans,

Thanks for the comments.

Review is good.  Review *and* actually trying the code is better.  If
it comes down to Laurent's time being the constraint, I would rather
see him spending the time setting up a tree with all his proposed
patches and doing a call for testers than cutting up patches so that
maintainers can review and guess whether it's not going to cause
problems in their particular driver (and I say "guess" here because in
some cases it may fail in non-obvious ways that wouldn't be noticed
without actually trying it).

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  8:56     ` Devin Heitmueller
  2009-11-18  9:13       ` Hans Verkuil
@ 2009-11-18  9:38       ` Laurent Pinchart
  1 sibling, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  9:38 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: Hans Verkuil, linux-media, mchehab, sakari.ailus

Hi Devin,

On Wednesday 18 November 2009 09:56:12 Devin Heitmueller wrote:
> On Wed, Nov 18, 2009 at 2:01 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> > Very nice cleanup!
> 
> The last time I saw one of these relatively innocent-looking changes
> being done across all drivers without testing, it introduced a rather
> nasty and hard to find OOPS into one of my drivers and I had to fix
> it:
> 
> http://linuxtv.org/hg/v4l-dvb/rev/5a54038a66c9
> 
> Is there some reason this is one massive patch instead of individual
> patches for each driver?

It was just easier to do so in a single patch, there's no other particular 
reason. The patch can be split.

> How confident are we that this *really* isn't going to break some bridge
> without anyone realizing it?  Is this going to be some situation where it
> just "goes in" and then the maintainers of individual bridges are going to
> have to clean up the mess when users start complaining?

Hopefully not. I haven't changed the drivers blindly but I've tried to 
understand the logic behind every piece of code I changed. Obviously a bug can 
still slip in, regardless of how careful we are.

So to answer your question, no, the patch will not blindly introduce a mess 
that will need to be cleaned by driver maintainers, but a bug could still get 
in.

> If there are going to be a series of cleanups such as this, perhaps it
> makes sense for Laurent to setup a tree with all the proposed fixes,
> and put out a call for testers so we can be more confident that it
> doesn't screw anything up.

Good idea, I'll do that. I'll incorporate the review comments and I'll send a 
link to the tree to the mailing list.

> Don't get me wrong, I'm all for seeing these things cleaned up, and
> the more functionality in the core the better.  But I am admittedly a
> bit nervous to see huge patches touching all the drivers where I am
> pretty sure that the developer probably only tested it on a couple of
> drivers and is assuming it works across all.

I share your concern. Unfortunately I can't test all the changes myself 
(unless people start sending me lots of hardware samples, but in that case 
I'll probably have to move to a bigger house :-)).

By the way, how would splitting the patches help solve (or at least mitigate) 
the problem ?

-- 
Regards,

Laurent Pinchart

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  9:13       ` Hans Verkuil
  2009-11-18  9:36         ` Devin Heitmueller
@ 2009-11-18  9:42         ` Laurent Pinchart
  2009-11-18  9:55           ` Devin Heitmueller
  1 sibling, 1 reply; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18  9:42 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: Devin Heitmueller, linux-media, mchehab, sakari.ailus

On Wednesday 18 November 2009 10:13:30 Hans Verkuil wrote:
> > On Wed, Nov 18, 2009 at 2:01 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> >> Very nice cleanup!
> >
> > The last time I saw one of these relatively innocent-looking changes
> > being done across all drivers without testing, it introduced a rather
> > nasty and hard to find OOPS into one of my drivers and I had to fix
> > it:
> >
> > http://linuxtv.org/hg/v4l-dvb/rev/5a54038a66c9
> >
> > Is there some reason this is one massive patch instead of individual
> > patches for each driver?  How confident are we that this *really*
> > isn't going to break some bridge without anyone realizing it?  Is this
> > going to be some situation where it just "goes in" and then the
> > maintainers of individual bridges are going to have to clean up the
> > mess when users start complaining?
> >
> > If there are going to be a series of cleanups such as this, perhaps it
> > makes sense for Laurent to setup a tree with all the proposed fixes,
> > and put out a call for testers so we can be more confident that it
> > doesn't screw anything up.
> >
> > Don't get me wrong, I'm all for seeing these things cleaned up, and
> > the more functionality in the core the better.  But I am admittedly a
> > bit nervous to see huge patches touching all the drivers where I am
> > pretty sure that the developer probably only tested it on a couple of
> > drivers and is assuming it works across all.
> 
> I agree that it would help to split this patch up. Some cases are trivial,
> so they can be put together in one patch. When things get more complex it
> makes sense to put it in a separate patch for easier reviewing by the
> relevant maintainers.
> 
> This is a very nice cleanup and improves the driver code significantly.
> Especially since so many drivers keep copying the same useless code time
> and again :-(
> 
> Reducing driver code complexity is a very important goal since that is the
> weakest point of many of the existing drivers. But it should be done
> carefully of course and in such a manner that people can review it easily.

I will setup a test tree to help maintainers test the changes. I can split 
some patches if needed, but how would that help exactly ?

-- 
Regards,

Laurent Pinchart

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  9:42         ` Laurent Pinchart
@ 2009-11-18  9:55           ` Devin Heitmueller
  0 siblings, 0 replies; 27+ messages in thread
From: Devin Heitmueller @ 2009-11-18  9:55 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: Hans Verkuil, linux-media, mchehab, sakari.ailus

On Wed, Nov 18, 2009 at 4:42 AM, Laurent Pinchart
<laurent.pinchart@ideasonboard.com> wrote:
> I will setup a test tree to help maintainers test the changes. I can split
> some patches if needed, but how would that help exactly ?

Hello Laurent,

In this case, splitting up the patch would just make it easier to
review, and potentially to check in changes for specific bridges as
they are validated (as opposed to all at once).  However, even just
having all your changes in a tree that can be checked out and tested
by users is probably "good enough" and would still provide
considerable value.

Cheers,

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

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

* Re: v4l: Use the video_drvdata function in drivers
  2009-11-18  9:36         ` Devin Heitmueller
@ 2009-11-18 12:41           ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18 12:41 UTC (permalink / raw)
  To: Devin Heitmueller; +Cc: Hans Verkuil, linux-media, mchehab, sakari.ailus

Hi Devin,

On Wednesday 18 November 2009 10:36:45 Devin Heitmueller wrote:
> On Wed, Nov 18, 2009 at 4:13 AM, Hans Verkuil <hverkuil@xs4all.nl> wrote:
> > I agree that it would help to split this patch up. Some cases are
> > trivial, so they can be put together in one patch. When things get more
> > complex it makes sense to put it in a separate patch for easier reviewing
> > by the relevant maintainers.
> >
> > This is a very nice cleanup and improves the driver code significantly.
> > Especially since so many drivers keep copying the same useless code time
> > and again :-(
> >
> > Reducing driver code complexity is a very important goal since that is
> > the weakest point of many of the existing drivers. But it should be done
> > carefully of course and in such a manner that people can review it
> > easily.
> 
> Hello Hans,
> 
> Thanks for the comments.
> 
> Review is good.  Review *and* actually trying the code is better.  If
> it comes down to Laurent's time being the constraint, I would rather
> see him spending the time setting up a tree with all his proposed
> patches and doing a call for testers than cutting up patches so that
> maintainers can review and guess whether it's not going to cause
> problems in their particular driver (and I say "guess" here because in
> some cases it may fail in non-obvious ways that wouldn't be noticed
> without actually trying it).

Time is always a constraint, but in this case the problem is that I don't have 
the necessary hardware to test all the changes.

Your wish turned into reality (I can't promise that for all wishes though 
;-)):

http://linuxtv.org/hg/~pinchartl/v4l-dvb-cleanup

-- 
Regards,

Laurent Pinchart

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

* Re: v4l: Add video_device_node_name function
  2009-11-18  7:06   ` Hans Verkuil
@ 2009-11-18 12:48     ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18 12:48 UTC (permalink / raw)
  To: Hans Verkuil; +Cc: linux-media, mchehab, sakari.ailus

Hi Hans,

On Wednesday 18 November 2009 08:06:22 Hans Verkuil wrote:
> On Wednesday 18 November 2009 01:38:42 Laurent Pinchart wrote:
> > Many drivers access the device number (video_device::v4l2_devnode::num)
> > in order to print the video device node name. Add and use a helper
> > function to retrieve the video_device node name.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> 
> Can you also add a bit of documentation for this function in
> Documentation/video4linux/v4l2-framework.txt? It should go in the section
> "video_device helper functions".

Sure.

> And update that file as well when the num and minor fields go away.

The fields won't go away completely, as they're still needed by the v4l core. 
I will document them as private when no drivers will be using them anymore.
 
> The same is also true for the new registration function.

Ok.

Thanks for the review.

-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH/RFC] V4L core cleanups
  2009-11-18  1:31 ` [PATCH/RFC] V4L core cleanups Aguirre, Sergio
@ 2009-11-18 12:57   ` Laurent Pinchart
  0 siblings, 0 replies; 27+ messages in thread
From: Laurent Pinchart @ 2009-11-18 12:57 UTC (permalink / raw)
  To: Aguirre, Sergio; +Cc: linux-media, hverkuil, mchehab, sakari.ailus

Hi Sergio,

On Wednesday 18 November 2009 02:31:23 Aguirre, Sergio wrote:
> Laurent,
> 
> > -----Original Message-----
> > From: linux-media-owner@vger.kernel.org
> > [mailto:linux-media-owner@vger.kernel.org] On Behalf Of
> > Laurent Pinchart
> > Sent: Tuesday, November 17, 2009 6:39 PM
> > To: linux-media@vger.kernel.org
> > Cc: hverkuil@xs4all.nl; mchehab@infradead.org;
> > sakari.ailus@maxwell.research.nokia.com
> > Subject: [PATCH/RFC] V4L core cleanups
> >
> > Hi everybody,
> >
> > this patch sets attemp to clean up the V4L core to remove the
> > video_device::minor and video_device::num references in most drivers.
> 
> I think you're missing usual subject prefix: [PATCH #/total]

The patches were sent using git send-email on a quilt series. It turns out git 
send-email doesn't add the usual subject prefix, I'll make sure I add it 
manually next time.

> Unless all patches are independent from eachother, which is something
> I'll hardly believe.

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2009-11-18 12:56 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-18  0:38 [PATCH/RFC] V4L core cleanups Laurent Pinchart
2009-11-18  0:38 ` v4l: Add video_device_node_name function Laurent Pinchart
2009-11-18  7:06   ` Hans Verkuil
2009-11-18 12:48     ` Laurent Pinchart
2009-11-18  0:38 ` v4l: Use the new " Laurent Pinchart
2009-11-18  6:29   ` Hans Verkuil
2009-11-18  9:30     ` Laurent Pinchart
2009-11-18  0:38 ` v4l: Remove video_device::num usage from device drivers Laurent Pinchart
2009-11-18  0:38 ` v4l: Replace video_is_unregistered with video_is_registered Laurent Pinchart
2009-11-18  7:15   ` Hans Verkuil
2009-11-18  0:38 ` hdpvr: " Laurent Pinchart
2009-11-18  0:38 ` v4l: Use the video_is_registered function in device drivers Laurent Pinchart
2009-11-18  0:38 ` v4l: Use the video_drvdata function in drivers Laurent Pinchart
2009-11-18  7:01   ` Hans Verkuil
2009-11-18  8:56     ` Devin Heitmueller
2009-11-18  9:13       ` Hans Verkuil
2009-11-18  9:36         ` Devin Heitmueller
2009-11-18 12:41           ` Laurent Pinchart
2009-11-18  9:42         ` Laurent Pinchart
2009-11-18  9:55           ` Devin Heitmueller
2009-11-18  9:38       ` Laurent Pinchart
2009-11-18  9:32     ` Laurent Pinchart
2009-11-18  0:38 ` v4l: Use video_device_node_name() instead of the minor number Laurent Pinchart
2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor assignments Laurent Pinchart
2009-11-18  0:38 ` v4l: Remove unneeded video_device::minor usage in drivers Laurent Pinchart
2009-11-18  1:31 ` [PATCH/RFC] V4L core cleanups Aguirre, Sergio
2009-11-18 12:57   ` Laurent Pinchart

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.