Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1245630
| From | "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/4] dmaengine: Add STM32 DMA driver |
| Date | 2015-10-13 14:00 +0200 |
| Message-ID | <qj6pk-5Fz-11@gated-at.bofh.it> (permalink) |
| References | <qhliO-7tw-11@gated-at.bofh.it> <qhliP-7tw-33@gated-at.bofh.it> <qiRJE-1cM-27@gated-at.bofh.it> <qj5Wi-55T-23@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi Maxime,
2015-10-13 13:25 GMT+02:00 M'boumba Cedric Madianga <cedric.madianga@gmail.com>:
>>> +static int stm32_dma_set_xfer_param(struct stm32_dma_chan *chan,
>>> + enum dma_transfer_direction direction,
>>> + enum dma_slave_buswidth *buswidth)
>>> +{
>>> + enum dma_slave_buswidth src_addr_width, dst_addr_width;
>>> + u32 src_bus_width, dst_bus_width, src_burst_size, dst_burst_size;
>>> + u32 src_maxburst, dst_maxburst;
>>> + dma_addr_t src_addr, dst_addr;
>>> +
>>> + src_addr_width = chan->dma_sconfig.src_addr_width;
>>> + dst_addr_width = chan->dma_sconfig.dst_addr_width;
>>> + src_maxburst = chan->dma_sconfig.src_maxburst;
>>> + dst_maxburst = chan->dma_sconfig.dst_maxburst;
>>> + src_addr = chan->dma_sconfig.src_addr;
>>> + dst_addr = chan->dma_sconfig.dst_addr;
>>> +
>>> + switch (direction) {
>>> + case DMA_MEM_TO_DEV:
>>> + dst_bus_width = stm32_get_dma_width(chan, dst_addr_width);
>>> + if (dst_bus_width < 0)
>>> + return -EINVAL;
>>
>> dst_bus_width is a u32, so cannot be negative.
>> Also, you should propagate de error returned by stm32_get_dma_width().
> Good point. Thanks.
> I am going to replace u32 by int in the v2.
> It will be done in v2.
>
Finally, I prefer to return a default value from stm32_get_dma_width()
and stm32_get_dma_burst().
In that way, I will always be able to configure DMA transfer parameters.
BR,
Cedric
--
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 | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/4] Add support for STM32 DMA M'boumba Cedric Madianga <cedric.madianga@gmail.com> - 2015-10-08 17:30 +0200
[PATCH 2/4] dmaengine: Add STM32 DMA driver M'boumba Cedric Madianga <cedric.madianga@gmail.com> - 2015-10-08 17:30 +0200
Re: [PATCH 2/4] dmaengine: Add STM32 DMA driver Maxime Coquelin <mcoquelin.stm32@gmail.com> - 2015-10-12 22:20 +0200
Re: [PATCH 2/4] dmaengine: Add STM32 DMA driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2015-10-13 13:30 +0200
Re: [PATCH 2/4] dmaengine: Add STM32 DMA driver "M'boumba Cedric Madianga" <cedric.madianga@gmail.com> - 2015-10-13 14:00 +0200
csiph-web