[PATCH 2/2] [media] v4l2-subdev: create interfaces at MC

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Now that the Media Controller has support for interfaces,
create them when v4l-subdev interfaces are created.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxxxxxxx>

diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
index 5b0a30b9252b..1e5176c558bf 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -247,8 +247,22 @@ int v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev)
 			goto clean_up;
 		}
 #if defined(CONFIG_MEDIA_CONTROLLER)
+		/* Needed just for backward compatibility with legacy MC API */
 		sd->entity.info.dev.major = VIDEO_MAJOR;
 		sd->entity.info.dev.minor = vdev->minor;
+
+		sd->intf_devnode = media_devnode_create(sd->entity.graph_obj.mdev,
+							MEDIA_INTF_T_V4L_SUBDEV,
+							0, VIDEO_MAJOR,
+							vdev->minor,
+							GFP_KERNEL);
+		if (!sd->intf_devnode) {
+			err = -ENOMEM;
+			kfree(vdev);
+			goto clean_up;
+		}
+
+		media_create_intf_link(&sd->entity, &sd->intf_devnode->intf, 0);
 #endif
 		sd->devnode = vdev;
 	}
@@ -286,6 +300,7 @@ void v4l2_device_unregister_subdev(struct v4l2_subdev *sd)
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	if (v4l2_dev->mdev) {
 		media_entity_remove_links(&sd->entity);
+		media_devnode_remove(sd->intf_devnode);
 		media_device_unregister_entity(&sd->entity);
 	}
 #endif
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 370fc38c34f1..1aa44f11eeb5 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -584,6 +584,7 @@ struct v4l2_subdev_platform_data {
 struct v4l2_subdev {
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	struct media_entity entity;
+	struct media_intf_devnode *intf_devnode;
 #endif
 	struct list_head list;
 	struct module *owner;
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux