Re: [PATCH v2 1/2] rust: io: gate ioremap/iounmap on CONFIG_HAS_IOMEM
From: Arnd Bergmann
Date: Thu Aug 06 2026 - 12:10:33 EST
On Thu, Aug 6, 2026, at 17:47, Danilo Krummrich wrote:
> On Wed Aug 5, 2026 at 11:39 PM CEST, Arnd Bergmann wrote:
>> Can you also hide the actual I/O accessors in this case?
>> While s390 without CONFIG_PCI still provides the asm-generic
>> version of those, that is technically a mistake, and it would
>> be nice not to.
>>
>> I'm guessing that there is enough kernel code that still expects
>> these to be present for C, but if all rust code has the correct
>> HAS_IOMEM dependencies, it would be cleaner not to reference
>> since there is no correct way to call them without ioremap().
>
> As things are right now, I think something like in [1] should work, but we'd
> also need to cfg-gate every single doc-test that uses I/O primitives, which is
> slightly annoying.
>
> In any case, I'm not sure it would be a huge benefit anyway. Unlike in C, where
> I/O accessors operate on raw void pointers, the Rust primitives are typed. So,
> users have no way of actually calling them without being able to obtain a
> mapping in the first place.
Right, makes sense.
Arnd