Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1195742

Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver

From Archit Taneja <architt@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver
Date 2015-07-30 09:00 +0200
Message-ID <pRPYS-7zo-15@gated-at.bofh.it> (permalink)
References (3 earlier) <pPVYK-5C3-7@gated-at.bofh.it> <pR4Qi-6WB-13@gated-at.bofh.it> <pRoFj-1X0-9@gated-at.bofh.it> <pRrWx-6Ul-1@gated-at.bofh.it> <pREqK-7Sb-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 7/30/2015 12:03 AM, Stephen Boyd wrote:
> On 07/29, Archit Taneja wrote:
>> On 07/29/2015 07:18 AM, Stephen Boyd wrote:
>>> On 07/27/2015 09:34 PM, Archit Taneja wrote:
>>>> Hi,
>>>>
>>>> On 07/25/2015 06:21 AM, Stephen Boyd wrote:
>>>>> On 07/21/2015 03:34 AM, Archit Taneja wrote:
>>>>>
>>>>>> +              int size)
>>>>>> +{Looks like a
>>>>>> +    struct desc_info *desc;
>>>>>> +    struct dma_async_tx_descriptor *dma_desc;
>>>>>> +    struct scatterlist *sgl;
>>>>>> +    int r;
>>>>>> +
>>>>>> +    desc = kzalloc(sizeof(*desc), GFP_KERNEL);
>>>>>> +    if (!desc)
>>>>>> +        return -ENOMEM;
>>>>>> +
>>>>>> +    list_add_tail(&desc->list, &this->list);
>>>>>> +
>>>>>> +    sgl = &desc->sgl;
>>>>>> +
>>>>>> +    sg_init_one(sgl, vaddr, size);
>>>>>> +
>>>>>> +    desc->dir = DMA_MEM_TO_DEV;
>>>>>> +
>>>>>> +    r = dma_map_sg(this->dev, sgl, 1, desc->dir);
>>>>>> +    if (r == 0)
>>>>>> +        goto err;
>>>>>
>>>>> Should we return an error in this case? Looks like return 0.
>>>>
>>>> dma_map_sg returns the number of sg entries successfully mapped. In
>>>> this case, it should be 1.
>>>
>>> Right, but this function returns 0 (success?) if we failed to map anything.
>>
>> Yes. The return value is number of entries successfully mapped.
>> dma_map_sg is a macro that is replaced by dma_map_sg_attrs. Its
>> comment
>> says:
>>
>> "dma_maps_sg_attrs returns 0 on error and > 0 on success. It should
>> never return a value < 0."
>
> Yes, and so this function that calls dma_map_sg() is going to
> return 0 to the caller when it didn't do what it was asked to do?

Ah, I get your point now :p. I thought you were referring to the
return value of dma_map_sg, and not write_data_dma. Will fix this.

Archit

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver Stephen Boyd <sboyd@codeaurora.org> - 2015-07-29 03:50 +0200
  Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver Archit Taneja <architt@codeaurora.org> - 2015-07-29 07:20 +0200
    Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver Archit Taneja <architt@codeaurora.org> - 2015-07-30 09:00 +0200

csiph-web