diff mbox

[PATCHv2,5/9] dvb core: add support for demux/dvr nodes at media controller

Message ID bdfebc426bab35918a19d91c07706b7bfc53ce7e.1420294938.git.mchehab@osg.samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mauro Carvalho Chehab Jan. 3, 2015, 2:49 p.m. UTC
Make the dvb core demux support aware of the media controller and
register the corresponding devices.

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
diff mbox

Patch

diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c
index abff803ad69a..9071636534db 100644
--- a/drivers/media/dvb-core/dmxdev.c
+++ b/drivers/media/dvb-core/dmxdev.c
@@ -1136,13 +1136,6 @@  static const struct file_operations dvb_demux_fops = {
 	.llseek = default_llseek,
 };
 
-static struct dvb_device dvbdev_demux = {
-	.priv = NULL,
-	.users = 1,
-	.writers = 1,
-	.fops = &dvb_demux_fops
-};
-
 static int dvb_dvr_do_ioctl(struct file *file,
 			    unsigned int cmd, void *parg)
 {
@@ -1209,16 +1202,29 @@  static const struct file_operations dvb_dvr_fops = {
 	.llseek = default_llseek,
 };
 
-static struct dvb_device dvbdev_dvr = {
-	.priv = NULL,
-	.readers = 1,
-	.users = 1,
-	.fops = &dvb_dvr_fops
-};
-
 int dvb_dmxdev_init(struct dmxdev *dmxdev, struct dvb_adapter *dvb_adapter)
 {
 	int i;
+	struct dvb_device dvbdev_demux = {
+		.priv = NULL,
+		.users = 1,
+		.writers = 1,
+		.fops = &dvb_demux_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+		.mdev = dmxdev->mdev,
+		.name = "demux",
+#endif
+	};
+	struct dvb_device dvbdev_dvr = {
+		.priv = NULL,
+		.readers = 1,
+		.users = 1,
+		.fops = &dvb_dvr_fops,
+#if defined(CONFIG_MEDIA_CONTROLLER)
+		.mdev = dmxdev->mdev,
+		.name = "dvr",
+#endif
+	};
 
 	if (dmxdev->demux->open(dmxdev->demux) < 0)
 		return -EUSERS;
diff --git a/drivers/media/dvb-core/dmxdev.h b/drivers/media/dvb-core/dmxdev.h
index 48c6cf92ab99..09832a8e6956 100644
--- a/drivers/media/dvb-core/dmxdev.h
+++ b/drivers/media/dvb-core/dmxdev.h
@@ -36,6 +36,8 @@ 
 
 #include <linux/dvb/dmx.h>
 
+#include <media/media-device.h>
+
 #include "dvbdev.h"
 #include "demux.h"
 #include "dvb_ringbuffer.h"
@@ -110,6 +112,10 @@  struct dmxdev {
 
 	struct mutex mutex;
 	spinlock_t lock;
+
+#if defined(CONFIG_MEDIA_CONTROLLER)
+	struct media_device *mdev;
+#endif
 };