From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D03737B00F; Wed, 4 Mar 2026 22:22:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772662926; cv=none; b=tYAo5JLJSnwSOaBqPD5yDiAC1Zh/bK55H6WwhOWR51F2zfan5oT7iS0y5AsnIilI1LhqbDLayVV0l9fQO7Z0UTi7tAvvHUDqFgLMQ+HyvI7JXEflJyQjCo9SoJbhF7gKvl3Oa9mqVkL+N2dSsTi0+at/rm9FCPSwPAhwDFCQut0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772662926; c=relaxed/simple; bh=dQaalXXA4uIu5doq8Hkb2eguS4UMBXh+fnkRPYEco0g=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:To:From:Subject: References:In-Reply-To; b=elmLjknGP2YflQySpBsQuIAv/U5eArNT7ocfF5oCakQ3b1WdQy1qV+x1oRWUFRSOZf+PQHrrhW3D+kRJbA6u/shsdsbJElV+1bKK7lLT+Uu6P20ZKPo0VZT3aMCMydtW6uGeZ8Bzkx9YKUNg/eRYbnbkIC512fPY57eWKfMvTy4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GicBaNtX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GicBaNtX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 466A6C19425; Wed, 4 Mar 2026 22:22:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772662926; bh=dQaalXXA4uIu5doq8Hkb2eguS4UMBXh+fnkRPYEco0g=; h=Date:Cc:To:From:Subject:References:In-Reply-To:From; b=GicBaNtX9eY4DKHSuoL319lv3CBri94h02GBRssdZ0xDtf1F9tJd9B+R4uxU+5PoG vuSFd99Ogvn4XLCRyJ2tmnpMAovqD+ZH0Oce2a17lOGWrYVrSIZmHl+72auIzUzUTX FEwU2kUGzZzD1qmknaOKr/mazqLkyX0DcbHdBlP7X6nD4aVTHBEtxOOd31jP7sZpZz Vux0/VajmCTSqVXQ9B4iKsg4sVq45uUNIw6DOPJs4AS2NruGR0Uzm5T9XgLpim24N3 NFUnAPmelrs+eEtRUSONScl8KizAubD40ypiWcjj8CN+96NaS4LXa4TyRuUFSDaq5T gjgQUYiByn0JA== Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 04 Mar 2026 23:22:00 +0100 Message-Id: Cc: "Alice Ryhl" , "Daniel Almeida" , "Miguel Ojeda" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Boqun Feng" , "Yury Norov" , "John Hubbard" , "Alistair Popple" , "Joel Fernandes" , "Timur Tabi" , "Edwin Peer" , "Eliot Courtney" , "Dirk Behme" , "Steven Price" , , To: "Gary Guo" , "Alexandre Courbot" From: "Danilo Krummrich" Subject: Re: [PATCH v7 05/10] rust: io: add IoLoc and IoWrite types References: <20260224-register-v7-0-aad44f760f33@nvidia.com> <20260224-register-v7-5-aad44f760f33@nvidia.com> In-Reply-To: On Wed Mar 4, 2026 at 11:15 PM CET, Gary Guo wrote: > On Wed Mar 4, 2026 at 9:38 PM GMT, Danilo Krummrich wrote: >> bar.write(regs::MyReg, regs::MyReg::foo()) > > This specific case is indeed more cumbersome with the two argument approa= ch, > although given Alex's nova diff I think the occurance shouldn't be that > frequent. > > It's also not that the two argument approach would preclude us from havin= g a > single argument option. In fact, with the two-argument design as the basi= s, we > can implement such a helper function cleaner than Alex's PATCH 10/10 (whi= ch uses > `Into`: > > /// Indicates that this type is always associated with a specific fix= ed I/O > /// location. > /// > /// This allows use of `io.bikeshed_shorthand_name(value)` instead of= specifying > /// the register name explicitly `io.write(REG, value)`. > trait FixedIoLocation { > type IoLocType: IoLoc; > const IO_LOCATION: Self::IoLocType; > } > > trait Io { > fn bikeshed_shorthand_name(&self, value: T) What about write()? :P > where T: FixedIoLocation + > Self: IoCapable<>::IoType>, > { > self.write(T::IO_LOCATION, value) > } > } Ok, please go ahead with this then.