Re: [PATCH v1] rust: conditionally compile dma abstraction based on CONFIG_HAS_DMA

From: FUJITA Tomonori
Date: Thu Apr 10 2025 - 09:00:34 EST


On Wed, 9 Apr 2025 11:07:02 +0200
Danilo Krummrich <dakr@xxxxxxxxxx> wrote:

> On Wed, Apr 09, 2025 at 02:55:01PM +0900, FUJITA Tomonori wrote:
>> Make dma abstraction conditional on CONFIG_HAS_DMA.
>
> I'm not convinced that this is the correct fix. This would require drivers to
> depend on CONFIG_HAS_DMA if they want to use the DMA API. The C side does not do
> this either.
>
> Instead, for functions like dma_alloc_attrs(), there is an empty implementation
> if CONFIG_HAS_DMA is not set [1].

Good point.

> However, this definition is not picked up by bindgen. Hence, I think the actual
> fix would be to introduce the corresponding Rust helpers.
>
> [1] https://elixir.bootlin.com/linux/v6.13.7/source/include/linux/dma-mapping.h#L189

I'll go with that approach for the next version.

Thanks,