media: atomisp: Set asd.subdev.devnode once from isp_subdev_init_entities()
authorHans de Goede <hdegoede@redhat.com>
Tue, 9 May 2023 20:10:34 +0000 (21:10 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 9 Jun 2023 13:54:54 +0000 (14:54 +0100)
Now that we have only one /dev/video# node we can set asd.subdev.devnode
once from isp_subdev_init_entities(), replacing the hack to set it the
last opened/closed /dev/video# node from atomisp_open() /
atomisp_release().

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/staging/media/atomisp/pci/atomisp_fops.c
drivers/staging/media/atomisp/pci/atomisp_subdev.c

index 179c23e..fb42c27 100644 (file)
@@ -505,8 +505,6 @@ static int atomisp_open(struct file *file)
 
        mutex_lock(&isp->mutex);
 
-       asd->subdev.devnode = vdev;
-
        if (!isp->input_cnt) {
                dev_err(isp->dev, "no camera attached\n");
                ret = -EINVAL;
@@ -567,8 +565,6 @@ static int atomisp_release(struct file *file)
 
        dev_dbg(isp->dev, "release device %s\n", vdev->name);
 
-       asd->subdev.devnode = vdev;
-
        /* Note file must not be used after this! */
        vb2_fop_release(file);
 
index 32fc4d2..8b99805 100644 (file)
@@ -880,6 +880,7 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
        sprintf(sd->name, "ATOMISP_SUBDEV");
        v4l2_set_subdevdata(sd, asd);
        sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
+       sd->devnode = &asd->video_out.vdev;
 
        pads[ATOMISP_SUBDEV_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
        pads[ATOMISP_SUBDEV_PAD_SOURCE].flags = MEDIA_PAD_FL_SOURCE;