* [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
@ 2018-08-18 15:16 zhong jiang
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-18 15:16 UTC (permalink / raw)
To: yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg
Cc: tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
The issue is detected with the help of Coccinelle.
zhong jiang (2):
media: ipu3-cio2: Use dma_zalloc_coherent to replace
dma_alloc_coherent + memset
media: mtk_vcodec_util: Use dma_zalloc_coherent to replace
dma_alloc_coherent + memset
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 +----
2 files changed, 3 insertions(+), 8 deletions(-)
--
1.7.12.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 1/2] media: ipu3-cio2: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
2018-08-18 15:16 [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset zhong jiang
@ 2018-08-18 15:16 ` zhong jiang
2018-08-24 2:58 ` Bing Bu Cao
2018-08-18 15:16 ` [PATCH 2/2] media: mtk_vcodec_util: " zhong jiang
2018-08-23 11:23 ` [PATCH 0/2] media: " zhong jiang
2 siblings, 1 reply; 6+ messages in thread
From: zhong jiang @ 2018-08-18 15:16 UTC (permalink / raw)
To: yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg
Cc: tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(),
We prefer to dma_zalloc_coherent instead of open-codeing.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
index 2902715..f0c6374 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
@@ -218,13 +218,11 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q)
{
struct device *dev = &cio2->pci_dev->dev;
- q->fbpt = dma_alloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
- GFP_KERNEL);
+ q->fbpt = dma_zalloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
+ GFP_KERNEL);
if (!q->fbpt)
return -ENOMEM;
- memset(q->fbpt, 0, CIO2_FBPT_SIZE);
-
return 0;
}
--
1.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] media: mtk_vcodec_util: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
2018-08-18 15:16 [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset zhong jiang
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
@ 2018-08-18 15:16 ` zhong jiang
2018-08-23 11:23 ` [PATCH 0/2] media: " zhong jiang
2 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-18 15:16 UTC (permalink / raw)
To: yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg
Cc: tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(),
We prefer to dma_zalloc_coherent instead of open-codeing.
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
index 0c28d0b..e80123c 100644
--- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
+++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c
@@ -49,16 +49,13 @@ int mtk_vcodec_mem_alloc(struct mtk_vcodec_ctx *data,
struct mtk_vcodec_ctx *ctx = (struct mtk_vcodec_ctx *)data;
struct device *dev = &ctx->dev->plat_dev->dev;
- mem->va = dma_alloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
-
+ mem->va = dma_zalloc_coherent(dev, size, &mem->dma_addr, GFP_KERNEL);
if (!mem->va) {
mtk_v4l2_err("%s dma_alloc size=%ld failed!", dev_name(dev),
size);
return -ENOMEM;
}
- memset(mem->va, 0, size);
-
mtk_v4l2_debug(3, "[%d] - va = %p", ctx->id, mem->va);
mtk_v4l2_debug(3, "[%d] - dma = 0x%lx", ctx->id,
(unsigned long)mem->dma_addr);
--
1.7.12.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
2018-08-18 15:16 [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset zhong jiang
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
2018-08-18 15:16 ` [PATCH 2/2] media: mtk_vcodec_util: " zhong jiang
@ 2018-08-23 11:23 ` zhong jiang
2 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-23 11:23 UTC (permalink / raw)
To: yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg
Cc: tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
Ping, Anyone has any objections about the patcheset?
Best wishes,
zhong jiang
On 2018/8/18 23:16, zhong jiang wrote:
> The issue is detected with the help of Coccinelle.
>
> zhong jiang (2):
> media: ipu3-cio2: Use dma_zalloc_coherent to replace
> dma_alloc_coherent + memset
> media: mtk_vcodec_util: Use dma_zalloc_coherent to replace
> dma_alloc_coherent + memset
>
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
> drivers/media/platform/mtk-vcodec/mtk_vcodec_util.c | 5 +----
> 2 files changed, 3 insertions(+), 8 deletions(-)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: ipu3-cio2: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
@ 2018-08-24 2:58 ` Bing Bu Cao
2018-08-24 3:36 ` zhong jiang
0 siblings, 1 reply; 6+ messages in thread
From: Bing Bu Cao @ 2018-08-24 2:58 UTC (permalink / raw)
To: zhong jiang, yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg
Cc: tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
Hi, Jiang
This looks fine for me in ipu3-cio2.
Actually, we already have this change locally, but I think we miss submit it to community.
Thanks!
On 08/18/2018 11:16 PM, zhong jiang wrote:
> dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(),
> We prefer to dma_zalloc_coherent instead of open-codeing.
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> index 2902715..f0c6374 100644
> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
> @@ -218,13 +218,11 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q)
> {
> struct device *dev = &cio2->pci_dev->dev;
>
> - q->fbpt = dma_alloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
> - GFP_KERNEL);
> + q->fbpt = dma_zalloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
> + GFP_KERNEL);
> if (!q->fbpt)
> return -ENOMEM;
>
> - memset(q->fbpt, 0, CIO2_FBPT_SIZE);
> -
> return 0;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] media: ipu3-cio2: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset
2018-08-24 2:58 ` Bing Bu Cao
@ 2018-08-24 3:36 ` zhong jiang
0 siblings, 0 replies; 6+ messages in thread
From: zhong jiang @ 2018-08-24 3:36 UTC (permalink / raw)
To: Bing Bu Cao
Cc: yong.zhi, sakari.ailus, bingbu.cao, mchehab, matthias.bgg,
tian.shu.qiu, jian.xu.zheng, linux-kernel, linux-media
On 2018/8/24 10:58, Bing Bu Cao wrote:
> Hi, Jiang
>
> This looks fine for me in ipu3-cio2.
> Actually, we already have this change locally, but I think we miss submit it to community.
> Thanks!
It's ok, Anyway, Thank you for let me know that.
Best wishes,
zhong jiang
> On 08/18/2018 11:16 PM, zhong jiang wrote:
>> dma_zalloc_coherent has implemented the dma_alloc_coherent() + memset(),
>> We prefer to dma_zalloc_coherent instead of open-codeing.
>>
>> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
>> ---
>> drivers/media/pci/intel/ipu3/ipu3-cio2.c | 6 ++----
>> 1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2.c b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>> index 2902715..f0c6374 100644
>> --- a/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>> +++ b/drivers/media/pci/intel/ipu3/ipu3-cio2.c
>> @@ -218,13 +218,11 @@ static int cio2_fbpt_init(struct cio2_device *cio2, struct cio2_queue *q)
>> {
>> struct device *dev = &cio2->pci_dev->dev;
>>
>> - q->fbpt = dma_alloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
>> - GFP_KERNEL);
>> + q->fbpt = dma_zalloc_coherent(dev, CIO2_FBPT_SIZE, &q->fbpt_bus_addr,
>> + GFP_KERNEL);
>> if (!q->fbpt)
>> return -ENOMEM;
>>
>> - memset(q->fbpt, 0, CIO2_FBPT_SIZE);
>> -
>> return 0;
>> }
>>
>
> .
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-08-24 3:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-18 15:16 [PATCH 0/2] media: Use dma_zalloc_coherent to replace dma_alloc_coherent + memset zhong jiang
2018-08-18 15:16 ` [PATCH 1/2] media: ipu3-cio2: " zhong jiang
2018-08-24 2:58 ` Bing Bu Cao
2018-08-24 3:36 ` zhong jiang
2018-08-18 15:16 ` [PATCH 2/2] media: mtk_vcodec_util: " zhong jiang
2018-08-23 11:23 ` [PATCH 0/2] media: " zhong jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).