vb2: replace void *alloc_ctxs by struct device *alloc_devs

Upstream: torvalds/linux@36c0f8b32c ("[media] vb2:
replace void *alloc_ctxs by struct device *alloc_devs")
This commit is contained in:
Azat Khuzhin
2016-10-10 21:21:44 +03:00
parent 48f9854e5d
commit 40e8e711ad
2 changed files with 14 additions and 0 deletions

View File

@@ -118,7 +118,9 @@ struct fthd_private {
struct vb2_queue vb2_queue;
struct mutex vb2_queue_lock;
struct list_head buffer_queue;
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
struct vb2_alloc_ctx *alloc_ctx;
#endif
struct h2t_buf_ctx h2t_bufs[FTHD_BUFFERS];
struct v4l2_ctrl_handler v4l2_ctrl_handler;

View File

@@ -52,7 +52,11 @@ static int fthd_buffer_queue_setup(
unsigned int *nbuffers,
unsigned int *nplanes,
unsigned int sizes[],
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
struct device *alloc_devs[]
#else
void *alloc_ctxs[]
#endif
) {
struct fthd_private *dev_priv = vb2_get_drv_priv(vq);
@@ -70,7 +74,11 @@ static int fthd_buffer_queue_setup(
/* FIXME: We assume single plane format here but not below */
for (i = 0; i < *nplanes; i++) {
sizes[i] = cur_fmt->sizeimage;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,8,0)
alloc_devs[i] = &dev_priv->pdev->dev;
#else
alloc_ctxs[i] = dev_priv->alloc_ctx;
#endif
total_size += sizes[i];
}
@@ -711,7 +719,9 @@ int fthd_v4l2_register(struct fthd_private *dev_priv)
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
goto fail;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
dev_priv->alloc_ctx = vb2_dma_sg_init_ctx(&dev_priv->pdev->dev);
#endif
vdev->v4l2_dev = v4l2_dev;
strcpy(vdev->name, "Apple Facetime HD"); // XXX: Length?
vdev->vfl_dir = VFL_DIR_RX;
@@ -746,7 +756,9 @@ void fthd_v4l2_unregister(struct fthd_private *dev_priv)
{
v4l2_ctrl_handler_free(&dev_priv->v4l2_ctrl_handler);
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,8,0)
vb2_dma_sg_cleanup_ctx(dev_priv->alloc_ctx);
#endif
video_unregister_device(dev_priv->videodev);
v4l2_device_unregister(&dev_priv->v4l2_dev);
}