Re: [PATCH -mm 0/6] remove unnecessary sync_single_range_* indma_map_ops

From: FUJITA Tomonori
Date: Mon May 10 2010 - 05:50:11 EST


On Mon, 10 May 2010 10:29:09 +0100
Russell King <rmk@xxxxxxxxxxxxxxxx> wrote:

> On Tue, Apr 27, 2010 at 09:25:34PM +0900, FUJITA Tomonori wrote:
> > This patchset removes useless sync_single_range_for_cpu and
> > sync_single_range_for_device hooks in dma_map_ops. These hooks were
> > for dma_sync_single_range_* DMA API, however, the API became obsolete
> > (the description in DMA API docs was removed too). Architecutres
> > should use sync_single_for_cpu and sync_single_for_device hooks
> > instead (as DMA API docs say, they need to support a partial sync).
>
> If you're going to do this, then please catch all instances - compare
> the number of places which contain "dma_sync_single_range" with your
> diffstat and you'll notice you've missed a _lot_ of places.
>
> $ git grep -l '\<dma_sync_single_range'
> arch/arm/include/asm/dma-mapping.h
> arch/avr32/include/asm/dma-mapping.h
> arch/blackfin/include/asm/dma-mapping.h
> arch/cris/include/asm/dma-mapping.h
> arch/frv/include/asm/dma-mapping.h
> arch/m68k/include/asm/dma-mapping.h
> arch/mips/include/asm/dma-mapping.h
> arch/mips/mm/dma-default.c
> arch/mn10300/include/asm/dma-mapping.h
> arch/parisc/include/asm/dma-mapping.h
> arch/xtensa/include/asm/dma-mapping.h
> include/asm-generic/dma-mapping-broken.h
> include/asm-generic/dma-mapping-common.h
> include/linux/ssb/ssb.h

The patchset doesn't remove dma_sync_single_range_for_{cpu|device}
API. It removes sync_single_range_for_cpu and
sync_single_range_for_device hooks in struct dma_map_ops. The above
architectures doesn't use struct dma_map_ops so not related with this
patchset.

With this patchset, on the architectures using dma_map_ops,
dma_sync_single_range_for_cpu and dma_sync_single_range_for_device is
just the wrapper of dma_sync_single_for_cpu and
dma_sync_single_for_device.

static inline void dma_sync_single_range_for_cpu(struct device *dev,
dma_addr_t addr,
unsigned long offset,
size_t size,
enum dma_data_direction dir)
{
dma_sync_single_for_cpu(dev, addr + offset, size, dir);
}

static inline void dma_sync_single_range_for_device(struct device *dev,
dma_addr_t addr,
unsigned long offset,
size_t size,
enum dma_data_direction dir)
{
dma_sync_single_for_device(dev, addr + offset, size, dir);
}

dma_sync_single_range_for_cpu and dma_sync_single_range_for_device are
obsolete but the API had been for some time so I guess that we can't
just remove it; we need to add it to feature-removal-schedule, put
__deprecated, and wait for some time. But the API is rarely used so
I'm not against removing it now.


> vs.
>
> > arch/ia64/kernel/pci-swiotlb.c | 2 -
> > arch/powerpc/kernel/dma-swiotlb.c | 4 +-
> > arch/powerpc/kernel/dma.c | 12 +++++-----
> > arch/x86/kernel/pci-swiotlb.c | 2 -
> > include/asm-generic/dma-mapping-common.h | 20 +-----------------
> > include/linux/dma-mapping.h | 10 ---------
> > include/linux/swiotlb.h | 10 ---------
> > lib/swiotlb.c | 31 ------------------------------
> > 8 files changed, 10 insertions(+), 81 deletions(-)
>
> It seems there's users of this API in linux/ssb/ssb.h.

As I wrote, the patchset doesn't remove the
dma_sync_single_range_for_{cpu|device} API so ssb.h is fine. However,
the -mm has patches to remove dma_sync_single_range_for_{cpu|device}
usage in ssb.h. There should be no user of this API in the -mm.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/