Márton Németh wrote:
> The MINOR_VFL_TYPE_GRABBER_MIN & MINOR_VFL_TYPE_VBI_MIN values are no longer
> available in 2.6.28. Instead, the struct video_device contains an index field
> which can be used to print the messages to kernel output buffer.

Sorry, my previous patch was wrongly using "index" instead of "num" field. Here
is the correct one:


The MINOR_VFL_TYPE_GRABBER_MIN & MINOR_VFL_TYPE_VBI_MIN values are no longer
available in 2.6.28. Instead, the struct video_device contains a "num" field
which can be used to print the messages to kernel output buffer. See
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=dd89601d47e2eeab7c17b25f2549444751bcffe4
for details.
diff -r f5ec3cd2c356 em28xx-video.c
--- a/em28xx-video.c	Sun Dec 28 21:12:25 2008 +0100
+++ b/em28xx-video.c	Tue Dec 30 07:27:52 2008 +0100
@@ -811,6 +811,34 @@
 	return errCode;
 }
 
+static int get_vbi_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+	return dev->minor - MINOR_VFL_TYPE_VBI_MIN;
+#else
+	return dev->num;
+#endif
+}
+
+static int get_video_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+	return dev->minor - MINOR_VFL_TYPE_GRABBER_MIN;
+#else
+	return dev->num;
+#endif
+}
+
+
+static int get_radio_index(struct video_device *dev)
+{
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28)
+	return dev->minor & 0x1f;
+#else
+	return dev->num;
+#endif
+}
+
 /*
  * em28xx_realease_resources()
  * unregisters the v4l2, i2c and usb devices
@@ -824,13 +852,12 @@
 	if (dev->dev_modes&EM28XX_VIDEO) {
 		em28xx_info("disconnecting %s\n", dev->vdev->name);
 		em28xx_info("V4L2 VIDEO devices /dev/video%d deregistered\n",
-				dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN);
+				get_video_index(dev->vdev));
 		video_unregister_device(dev->vdev);
 		if (dev->dev_modes & EM28XX_VBI) {
 			em28xx_info("V4L2 VBI devices /dev/vbi%d "
 				"deregistered\n",
-					dev->vbi_dev->minor -
-					MINOR_VFL_TYPE_VBI_MIN);
+					get_vbi_index(dev->vbi_dev));
 			video_unregister_device(dev->vbi_dev);
 		}
 	}
@@ -1534,8 +1561,7 @@
 			dev->state |= DEV_MISCONFIGURED;
 			em28xx_videodbg("device is misconfigured; close and "
 					"open /dev/video%d again\n",
-					dev->vdev->minor -
-					MINOR_VFL_TYPE_GRABBER_MIN);
+					get_video_index(dev->vdev));
 		}
 		break;
 	case EM28XX_VIDEO:
@@ -1550,8 +1576,7 @@
 			dev->state |= DEV_MISCONFIGURED;
 			em28xx_videodbg("device is misconfigured; close and "
 				"open /dev/video%d again\n",
-					dev->vdev->minor -
-					MINOR_VFL_TYPE_GRABBER_MIN);
+					get_video_index(dev->vdev));
 			return ret;
 		}
 		break;
@@ -3133,7 +3158,7 @@
 			return -ENODEV;
 		}
 		printk(KERN_INFO"radio device registered as /dev/radio%d\n",
-					dev->rdev->minor & 0x1f);
+					get_radio_index(dev->rdev));
 	}
 
 	if (dev->dev_modes&EM28XX_VIDEO) {
@@ -3262,11 +3287,11 @@
 				return -ENODEV;
 			}
 			em28xx_info("V4L2 VBI device registered as /dev/vbi%d\n",
-					dev->vbi_dev->minor-MINOR_VFL_TYPE_VBI_MIN);
+					get_vbi_index(dev->vbi_dev));
 		}
 		video_mux(dev, 0);
 		em28xx_info("V4L2 device registered as /dev/video%d\n",
-				dev->vdev->minor-MINOR_VFL_TYPE_GRABBER_MIN);
+				get_video_index(dev->vdev));
 	}
 
 	/* when reattaching the device reinitialize the attached submodules */
_______________________________________________
Em28xx mailing list
[email protected]
http://mcentral.de/mailman/listinfo/em28xx

Reply via email to