mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 19:21:28 +02:00
media: s5p-mfc: Store s5p_mfc_ctx in vb2_queue.drv_priv
The driver stores a pointer to a v4l2_fh in the vb2_queue.drv_priv, which it then has to cast to a s5p_mfc_ctx pointer in all vb2 queue operations. Store the pointer to the s5p_mfc_ctx instead to avoid the cast. While at it, use the vb2_get_drv_priv() helper to access the field. Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
parent
52e6cd6aaa
commit
4df43d4997
|
|
@ -876,7 +876,7 @@ static int s5p_mfc_open(struct file *file)
|
|||
/* Init videobuf2 queue for CAPTURE */
|
||||
q = &ctx->vq_dst;
|
||||
q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
|
||||
q->drv_priv = &ctx->fh;
|
||||
q->drv_priv = ctx;
|
||||
q->lock = &dev->mfc_mutex;
|
||||
if (vdev == dev->vfd_dec) {
|
||||
q->io_modes = VB2_MMAP;
|
||||
|
|
@ -903,7 +903,7 @@ static int s5p_mfc_open(struct file *file)
|
|||
/* Init videobuf2 queue for OUTPUT */
|
||||
q = &ctx->vq_src;
|
||||
q->type = V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE;
|
||||
q->drv_priv = &ctx->fh;
|
||||
q->drv_priv = ctx;
|
||||
q->lock = &dev->mfc_mutex;
|
||||
if (vdev == dev->vfd_dec) {
|
||||
q->io_modes = VB2_MMAP;
|
||||
|
|
|
|||
|
|
@ -937,7 +937,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
|
|||
unsigned int *plane_count, unsigned int psize[],
|
||||
struct device *alloc_devs[])
|
||||
{
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
const struct v4l2_format_info *format;
|
||||
|
||||
|
|
@ -1006,7 +1006,7 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
|
|||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
unsigned int i;
|
||||
|
||||
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
|
||||
|
|
@ -1068,7 +1068,7 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
|
|||
|
||||
static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
{
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
|
||||
v4l2_ctrl_handler_setup(&ctx->ctrl_handler);
|
||||
|
|
@ -1085,7 +1085,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
|
|||
static void s5p_mfc_stop_streaming(struct vb2_queue *q)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
int aborted = 0;
|
||||
|
||||
|
|
@ -1130,7 +1130,7 @@ static void s5p_mfc_stop_streaming(struct vb2_queue *q)
|
|||
static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
unsigned long flags;
|
||||
struct s5p_mfc_buf *mfc_buf;
|
||||
|
|
|
|||
|
|
@ -2418,7 +2418,7 @@ static int s5p_mfc_queue_setup(struct vb2_queue *vq,
|
|||
unsigned int *buf_count, unsigned int *plane_count,
|
||||
unsigned int psize[], struct device *alloc_devs[])
|
||||
{
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
|
||||
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
|
||||
|
|
@ -2477,7 +2477,7 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
|
|||
{
|
||||
struct vb2_v4l2_buffer *vbuf = to_vb2_v4l2_buffer(vb);
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
unsigned int i;
|
||||
int ret;
|
||||
|
||||
|
|
@ -2516,7 +2516,7 @@ static int s5p_mfc_buf_init(struct vb2_buffer *vb)
|
|||
static int s5p_mfc_buf_prepare(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
int ret;
|
||||
|
||||
if (vq->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) {
|
||||
|
|
@ -2557,7 +2557,7 @@ static int s5p_mfc_buf_prepare(struct vb2_buffer *vb)
|
|||
|
||||
static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
{
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
|
||||
if (IS_MFCV6_PLUS(dev) &&
|
||||
|
|
@ -2588,7 +2588,7 @@ static int s5p_mfc_start_streaming(struct vb2_queue *q, unsigned int count)
|
|||
static void s5p_mfc_stop_streaming(struct vb2_queue *q)
|
||||
{
|
||||
unsigned long flags;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(q->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(q);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
|
||||
if ((ctx->state == MFCINST_FINISHING ||
|
||||
|
|
@ -2617,7 +2617,7 @@ static void s5p_mfc_stop_streaming(struct vb2_queue *q)
|
|||
static void s5p_mfc_buf_queue(struct vb2_buffer *vb)
|
||||
{
|
||||
struct vb2_queue *vq = vb->vb2_queue;
|
||||
struct s5p_mfc_ctx *ctx = fh_to_ctx(vq->drv_priv);
|
||||
struct s5p_mfc_ctx *ctx = vb2_get_drv_priv(vq);
|
||||
struct s5p_mfc_dev *dev = ctx->dev;
|
||||
unsigned long flags;
|
||||
struct s5p_mfc_buf *mfc_buf;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user