Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media

Pull media fixes from Mauro Carvalho Chehab:
 "Some driver fixes for s5p/exynos (mostly race fixes)"

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
  [media] s5p-mfc: Handle multi-frame input buffer
  [media] s5p-mfc: Bug fix of timestamp/timecode copy mechanism
  [media] exynos-gsc: Add missing video device vfl_dir flag initialization
  [media] exynos-gsc: Fix settings for input and output image RGB type
  [media] exynos-gsc: Don't use mutex_lock_interruptible() in device release()
  [media] fimc-lite: Don't use mutex_lock_interruptible() in device release()
  [media] s5p-fimc: Don't use mutex_lock_interruptible() in device release()
  [media] s5p-fimc: Prevent race conditions during subdevs registration
This commit is contained in:
Linus Torvalds 2012-12-03 11:13:32 -08:00
commit 4ba0032984
8 changed files with 27 additions and 25 deletions

View File

@ -657,8 +657,7 @@ static int gsc_m2m_release(struct file *file)
pr_debug("pid: %d, state: 0x%lx, refcnt= %d", pr_debug("pid: %d, state: 0x%lx, refcnt= %d",
task_pid_nr(current), gsc->state, gsc->m2m.refcnt); task_pid_nr(current), gsc->state, gsc->m2m.refcnt);
if (mutex_lock_interruptible(&gsc->lock)) mutex_lock(&gsc->lock);
return -ERESTARTSYS;
v4l2_m2m_ctx_release(ctx->m2m_ctx); v4l2_m2m_ctx_release(ctx->m2m_ctx);
gsc_ctrls_delete(ctx); gsc_ctrls_delete(ctx);
@ -732,6 +731,7 @@ int gsc_register_m2m_device(struct gsc_dev *gsc)
gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops; gsc->vdev.ioctl_ops = &gsc_m2m_ioctl_ops;
gsc->vdev.release = video_device_release_empty; gsc->vdev.release = video_device_release_empty;
gsc->vdev.lock = &gsc->lock; gsc->vdev.lock = &gsc->lock;
gsc->vdev.vfl_dir = VFL_DIR_M2M;
snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m", snprintf(gsc->vdev.name, sizeof(gsc->vdev.name), "%s.%d:m2m",
GSC_MODULE_NAME, gsc->id); GSC_MODULE_NAME, gsc->id);

View File

@ -40,10 +40,10 @@
#define GSC_IN_ROT_YFLIP (2 << 16) #define GSC_IN_ROT_YFLIP (2 << 16)
#define GSC_IN_ROT_XFLIP (1 << 16) #define GSC_IN_ROT_XFLIP (1 << 16)
#define GSC_IN_RGB_TYPE_MASK (3 << 14) #define GSC_IN_RGB_TYPE_MASK (3 << 14)
#define GSC_IN_RGB_HD_WIDE (3 << 14) #define GSC_IN_RGB_HD_NARROW (3 << 14)
#define GSC_IN_RGB_HD_NARROW (2 << 14) #define GSC_IN_RGB_HD_WIDE (2 << 14)
#define GSC_IN_RGB_SD_WIDE (1 << 14) #define GSC_IN_RGB_SD_NARROW (1 << 14)
#define GSC_IN_RGB_SD_NARROW (0 << 14) #define GSC_IN_RGB_SD_WIDE (0 << 14)
#define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13) #define GSC_IN_YUV422_1P_ORDER_MASK (1 << 13)
#define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13) #define GSC_IN_YUV422_1P_ORDER_LSB_Y (0 << 13)
#define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13) #define GSC_IN_YUV422_1P_OEDER_LSB_C (1 << 13)
@ -85,10 +85,10 @@
#define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24) #define GSC_OUT_GLOBAL_ALPHA_MASK (0xff << 24)
#define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24) #define GSC_OUT_GLOBAL_ALPHA(x) ((x) << 24)
#define GSC_OUT_RGB_TYPE_MASK (3 << 10) #define GSC_OUT_RGB_TYPE_MASK (3 << 10)
#define GSC_OUT_RGB_HD_NARROW (3 << 10) #define GSC_OUT_RGB_HD_WIDE (3 << 10)
#define GSC_OUT_RGB_HD_WIDE (2 << 10) #define GSC_OUT_RGB_HD_NARROW (2 << 10)
#define GSC_OUT_RGB_SD_NARROW (1 << 10) #define GSC_OUT_RGB_SD_WIDE (1 << 10)
#define GSC_OUT_RGB_SD_WIDE (0 << 10) #define GSC_OUT_RGB_SD_NARROW (0 << 10)
#define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9) #define GSC_OUT_YUV422_1P_ORDER_MASK (1 << 9)
#define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9) #define GSC_OUT_YUV422_1P_ORDER_LSB_Y (0 << 9)
#define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9) #define GSC_OUT_YUV422_1P_OEDER_LSB_C (1 << 9)

View File

@ -556,8 +556,7 @@ static int fimc_capture_close(struct file *file)
dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state); dbg("pid: %d, state: 0x%lx", task_pid_nr(current), fimc->state);
if (mutex_lock_interruptible(&fimc->lock)) mutex_lock(&fimc->lock);
return -ERESTARTSYS;
if (--fimc->vid_cap.refcnt == 0) { if (--fimc->vid_cap.refcnt == 0) {
clear_bit(ST_CAPT_BUSY, &fimc->state); clear_bit(ST_CAPT_BUSY, &fimc->state);
@ -1774,9 +1773,13 @@ static int fimc_capture_subdev_registered(struct v4l2_subdev *sd)
if (ret) if (ret)
return ret; return ret;
fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd);
ret = fimc_register_capture_device(fimc, sd->v4l2_dev); ret = fimc_register_capture_device(fimc, sd->v4l2_dev);
if (ret) if (ret) {
fimc_unregister_m2m_device(fimc); fimc_unregister_m2m_device(fimc);
fimc->pipeline_ops = NULL;
}
return ret; return ret;
} }
@ -1793,6 +1796,7 @@ static void fimc_capture_subdev_unregistered(struct v4l2_subdev *sd)
if (video_is_registered(&fimc->vid_cap.vfd)) { if (video_is_registered(&fimc->vid_cap.vfd)) {
video_unregister_device(&fimc->vid_cap.vfd); video_unregister_device(&fimc->vid_cap.vfd);
media_entity_cleanup(&fimc->vid_cap.vfd.entity); media_entity_cleanup(&fimc->vid_cap.vfd.entity);
fimc->pipeline_ops = NULL;
} }
kfree(fimc->vid_cap.ctx); kfree(fimc->vid_cap.ctx);
fimc->vid_cap.ctx = NULL; fimc->vid_cap.ctx = NULL;

View File

@ -491,8 +491,7 @@ static int fimc_lite_close(struct file *file)
struct fimc_lite *fimc = video_drvdata(file); struct fimc_lite *fimc = video_drvdata(file);
int ret; int ret;
if (mutex_lock_interruptible(&fimc->lock)) mutex_lock(&fimc->lock);
return -ERESTARTSYS;
if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) { if (--fimc->ref_count == 0 && fimc->out_path == FIMC_IO_DMA) {
clear_bit(ST_FLITE_IN_USE, &fimc->state); clear_bit(ST_FLITE_IN_USE, &fimc->state);
@ -1263,10 +1262,12 @@ static int fimc_lite_subdev_registered(struct v4l2_subdev *sd)
return ret; return ret;
video_set_drvdata(vfd, fimc); video_set_drvdata(vfd, fimc);
fimc->pipeline_ops = v4l2_get_subdev_hostdata(sd);
ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1); ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
if (ret < 0) { if (ret < 0) {
media_entity_cleanup(&vfd->entity); media_entity_cleanup(&vfd->entity);
fimc->pipeline_ops = NULL;
return ret; return ret;
} }
@ -1285,6 +1286,7 @@ static void fimc_lite_subdev_unregistered(struct v4l2_subdev *sd)
if (video_is_registered(&fimc->vfd)) { if (video_is_registered(&fimc->vfd)) {
video_unregister_device(&fimc->vfd); video_unregister_device(&fimc->vfd);
media_entity_cleanup(&fimc->vfd.entity); media_entity_cleanup(&fimc->vfd.entity);
fimc->pipeline_ops = NULL;
} }
} }

View File

@ -718,8 +718,7 @@ static int fimc_m2m_release(struct file *file)
dbg("pid: %d, state: 0x%lx, refcnt= %d", dbg("pid: %d, state: 0x%lx, refcnt= %d",
task_pid_nr(current), fimc->state, fimc->m2m.refcnt); task_pid_nr(current), fimc->state, fimc->m2m.refcnt);
if (mutex_lock_interruptible(&fimc->lock)) mutex_lock(&fimc->lock);
return -ERESTARTSYS;
v4l2_m2m_ctx_release(ctx->m2m_ctx); v4l2_m2m_ctx_release(ctx->m2m_ctx);
fimc_ctrls_delete(ctx); fimc_ctrls_delete(ctx);

View File

@ -352,6 +352,7 @@ static int fimc_register_callback(struct device *dev, void *p)
sd = &fimc->vid_cap.subdev; sd = &fimc->vid_cap.subdev;
sd->grp_id = FIMC_GROUP_ID; sd->grp_id = FIMC_GROUP_ID;
v4l2_set_subdev_hostdata(sd, (void *)&fimc_pipeline_ops);
ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, sd);
if (ret) { if (ret) {
@ -360,7 +361,6 @@ static int fimc_register_callback(struct device *dev, void *p)
return ret; return ret;
} }
fimc->pipeline_ops = &fimc_pipeline_ops;
fmd->fimc[fimc->id] = fimc; fmd->fimc[fimc->id] = fimc;
return 0; return 0;
} }
@ -375,6 +375,7 @@ static int fimc_lite_register_callback(struct device *dev, void *p)
return 0; return 0;
fimc->subdev.grp_id = FLITE_GROUP_ID; fimc->subdev.grp_id = FLITE_GROUP_ID;
v4l2_set_subdev_hostdata(&fimc->subdev, (void *)&fimc_pipeline_ops);
ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev); ret = v4l2_device_register_subdev(&fmd->v4l2_dev, &fimc->subdev);
if (ret) { if (ret) {
@ -384,7 +385,6 @@ static int fimc_lite_register_callback(struct device *dev, void *p)
return ret; return ret;
} }
fimc->pipeline_ops = &fimc_pipeline_ops;
fmd->fimc_lite[fimc->index] = fimc; fmd->fimc_lite[fimc->index] = fimc;
return 0; return 0;
} }

View File

@ -381,11 +381,8 @@ static void s5p_mfc_handle_frame(struct s5p_mfc_ctx *ctx,
ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops, ctx->consumed_stream += s5p_mfc_hw_call(dev->mfc_ops,
get_consumed_stream, dev); get_consumed_stream, dev);
if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC && if (ctx->codec_mode != S5P_MFC_CODEC_H264_DEC &&
s5p_mfc_hw_call(dev->mfc_ops, ctx->consumed_stream + STUFF_BYTE <
get_dec_frame_type, dev) == src_buf->b->v4l2_planes[0].bytesused) {
S5P_FIMV_DECODE_FRAME_P_FRAME
&& ctx->consumed_stream + STUFF_BYTE <
src_buf->b->v4l2_planes[0].bytesused) {
/* Run MFC again on the same buffer */ /* Run MFC again on the same buffer */
mfc_debug(2, "Running again the same buffer\n"); mfc_debug(2, "Running again the same buffer\n");
ctx->after_packed_pb = 1; ctx->after_packed_pb = 1;

View File

@ -1762,7 +1762,7 @@ int s5p_mfc_get_dspl_y_adr_v6(struct s5p_mfc_dev *dev)
int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev) int s5p_mfc_get_dec_y_adr_v6(struct s5p_mfc_dev *dev)
{ {
return mfc_read(dev, S5P_FIMV_D_DISPLAY_LUMA_ADDR_V6); return mfc_read(dev, S5P_FIMV_D_DECODED_LUMA_ADDR_V6);
} }
int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev) int s5p_mfc_get_dspl_status_v6(struct s5p_mfc_dev *dev)