From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF6F4C282D6 for ; Tue, 4 Mar 2025 14:30:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6614B10E5F6; Tue, 4 Mar 2025 14:30:59 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="f54Samq2"; dkim-atps=neutral Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by gabe.freedesktop.org (Postfix) with ESMTPS id 21BFC10E5F4; Tue, 4 Mar 2025 14:30:58 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 73C4DA4561D; Tue, 4 Mar 2025 14:25:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3C9DC4CEE5; Tue, 4 Mar 2025 14:30:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1741098657; bh=+bcl3HGDoc9IqaZsMJSKegqvSclSq4gfCFg0kcJllNc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=f54Samq2ENCyCzuTHGR/tYVZKiwx076XuyVyuDVLnKmBwmBZLrrFDqh/SJuc8H2A8 QK/pOjMHQD2Zr1heHM8PR9WQZ9EqTc3k0MqkEQip4O0NsOspaS2Tn9LQvf1skBxKrN xLtT3Cn2+850TS7nTuTHGzQSRtU3CAqvIeCuNRcYiVNQbYsRIrOGi8IztoA9X0FxeJ JyWCMgeVgiQshwxCL02k7yH3iIhj9wr24Epn30wWdi02sU++HLb0uy1n5bZG+ArkTW a5Pkoyizp8l35EIyOFSmuLNWE16gROFxnX4oLq1YO0hUmND3VXceKOodcfD3Nkrk1R oRkGgycHf/kDQ== Date: Tue, 4 Mar 2025 15:30:48 +0100 From: Danilo Krummrich To: Alexandre Courbot Cc: airlied@gmail.com, simona@ffwll.ch, corbet@lwn.net, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, ajanulgu@redhat.com, lyude@redhat.com, pstanner@redhat.com, zhiw@nvidia.com, cjia@nvidia.com, jhubbard@nvidia.com, bskeggs@nvidia.com, acurrid@nvidia.com, ojeda@kernel.org, alex.gaynor@gmail.com, boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com, benno.lossin@proton.me, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, mcgrof@kernel.org, russ.weight@linux.dev, dri-devel@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, rust-for-linux@vger.kernel.org, Nouveau Subject: Re: [PATCH v4 5/6] gpu: nova-core: add initial driver stub Message-ID: References: <20250226175552.29381-1-dakr@kernel.org> <20250226175552.29381-6-dakr@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 for Chipset { > > + type Error = kernel::error::Error; > > + > > + fn try_from(value: u32) -> Result { > > + 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 for Chipset { > type Error = kernel::error::Error; > > fn try_from(value: u32) -> Result { > 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.