Commit 1e76ae8e authored by Dafna Hirschfeld's avatar Dafna Hirschfeld Committed by Mauro Carvalho Chehab

media: staging: rkisp1: unify (un)register functions to have the same parameters

The different register/unregister functions receive
different parameters. This patch unify them so they all receive just
'struct *rkisp1_device' as parameter.
Signed-off-by: default avatarDafna Hirschfeld <dafna.hirschfeld@collabora.com>
Acked-by: default avatarHelen Koike <helen.koike@collabora.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent f690abdc
...@@ -303,8 +303,7 @@ void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop, ...@@ -303,8 +303,7 @@ void rkisp1_sd_adjust_crop_rect(struct v4l2_rect *crop,
void rkisp1_sd_adjust_crop(struct v4l2_rect *crop, void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
const struct v4l2_mbus_framefmt *bounds); const struct v4l2_mbus_framefmt *bounds);
int rkisp1_isp_register(struct rkisp1_device *rkisp1, int rkisp1_isp_register(struct rkisp1_device *rkisp1);
struct v4l2_device *v4l2_dev);
void rkisp1_isp_unregister(struct rkisp1_device *rkisp1); void rkisp1_isp_unregister(struct rkisp1_device *rkisp1);
const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code); const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code);
...@@ -321,19 +320,15 @@ void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1); ...@@ -321,19 +320,15 @@ void rkisp1_capture_devs_unregister(struct rkisp1_device *rkisp1);
int rkisp1_resizer_devs_register(struct rkisp1_device *rkisp1); int rkisp1_resizer_devs_register(struct rkisp1_device *rkisp1);
void rkisp1_resizer_devs_unregister(struct rkisp1_device *rkisp1); void rkisp1_resizer_devs_unregister(struct rkisp1_device *rkisp1);
int rkisp1_stats_register(struct rkisp1_stats *stats, int rkisp1_stats_register(struct rkisp1_device *rkisp1);
struct v4l2_device *v4l2_dev, void rkisp1_stats_unregister(struct rkisp1_device *rkisp1);
struct rkisp1_device *rkisp1);
void rkisp1_stats_unregister(struct rkisp1_stats *stats);
void rkisp1_params_configure(struct rkisp1_params *params, void rkisp1_params_configure(struct rkisp1_params *params,
enum rkisp1_fmt_raw_pat_type bayer_pat, enum rkisp1_fmt_raw_pat_type bayer_pat,
enum v4l2_quantization quantization); enum v4l2_quantization quantization);
void rkisp1_params_disable(struct rkisp1_params *params); void rkisp1_params_disable(struct rkisp1_params *params);
int rkisp1_params_register(struct rkisp1_params *params, int rkisp1_params_register(struct rkisp1_device *rkisp1);
struct v4l2_device *v4l2_dev, void rkisp1_params_unregister(struct rkisp1_device *rkisp1);
struct rkisp1_device *rkisp1);
void rkisp1_params_unregister(struct rkisp1_params *params);
void rkisp1_params_isr_handler(struct rkisp1_device *rkisp1, u32 isp_mis); void rkisp1_params_isr_handler(struct rkisp1_device *rkisp1, u32 isp_mis);
......
...@@ -345,7 +345,7 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1) ...@@ -345,7 +345,7 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
{ {
int ret; int ret;
ret = rkisp1_isp_register(rkisp1, &rkisp1->v4l2_dev); ret = rkisp1_isp_register(rkisp1);
if (ret) if (ret)
return ret; return ret;
...@@ -357,12 +357,11 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1) ...@@ -357,12 +357,11 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
if (ret) if (ret)
goto err_unreg_resizer_devs; goto err_unreg_resizer_devs;
ret = rkisp1_stats_register(&rkisp1->stats, &rkisp1->v4l2_dev, rkisp1); ret = rkisp1_stats_register(rkisp1);
if (ret) if (ret)
goto err_unreg_capture_devs; goto err_unreg_capture_devs;
ret = rkisp1_params_register(&rkisp1->params, ret = rkisp1_params_register(rkisp1);
&rkisp1->v4l2_dev, rkisp1);
if (ret) if (ret)
goto err_unreg_stats; goto err_unreg_stats;
...@@ -375,9 +374,9 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1) ...@@ -375,9 +374,9 @@ static int rkisp1_entities_register(struct rkisp1_device *rkisp1)
return 0; return 0;
err_unreg_params: err_unreg_params:
rkisp1_params_unregister(&rkisp1->params); rkisp1_params_unregister(rkisp1);
err_unreg_stats: err_unreg_stats:
rkisp1_stats_unregister(&rkisp1->stats); rkisp1_stats_unregister(rkisp1);
err_unreg_capture_devs: err_unreg_capture_devs:
rkisp1_capture_devs_unregister(rkisp1); rkisp1_capture_devs_unregister(rkisp1);
err_unreg_resizer_devs: err_unreg_resizer_devs:
...@@ -551,8 +550,8 @@ static int rkisp1_remove(struct platform_device *pdev) ...@@ -551,8 +550,8 @@ static int rkisp1_remove(struct platform_device *pdev)
v4l2_async_notifier_unregister(&rkisp1->notifier); v4l2_async_notifier_unregister(&rkisp1->notifier);
v4l2_async_notifier_cleanup(&rkisp1->notifier); v4l2_async_notifier_cleanup(&rkisp1->notifier);
rkisp1_params_unregister(&rkisp1->params); rkisp1_params_unregister(rkisp1);
rkisp1_stats_unregister(&rkisp1->stats); rkisp1_stats_unregister(rkisp1);
rkisp1_capture_devs_unregister(rkisp1); rkisp1_capture_devs_unregister(rkisp1);
rkisp1_resizer_devs_unregister(rkisp1); rkisp1_resizer_devs_unregister(rkisp1);
rkisp1_isp_unregister(rkisp1); rkisp1_isp_unregister(rkisp1);
......
...@@ -989,8 +989,7 @@ static const struct v4l2_subdev_ops rkisp1_isp_ops = { ...@@ -989,8 +989,7 @@ static const struct v4l2_subdev_ops rkisp1_isp_ops = {
.pad = &rkisp1_isp_pad_ops, .pad = &rkisp1_isp_pad_ops,
}; };
int rkisp1_isp_register(struct rkisp1_device *rkisp1, int rkisp1_isp_register(struct rkisp1_device *rkisp1)
struct v4l2_device *v4l2_dev)
{ {
struct rkisp1_isp *isp = &rkisp1->isp; struct rkisp1_isp *isp = &rkisp1->isp;
struct media_pad *pads = isp->pads; struct media_pad *pads = isp->pads;
...@@ -1018,7 +1017,7 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1, ...@@ -1018,7 +1017,7 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1,
if (ret) if (ret)
return ret; return ret;
ret = v4l2_device_register_subdev(v4l2_dev, sd); ret = v4l2_device_register_subdev(&rkisp1->v4l2_dev, sd);
if (ret) { if (ret) {
dev_err(rkisp1->dev, "Failed to register isp subdev\n"); dev_err(rkisp1->dev, "Failed to register isp subdev\n");
goto err_cleanup_media_entity; goto err_cleanup_media_entity;
......
...@@ -1564,10 +1564,9 @@ static void rkisp1_init_params(struct rkisp1_params *params) ...@@ -1564,10 +1564,9 @@ static void rkisp1_init_params(struct rkisp1_params *params)
sizeof(struct rkisp1_params_cfg); sizeof(struct rkisp1_params_cfg);
} }
int rkisp1_params_register(struct rkisp1_params *params, int rkisp1_params_register(struct rkisp1_device *rkisp1)
struct v4l2_device *v4l2_dev,
struct rkisp1_device *rkisp1)
{ {
struct rkisp1_params *params = &rkisp1->params;
struct rkisp1_vdev_node *node = &params->vnode; struct rkisp1_vdev_node *node = &params->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
int ret; int ret;
...@@ -1587,7 +1586,7 @@ int rkisp1_params_register(struct rkisp1_params *params, ...@@ -1587,7 +1586,7 @@ int rkisp1_params_register(struct rkisp1_params *params,
* to protect all fops and v4l2 ioctls. * to protect all fops and v4l2 ioctls.
*/ */
vdev->lock = &node->vlock; vdev->lock = &node->vlock;
vdev->v4l2_dev = v4l2_dev; vdev->v4l2_dev = &rkisp1->v4l2_dev;
vdev->queue = &node->buf_queue; vdev->queue = &node->buf_queue;
vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT; vdev->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_META_OUTPUT;
vdev->vfl_dir = VFL_DIR_TX; vdev->vfl_dir = VFL_DIR_TX;
...@@ -1611,8 +1610,9 @@ int rkisp1_params_register(struct rkisp1_params *params, ...@@ -1611,8 +1610,9 @@ int rkisp1_params_register(struct rkisp1_params *params,
return ret; return ret;
} }
void rkisp1_params_unregister(struct rkisp1_params *params) void rkisp1_params_unregister(struct rkisp1_device *rkisp1)
{ {
struct rkisp1_params *params = &rkisp1->params;
struct rkisp1_vdev_node *node = &params->vnode; struct rkisp1_vdev_node *node = &params->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
......
...@@ -375,10 +375,9 @@ static void rkisp1_init_stats(struct rkisp1_stats *stats) ...@@ -375,10 +375,9 @@ static void rkisp1_init_stats(struct rkisp1_stats *stats)
sizeof(struct rkisp1_stat_buffer); sizeof(struct rkisp1_stat_buffer);
} }
int rkisp1_stats_register(struct rkisp1_stats *stats, int rkisp1_stats_register(struct rkisp1_device *rkisp1)
struct v4l2_device *v4l2_dev,
struct rkisp1_device *rkisp1)
{ {
struct rkisp1_stats *stats = &rkisp1->stats;
struct rkisp1_vdev_node *node = &stats->vnode; struct rkisp1_vdev_node *node = &stats->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
int ret; int ret;
...@@ -395,7 +394,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats, ...@@ -395,7 +394,7 @@ int rkisp1_stats_register(struct rkisp1_stats *stats,
vdev->fops = &rkisp1_stats_fops; vdev->fops = &rkisp1_stats_fops;
vdev->release = video_device_release_empty; vdev->release = video_device_release_empty;
vdev->lock = &node->vlock; vdev->lock = &node->vlock;
vdev->v4l2_dev = v4l2_dev; vdev->v4l2_dev = &rkisp1->v4l2_dev;
vdev->queue = &node->buf_queue; vdev->queue = &node->buf_queue;
vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING; vdev->device_caps = V4L2_CAP_META_CAPTURE | V4L2_CAP_STREAMING;
vdev->vfl_dir = VFL_DIR_RX; vdev->vfl_dir = VFL_DIR_RX;
...@@ -424,8 +423,9 @@ int rkisp1_stats_register(struct rkisp1_stats *stats, ...@@ -424,8 +423,9 @@ int rkisp1_stats_register(struct rkisp1_stats *stats,
return ret; return ret;
} }
void rkisp1_stats_unregister(struct rkisp1_stats *stats) void rkisp1_stats_unregister(struct rkisp1_device *rkisp1)
{ {
struct rkisp1_stats *stats = &rkisp1->stats;
struct rkisp1_vdev_node *node = &stats->vnode; struct rkisp1_vdev_node *node = &stats->vnode;
struct video_device *vdev = &node->vdev; struct video_device *vdev = &node->vdev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment