[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <55B9C9F9.3030003@codeaurora.org>
Date: Thu, 30 Jul 2015 12:23:45 +0530
From: Archit Taneja <architt@...eaurora.org>
To: Stephen Boyd <sboyd@...eaurora.org>
CC: dehrenberg@...gle.com, linux-arm-msm@...r.kernel.org,
cernekee@...il.com, linux-kernel@...r.kernel.org,
linux-mtd@...ts.infradead.org, agross@...eaurora.org,
computersforpeace@...il.com
Subject: Re: [PATCH v2 2/5] mtd: nand: Qualcomm NAND controller driver
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@...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