Re: [PATCH v2] char: xillybus: Eliminate redundant wrappers to DMA related calls
From: Arnd Bergmann
Date: Wed Sep 29 2021 - 08:08:49 EST
On Wed, Sep 29, 2021 at 11:44 AM <eli.billauer@xxxxxxxxx> wrote:
> From: Eli Billauer <eli.billauer@xxxxxxxxx>
> The driver was originally written with the assumption that a different
> API must be used for DMA-related functions if the device is PCIe based
> or if not. Since Xillybus' driver supports devices on a PCIe bus (with
> xillybus_pcie) as well as connected directly to the processor (with
> xillybus_of), it originally used wrapper functions that ensure that
> a different API is used for each.
> This patch eliminates the said wrapper functions, as all use the same
> dma_* API now. This is most notable by the code deleted in xillybus_pcie.c
> and xillybus_of.c.
> It also eliminates the OF driver's check for a "dma-coherent" attribute
> in the device's OF entry, since this is taken care of by the kernel's
> implementation of dma_sync_single_for_*().
> There is however still need for one wrapper function, which is merged
> from xillybus_pcie.c and xillybus_of.c into xillybus_core.c: The call to
> dma_map_single() is wrapped by a function that uses the Managed Device
> (devres) framework, in the absence of a relevant function in the current
> kernel's API.
> Suggested-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx>
> Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
> Signed-off-by: Eli Billauer <eli.billauer@xxxxxxxxx>
Reviewed-by: Arnd Bergmann <arnd@xxxxxxxx>