[PATCH] drm/mediatek: Drop local dma_parms
Chun-Kuang Hu
chunkuang.hu at kernel.org
Mon Nov 23 09:24:38 EST 2020
Hi, Robin:
Robin Murphy <robin.murphy at arm.com> 於 2020年9月4日 週五 上午4:59寫道:
>
> Since commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms
> for platform devices"), struct platform_device already provides a
> dma_parms structure, so we can save allocating another one.
>
> Also the DMA segment size is simply a size, not a bitmask.
>
Applied to mediatek-drm-next [1], thanks.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next
Regards,
Chun-Kuang.
> Signed-off-by: Robin Murphy <robin.murphy at arm.com>
> ---
> drivers/gpu/drm/mediatek/mtk_drm_drv.c | 23 +++--------------------
> drivers/gpu/drm/mediatek/mtk_drm_drv.h | 2 --
> 2 files changed, 3 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 040a8f393fe2..3941f6f6b003 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -221,21 +221,10 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> * Configure the DMA segment size to make sure we get contiguous IOVA
> * when importing PRIME buffers.
> */
> - if (!dma_dev->dma_parms) {
> - private->dma_parms_allocated = true;
> - dma_dev->dma_parms =
> - devm_kzalloc(drm->dev, sizeof(*dma_dev->dma_parms),
> - GFP_KERNEL);
> - }
> - if (!dma_dev->dma_parms) {
> - ret = -ENOMEM;
> - goto err_component_unbind;
> - }
> -
> - ret = dma_set_max_seg_size(dma_dev, (unsigned int)DMA_BIT_MASK(32));
> + ret = dma_set_max_seg_size(dma_dev, UINT_MAX);
> if (ret) {
> dev_err(dma_dev, "Failed to set DMA segment size\n");
> - goto err_unset_dma_parms;
> + goto err_component_unbind;
> }
>
> /*
> @@ -246,16 +235,13 @@ static int mtk_drm_kms_init(struct drm_device *drm)
> drm->irq_enabled = true;
> ret = drm_vblank_init(drm, MAX_CRTC);
> if (ret < 0)
> - goto err_unset_dma_parms;
> + goto err_component_unbind;
>
> drm_kms_helper_poll_init(drm);
> drm_mode_config_reset(drm);
>
> return 0;
>
> -err_unset_dma_parms:
> - if (private->dma_parms_allocated)
> - dma_dev->dma_parms = NULL;
> err_component_unbind:
> component_unbind_all(drm->dev, drm);
>
> @@ -269,9 +255,6 @@ static void mtk_drm_kms_deinit(struct drm_device *drm)
> drm_kms_helper_poll_fini(drm);
> drm_atomic_helper_shutdown(drm);
>
> - if (private->dma_parms_allocated)
> - private->dma_dev->dma_parms = NULL;
> -
> component_unbind_all(drm->dev, drm);
> }
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> index b5be63e53176..6afd0b5f2b92 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h
> @@ -44,8 +44,6 @@ struct mtk_drm_private {
> struct mtk_ddp_comp *ddp_comp[DDP_COMPONENT_ID_MAX];
> const struct mtk_mmsys_driver_data *data;
> struct drm_atomic_state *suspend_state;
> -
> - bool dma_parms_allocated;
> };
>
> extern struct platform_driver mtk_ddp_driver;
> --
> 2.28.0.dirty
>
More information about the Linux-mediatek
mailing list