OSDN Git Service

media: staging: rkisp1: fix dev param for dev_* debugs
authorDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Fri, 22 May 2020 11:56:33 +0000 (13:56 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 23 Jun 2020 11:15:44 +0000 (13:15 +0200)
In some debug prints a wrong 'dev' argument is used
for the dev_(dbg/err/warn), this cause a prefix
"(NULL device *)" to the prints.
In some prints the 'dev' of the sensor subdevice is used
which is also wrong.

Signed-off-by: Dafna Hirschfeld <dafna.hirschfeld@collabora.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
[hverkuil-cisco@xs4all.nl: s/in subdev/in sensor subdev/ as per Laurent's comment]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/rkisp1/rkisp1-dev.c
drivers/staging/media/rkisp1/rkisp1-isp.c
drivers/staging/media/rkisp1/rkisp1-params.c
drivers/staging/media/rkisp1/rkisp1-resizer.c

index 9ac38ba..f38801f 100644 (file)
@@ -129,7 +129,7 @@ static int rkisp1_create_links(struct rkisp1_device *rkisp1)
                ret = media_entity_get_fwnode_pad(&sd->entity, sd->fwnode,
                                                  MEDIA_PAD_FL_SOURCE);
                if (ret < 0) {
-                       dev_err(sd->dev, "failed to find src pad for %s\n",
+                       dev_err(rkisp1->dev, "failed to find src pad for %s\n",
                                sd->name);
                        return ret;
                }
index dc2b59a..6763379 100644 (file)
@@ -203,10 +203,8 @@ static struct v4l2_subdev *rkisp1_get_remote_sensor(struct v4l2_subdev *sd)
 
        local = &sd->entity.pads[RKISP1_ISP_PAD_SINK_VIDEO];
        remote = media_entity_remote_pad(local);
-       if (!remote) {
-               dev_warn(sd->dev, "No link between isp and sensor\n");
+       if (!remote)
                return NULL;
-       }
 
        sensor_me = remote->entity;
        return media_entity_to_v4l2_subdev(sensor_me);
@@ -889,18 +887,20 @@ static const struct v4l2_subdev_pad_ops rkisp1_isp_pad_ops = {
 static int rkisp1_mipi_csi2_start(struct rkisp1_isp *isp,
                                  struct rkisp1_sensor_async *sensor)
 {
+       struct rkisp1_device *rkisp1 =
+               container_of(isp->sd.v4l2_dev, struct rkisp1_device, v4l2_dev);
        union phy_configure_opts opts;
        struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy;
        s64 pixel_clock;
 
        if (!sensor->pixel_rate_ctrl) {
-               dev_warn(sensor->sd->dev, "No pixel rate control in subdev\n");
+               dev_warn(rkisp1->dev, "No pixel rate control in sensor subdev\n");
                return -EPIPE;
        }
 
        pixel_clock = v4l2_ctrl_g_ctrl_int64(sensor->pixel_rate_ctrl);
        if (!pixel_clock) {
-               dev_err(sensor->sd->dev, "Invalid pixel rate value\n");
+               dev_err(rkisp1->dev, "Invalid pixel rate value\n");
                return -EINVAL;
        }
 
@@ -933,8 +933,11 @@ static int rkisp1_isp_s_stream(struct v4l2_subdev *sd, int enable)
        }
 
        sensor_sd = rkisp1_get_remote_sensor(sd);
-       if (!sensor_sd)
+       if (!sensor_sd) {
+               dev_warn(rkisp1->dev, "No link between isp and sensor\n");
                return -ENODEV;
+       }
+
        rkisp1->active_sensor = container_of(sensor_sd->asd,
                                             struct rkisp1_sensor_async, asd);
 
@@ -1021,7 +1024,7 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1,
 
        ret = v4l2_device_register_subdev(v4l2_dev, sd);
        if (ret) {
-               dev_err(sd->dev, "Failed to register isp subdev\n");
+               dev_err(rkisp1->dev, "Failed to register isp subdev\n");
                goto err_cleanup_media_entity;
        }
 
index 44d542c..797e79d 100644 (file)
@@ -1607,7 +1607,7 @@ int rkisp1_params_register(struct rkisp1_params *params,
                goto err_release_queue;
        ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
        if (ret) {
-               dev_err(&vdev->dev,
+               dev_err(rkisp1->dev,
                        "failed to register %s, ret=%d\n", vdev->name, ret);
                goto err_cleanup_media_entity;
        }
index d049374..26fb410 100644 (file)
@@ -639,7 +639,7 @@ static int rkisp1_rsz_set_selection(struct v4l2_subdev *sd,
        if (sel->target != V4L2_SEL_TGT_CROP || sel->pad == RKISP1_RSZ_PAD_SRC)
                return -EINVAL;
 
-       dev_dbg(sd->dev, "%s: pad: %d sel(%d,%d)/%dx%d\n", __func__,
+       dev_dbg(rsz->rkisp1->dev, "%s: pad: %d sel(%d,%d)/%dx%d\n", __func__,
                sel->pad, sel->r.left, sel->r.top, sel->r.width, sel->r.height);
 
        mutex_lock(&rsz->ops_lock);