V4L/DVB (8852): v4l2: use register_chrdev_region instead of register_chrdev

Replace the old register_chrdev with the more flexible register_chrdev_region.

Ensure that the release() is called when the very last chardev usage was
released, and not when the sysfs devices were removed. This should simplify
hotpluggable drivers considerably.

Tested-by: Mike Isely <isely@isely.net>
Tested-by: Laurent Pinchart <laurent.pinchart@skynet.be>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Acked-by: David Ellingsworth <david@identd.dyndns.org>
Reviewed-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/include/media/v4l2-dev.h b/include/media/v4l2-dev.h
index fb92e3d..d129b56 100644
--- a/include/media/v4l2-dev.h
+++ b/include/media/v4l2-dev.h
@@ -12,6 +12,7 @@
 #include <linux/poll.h>
 #include <linux/fs.h>
 #include <linux/device.h>
+#include <linux/cdev.h>
 #include <linux/mutex.h>
 #include <linux/videodev2.h>
 
@@ -47,6 +48,8 @@
 
 	/* sysfs */
 	struct device dev;		/* v4l device */
+	struct cdev cdev;		/* character device */
+	void (*cdev_release)(struct kobject *kobj);
 	struct device *parent;		/* device parent */
 
 	/* device info */