[26/28] media: atomisp: Remove struct atomisp_sub_device index field
Commit Message
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.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
.../staging/media/atomisp/pci/atomisp_cmd.c | 15 +++++-------
.../staging/media/atomisp/pci/atomisp_ioctl.c | 23 ++++---------------
.../media/atomisp/pci/atomisp_subdev.c | 3 +--
.../media/atomisp/pci/atomisp_subdev.h | 5 ----
4 files changed, 11 insertions(+), 35 deletions(-)
Comments
On Sat, Apr 1, 2023 at 5:00 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> 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.
There are already dev_dbg() calls w/o __func__. Hence it makes sense
(to me) to drop __func__ in the ones you touched in this patch.
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> .../staging/media/atomisp/pci/atomisp_cmd.c | 15 +++++-------
> .../staging/media/atomisp/pci/atomisp_ioctl.c | 23 ++++---------------
> .../media/atomisp/pci/atomisp_subdev.c | 3 +--
> .../media/atomisp/pci/atomisp_subdev.h | 5 ----
> 4 files changed, 11 insertions(+), 35 deletions(-)
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> index d0386dcb24ce..28663d6fc4dd 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c
> @@ -523,9 +523,8 @@ irqreturn_t atomisp_isr(int irq, void *dev)
> 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);
> + "%s ISYS event: EOF exp_id %d\n",
> + __func__, eof_event.event.exp_id);
> }
>
> irq_infos &= ~IA_CSS_IRQ_INFO_ISYS_EVENTS_READY;
> @@ -3302,9 +3301,8 @@ int atomisp_set_parameters(struct video_device *vdev,
> }
>
> 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);
> + "%s: set parameter(per_frame_setting %d) isp_config_id %d of %s\n",
> + __func__, arg->per_frame_setting, arg->isp_config_id, vdev->name);
>
> if (IS_ISP2401) {
> if (atomisp_is_vf_pipe(pipe) && arg->per_frame_setting) {
> @@ -4515,9 +4513,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);
>
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> index 14700afd92c2..384f31fc66c5 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_ioctl.c
> @@ -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
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.c b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
> index 143176bc684a..a0acfdb87177 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.c
> @@ -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);
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_subdev.h b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
> index 117803f3cbd1..fee663bc415a 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_subdev.h
> +++ b/drivers/staging/media/atomisp/pci/atomisp_subdev.h
> @@ -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;
> --
> 2.39.1
>
@@ -523,9 +523,8 @@ irqreturn_t atomisp_isr(int irq, void *dev)
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);
+ "%s ISYS event: EOF exp_id %d\n",
+ __func__, eof_event.event.exp_id);
}
irq_infos &= ~IA_CSS_IRQ_INFO_ISYS_EVENTS_READY;
@@ -3302,9 +3301,8 @@ int atomisp_set_parameters(struct video_device *vdev,
}
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);
+ "%s: set parameter(per_frame_setting %d) isp_config_id %d of %s\n",
+ __func__, arg->per_frame_setting, arg->isp_config_id, vdev->name);
if (IS_ISP2401) {
if (atomisp_is_vf_pipe(pipe) && arg->per_frame_setting) {
@@ -4515,9 +4513,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);
@@ -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
@@ -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);
@@ -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;