Re: [PATCH v2 01/31] rust: pci: add domain_nr() accessor

John Hubbard <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 8/22/26 12:57 AM, Miguel Ojeda wrote:
> On Sat, Aug 22, 2026 at 3:55 AM John Hubbard <[email protected]> wrote:
>>
>> +        // CAST: The C function returns `int`, but a PCI domain number is always
>> +        // non-negative, so this cast will not lose any information.
>> +        domain_nr as u32
> 
> What about
> 
>      debug_assert!(domain_nr >= 0);
> 
> ?

Yes, good idea. That's appropriate because the PCI core on the C side
provides a positive domain number, and the Rust side can assert that
that continues to be true.

I'll add it right after the "let domain_nr..." statement, when I send
the next version.

(Although I would like to figure out some way to get this in ahead of
things, one way or another.)

thanks,
-- 
John Hubbard
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.