Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] media/.../soc-camera: convert drivers to use the new vb2_queue dev field

Stop using alloc_ctx and just fill in the device pointer.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: Ludovic Desroches <ludovic.desroches@atmel.com>
Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
8e9bca3a 1ad70ced

+4 -36
+1 -12
drivers/media/platform/soc_camera/atmel-isi.c
··· 72 72 73 73 int sequence; 74 74 75 - struct vb2_alloc_ctx *alloc_ctx; 76 - 77 75 /* Allocate descriptors for dma buffer use */ 78 76 struct fbd *p_fb_descriptors; 79 77 dma_addr_t fb_descriptors_phys; ··· 320 322 321 323 *nplanes = 1; 322 324 sizes[0] = size; 323 - alloc_ctxs[0] = isi->alloc_ctx; 324 325 325 326 isi->sequence = 0; 326 327 isi->active = NULL; ··· 564 567 q->mem_ops = &vb2_dma_contig_memops; 565 568 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 566 569 q->lock = &ici->host_lock; 570 + q->dev = ici->v4l2_dev.dev; 567 571 568 572 return vb2_queue_init(q); 569 573 } ··· 961 963 struct atmel_isi, soc_host); 962 964 963 965 soc_camera_host_unregister(soc_host); 964 - vb2_dma_contig_cleanup_ctx(isi->alloc_ctx); 965 966 dma_free_coherent(&pdev->dev, 966 967 sizeof(struct fbd) * MAX_BUFFER_NUM, 967 968 isi->p_fb_descriptors, ··· 1064 1067 list_add(&isi->dma_desc[i].list, &isi->dma_desc_head); 1065 1068 } 1066 1069 1067 - isi->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); 1068 - if (IS_ERR(isi->alloc_ctx)) { 1069 - ret = PTR_ERR(isi->alloc_ctx); 1070 - goto err_alloc_ctx; 1071 - } 1072 - 1073 1070 regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1074 1071 isi->regs = devm_ioremap_resource(&pdev->dev, regs); 1075 1072 if (IS_ERR(isi->regs)) { ··· 1110 1119 pm_runtime_disable(&pdev->dev); 1111 1120 err_req_irq: 1112 1121 err_ioremap: 1113 - vb2_dma_contig_cleanup_ctx(isi->alloc_ctx); 1114 - err_alloc_ctx: 1115 1122 dma_free_coherent(&pdev->dev, 1116 1123 sizeof(struct fbd) * MAX_BUFFER_NUM, 1117 1124 isi->p_fb_descriptors,
+1 -11
drivers/media/platform/soc_camera/rcar_vin.c
··· 484 484 struct list_head capture; 485 485 #define MAX_BUFFER_NUM 3 486 486 struct vb2_v4l2_buffer *queue_buf[MAX_BUFFER_NUM]; 487 - struct vb2_alloc_ctx *alloc_ctx; 488 487 enum v4l2_field field; 489 488 unsigned int pdata_flags; 490 489 unsigned int vb_count; ··· 538 539 struct soc_camera_device *icd = soc_camera_from_vb2q(vq); 539 540 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 540 541 struct rcar_vin_priv *priv = ici->priv; 541 - 542 - alloc_ctxs[0] = priv->alloc_ctx; 543 542 544 543 if (!vq->num_buffers) 545 544 priv->sequence = 0; ··· 1813 1816 vq->buf_struct_size = sizeof(struct rcar_vin_buffer); 1814 1817 vq->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1815 1818 vq->lock = &ici->host_lock; 1819 + vq->dev = ici->v4l2_dev.dev; 1816 1820 1817 1821 return vb2_queue_init(vq); 1818 1822 } ··· 1910 1912 if (ret) 1911 1913 return ret; 1912 1914 1913 - priv->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); 1914 - if (IS_ERR(priv->alloc_ctx)) 1915 - return PTR_ERR(priv->alloc_ctx); 1916 - 1917 1915 priv->ici.priv = priv; 1918 1916 priv->ici.v4l2_dev.dev = &pdev->dev; 1919 1917 priv->ici.drv_name = dev_name(&pdev->dev); ··· 1940 1946 1941 1947 cleanup: 1942 1948 pm_runtime_disable(&pdev->dev); 1943 - vb2_dma_contig_cleanup_ctx(priv->alloc_ctx); 1944 1949 1945 1950 return ret; 1946 1951 } ··· 1947 1954 static int rcar_vin_remove(struct platform_device *pdev) 1948 1955 { 1949 1956 struct soc_camera_host *soc_host = to_soc_camera_host(&pdev->dev); 1950 - struct rcar_vin_priv *priv = container_of(soc_host, 1951 - struct rcar_vin_priv, ici); 1952 1957 1953 1958 soc_camera_host_unregister(soc_host); 1954 1959 pm_runtime_disable(&pdev->dev); 1955 - vb2_dma_contig_cleanup_ctx(priv->alloc_ctx); 1956 1960 1957 1961 return 0; 1958 1962 }
+2 -13
drivers/media/platform/soc_camera/sh_mobile_ceu_camera.c
··· 113 113 spinlock_t lock; /* Protects video buffer lists */ 114 114 struct list_head capture; 115 115 struct vb2_v4l2_buffer *active; 116 - struct vb2_alloc_ctx *alloc_ctx; 117 116 118 117 struct sh_mobile_ceu_info *pdata; 119 118 struct completion complete; ··· 215 216 struct soc_camera_device *icd = soc_camera_from_vb2q(vq); 216 217 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); 217 218 struct sh_mobile_ceu_dev *pcdev = ici->priv; 218 - 219 - alloc_ctxs[0] = pcdev->alloc_ctx; 220 219 221 220 if (!vq->num_buffers) 222 221 pcdev->sequence = 0; ··· 1667 1670 q->buf_struct_size = sizeof(struct sh_mobile_ceu_buffer); 1668 1671 q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC; 1669 1672 q->lock = &ici->host_lock; 1673 + q->dev = ici->v4l2_dev.dev; 1670 1674 1671 1675 return vb2_queue_init(q); 1672 1676 } ··· 1820 1822 pcdev->ici.ops = &sh_mobile_ceu_host_ops; 1821 1823 pcdev->ici.capabilities = SOCAM_HOST_CAP_STRIDE; 1822 1824 1823 - pcdev->alloc_ctx = vb2_dma_contig_init_ctx(&pdev->dev); 1824 - if (IS_ERR(pcdev->alloc_ctx)) { 1825 - err = PTR_ERR(pcdev->alloc_ctx); 1826 - goto exit_free_clk; 1827 - } 1828 - 1829 1825 if (pcdev->pdata && pcdev->pdata->asd_sizes) { 1830 1826 struct v4l2_async_subdev **asd; 1831 1827 char name[] = "sh-mobile-csi2"; ··· 1864 1872 1865 1873 if (!csi2_pdev) { 1866 1874 err = -ENOMEM; 1867 - goto exit_free_ctx; 1875 + goto exit_free_clk; 1868 1876 } 1869 1877 1870 1878 pcdev->csi2_pdev = csi2_pdev; ··· 1947 1955 pcdev->csi2_pdev->resource = NULL; 1948 1956 platform_device_put(pcdev->csi2_pdev); 1949 1957 } 1950 - exit_free_ctx: 1951 - vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1952 1958 exit_free_clk: 1953 1959 pm_runtime_disable(&pdev->dev); 1954 1960 exit_release_mem: ··· 1966 1976 pm_runtime_disable(&pdev->dev); 1967 1977 if (platform_get_resource(pdev, IORESOURCE_MEM, 1)) 1968 1978 dma_release_declared_memory(&pdev->dev); 1969 - vb2_dma_contig_cleanup_ctx(pcdev->alloc_ctx); 1970 1979 if (csi2_pdev && csi2_pdev->dev.driver) { 1971 1980 struct module *csi2_drv = csi2_pdev->dev.driver->owner; 1972 1981 platform_device_del(csi2_pdev);