Re: [PATCH net-next v3 2/7] dma: avoid redundant calls for sync operations

From: Christoph Hellwig
Date: Thu Feb 15 2024 - 00:09:17 EST


On Wed, Feb 14, 2024 at 05:55:23PM +0000, Robin Murphy wrote:
>> #define DMA_F_PCI_P2PDMA_SUPPORTED (1 << 0)
>> +#define DMA_F_CAN_SKIP_SYNC BIT(1)
>
> Yuck, please be consistent - either match the style of the existing code,
> or change that to BIT(0) as well.

Just don't use BIT() ever. It doesn't save any typing and creates a
totally pointless mental indirection.

> I guess this was the existing condition from dma_need_sync(), but now it's
> on a one-off slow path it might be nice to check the sync_sg_* ops as well
> for completeness, or at least comment that nobody should be implementing
> those without also implementing the sync_single_* ops.

Implementing only one and not the other doesn't make any sense. Maybe
a debug check for that is ok, but thing will break badly if they aren't
in sync anyway.