media: atomisp: Remove struct atomisp_sub_device index field
authorHans de Goede <hdegoede@redhat.com>
Sun, 5 Mar 2023 15:41:02 +0000 (15:41 +0000)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sat, 15 Apr 2023 09:42:15 +0000 (10:42 +0100)
Remove the struct atomisp_sub_device.

This was used for 2 things:

1. In dev_dbg() messages
2. To set the name of the v4l2_subdev for each struct atomisp_sub_device

Now that only 1 subdev is used neither is useful anymore. Remove the _%d
postfix from the v4l2_subdev name and remove the logging of the asd index
from the dev_dbg() messages.

In case of the atomisp_s_input() check to see if an input/sensor has
already been assigned to another subdev the entire check no longer
makes sense, so instead of changing the dev_err() message there just
drop the entire check.

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_cmd.c
drivers/staging/media/atomisp/pci/atomisp_ioctl.c
drivers/staging/media/atomisp/pci/atomisp_subdev.c
drivers/staging/media/atomisp/pci/atomisp_subdev.h

index f4139e8..aa790ae 100644 (file)
@@ -522,10 +522,8 @@ irqreturn_t atomisp_isr(int irq, void *dev)
        if (irq_infos & IA_CSS_IRQ_INFO_ISYS_EVENTS_READY) {
                while (ia_css_dequeue_isys_event(&eof_event.event) == 0) {
                        atomisp_eof_event(&isp->asd, eof_event.event.exp_id);
-                       dev_dbg_ratelimited(isp->dev,
-                                           "%s ISYS event: EOF exp_id %d, asd %d\n",
-                                           __func__, eof_event.event.exp_id,
-                                           isp->asd.index);
+                       dev_dbg_ratelimited(isp->dev, "ISYS event: EOF exp_id %d\n",
+                                           eof_event.event.exp_id);
                }
 
                irq_infos &= ~IA_CSS_IRQ_INFO_ISYS_EVENTS_READY;
@@ -3298,10 +3296,8 @@ int atomisp_set_parameters(struct video_device *vdev,
                return -EINVAL;
        }
 
-       dev_dbg(asd->isp->dev,
-               "%s: set parameter(per_frame_setting %d) for asd%d with isp_config_id %d of %s\n",
-               __func__, arg->per_frame_setting, asd->index,
-               arg->isp_config_id, vdev->name);
+       dev_dbg(asd->isp->dev, "set parameter(per_frame_setting %d) isp_config_id %d of %s\n",
+               arg->per_frame_setting, arg->isp_config_id, vdev->name);
 
        if (IS_ISP2401) {
                if (atomisp_is_vf_pipe(pipe) && arg->per_frame_setting) {
@@ -4512,9 +4508,8 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)
                return -EINVAL;
 
        dev_dbg(isp->dev,
-               "setting resolution %ux%u on pad %u for asd%d, bytesperline %u\n",
-               f->fmt.pix.width, f->fmt.pix.height, source_pad,
-               asd->index, f->fmt.pix.bytesperline);
+               "setting resolution %ux%u on pad %u bytesperline %u\n",
+               f->fmt.pix.width, f->fmt.pix.height, source_pad, f->fmt.pix.bytesperline);
 
        v4l2_fh_init(&fh.vfh, vdev);
 
index 14700af..384f31f 100644 (file)
@@ -671,18 +671,6 @@ static int atomisp_s_input(struct file *file, void *fh, unsigned int input)
                return -EINVAL;
        }
 
-       /*
-        * check whether the request camera:
-        * 1: already in use
-        * 2: if in use, whether it is used by other streams
-        */
-       if (isp->inputs[input].asd && isp->inputs[input].asd != asd) {
-               dev_err(isp->dev,
-                       "%s, camera is already used by stream: %d\n", __func__,
-                       isp->inputs[input].asd->index);
-               return -EBUSY;
-       }
-
        camera = isp->inputs[input].camera;
        if (!camera) {
                dev_err(isp->dev, "%s, no camera\n", __func__);
@@ -1106,9 +1094,8 @@ static int atomisp_dqbuf_wrapper(struct file *file, void *fh, struct v4l2_buffer
        buf->reserved2 = pipe->frame_config_id[buf->index];
 
        dev_dbg(isp->dev,
-               "dqbuf buffer %d (%s) for asd%d with exp_id %d, isp_config_id %d\n",
-               buf->index, vdev->name, asd->index, buf->reserved >> 16,
-               buf->reserved2);
+               "dqbuf buffer %d (%s) with exp_id %d, isp_config_id %d\n",
+               buf->index, vdev->name, buf->reserved >> 16, buf->reserved2);
        return 0;
 }
 
@@ -1186,8 +1173,7 @@ int atomisp_start_streaming(struct vb2_queue *vq, unsigned int count)
 
        mutex_lock(&isp->mutex);
 
-       dev_dbg(isp->dev, "Start stream on pad %d for asd%d\n",
-               atomisp_subdev_source_pad(vdev), asd->index);
+       dev_dbg(isp->dev, "Start stream on pad %d\n", atomisp_subdev_source_pad(vdev));
 
        ret = atomisp_pipe_check(pipe, false);
        if (ret)
@@ -1320,8 +1306,7 @@ void atomisp_stop_streaming(struct vb2_queue *vq)
 
        mutex_lock(&isp->mutex);
 
-       dev_dbg(isp->dev, "Stop stream on pad %d for asd%d\n",
-               atomisp_subdev_source_pad(vdev), asd->index);
+       dev_dbg(isp->dev, "Stop stream on pad %d\n", atomisp_subdev_source_pad(vdev));
 
        /*
         * There is no guarantee that the buffers queued to / owned by the ISP
index 143176b..a0acfdb 100644 (file)
@@ -918,7 +918,7 @@ static int isp_subdev_init_entities(struct atomisp_sub_device *asd)
        int ret;
 
        v4l2_subdev_init(sd, &isp_subdev_v4l2_ops);
-       sprintf(sd->name, "ATOMISP_SUBDEV_%d", asd->index);
+       sprintf(sd->name, "ATOMISP_SUBDEV");
        v4l2_set_subdevdata(sd, asd);
        sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS | V4L2_SUBDEV_FL_HAS_DEVNODE;
 
@@ -1161,7 +1161,6 @@ int atomisp_subdev_init(struct atomisp_device *isp)
 {
        int ret;
 
-       isp->asd.index = 0;
        isp->asd.isp = isp;
        isp_subdev_init_params(&isp->asd);
        ret = isp_subdev_init_entities(&isp->asd);
index 117803f..fee663b 100644 (file)
@@ -315,11 +315,6 @@ struct atomisp_sub_device {
        unsigned int streaming;
        bool stream_prepared; /* whether css stream is created */
 
-       /* subdev index: will be used to show which subdev is holding the
-        * resource, like which camera is used by which subdev
-        */
-       unsigned int index;
-
        unsigned int latest_preview_exp_id; /* CSS ZSL/SDV raw buffer id */
 
        unsigned int mipi_frame_size;