Re: [PATCH v5 5/5] gpu: nova-core: add ChannelIdPool
"Eliot Courtney" <[email protected]>
| Newsgroups | gmane.linux.kernel.rust,gmane.linux.kernel,gmane.comp.video.dri.devel |
|---|---|
| Message-ID | <[email protected]> |
> 1. Provide a nz! macro to create constant non-zero things. Provide some
> constants for common alignments
>
> Potentially, we could use build_assert! for cases it is provably
> non-zero but not a literal (although tbh not sure this is a good idea -
> at least not do this initially).
>
> So either: nz!: const { NonZero::new(value).unwrap() }, or, nz!: some
> build assert gated construction of NonZero. A general nz! macro could
> also help ergonomics for other use cases too.
>
> That looks like this:
>
> pool.alloc_area(nz!(8), Alignment::AL_8)?;
Actually found that if we implement SizeConstants for Alignment then we
can get Alignment::SZ_4K etc almost for free.