Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

From: éåæ
Date: Mon Sep 25 2017 - 21:48:32 EST


Hi, Christoph,

Can I put the declaration in asm/dma-coherence.h?

And, last time you said it is OK to pass a NULL to dma_get_cache_alignment() and cc all driver maintainers. I have do so.

Huacai

------------------ Original ------------------
From: "Christoph Hellwig"<hch@xxxxxx>;
Date: Mon, Sep 25, 2017 08:51 PM
To: "Huacai Chen"<chenhc@xxxxxxxxxx>;
Cc: "Christoph Hellwig"<hch@xxxxxx>; "Marek Szyprowski"<m.szyprowski@xxxxxxxxxxx>; "Robin Murphy"<robin.murphy@xxxxxxx>; "Andrew Morton"<akpm@xxxxxxxxxxxxxxxxxxxx>; "Fuxin Zhang"<zhangfx@xxxxxxxxxx>; "linux-kernel"<linux-kernel@xxxxxxxxxxxxxxx>; "Ralf Baechle"<ralf@xxxxxxxxxxxxxx>; "James Hogan"<james.hogan@xxxxxxxxxx>; "linux-mips"<linux-mips@xxxxxxxxxxxxxx>; "James E . J . Bottomley"<jejb@xxxxxxxxxxxxxxxxxx>; "Martin K . Petersen"<martin.petersen@xxxxxxxxxx>; "linux-scsi"<linux-scsi@xxxxxxxxxxxxxxx>; "Roland Dreier"<rolandd@xxxxxxxxx>; "Pawel Osciak"<pawel@xxxxxxxxxx>; "Kyungmin Park"<kyungmin.park@xxxxxxxxxxx>; "Michael Chan"<michael.chan@xxxxxxxxxxxx>; "Benjamin Herrenschmidt"<benh@xxxxxxxxxxxxxxxxxxx>; "Ivan Mikhaylov"<ivan@xxxxxxxxxx>; "Tariq Toukan"<tariqt@xxxxxxxxxxxx>; "Andy Gross"<agross@xxxxxxxxxxxxxx>; "Mark A . Greer"<mgreer@xxxxxxxxxx>; "Robert Baldyga"<r.baldyga@xxxxxxxxxxx>; "stable"<stable@xxxxxxxxxxxxxxx>;
Subject: Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()


> index aba7138..e2c5d9e 100644
> --- a/arch/mips/include/asm/dma-mapping.h
> +++ b/arch/mips/include/asm/dma-mapping.h
> @@ -39,4 +39,6 @@ static inline void arch_setup_dma_ops(struct device *dev, u64 dma_base,
> #endif
> }
>
> +int mips_get_cache_alignment(struct device *dev);

All the other mips generic dma helpers are prefixed mips_dma_*
so it might make sense to follow that.

Also please don't add arch-local helpers to asm/dma-mapping.h - this
is a header used by linux/dma-mapping.h and should not contain
implementation details if avoidable.

> + dma_get_cache_alignment(NULL)) / mdev->limits.mtt_seg_size;

As said before - please don't pass NULL to this function but the proper
device, which would be &mdev->pdev->dev in this case for example.