1. 09 Apr, 2021 17 commits
  2. 08 Apr, 2021 2 commits
    • Mauro Carvalho Chehab's avatar
      media: venus: don't de-reference NULL pointers at IRQ time · 686ee9b6
      Mauro Carvalho Chehab authored
      Smatch is warning that:
      	drivers/media/platform/qcom/venus/hfi_venus.c:1100 venus_isr() warn: variable dereferenced before check 'hdev' (see line 1097)
      
      The logic basically does:
      	hdev = to_hfi_priv(core);
      
      with is translated to:
      	hdev = core->priv;
      
      If the IRQ code can receive a NULL pointer for hdev, there's
      a bug there, as it will first try to de-reference the pointer,
      and then check if it is null.
      
      After looking at the code, it seems that this indeed can happen:
      Basically, the venus IRQ thread is started with:
      	devm_request_threaded_irq()
      So, it will only be freed after the driver unbinds.
      
      In order to prevent the IRQ code to work with freed data,
      the logic at venus_hfi_destroy() sets core->priv to NULL,
      which would make the IRQ code to ignore any pending IRQs.
      
      There is, however a race condition, as core->priv is set
      to NULL only after being freed. So, we need also to move the
      core->priv = NULL to happen earlier.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      686ee9b6
    • Mauro Carvalho Chehab's avatar
      media: venus: use NULL instead of zero for pointers · b6f13994
      Mauro Carvalho Chehab authored
      As reported by sparse:
      
      	drivers/media/platform/qcom/venus/core.c:227:41: warning: Using plain integer as NULL pointer
      	drivers/media/platform/qcom/venus/core.c:228:34: warning: Using plain integer as NULL pointer
      
      Two vars are using zero instead of NULL for pointers. Not really
      an issue, but using NULL makes it clearer that the init data is
      expecting a pointer.
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      b6f13994
  3. 07 Apr, 2021 2 commits
  4. 06 Apr, 2021 19 commits
    • Sylwester Nawrocki's avatar
      media: s5p-mfc: Fix kernel-doc entries in s5p_mfc_common.h · 7acc54ed
      Sylwester Nawrocki authored
      Fixes scripts/kernel-doc warnings:
      
      s5p_mfc_common.h:343: warning: Function parameter or member 'fw_buf' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'mem_size' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'mem_base' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'mem_bitmap' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'mem_virt' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'dma_base' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'watchdog_timer' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'fw_get_done' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:343: warning: Function parameter or member 'risc_on' not described in 's5p_mfc_dev'
      s5p_mfc_common.h:714: warning: Function parameter or member 'src_bufs_cnt' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'dst_bufs_cnt' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'pb_count' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'force_frame_type' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'slice_mode' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'slice_size' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'frame_tag' not described in 's5p_mfc_ctx'
      s5p_mfc_common.h:714: warning: Function parameter or member 'scratch_buf_size' not described in 's5p_mfc_ctx'
      Reported-by: default avatarHans verkuil <hverkuil@xs4all.nl>
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      7acc54ed
    • Sylwester Nawrocki's avatar
      media: exynos4-is: Fix kernel-doc entries in fimc-is.h · 08874fdd
      Sylwester Nawrocki authored
      Fixes scripts/kernel-doc warnings:
      
      fimc-is.h:286: warning: Function parameter or member 'fw' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'memory' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'f_w' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'isp' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'sensor' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'setfile' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'ctrl_handler' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'irq' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'sensor_index' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'i2h_cmd' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'h2i_cmd' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'fd_header' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'config' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'config_index' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'is_p_region' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'is_dma_p_region' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'is_shared_region' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'af' not described in 'fimc_is'
      fimc-is.h:286: warning: Function parameter or member 'debugfs_entry' not described in 'fimc_is'
      
      The f_w field is unused so remove it.
      Reported-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      08874fdd
    • Hans Verkuil's avatar
      media: adv7511-v4l2: correctly report EDIDs of 1 block · b24bc3ab
      Hans Verkuil authored
      If the EDID has an odd number of blocks (usually just 1, but the
      same problem occurs with 3 blocks), then VIDIOC_G_EDID reported 2
      (or 4) blocks. Fix this.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      b24bc3ab
    • Hans Verkuil's avatar
      media: adv7604: support EDIDs up to 4 blocks · c730ff32
      Hans Verkuil authored
      While the adv7604/11/12 hardware supported EDIDs up to 4 blocks, the
      driver didn't. This patch adds support for this. It also improves support
      for EDIDs that do not have a Source Physical Address: in that case the
      spa location is set to the first byte of the second block, and the
      'physical address' is just the two bytes at that location. This is per
      the suggestion in the adv76xx documentation for such EDIDs.
      
      Tested with an adv7604 and adv7612.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      c730ff32
    • Hans Verkuil's avatar
      media: adv7604: fix HPD support for adv7611/12 · 1cf233d8
      Hans Verkuil authored
      For the adv7604 the hotplug detect pin is controlled through gpio pins from
      the SoC, but the adv7611 and adv7612 control the hotplug detect pin
      themselves.
      
      But the driver had no support for this, so the HPD was always high, even
      when changing the EDID. Add proper support for this to the driver.
      
      Tested with an adv7612.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      1cf233d8
    • Daniel Almeida's avatar
      media: rkvdec: Do not require all controls to be present in every request · 54676d5f
      Daniel Almeida authored
      According to the v4l2 api, it is allowed to skip
      setting a control if its contents haven't changed for performance
      reasons: userspace should only update the controls that changed from
      last frame rather then updating them all. Still some ancient code
      that checks for mandatory controls has been left in this driver.
      
      Remove it.
      
      Fixes: cd33c830 ("media: rkvdec: Add the rkvdec driver")
      Signed-off-by: default avatarDaniel Almeida <daniel.almeida@collabora.com>
      Reviewed-by: default avatarEzequiel Garcia <ezequiel@collabora.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      54676d5f
    • Geert Uytterhoeven's avatar
      media: VIDEO_IMX8_JPEG should depend on ARCH_MXC and not default to m · 4cd15d84
      Geert Uytterhoeven authored
      The i.MX8 QXP/QM integrated JPEG encoder/decoder is only present on
      Freescale/NXP i.MX8 QXP and QM SoCs.  Hence add a dependency on
      ARCH_MXC, to prevent asking the user about this driver when configuring
      a kernel without i.MX8 support.
      
      Drop the "default m" (which means "default y" if CONFIG_MODULES is not
      enabled), as merely enabling CONFIG_COMPILE_TEST should not enable
      additional code.
      
      Fixes: 2db16c6e ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
      Signed-off-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      4cd15d84
    • Wan Jiabing's avatar
      media: em28xx/em28xx.h: Remove duplicate struct declaration · 34ad0137
      Wan Jiabing authored
      struct em28xx is declared at 219th line.
      The declaration here is unnecessary. Remove it.
      Signed-off-by: default avatarWan Jiabing <wanjiabing@vivo.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      34ad0137
    • Wan Jiabing's avatar
      media: cx231xx/cx231xx.h: Remove repeated struct declaration · dea37798
      Wan Jiabing authored
      struct cx231xx is declared at 146th line.
      The declaration here is unnecessary. Remove it.
      Signed-off-by: default avatarWan Jiabing <wanjiabing@vivo.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      dea37798
    • Yang Yingliang's avatar
      media: camss: csid: Remove redundant dev_err call in msm_csid_subdev_init() · 6c0ed6d4
      Yang Yingliang authored
      There is a error message within devm_ioremap_resource
      already, so remove the dev_err call to avoid redundant
      error message.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      6c0ed6d4
    • Yang Yingliang's avatar
      media: camss: csiphy: Remove redundant dev_err call in msm_csiphy_subdev_init() · 6fe1152a
      Yang Yingliang authored
      There is an error message within devm_ioremap_resource
      already, so remove the dev_err call to avoid redundant
      error message.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarRobert Foss <robert.foss@linaro.org>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      6fe1152a
    • Yang Yingliang's avatar
      media: ti-vpe: sc: remove redundant dev_err call in sc_create() · f274245b
      Yang Yingliang authored
      There is an error message within devm_ioremap_resource
      already, so remove the dev_err call to avoid redundant
      error message.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      f274245b
    • Yang Yingliang's avatar
      media: ti-vpe: csc: remove redundant dev_err call in csc_create() · dd546790
      Yang Yingliang authored
      There is an error message within devm_ioremap_resource
      already, so remove the dev_err call to avoid redundant
      error message.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarBenoit Parrot <bparrot@ti.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      dd546790
    • Yang Yingliang's avatar
      media: imx-pxp: remove redundant dev_err call in pxp_probe() · d21ffd93
      Yang Yingliang authored
      There is an error message within devm_ioremap_resource
      already, so remove the dev_err call to avoid redundant
      error message.
      Reported-by: default avatarHulk Robot <hulkci@huawei.com>
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Reviewed-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      d21ffd93
    • Hans Verkuil's avatar
      media: cec/core: clarify rx-arb-lost usage message · 92eda6b7
      Hans Verkuil authored
      The rx-arb-lost error injection command only works with <op> set to 'any'.
      Explicitly say so in the usage message.
      
      Also use [] to indicate that the <poll> argument is optional.
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      92eda6b7
    • Fabio Estevam's avatar
      media: imx-pxp: Remove unneeded of_match_ptr() · 2f65dd20
      Fabio Estevam authored
      i.MX is a DT-only platform, so of_match_ptr() can be safely
      removed.
      
      Remove the unneeded of_match_ptr().
      Signed-off-by: default avatarFabio Estevam <festevam@gmail.com>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      2f65dd20
    • Christophe JAILLET's avatar
      media: tw68: switch from 'pci_' to 'dma_' API · e999db58
      Christophe JAILLET authored
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below and has been
      hand modified to replace GFP_ with a correct flag.
      It has been compile tested.
      
      When memory is allocated in 'tw68_risc_buffer()' (tw68-risc.c) GFP_KERNEL
      can be used because this function is only called from a vb2_ops buf_prepare
      function.
      The call chain is:
        tw68_video_qops.buf_prepare	         (tw68-video.c)
          --> tw68_buf_prepare               (tw68-video.c)
            --> tw68_risc_buffer
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      e999db58
    • Christophe JAILLET's avatar
      media: tw686x: switch from 'pci_' to 'dma_' API · c1dbcf62
      Christophe JAILLET authored
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below and has been
      hand modified to replace GFP_ with a correct flag.
      It has been compile tested.
      
      When memory is allocated in 'tw686x_audio_dma_alloc()' (tw686x-audio.c)
      GFP_KERNEL can be used because it is only called from a probe function
      and no spinlock is taken in the between.
      The call chain is:
        tw686x_probe					(tw686x-core.c)
          --> tw686x_audio_init					(tw686x-audio.c)
            --> tw686x_audio_dma_alloc					(tw686x-audio.c)
      
      When memory is allocated in 'tw686x_memcpy_dma_alloc()' and in
      'tw686x_sg_dma_alloc()' (tw686x-video.c) GFP_KERNEL can be used because
      these functions are .alloc functions from a tw686x_dma_ops structure.
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      c1dbcf62
    • Christophe JAILLET's avatar
      media: cx23885: switch from 'pci_' to 'dma_' API · 7a77379f
      Christophe JAILLET authored
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below and has been
      hand modified to replace GFP_ with a correct flag.
      It has been compile tested.
      
      When memory is allocated in 'cx23885_risc_buffer()' GFP_KERNEL can be used
      because this function is only called from a vb2_ops buf_prepare function.
      The call chain is:
        cx23885_video_qops.buf_prepare        (cx23885-video.c)
          --> buffer_prepare                  (cx23885-video.c)
            --> cx23885_risc_buffer
      
      When memory is allocated in 'cx23885_risc_databuffer()' GFP_KERNEL can be
      used because this function is only called from a function that already uses
      GFP_KERNEL or from a vb2_ops buf_prepare
      function.
      The call chains are:
        snd_cx23885_hw_params                 (cx23885-alsa.c) --> use GFP_KERNEL
          --> cx23885_risc_databuffer
      
        cx23885_qops.buffer_prepare           (cx23885-417.c)
           or
        dvb_qops.buffer_prepare               (cx23885-dvb.c)
          --> cx23885_buf_prepare
            --> cx23885_risc_databuffer
      
      When memory is allocated in 'cx23885_risc_vbibuffer()' GFP_KERNEL can be
      used because this function is only called from a vb2_ops buf_prepare
      function.
      The call chains are:
        cx23885_vbi_qops.buffer_prepare       (cx23885-vbi.c)
          --> cx23885_risc_vbibuffer
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
      7a77379f