[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5637977E.7000704@huawei.com>
Date: Mon, 2 Nov 2015 17:03:58 +0000
From: John Garry <john.garry@...wei.com>
To: Arnd Bergmann <arnd@...db.de>
CC: <mark.rutland@....com>, <devicetree@...r.kernel.org>,
<linux-scsi@...r.kernel.org>, <pawel.moll@....com>,
<ijc+devicetree@...lion.org.uk>, <JBottomley@...n.com>,
<john.garry2@...l.dcu.ie>, <linux-kernel@...r.kernel.org>,
<linuxarm@...wei.com>, <robh+dt@...nel.org>, <hare@...e.de>,
<galak@...eaurora.org>, <zhangfei.gao@...aro.org>
Subject: Re: [PATCH v2 27/32] scsi: hisi_sas: add smp protocol support
On 30/10/2015 16:22, John Garry wrote:
> On 30/10/2015 13:53, Arnd Bergmann wrote:
>> On Monday 26 October 2015 22:14:58 John Garry wrote:
>>
>>> + /*
>>> + * DMA-map SMP request, response buffers
>>> + */
>>> + /* req */
>>> + sg_req = &task->smp_task.smp_req;
>>> + elem = dma_map_sg(dev, sg_req, 1, DMA_TO_DEVICE);
>>> + if (!elem)
>>> + return -ENOMEM;
>>> + req_len = sg_dma_len(sg_req);
>>> + req_dma_addr = sg_dma_address(sg_req);
>>
>> If you only use the first element, could you just use dma_map_single()?
>>
>
> Can do. Actually sg_req seems only ever has one element:
> expander.c, smp_execute_task()
> sg_init_one(&task->smp_task.smp_req, req, req_size);
>
>
I tried replacing with dma_map_single, but I feel the code is not as
clean as I need to manually set sg_dma_len() and sg_dma_address():
req_len = sg_dma_len(sg_req) = sg_req->length;
sg_dma_address(sg_req) = dma_map_single(dev, sg_virt(sg_req),
req_len, DMA_TO_DEVICE);
if (dma_mapping_error(dev, sg_dma_address(sg_req)))
return -ENOMEM;
sg_dma_address(sg_req) is used in another function for unmap.
opinion?
>
>
> _______________________________________________
> linuxarm mailing list
> linuxarm@...wei.com
> http://rnd-openeuler.huawei.com/mailman/listinfo/linuxarm
>
> .
>
cheers,
John
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists