The media device doesn't need to be exposed to userspace when the VSP is
fully controlled by the DU driver. Don't register it in that case.

Signed-off-by: Laurent Pinchart <laurent.pinchart+rene...@ideasonboard.com>
---
 drivers/media/platform/vsp1/vsp1_drv.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/vsp1/vsp1_drv.c 
b/drivers/media/platform/vsp1/vsp1_drv.c
index c42576825ad4..cd56cad3abd9 100644
--- a/drivers/media/platform/vsp1/vsp1_drv.c
+++ b/drivers/media/platform/vsp1/vsp1_drv.c
@@ -218,7 +218,8 @@ static void vsp1_destroy_entities(struct vsp1_device *vsp1)
        }
 
        v4l2_device_unregister(&vsp1->v4l2_dev);
-       media_device_unregister(&vsp1->media_dev);
+       if (vsp1->info->uapi)
+               media_device_unregister(&vsp1->media_dev);
        media_device_cleanup(&vsp1->media_dev);
 
        if (!vsp1->info->uapi)
@@ -403,14 +404,15 @@ static int vsp1_create_entities(struct vsp1_device *vsp1)
        /* Register subdev nodes if the userspace API is enabled or initialize
         * the DRM pipeline otherwise.
         */
-       if (vsp1->info->uapi)
+       if (vsp1->info->uapi) {
                ret = v4l2_device_register_subdev_nodes(&vsp1->v4l2_dev);
-       else
-               ret = vsp1_drm_init(vsp1);
-       if (ret < 0)
-               goto done;
+               if (ret < 0)
+                       goto done;
 
-       ret = media_device_register(mdev);
+               ret = media_device_register(mdev);
+       } else {
+               ret = vsp1_drm_init(vsp1);
+       }
 
 done:
        if (ret < 0)
-- 
Regards,

Laurent Pinchart

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

Reply via email to