diff options
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_entity.c | 3 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_entity.h | 3 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_rpf.c | 12 | ||||
-rw-r--r-- | drivers/media/platform/vsp1/vsp1_wpf.c | 12 |
4 files changed, 18 insertions, 12 deletions
diff --git a/drivers/media/platform/vsp1/vsp1_entity.c b/drivers/media/platform/vsp1/vsp1_entity.c index 44167834285d..ceac0d7e5643 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.c +++ b/drivers/media/platform/vsp1/vsp1_entity.c | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "vsp1.h" | 21 | #include "vsp1.h" |
22 | #include "vsp1_entity.h" | 22 | #include "vsp1_entity.h" |
23 | #include "vsp1_video.h" | ||
23 | 24 | ||
24 | /* ----------------------------------------------------------------------------- | 25 | /* ----------------------------------------------------------------------------- |
25 | * V4L2 Subdevice Operations | 26 | * V4L2 Subdevice Operations |
@@ -185,6 +186,8 @@ int vsp1_entity_init(struct vsp1_device *vsp1, struct vsp1_entity *entity, | |||
185 | 186 | ||
186 | void vsp1_entity_destroy(struct vsp1_entity *entity) | 187 | void vsp1_entity_destroy(struct vsp1_entity *entity) |
187 | { | 188 | { |
189 | if (entity->video) | ||
190 | vsp1_video_cleanup(entity->video); | ||
188 | if (entity->subdev.ctrl_handler) | 191 | if (entity->subdev.ctrl_handler) |
189 | v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); | 192 | v4l2_ctrl_handler_free(entity->subdev.ctrl_handler); |
190 | media_entity_cleanup(&entity->subdev.entity); | 193 | media_entity_cleanup(&entity->subdev.entity); |
diff --git a/drivers/media/platform/vsp1/vsp1_entity.h b/drivers/media/platform/vsp1/vsp1_entity.h index 7afbd8a7ba66..f0257f68f16a 100644 --- a/drivers/media/platform/vsp1/vsp1_entity.h +++ b/drivers/media/platform/vsp1/vsp1_entity.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <media/v4l2-subdev.h> | 18 | #include <media/v4l2-subdev.h> |
19 | 19 | ||
20 | struct vsp1_device; | 20 | struct vsp1_device; |
21 | struct vsp1_video; | ||
21 | 22 | ||
22 | enum vsp1_entity_type { | 23 | enum vsp1_entity_type { |
23 | VSP1_ENTITY_BRU, | 24 | VSP1_ENTITY_BRU, |
@@ -68,6 +69,8 @@ struct vsp1_entity { | |||
68 | 69 | ||
69 | struct v4l2_subdev subdev; | 70 | struct v4l2_subdev subdev; |
70 | struct v4l2_mbus_framefmt *formats; | 71 | struct v4l2_mbus_framefmt *formats; |
72 | |||
73 | struct vsp1_video *video; | ||
71 | }; | 74 | }; |
72 | 75 | ||
73 | static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev) | 76 | static inline struct vsp1_entity *to_vsp1_entity(struct v4l2_subdev *subdev) |
diff --git a/drivers/media/platform/vsp1/vsp1_rpf.c b/drivers/media/platform/vsp1/vsp1_rpf.c index c3d98642a4aa..9b3fc70e18f0 100644 --- a/drivers/media/platform/vsp1/vsp1_rpf.c +++ b/drivers/media/platform/vsp1/vsp1_rpf.c | |||
@@ -205,7 +205,9 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
205 | 205 | ||
206 | ret = vsp1_video_init(video, &rpf->entity); | 206 | ret = vsp1_video_init(video, &rpf->entity); |
207 | if (ret < 0) | 207 | if (ret < 0) |
208 | goto error_video; | 208 | goto error; |
209 | |||
210 | rpf->entity.video = video; | ||
209 | 211 | ||
210 | /* Connect the video device to the RPF. */ | 212 | /* Connect the video device to the RPF. */ |
211 | ret = media_entity_create_link(&rpf->video.video.entity, 0, | 213 | ret = media_entity_create_link(&rpf->video.video.entity, 0, |
@@ -214,13 +216,11 @@ struct vsp1_rwpf *vsp1_rpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
214 | MEDIA_LNK_FL_ENABLED | | 216 | MEDIA_LNK_FL_ENABLED | |
215 | MEDIA_LNK_FL_IMMUTABLE); | 217 | MEDIA_LNK_FL_IMMUTABLE); |
216 | if (ret < 0) | 218 | if (ret < 0) |
217 | goto error_link; | 219 | goto error; |
218 | 220 | ||
219 | return rpf; | 221 | return rpf; |
220 | 222 | ||
221 | error_link: | 223 | error: |
222 | vsp1_video_cleanup(video); | 224 | vsp1_entity_destroy(&rpf->entity); |
223 | error_video: | ||
224 | media_entity_cleanup(&rpf->entity.subdev.entity); | ||
225 | return ERR_PTR(ret); | 225 | return ERR_PTR(ret); |
226 | } | 226 | } |
diff --git a/drivers/media/platform/vsp1/vsp1_wpf.c b/drivers/media/platform/vsp1/vsp1_wpf.c index 1294340dcb36..36c479362f8c 100644 --- a/drivers/media/platform/vsp1/vsp1_wpf.c +++ b/drivers/media/platform/vsp1/vsp1_wpf.c | |||
@@ -216,7 +216,9 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
216 | 216 | ||
217 | ret = vsp1_video_init(video, &wpf->entity); | 217 | ret = vsp1_video_init(video, &wpf->entity); |
218 | if (ret < 0) | 218 | if (ret < 0) |
219 | goto error_video; | 219 | goto error; |
220 | |||
221 | wpf->entity.video = video; | ||
220 | 222 | ||
221 | /* Connect the video device to the WPF. All connections are immutable | 223 | /* Connect the video device to the WPF. All connections are immutable |
222 | * except for the WPF0 source link if a LIF is present. | 224 | * except for the WPF0 source link if a LIF is present. |
@@ -229,15 +231,13 @@ struct vsp1_rwpf *vsp1_wpf_create(struct vsp1_device *vsp1, unsigned int index) | |||
229 | RWPF_PAD_SOURCE, | 231 | RWPF_PAD_SOURCE, |
230 | &wpf->video.video.entity, 0, flags); | 232 | &wpf->video.video.entity, 0, flags); |
231 | if (ret < 0) | 233 | if (ret < 0) |
232 | goto error_link; | 234 | goto error; |
233 | 235 | ||
234 | wpf->entity.sink = &wpf->video.video.entity; | 236 | wpf->entity.sink = &wpf->video.video.entity; |
235 | 237 | ||
236 | return wpf; | 238 | return wpf; |
237 | 239 | ||
238 | error_link: | 240 | error: |
239 | vsp1_video_cleanup(video); | 241 | vsp1_entity_destroy(&wpf->entity); |
240 | error_video: | ||
241 | media_entity_cleanup(&wpf->entity.subdev.entity); | ||
242 | return ERR_PTR(ret); | 242 | return ERR_PTR(ret); |
243 | } | 243 | } |