lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Z8cOmISkQNcFdcvm@cassiopeiae>
Date: Tue, 4 Mar 2025 15:30:48 +0100
From: Danilo Krummrich <dakr@...nel.org>
To: Alexandre Courbot <acourbot@...dia.com>
Cc: airlied@...il.com, simona@...ll.ch, corbet@....net,
	maarten.lankhorst@...ux.intel.com, mripard@...nel.org,
	tzimmermann@...e.de, ajanulgu@...hat.com, lyude@...hat.com,
	pstanner@...hat.com, zhiw@...dia.com, cjia@...dia.com,
	jhubbard@...dia.com, bskeggs@...dia.com, acurrid@...dia.com,
	ojeda@...nel.org, alex.gaynor@...il.com, boqun.feng@...il.com,
	gary@...yguo.net, bjorn3_gh@...tonmail.com, benno.lossin@...ton.me,
	a.hindborg@...nel.org, aliceryhl@...gle.com, tmgross@...ch.edu,
	mcgrof@...nel.org, russ.weight@...ux.dev,
	dri-devel@...ts.freedesktop.org, linux-doc@...r.kernel.org,
	linux-kernel@...r.kernel.org, nouveau@...ts.freedesktop.org,
	rust-for-linux@...r.kernel.org,
	Nouveau <nouveau-bounces@...ts.freedesktop.org>
Subject: Re: [PATCH v4 5/6] gpu: nova-core: add initial driver stub

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ