linux/drivers/spi
Russell King - ARM Linux 07fe035170 spi/omap: Fix DMA API usage in OMAP MCSPI driver
Running the latest kernel on the 4430SDP board with DMA API debugging
enabled results in this:

WARNING: at lib/dma-debug.c:803 check_unmap+0x19c/0x6f0()
NULL NULL: DMA-API: device driver tries to free DMA memory it has not allocated
[device address=0x000000008129901a] [size=260 bytes]
Modules linked in:
Backtrace:
[<c003cbe0>] (dump_backtrace+0x0/0x10c) from [<c0278da8>] (dump_stack+0x18/0x1c)
 r7:c1839dc0 r6:c0198578 r5:c0304b17 r4:00000323
[<c0278d90>] (dump_stack+0x0/0x1c) from [<c005b158>] (warn_slowpath_common+0x58/0x70)
[<c005b100>] (warn_slowpath_common+0x0/0x70) from [<c005b214>] (warn_slowpath_fmt+0x38/0x40)
 r8:c1839e40 r7:00000000 r6:00000104 r5:00000000 r4:8129901a
[<c005b1dc>] (warn_slowpath_fmt+0x0/0x40) from [<c0198578>] (check_unmap+0x19c/0x6f0)
 r3:c03110de r2:c0304e6b
[<c01983dc>] (check_unmap+0x0/0x6f0) from [<c0198cd8>] (debug_dma_unmap_page+0x74/0x80)
[<c0198c64>] (debug_dma_unmap_page+0x0/0x80) from [<c01d5ad8>] (omap2_mcspi_work+0x514/0xbf0)
[<c01d55c4>] (omap2_mcspi_work+0x0/0xbf0) from [<c006dfb0>] (process_one_work+0x294/0x400)
[<c006dd1c>] (process_one_work+0x0/0x400) from [<c006e50c>] (worker_thread+0x220/0x3f8)
[<c006e2ec>] (worker_thread+0x0/0x3f8) from [<c00738d0>] (kthread+0x88/0x90)
[<c0073848>] (kthread+0x0/0x90) from [<c005e924>] (do_exit+0x0/0x5fc)
 r7:00000013 r6:c005e924 r5:c0073848 r4:c1829ee0
---[ end trace 1b75b31a2719ed20 ]---

I've no idea why this driver uses NULL for dma_unmap_single instead of
the &spi->dev that is laying around just waiting to be used in that
function - but it's an easy fix.

Also replace this comment with a FIXME comment:
                /* Do DMA mapping "early" for better error reporting and
                 * dcache use.  Note that if dma_unmap_single() ever starts
                 * to do real work on ARM, we'd need to clean up mappings
                 * for previous transfers on *ALL* exits of this loop...
                 */
as the comment is not true - we do work in dma_unmap() functions,
particularly on ARMv6 and above.  I've corrected the existing unmap
functions but if any others are required they must be added ASAP.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
2011-01-07 13:44:24 -07:00
..
amba-pl022.c spi/pl022: convert running variable 2010-12-23 21:06:47 -07:00
atmel_spi.c atmel_spi: fix warning In function 'atmel_spi_dma_map_xfer' 2010-11-30 17:23:24 +01:00
atmel_spi.h
au1550_spi.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
coldfire_qspi.c m68knommu: include sched.h in ColdFire/SPI driver 2010-08-18 12:44:31 +10:00
davinci_spi.c spi: davinci: shorten variable names 2010-11-18 18:38:38 +05:30
dw_spi_mid.c spi/dw_spi: add DMA support 2010-12-24 01:23:25 -07:00
dw_spi_mmio.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
dw_spi_pci.c spi/dw_spi: add DMA support 2010-12-24 01:23:25 -07:00
dw_spi.c spi/dw_spi Typo change diable to disable. 2010-12-30 23:44:55 -07:00
ep93xx_spi.c spi/ep93xx: implemented driver for Cirrus EP93xx SPI controller 2010-05-25 00:23:16 -06:00
Kconfig Merge branch 'spi' of git://git.linutronix.de/users/bigeasy/soda into spi/next 2010-12-29 01:05:50 -07:00
Makefile Merge branch 'spi' of git://git.linutronix.de/users/bigeasy/soda into spi/next 2010-12-29 01:05:50 -07:00
mpc52xx_psc_spi.c spi/mpc52xx-psc-spi: move probe/remove to proper sections 2010-12-24 11:18:34 -07:00
mpc52xx_spi.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
mpc512x_psc_spi.c Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2010-08-14 11:54:09 -07:00
omap2_mcspi.c spi/omap: Fix DMA API usage in OMAP MCSPI driver 2011-01-07 13:44:24 -07:00
omap_spi_100k.c SPI100k: Fix 8-bit and RX-only transfers 2010-07-03 22:45:44 -06:00
omap_uwire.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
orion_spi.c spi/orion: Drop unnecessary null test 2010-09-29 17:31:29 +09:00
pxa2xx_spi_pci.c spi/pxa2xx: Add CE4100 support 2010-12-01 13:48:30 +01:00
pxa2xx_spi.c spi/pxa2xx: pass of_node to spi device and set a parent device 2010-12-02 17:55:13 +01:00
spi_bfin5xx.c spi/bfin_spi: only request GPIO on first load 2010-10-22 01:26:46 -06:00
spi_bitbang_txrx.h spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes 2010-07-03 22:45:44 -06:00
spi_bitbang.c spi/bitbang: reinitialize transfer parameters for every message 2010-07-03 22:59:18 -06:00
spi_butterfly.c spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes 2010-07-03 22:45:44 -06:00
spi_fsl_espi.c spi/fsl_espi: change the read behaviour of the SPIRF 2010-12-29 23:04:46 -07:00
spi_fsl_lib.c spi/mpc8xxx: refactor the common code for SPI/eSPI controller 2010-10-12 21:38:12 -06:00
spi_fsl_lib.h spi/fsl_spi: Fix compile errors when building on ppc64 2010-10-14 08:30:12 -06:00
spi_fsl_spi.c spi/mpc8xxx: refactor the common code for SPI/eSPI controller 2010-10-12 21:38:12 -06:00
spi_gpio.c spi: spi-gpio.c tests SPI_MASTER_NO_RX bit twice, but not SPI_MASTER_NO_TX 2010-10-02 21:09:08 -06:00
spi_imx.c spi/imx: correct the test on platform_get_irq() return value 2011-01-07 10:01:23 -07:00
spi_lm70llp.c spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes 2010-07-03 22:45:44 -06:00
spi_nuc900.c drivers/spi: Remove unnecessary semicolons 2010-11-14 20:57:20 -07:00
spi_ppc4xx.c of/device: Replace struct of_device with struct platform_device 2010-08-06 09:25:50 -06:00
spi_s3c24xx_fiq.h spi_s3c24xx: add FIQ pseudo-DMA support 2009-12-17 08:57:01 -07:00
spi_s3c24xx_fiq.S spi_s3c24xx: add FIQ pseudo-DMA support 2009-12-17 08:57:01 -07:00
spi_s3c24xx_gpio.c spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes 2010-07-03 22:45:44 -06:00
spi_s3c24xx.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
spi_s3c64xx.c spi/s3c64xx: Correction for 16,32 bits bus width 2010-09-29 17:31:33 +09:00
spi_sh_msiof.c Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2010-02-25 15:38:03 -08:00
spi_sh_sci.c spi/bitbang: add support for SPI_MASTER_NO_{TX, RX} modes 2010-07-03 22:45:44 -06:00
spi_stmp.c spi: Fix reversed args to time_before() in Freescale stmp driver. 2010-01-20 13:49:44 -07:00
spi_tegra.c spi: tegra: fix error setting on timeout 2010-10-25 16:57:46 -07:00
spi_topcliff_pch.c spi/topcliff: Typo fix threhold to threshold 2010-12-31 17:49:30 -07:00
spi_txx9.c Merge branch 'next-spi' of git://git.secretlab.ca/git/linux-2.6 2009-12-17 15:59:05 -08:00
spi.c spi: fixed odd static string conventions in core code 2010-10-22 09:51:05 -06:00
spidev.c llseek: automatically add .llseek fop 2010-10-15 15:53:27 +02:00
tle62x0.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
xilinx_spi.c spi/xilinx: merge OF support code into main driver 2010-11-09 21:41:28 -07:00