summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* dmaengine: tegra-apb: Fix coding style problemsDmitry Osipenko2020-02-251-131/+144
| | | | | | | | | | This patch fixes few dozens of coding style problems reported by checkpatch and prettifies code where makes sense. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-9-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra-apb: Use devm_request_irqDmitry Osipenko2020-02-251-24/+11
| | | | | | | | | Use resource-managed variant of request_irq for brevity. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-8-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra-apb: Use devm_platform_ioremap_resourceDmitry Osipenko2020-02-251-2/+1
| | | | | | | | | Use devm_platform_ioremap_resource to keep code cleaner a tad. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-7-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra-apb: Clean up tasklet releasingDmitry Osipenko2020-02-251-5/+1
| | | | | | | | | | | | | There is no need to kill tasklet when driver's probe fails because tasklet can't be scheduled at this time. It is also cleaner to kill tasklet on channel's freeing rather than to kill it on driver's removal, otherwise tasklet could perform a dummy execution after channel's releasing, which isn't very nice. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-6-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra-apb: Prevent race conditions on channel's freeingDmitry Osipenko2020-02-251-2/+1
| | | | | | | | | | | It's incorrect to check the channel's "busy" state without taking a lock. That shouldn't cause any real troubles, nevertheless it's always better not to have any race conditions in the code. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-5-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra-apb: Implement synchronization hookDmitry Osipenko2020-02-251-0/+8
| | | | | | | | | | The ISR tasklet could be kept scheduled after DMA transfer termination, let's add synchronization hook which blocks until tasklet is finished. Signed-off-by: Dmitry Osipenko <digetx@gmail.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Link: https://lore.kernel.org/r/20200209163356.6439-4-digetx@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: ti: edma: Support for interleaved mem to mem transferPeter Ujfalusi2020-02-251-0/+79
| | | | | | | | Add basic interleaved support via EDMA. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200210094455.3615-1-peter.ujfalusi@ti.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_xdmac: Fix locking in taskletTudor Ambarus2020-02-251-11/+12
| | | | | | | | | | | | | | | | | | | | Tasklets run with all the interrupts enabled. This means that we should replace all the (already present) spin_lock_irqsave() uses in the tasklet with spin_lock_irq() to protect being interrupted by a IRQ which tries to get the same lock (via calls to device_prep_dma_* for example). spin_lock and spin_lock_bh in tasklets are not enough to protect from IRQs, update these to spin_lock_irq(). at_xdmac_advance_work() can be called with all the interrupts enabled (when called from tasklet), or with interrupts disabled (when called from at_xdmac_issue_pending). Move the locking in the callers to be able to use spin_lock_irq() and spin_lock_irqsave() for these cases. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-10-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_xdmac: GFP_KERNEL for user that can sleepTudor Ambarus2020-02-251-1/+1
| | | | | | | | | device_alloc_chan_resources can sleep, use GFP_KERNEL flag. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-9-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_xdmac: Drop locking in at_xdmac_alloc_chan_resources()Tudor Ambarus2020-02-251-9/+2
| | | | | | | | | | | There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-8-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_xdmac: Drop always true checkTudor Ambarus2020-02-251-5/+3
| | | | | | | | | | The code in cause is already in the else case of 'if (at_xdmac_chan_is_cyclic(atchan))', drop the redundant check. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-7-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Fix deadlocksTudor Ambarus2020-02-251-35/+39
| | | | | | | | | | | | | | | | | | | | | | Fix the following deadlocks: 1/ atc_handle_cyclic() and atc_chain_complete() called dmaengine_desc_get_callback_invoke() while wrongly holding the atchan->lock. Clients can set the callback to dmaengine_terminate_sync() which will end up trying to get the same lock, thus a deadlock occurred. 2/ dma_run_dependencies() was called with the atchan->lock held, but the method calls device_issue_pending() which tries to get the same lock, and so a deadlock occurred. The driver must not hold the lock when invoking the callback or when running dependencies. Releasing the spinlock within a called function before calling the callback is not a nice thing to do -> called functions become non-atomic when called within an atomic region. Thus the lock is now taken in the child routines whereever is needed. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-6-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Switch atomic allocations to GFP_NOWAITTudor Ambarus2020-02-251-3/+3
| | | | | | | | | | | | | Avoids sleeping without depleting the emergency pool. The rationale being that in most cases a dma device is either offloading an operation that will automatically fallback to software when the descriptor allocation fails, or we can simply poll and wait for the dma device to release some in use descriptors. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-5-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Drop description for a not defined parameterTudor Ambarus2020-02-251-1/+0
| | | | | | | | | Probably a leftover, drop it. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-4-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Return err in case the chan is not free at alloc res timeTudor Ambarus2020-02-252-25/+8
| | | | | | | | | | | | | | | | | | Having a list of descriptors allocated for the channel at device_alloc_chan_resources() time is a sign for bad free usage. Return err and add a debug message in case the channel is not free from a previous use. atchan->descs_allocated becomes useless, get rid of it. More, drop the error message in atc_desc_get() because now it would introduce an extra if statement. The callers of atc_desc_get() already print error messages in case the callee fails, no one is hurt. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-3-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Drop locking in at_hdmac_alloc_chan_resources()Tudor Ambarus2020-02-251-6/+1
| | | | | | | | | | | There is no need for locking in device_alloc_chan_resources(), the DMA core takes care of it by using a dma_list_mutex around the DMA devices. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-2-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: at_hdmac: Substitute kzalloc with kmallocTudor Ambarus2020-02-251-1/+1
| | | | | | | | | | All members of the structure are initialized below in the function, there is no need to use kzalloc. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com> Link: https://lore.kernel.org/r/20200123140237.125799-1-tudor.ambarus@microchip.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: xilinx_dma: In dma channel probe fix node order dependencyRadhey Shyam Pandey2020-02-251-22/+17
| | | | | | | | | | | | | | | | | | | | | | | In overlay application we noticed that dma channel node probe order is inverted i.e s2mm channel is probed first followed by mm2s channel. The reason for this inversion is fdtoverlay utility which uses a function called fdt_add_subnode(*). It stores the subnodes after the properties, this has the effect of inserting the new subnode before any others and the end result is a reversal. Because of this inverted channel probe order, the node probed first is assigned a '0' index instead of Channel ID should be '0' for tx and '1' for rx and dmatest client using the DT convention fails in dma transfer as channel are swapped. To fix above behavior and make channel assignment index independent of probe order, always assign mm2s channel at '0' index and the s2mm channel at IP specific fixed offset derived from the max_channels count. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Link: https://lore.kernel.org/r/1580388865-9960-3-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: xilinx_dma: Extend dma_config structure to store max channel countRadhey Shyam Pandey2020-02-251-1/+8
| | | | | | | | | | | Extend dma_config structure to store the max channel count. This input is used to populate dma device channel nodes at the fixed offset. It serves as a preparatory patch for removing dma channel DT node order dependency, added in the subsequent commit. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Link: https://lore.kernel.org/r/1580388865-9960-2-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: use vchan_terminate_vdesc() in .terminate_allAmelie Delaunay2020-02-251-3/+6
| | | | | | | | | | | | To avoid race with vchan_complete, use the race free way to terminate running transfer. Move vdesc->node list_del in stm32_dma_start_transfer instead of in stm32_mdma_chan_complete to avoid another race in vchan_dma_desc_free_list. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-9-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: fix sleeping function called from invalid contextAmelie Delaunay2020-02-251-18/+9
| | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes BUG: sleeping function called from invalid context in stm32_dma_disable_chan function. The goal of this function is to force channel disable if it has not been disabled by hardware. This consists in clearing STM32_DMA_SCR_EN bit and read it as 0 to ensure the channel is well disabled and the last transfer is over. In previous implementation, the waiting loop was based on a do...while (1) with a call to cond_resched to give the scheduler a chance to run a higher priority process. But in some conditions, stm32_dma_disable_chan can be called while preemption is disabled, on a stm32_dma_stop call for example. So cond_resched must not be used. To avoid this, use readl_relaxed_poll_timeout_atomic to poll STM32_DMA_SCR_EN bit cleared. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-8-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: add copy_align constraintAmelie Delaunay2020-02-251-0/+1
| | | | | | | | | | This patch adds copy_align property in accordance with hardware restriction. Signed-off-by: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-7-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: use dma_set_max_seg_size to set the sg limitAmelie Delaunay2020-02-251-0/+2
| | | | | | | | | | | This patch adds dma_set_max_seg_size to define sg dma constraint. This constraint may be taken into account by client to scatter/gather its buffer. Signed-off-by: Ludovic Barre <ludovic.barre@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-6-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: enable descriptor_reusePierre-Yves MORDRET2020-02-251-0/+2
| | | | | | | | | | Enable client to resubmit already processed descriptors in order to save descriptor creation time. Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-5-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: driver defers probe for resetEtienne Carriere2020-02-251-4/+11
| | | | | | | | | | | | | | Change STM32 DMA driver to defer its probe operation when reset controller is expected but has not been probed yet when DMA device is probed. Changes error traces when failing to get a system resource so that it is not printed on failure with deferred probing. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-4-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: use reset controller only at probe timeEtienne Carriere2020-02-251-5/+5
| | | | | | | | | | Remove reset controller reference from device instance since it is used only at probe time. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-3-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dma: add suspend/resume power management supportPierre-Yves MORDRET2020-02-251-0/+32
| | | | | | | | | Add suspend/resume power management relying on PM Runtime engine. Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200129153628.29329-2-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: xilinx_dma: Reset DMA channel in dma_terminate_allRadhey Shyam Pandey2020-02-241-8/+9
| | | | | | | | | | | | Reset DMA channel after stop to ensure that pending transfers and FIFOs in the datapath are flushed or completed. It also cleanup the terminate path and removes stop for the cyclic mode as after the reset stop is not required. This fixes intermittent data verification failure when xilinx dma test the client is stressed and loaded/unloaded multiple times. Signed-off-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com> Link: https://lore.kernel.org/r/1580283909-32678-1-git-send-email-radhey.shyam.pandey@xilinx.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dmamux: driver defers probe for clock and resetEtienne Carriere2020-02-241-4/+13
| | | | | | | | | | | | | Changes STM32 DMAMUX driver to defer its probe operation when reset controller is expected but has not been probed yet. Changes error traces when failing to get a system resource so that it is not printed on failure with deferred probing. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200128094158.20361-5-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dmamux: use reset controller only at probe timeEtienne Carriere2020-02-241-5/+5
| | | | | | | | | | Remove reset controller reference from device instance since it is used only at probe time. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200128094158.20361-4-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dmamux: fix clock handling in probe sequenceEtienne Carriere2020-02-241-9/+11
| | | | | | | | | | This change ensures the DMAMUX device is reset only once it is clocked and that clock is released in a safe state when probe operation fails. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200128094158.20361-3-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-dmamux: add suspend/resume power management supportPierre-Yves MORDRET2020-02-241-0/+50
| | | | | | | | | Add suspend/resume power management relying on PM Runtime engine. Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200128094158.20361-2-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: use vchan_terminate_vdesc() in .terminate_allAmelie Delaunay2020-02-241-3/+6
| | | | | | | | | | | | To avoid race with vchan_complete, use the race free way to terminate running transfer. Move vdesc->node list_del in stm32_mdma_start_transfer instead of in stm32_mdma_xfer_end to avoid another race in vchan_dma_desc_free_list. Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-7-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: enable descriptor_reusePierre-Yves MORDRET2020-02-241-0/+2
| | | | | | | | | | Enable descriptor reuse to allow client to resubmit already processed descriptors in order to save descriptor creation time. Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-6-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: driver defers probe for clock and resetAmelie Delaunay2020-02-241-3/+7
| | | | | | | | | | | | | This patch changes error log when failing to get the clock so that it is not printed on failure with probe deferring. It also defers probe when reset controller is expected but has not been probed yet when MDMA device is probed. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-5-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: disable clock in case of error during probeEtienne Carriere2020-02-241-6/+10
| | | | | | | | | | This patch disables the clock in case of error during probe. The unneeded err_unregister label is renamed err_clk instead. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-4-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: use reset controller only at probe timeEtienne Carriere2020-02-241-5/+5
| | | | | | | | | | Remove reset controller reference from device instance since it is used only at probe time. Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-3-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: stm32-mdma: add suspend/resume power management supportPierre-Yves MORDRET2020-02-241-0/+33
| | | | | | | | | Add suspend/resume power management relying on PM Runtime engine. Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Amelie Delaunay <amelie.delaunay@st.com> Link: https://lore.kernel.org/r/20200127085334.13163-2-amelie.delaunay@st.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmanegine: ioat/dca: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200214171302.GA20586@embeddedor Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: tegra210-adma: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200214171657.GA25663@embeddedor Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: sprd: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Reviewed-by: Baolin Wang <baolin.wang7@gmail.com> Link: https://lore.kernel.org/r/20200214171536.GA24077@embeddedor Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: sa11x0: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200214171435.GA22930@embeddedor Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: sun4i: set the linear_mode properlyVinod Koul2020-02-171-1/+1
| | | | | | | | | | | | Commit 6ebb827f7aad ("dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic") updated the condition but introduced a semi colon this making this statement have no effect, so add the bitwise OR to fix it" Fixes: 6ebb827f7aad ("dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclic") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Link: https://lore.kernel.org/r/20200214044609.2215861-1-vkoul@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: ti: dma-crossbar: convert to devm_platform_ioremap_resource()chenqiwu2020-02-131-6/+2
| | | | | | | | | Use a new API devm_platform_ioremap_resource() to simplify code. Signed-off-by: chenqiwu <chenqiwu@xiaomi.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/1580189746-2864-1-git-send-email-qiwuchen55@gmail.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: sun4i: use 'linear_mode' in sun4i_dma_prep_dma_cyclicYueHaibing2020-02-131-0/+2
| | | | | | | | | | | | | | drivers/dma/sun4i-dma.c: In function sun4i_dma_prep_dma_cyclic: drivers/dma/sun4i-dma.c:672:24: warning: variable linear_mode set but not used [-Wunused-but-set-variable] commit ffc079a4accc ("dmaengine: sun4i: Add support for cyclic requests with dedicated DMA") involved this, explicitly using the value makes the code more readable. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Link: https://lore.kernel.org/r/20200207024445.44600-1-yuehaibing@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: ti: omap-dma: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200213003925.GA6906@embeddedor.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: uniphier-mdmac: replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200213003535.GA3269@embeddedor.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: bcm-sba-raid: Replace zero-length array with flexible-array memberGustavo A. R. Silva2020-02-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current codebase makes use of the zero-length array language extension to the C90 standard, but the preferred mechanism to declare variable-length types such as these ones is a flexible array member[1][2], introduced in C99: struct foo { int stuff; struct boo array[]; }; By making use of the mechanism above, we will get a compiler warning in case the flexible array does not occur last in the structure, which will help us prevent some kind of undefined behavior bugs from being inadvertently introduced[3] to the codebase from now on. Also, notice that, dynamic memory allocations won't be affected by this change: "Flexible array members have incomplete type, and so the sizeof operator may not be applied. As a quirk of the original implementation of zero-length arrays, sizeof evaluates to zero."[1] This issue was found with the help of Coccinelle. [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html [2] https://github.com/KSPP/linux/issues/21 [3] commit 76497732932f ("cxgb3/l2t: Fix undefined behaviour") Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Link: https://lore.kernel.org/r/20200213003703.GA4177@embeddedor.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dt-bindings: dma: ti-edma: fix example compatible propertyJohan Hovold2020-02-131-1/+1
| | | | | | | | | | | Make sure that the compatible string in the edma1_tptc1 example node matches the binding by removing the space between the manufacturer and model. Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Link: https://lore.kernel.org/r/20200212104840.20393-1-johan@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org>
* dmaengine: idxd: remove set but not used variable 'idxd_cdev'YueHaibing2020-02-131-2/+0
| | | | | | | | | | | | | | | drivers/dma/idxd/cdev.c: In function idxd_cdev_open: drivers/dma/idxd/cdev.c:77:20: warning: variable idxd_cdev set but not used [-Wunused-but-set-variable] commit 42d279f9137a ("dmaengine: idxd: add char driver to expose submission portal to userland") involed this. Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20200210151855.55044-1-yuehaibing@huawei.com Signed-off-by: Vinod Koul <vkoul@kernel.org>