01 Oct, 2020

1 commit


18 Sep, 2020

2 commits

  • drivers/dma/iop-adma.c: In function ‘iop_adma_alloc_chan_resources’:
    drivers/dma/iop-adma.c:447:13: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    hw_desc = (char *) iop_chan->device->dma_desc_pool;
    ^
    drivers/dma/iop-adma.c:449:4: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    (dma_addr_t) &hw_desc[idx * IOP_ADMA_SLOT_SIZE];
    ^
    drivers/dma/iop-adma.c: In function ‘iop_adma_probe’:
    drivers/dma/iop-adma.c:1301:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
    (void *) adev->dma_desc_pool);

    Use dma_addr_t for dma_desc_pool, and %pad to print dma_addr_t.

    Signed-off-by: YueHaibing
    Link: https://lore.kernel.org/r/20200818115101.55700-1-yuehaibing@huawei.com
    Signed-off-by: Vinod Koul

    YueHaibing
     
  • In preparation for unconditionally passing the
    struct tasklet_struct pointer to all tasklet
    callbacks, switch to using the new tasklet_setup()
    and from_tasklet() to pass the tasklet pointer explicitly.

    Signed-off-by: Romain Perier
    Signed-off-by: Allen Pais
    Link: https://lore.kernel.org/r/20200831103542.305571-11-allen.lkml@gmail.com
    Signed-off-by: Vinod Koul

    Allen Pais
     

15 Jul, 2020

1 commit


14 Nov, 2019

1 commit


14 Oct, 2019

1 commit

  • Don't populate the array 'handler' on the stack but instead make it
    static const. Makes the object code smaller by 80 bytes.

    Before:
    text data bss dec hex filename
    38225 9084 64 47373 b90d drivers/dma/iop-adma.o

    After:
    text data bss dec hex filename
    38081 9148 64 47293 b8bd drivers/dma/iop-adma.o

    (gcc version 9.2.1, amd64)

    Signed-off-by: Colin Ian King
    Link: https://lore.kernel.org/r/20190905163726.19690-1-colin.king@canonical.com
    Signed-off-by: Vinod Koul

    Colin Ian King
     

18 Sep, 2019

1 commit

  • Pull dmaengine updates from Vinod Koul:

    - Move Dmaengine DT bindings to YAML and convert Allwinner to schema.

    - FSL dma device_synchronize implementation

    - DW split acpi and of helpers and updates to driver and support for
    Elkhart Lake

    - Move filter fn as private for omap-dma and edma drivers and
    improvements to these drivers

    - Mark expected switch fall-through in couple of drivers

    - Renames of shdma and nbpfaxi binding document

    - Minor updates to bunch of drivers

    * tag 'dmaengine-5.4-rc1' of git://git.infradead.org/users/vkoul/slave-dma: (55 commits)
    dmaengine: ti: edma: Use bitmap_set() instead of open coded edma_set_bits()
    dmaengine: ti: edma: Only reset region0 access registers
    dmaengine: ti: edma: Do not reset reserved paRAM slots
    dmaengine: iop-adma.c: fix printk format warning
    dmaengine: stm32-dma: Use struct_size() helper
    dt-bindings: dmaengine: dma-common: Fix the dma-channel-mask property
    dmanegine: ioat/dca: Use struct_size() helper
    dmaengine: iop-adma: remove set but not used variable 'slots_per_op'
    dmaengine: dmatest: Add support for completion polling
    dmaengine: ti: omap-dma: Remove variable override in omap_dma_tx_status()
    dmaengine: ti: omap-dma: Remove 'Assignment in if condition'
    dmaengine: ti: edma: Remove 'Assignment in if condition'
    dmaengine: dw: platform: Split OF helpers to separate module
    dmaengine: dw: platform: Split ACPI helpers to separate module
    dmaengine: dw: platform: Move handle check to dw_dma_acpi_controller_register()
    dmaengine: dw: platform: Switch to acpi_dma_controller_register()
    dmaengine: dw: platform: Use devm_platform_ioremap_resource()
    dmaengine: dw: platform: Enable iDMA 32-bit on Intel Elkhart Lake
    dmaengine: dw: platform: Use struct dw_dma_chip_pdata
    dmaengine: dw: Export struct dw_dma_chip_pdata for wider use
    ...

    Linus Torvalds
     

04 Sep, 2019

2 commits

  • Fix printk format warning in iop-adma.c (seen on x86_64) by using
    %pad:

    ../drivers/dma/iop-adma.c:118:12: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 6 has type ‘dma_addr_t {aka long long unsigned int}’ [-Wformat=]

    Fixes: c211092313b9 ("dmaengine: driver for the iop32x, iop33x, and iop13xx raid engines")
    Signed-off-by: Randy Dunlap
    Acked-by: Dan Williams
    Link: https://lore.kernel.org/r/1803541f-98a6-7cce-b050-ff1e9a333ab2@infradead.org
    Signed-off-by: Vinod Koul

    Randy Dunlap
     
  • Fixes gcc '-Wunused-but-set-variable' warning:

    drivers/dma/iop-adma.c: In function iop_adma_tx_submit:
    drivers/dma/iop-adma.c:367:6: warning:
    variable slots_per_op set but not used [-Wunused-but-set-variable]

    It is never used, so can be removed.

    Reported-by: Hulk Robot
    Signed-off-by: YueHaibing
    Link: https://lore.kernel.org/r/20190821121908.7468-1-yuehaibing@huawei.com
    Signed-off-by: Vinod Koul

    YueHaibing
     

14 Aug, 2019

3 commits

  • Now that iop3xx and iop13xx are gone, the iop-adma driver no
    longer needs to deal with incompatible register layout defined
    in machine specific header files.

    Move the iop32x specific definitions into drivers/dma/iop-adma.h
    and the platform_data into include/linux/platform_data/dma-iop32x.h,
    and change the machine code to no longer reference those.

    The DMA0_ID/DMA1_ID/AAU_ID macros are required as part of the
    platform data interface and still need to be visible, so move
    those from one header to the other.

    Link: https://lore.kernel.org/r/20190809163334.489360-4-arnd@arndb.de
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • When compile-testing on other architectures, we get lots of warnings
    about incorrect format strings, like:

    drivers/dma/iop-adma.c: In function 'iop_adma_alloc_slots':
    drivers/dma/iop-adma.c:307:6: warning: format '%x' expects argument of type 'unsigned int', but argument 6 has type 'dma_addr_t {aka long long unsigned int}' [-Wformat=]

    drivers/dma/iop-adma.c: In function 'iop_adma_prep_dma_memcpy':
    >> drivers/dma/iop-adma.c:518:40: warning: format '%u' expects argument of type 'unsigned int', but argument 5 has type 'size_t {aka long unsigned int}' [-Wformat=]

    Use %zu for printing size_t as required, and cast the dma_addr_t
    arguments to 'u64' for printing with %llx. Ideally this should use
    the %pad format string, but that requires an lvalue argument that
    doesn't work here.

    Link: https://lore.kernel.org/r/20190809163334.489360-3-arnd@arndb.de
    Signed-off-by: Arnd Bergmann
    Acked-by: Vinod Koul
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     
  • Compile-testing this driver fails on m68k without the
    extra header inclusion.

    Link: https://lore.kernel.org/r/20190809163334.489360-2-arnd@arndb.de
    Reported-by: kbuild test robot
    Signed-off-by: Arnd Bergmann
    Acked-by: Vinod Koul
    Signed-off-by: Arnd Bergmann

    Arnd Bergmann
     

05 Jun, 2019

1 commit

  • Based on 1 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms and conditions of the gnu general public license
    version 2 as published by the free software foundation this program
    is distributed in the hope it will be useful but without any
    warranty without even the implied warranty of merchantability or
    fitness for a particular purpose see the gnu general public license
    for more details

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 263 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Allison Randal
    Reviewed-by: Alexios Zavras
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

08 Aug, 2016

1 commit

  • This is in preperation of moving to a callback that provides results to the
    callback for the transaction. The conversion will maintain current behavior
    and the driver must convert to new callback mechanism at a later time in
    order to receive results.

    Signed-off-by: Dave Jiang
    Reviewed-by: Lars-Peter Clausen
    Signed-off-by: Vinod Koul

    Dave Jiang
     

09 Mar, 2016

1 commit

  • Rename dma_*_writecombine() to dma_*_wc(), so that the naming
    is coherent across the various write-combining APIs. Keep the
    old names for compatibility for a while, these can be removed
    at a later time. A guard is left to enable backporting of the
    rename, and later remove of the old mapping defines seemlessly.

    Build tested successfully with allmodconfig.

    The following Coccinelle SmPL patch was used for this simple
    transformation:

    @ rename_dma_alloc_writecombine @
    expression dev, size, dma_addr, gfp;
    @@

    -dma_alloc_writecombine(dev, size, dma_addr, gfp)
    +dma_alloc_wc(dev, size, dma_addr, gfp)

    @ rename_dma_free_writecombine @
    expression dev, size, cpu_addr, dma_addr;
    @@

    -dma_free_writecombine(dev, size, cpu_addr, dma_addr)
    +dma_free_wc(dev, size, cpu_addr, dma_addr)

    @ rename_dma_mmap_writecombine @
    expression dev, vma, cpu_addr, dma_addr, size;
    @@

    -dma_mmap_writecombine(dev, vma, cpu_addr, dma_addr, size)
    +dma_mmap_wc(dev, vma, cpu_addr, dma_addr, size)

    We also keep the old names as compatibility helpers, and
    guard against their definition to make backporting easier.

    Generated-by: Coccinelle SmPL
    Suggested-by: Ingo Molnar
    Signed-off-by: Luis R. Rodriguez
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: airlied@linux.ie
    Cc: akpm@linux-foundation.org
    Cc: benh@kernel.crashing.org
    Cc: bhelgaas@google.com
    Cc: bp@suse.de
    Cc: dan.j.williams@intel.com
    Cc: daniel.vetter@ffwll.ch
    Cc: dhowells@redhat.com
    Cc: julia.lawall@lip6.fr
    Cc: konrad.wilk@oracle.com
    Cc: linux-fbdev@vger.kernel.org
    Cc: linux-pci@vger.kernel.org
    Cc: luto@amacapital.net
    Cc: mst@redhat.com
    Cc: tomi.valkeinen@ti.com
    Cc: toshi.kani@hp.com
    Cc: vinod.koul@intel.com
    Cc: xen-devel@lists.xensource.com
    Link: http://lkml.kernel.org/r/1453516462-4844-1-git-send-email-mcgrof@do-not-panic.com
    Signed-off-by: Ingo Molnar

    Luis R. Rodriguez
     

25 Aug, 2015

1 commit

  • dma_alloc_writecombine()'s call and return value check is
    tangled in all in one call. Untangle both calls according to
    kernel coding style.

    Signed-off-by: Luis R. Rodriguez
    Signed-off-by: Borislav Petkov
    Acked-by: Vinod Koul
    Cc: Dan Williams
    Cc: Linus Torvalds
    Cc: Peter Zijlstra
    Cc: Thomas Gleixner
    Cc: airlied@linux.ie
    Cc: benh@kernel.crashing.org
    Cc: bhelgaas@google.com
    Cc: daniel.vetter@ffwll.ch
    Cc: dmaengine@vger.kernel.org
    Cc: konrad.wilk@oracle.com
    Cc: luto@amacapital.net
    Cc: mst@redhat.com
    Cc: tomi.valkeinen@ti.com
    Cc: toshi.kani@hp.com
    Cc: xen-devel@lists.xensource.com
    Link: http://lkml.kernel.org/r/1440443613-13696-10-git-send-email-mcgrof@do-not-panic.com
    Signed-off-by: Ingo Molnar

    Luis R. Rodriguez
     

17 Mar, 2015

1 commit

  • Free Software Foundation mailing address has been moved in the past and some
    of the addresses here are outdated. Remove them from file headers since the
    COPYING file in the kernel sources includes it.

    Signed-off-by: Jarkko Nikula
    Signed-off-by: Vinod Koul

    Jarkko Nikula
     

06 Nov, 2014

1 commit

  • There is no need to init .owner field.

    Based on the patch from Peter Griffin
    "mmc: remove .owner field for drivers using module_platform_driver"

    This patch removes the superflous .owner field for drivers which
    use the module_platform_driver API, as this is overriden in
    platform_driver_register anyway."

    Signed-off-by: Kiran Padwal
    [for nvidia]
    Acked-by: Thierry Reding
    Signed-off-by: Vinod Koul

    Kiran Padwal
     

16 Nov, 2013

1 commit

  • Pull dmaengine changes from Dan

    1/ Bartlomiej and Dan finalized a rework of the dma address unmap
    implementation.

    2/ In the course of testing 1/ a collection of enhancements to dmatest
    fell out. Notably basic performance statistics, and fixed / enhanced
    test control through new module parameters 'run', 'wait', 'noverify',
    and 'verbose'. Thanks to Andriy and Linus for their review.

    3/ Testing the raid related corner cases of 1/ triggered bugs in the
    recently added 16-source operation support in the ioatdma driver.

    4/ Some minor fixes / cleanups to mv_xor and ioatdma.

    Conflicts:
    drivers/dma/dmatest.c

    Signed-off-by: Vinod Koul

    Vinod Koul
     

15 Nov, 2013

1 commit

  • Remove support for DMA unmapping from drivers as it is no longer
    needed (DMA core code is now handling it).

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    [djbw: fix up chan2parent() unused warning in drivers/dma/dw/core.c]
    Signed-off-by: Dan Williams

    Bartlomiej Zolnierkiewicz
     

14 Nov, 2013

1 commit

  • Add a hook for a common dma unmap implementation to enable removal of
    the per driver custom unmap code. (A reworked version of Bartlomiej
    Zolnierkiewicz's patches to remove the custom callbacks and the size
    increase of dma_async_tx_descriptor for drivers that don't care about
    raid).

    Cc: Vinod Koul
    Cc: Tomasz Figa
    Cc: Dave Jiang
    [bzolnier: prepare pl330 driver for adding missing unmap while at it]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Dan Williams

    Dan Williams
     

25 Oct, 2013

1 commit


13 Aug, 2013

1 commit


10 Jul, 2013

1 commit

  • The recent "drivers/dma: remove unused support for MEMSET operations"
    change has fallout from lack of build testing by the author. This
    fixes:

    drivers/dma/iop-adma.c:1020:13: warning: unused variable 'dma_addr' [-Wunused-variable]
    drivers/dma/iop-adma.c:1519:2: warning: format '%s' expects a matching 'char *' argument [-Wformat=]

    Signed-off-by: Olof Johansson
    Cc: Bartlomiej Zolnierkiewicz
    Cc: Kyungmin Park
    Cc: Sebastian Hesselbarth
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Olof Johansson
     

04 Jul, 2013

1 commit

  • There have never been any real users of MEMSET operations since they
    have been introduced in January 2007 by commit 7405f74badf4 ("dmaengine:
    refactor dmaengine around dma_async_tx_descriptor"). Therefore remove
    support for them for now, it can be always brought back when needed.

    [sebastian.hesselbarth@gmail.com: fix drivers/dma/mv_xor]
    Signed-off-by: Bartlomiej Zolnierkiewicz
    Signed-off-by: Kyungmin Park
    Signed-off-by: Sebastian Hesselbarth
    Cc: Vinod Koul
    Acked-by: Dan Williams
    Cc: Tomasz Figa
    Cc: Herbert Xu
    Cc: Olof Johansson
    Cc: Kevin Hilman
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Bartlomiej Zolnierkiewicz
     

27 Feb, 2013

1 commit

  • Pull slave-dmaengine updates from Vinod Koul:
    "This is fairly big pull by my standards as I had missed last merge
    window. So we have the support for device tree for slave-dmaengine,
    large updates to dw_dmac driver from Andy for reusing on different
    architectures. Along with this we have fixes on bunch of the drivers"

    Fix up trivial conflicts, usually due to #include line movement next to
    each other.

    * 'next' of git://git.infradead.org/users/vkoul/slave-dma: (111 commits)
    Revert "ARM: SPEAr13xx: Pass DW DMAC platform data from DT"
    ARM: dts: pl330: Add #dma-cells for generic dma binding support
    DMA: PL330: Register the DMA controller with the generic DMA helpers
    DMA: PL330: Add xlate function
    DMA: PL330: Add new pl330 filter for DT case.
    dma: tegra20-apb-dma: remove unnecessary assignment
    edma: do not waste memory for dma_mask
    dma: coh901318: set residue only if dma is in progress
    dma: coh901318: avoid unbalanced locking
    dmaengine.h: remove redundant else keyword
    dma: of-dma: protect list write operation by spin_lock
    dmaengine: ste_dma40: do not remove descriptors for cyclic transfers
    dma: of-dma.c: fix memory leakage
    dw_dmac: apply default dma_mask if needed
    dmaengine: ioat - fix spare sparse complain
    dmaengine: move drivers/of/dma.c -> drivers/dma/of-dma.c
    ioatdma: fix race between updating ioat->head and IOAT_COMPLETION_PENDING
    dw_dmac: add support for Lynxpoint DMA controllers
    dw_dmac: return proper residue value
    dw_dmac: fill individual length of descriptor
    ...

    Linus Torvalds
     

08 Jan, 2013

1 commit


04 Jan, 2013

1 commit

  • CONFIG_HOTPLUG is going away as an option. As a result, the __dev*
    markings need to be removed.

    This change removes the use of __devinit, __devexit_p, __devinitconst,
    and __devexit from these drivers.

    Based on patches originally written by Bill Pemberton, but redone by me
    in order to handle some of the coding style issues better, by hand.

    Cc: Bill Pemberton
    Cc: Viresh Kumar
    Cc: Dan Williams
    Cc: Vinod Koul
    Cc: Barry Song
    Cc: Jeff Kirsher
    Cc: Alexander Duyck
    Cc: Russell King
    Cc: Linus Walleij
    Cc: Jassi Brar
    Cc: Dave Jiang
    Cc: Bill Pemberton
    Cc: Guennadi Liakhovetski
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

29 Nov, 2012

2 commits


11 Apr, 2012

1 commit

  • Pull dmaengine fixes from Dan Williams:

    1/ regression fix for Xen as it now trips over a broken assumption
    about the dma address size on 32-bit builds

    2/ new quirk for netdma to ignore dma channels that cannot meet
    netdma alignment requirements

    3/ fixes for two long standing issues in ioatdma (ring size overflow)
    and iop-adma (potential stack corruption)

    * tag 'dmaengine-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/djbw/dmaengine:
    netdma: adding alignment check for NETDMA ops
    ioatdma: DMA copy alignment needed to address IOAT DMA silicon errata
    ioat: ring size variables need to be 32bit to avoid overflow
    iop-adma: Corrected array overflow in RAID6 Xscale(R) test.
    ioat: fix size of 'completion' for Xen

    Linus Torvalds
     

30 Mar, 2012

1 commit

  • Pull slave-dmaengine update from Vinod Koul:
    "This includes the cookie cleanup by Russell, the addition of context
    parameter for dmaengine APIs, more arm dmaengine driver cleanup by
    moving code to dmaengine, this time for imx by Javier and pl330 by
    Boojin along with the usual driver fixes."

    Fix up some fairly trivial conflicts with various other cleanups.

    * 'next' of git://git.infradead.org/users/vkoul/slave-dma: (67 commits)
    dmaengine: imx: fix the build failure on x86_64
    dmaengine: i.MX: Fix merge of cookie branch.
    dmaengine: i.MX: Add support for interleaved transfers.
    dmaengine: imx-dma: use 'dev_dbg' and 'dev_warn' for messages.
    dmaengine: imx-dma: remove 'imx_dmav1_baseaddr' and 'dma_clk'.
    dmaengine: imx-dma: remove unused arg of imxdma_sg_next.
    dmaengine: imx-dma: remove internal structure.
    dmaengine: imx-dma: remove 'resbytes' field of 'internal' structure.
    dmaengine: imx-dma: remove 'in_use' field of 'internal' structure.
    dmaengine: imx-dma: remove sg member from internal structure.
    dmaengine: imx-dma: remove 'imxdma_setup_sg_hw' function.
    dmaengine: imx-dma: remove 'imxdma_config_channel_hw' function.
    dmaengine: imx-dma: remove 'imxdma_setup_mem2mem_hw' function.
    dmaengine: imx-dma: remove dma_mode member of internal structure.
    dmaengine: imx-dma: remove data member from internal structure.
    dmaengine: imx-dma: merge old dma-v1.c with imx-dma.c
    dmaengine: at_hdmac: add slave config operation
    dmaengine: add context parameter to prep_slave_sg and prep_dma_cyclic
    dmaengine/dma_slave: introduce inline wrappers
    dma: imx-sdma: Treat firmware messages as warnings instead of erros
    ...

    Linus Torvalds
     

28 Mar, 2012

1 commit

  • Bug: cppcheck reported overflow in array assignment (for loop walks
    0 to IOP_ADMA_NUM_SRC_TEST+2, array size is IOP_ADMA_NUM_SRC_TEST).

    Reported as: https://bugzilla.kernel.org/show_bug.cgi?id=42677

    Test code pq_src array was grown by two elements to correspond with actual
    usage (IOP_ADMA_NUM_SRC_TEST+2), stack consumption was kept constant by
    modifying the pq_dest two element array which is only used when pq_src
    is referenced up to IOP_ADMA_NUM_SRC_TEST elements into the address
    of the new last two elements of the pq_src array. This is presumed to
    be the original intent but would be reliant on compilers always having
    pq_dest contiguous with the final element of pq_src.

    Note: This is a re-send of a request for review from two weeks ago.
    Looking for review (or shootdown), adding LKML to list for a wider
    audience. Thanks.

    Updated per review comments of Sergei Shtylyov

    Signed-off-by: Don Morris
    Signed-off-by: Dan Williams

    Don Morris
     

13 Mar, 2012

7 commits

  • Fixed trivial issues in drivers:
    drivers/dma/imx-sdma.c
    drivers/dma/intel_mid_dma.c
    drivers/dma/ioat/dma_v3.c
    drivers/dma/iop-adma.c
    drivers/dma/sirf-dma.c
    drivers/dma/timb_dma.c

    Signed-off-by: Vinod Koul

    Vinod Koul
     
  • Ensure all DMA engine drivers initialize their cookies in the same way,
    so that they all behave in a similar fashion. This means their first
    issued cookie will be 2 rather than 1, and will increment to INT_MAX
    before returning 1 and starting over.

    In connection with this, Dan Williams said:
    > Russell King wrote:
    > > Secondly, some DMA engine drivers initialize the dma_chan cookie to 0,
    > > others to 1.  Is there a reason for this, or are these all buggy?
    >
    > I know that ioat and iop-adma expect 0 to mean "I have cleaned up this
    > descriptor and it is idle", and would break if zero was an in-flight
    > cookie value. The reserved usage of zero is an driver internal
    > concern, but I have no problem formalizing it as a reserved value.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     
  • Dan Williams said:
    > > Russell King wrote:
    > > Firstly, we have DMA_MIN_COOKIE which has value 1 - so any cookies below
    > > that aren't valid.  That seems sane.
    > >
    > > We seem to have different behaviours:
    > >
    > > -       cookie = c->cookie;
    > > -       cookie++;
    > > -       if (cookie < 0)
    > > -               cookie = 1;
    > > -       c->cookie = cookie;
    > > -       tx->cookie = cookie;
    > >
    > > c->cookie here is initialized to zero, so the first cookie given out will
    > > be 1.  This is how most DMA engine drivers implement this.
    > >
    > > Then we have this:
    > >
    > >                cookie = chan->common.cookie;
    > >                cookie++;
    > >                if (cookie >                        cookie = 2;
    > >
    > >                /* initialize the completed cookie to be less than
    > >                 * the most recently used cookie
    > >                 */
    > >                chan->common.completed_cookie = cookie - 1;
    > >                chan->common.cookie = sw_desc->async_tx.cookie = cookie;
    > >
    > > Again, chan->common.cookie starts off at 0.  The first cookie given out
    > > will be 2, and 1 will never be used.  There are three drivers which
    > > implement it this way.
    > >
    > > Why is there this difference, and can these three be corrected to behave
    > > the same way as the first (and therefore the assignment of cookies
    > > consolidated?)
    >
    > Yes, they should be consolidated, and I believe they have drifted only
    > because there were no good common helpers and murphy's law took over.

    So lets fix this up to use the common dma_cookie_assign() helper.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     
  • Now that we have the completed cookie in the dma_chan structure, we
    can consolidate the tx_status functions by providing a function to set
    the txstate structure and returning the DMA status. We also provide
    a separate helper to set the residue for cookies which are still in
    progress.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     
  • Everyone deals with assigning DMA cookies in the same way (it's part of
    the API so they should be), so lets consolidate the common code into a
    helper function to avoid this duplication.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     
  • Add a local private header file to contain definitions and declarations
    which should only be used by DMA engine drivers.

    We also fix linux/dmaengine.h to use LINUX_DMAENGINE_H to guard against
    multiple inclusion.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux
     
  • Every DMA engine implementation declares a last completed dma cookie
    in their private dma channel structures. This is pointless, and
    forces driver specific code. Move this out into the common dma_chan
    structure.

    Signed-off-by: Russell King
    Tested-by: Linus Walleij
    Reviewed-by: Linus Walleij
    Acked-by: Jassi Brar
    [imx-sdma.c & mxs-dma.c]
    Tested-by: Shawn Guo
    Signed-off-by: Vinod Koul

    Russell King - ARM Linux