Re: [PATCH 1/3] dma-pool: factor out a calculate_pool_size helper
From: Christoph Hellwig
Date: Sun Aug 21 2022 - 06:41:33 EST
On Wed, Aug 17, 2022 at 01:32:42PM +0100, Robin Murphy wrote:
> On 2022-08-17 07:06, Christoph Hellwig wrote:
>> Add a helper to calculate the pool size from dma_atomic_pool_init,
>> and fix up the last max_t to use the proper type.
>
> Hmm, both atomic_pool_size and the argument to __dma_atomic_pool_init()
> where this gets directly passed later are size_t, not to mention that the
> function name says we're calculating a size, so I'd say size_t *is* the
> proper type to return here.
But the type passed to calculate_pool_size isn't about the return type,
but rather the type to use for the comparing the other two arguments.
The should generally by the largest of the involved types. Besides
that using a size_t for a number of pages is not a correct use of
size_t, but that's a separate story.
But I'll go back to what we had originally, there's no good reason
to change it in this series.