Re: [PATCH v4 5/6] gpu: nova-core: add initial driver stub

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Mar 04, 2025 at 11:19:49PM +0900, Alexandre Courbot wrote:
> On Thu Feb 27, 2025 at 2:55 AM JST, Danilo Krummrich wrote:
> 
> > +// TODO replace with something like derive(FromPrimitive)
> > +impl TryFrom<u32> for Chipset {
> > +    type Error = kernel::error::Error;
> > +
> > +    fn try_from(value: u32) -> Result<Self, Self::Error> {
> > +        match value {
> > +            0x162 => Ok(Chipset::TU102),
> > +            0x164 => Ok(Chipset::TU104),
> > +            0x166 => Ok(Chipset::TU106),
> > +            0x167 => Ok(Chipset::TU117),
> > +            0x168 => Ok(Chipset::TU116),
> > +            0x172 => Ok(Chipset::GA102),
> > +            0x173 => Ok(Chipset::GA103),
> > +            0x174 => Ok(Chipset::GA104),
> > +            0x176 => Ok(Chipset::GA106),
> > +            0x177 => Ok(Chipset::GA107),
> > +            0x192 => Ok(Chipset::AD102),
> > +            0x193 => Ok(Chipset::AD103),
> > +            0x194 => Ok(Chipset::AD104),
> > +            0x196 => Ok(Chipset::AD106),
> > +            0x197 => Ok(Chipset::AD107),
> > +            _ => Err(ENODEV),
> > +        }
> > +    }
> > +}
> 
> I know this is probably temporary anyway, but since there is a macro now you can simplify this implementation by making part of it:
> 
> 		impl TryFrom<u32> for Chipset {
> 				type Error = kernel::error::Error;
> 
> 				fn try_from(value: u32) -> Result<Self, Self::Error> {
> 						match value {
> 								$( $value => Ok(Chipset::$variant), )*
> 								_ => Err(ENODEV),
> 						}
> 				}
> 		}
> 

Sure, that's a good suggestion, will do.

With that changed, may I add your RB? I'd like to land this series in the next
merge window.




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux