Message ID | 20240201-rockchip-rust-phy_depend-v2-1-c5fa4faab924@christina-quast.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2719:b0:106:209c:c626 with SMTP id hl25csp346591dyb; Thu, 1 Feb 2024 10:12:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyrrgh9sj9JuxDHhtMhEsJv/ccCfTUzkBWfxhtfpT0urn/C5XYUMlRkTBhWsLSTxfvOfQn X-Received: by 2002:ac8:5a0f:0:b0:42b:ecc3:d1ab with SMTP id n15-20020ac85a0f000000b0042becc3d1abmr5802691qta.5.1706811127909; Thu, 01 Feb 2024 10:12:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706811127; cv=pass; d=google.com; s=arc-20160816; b=PUZ0c8N6xF3ZWZLO1rlbVhuuLTHAwvyDbQcScp/YtGoaoZRhGvM3WxxExynhNtfRxQ XZu61Ed/VnJS50Rn7OoVkiCuxfzv3/QLMpC8b0jya/FmNoHJZabowZ5SOJ5KCqW3N9YH ro5T1wq4hL17u5Pa7pQ3v2g7NXe1rSo4A47xuykUtZwFM42aVqSCy4CBXUGSOWOuggHx bbntJQNUT0/cvglSNYgcr7Zt6qIK/jEPxjSwKG24J2hXRy/WgMKlkRacfXR2fpWLizat Upz+0cUaa+KNH3mbWIEuHTxBrnmEbMjXUtda/hZdoUaY0M5j20eEed3fcMLLrZgzEzKd XqAA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from; bh=/BU9D4HcvXvKXNPcylF3xNxeKcyxIj1bNUEaYf083ys=; fh=4Vwmn140VMLDgEMVFAb7YMHzFEKwV3CzIzI+hKY4E4Y=; b=YCtws1dW62DwCQEhsGCOycAKZh54ladaoTzENIqNcc14mXnpgUN8XJih/N2oZ+wNTJ kKjSHq3y0kOcf13jnFOatz2cS3F9GW1fonswY/IFzAQ0Ybt2/J3X1hewBcepZXMAWXhV 2PvD73/+qzwWM0s7akyl5/UOjEHA0HK2qYv25/BeBoI8FIljHNOr+PohxiPx0VPXfLEl n/7tijqrArknUGfiUYa+Diax4FjfjkiT6ZLVOVoYNBLtl3xMbGR02s6Uom+4lDfA2CQy x26I0wrJtbDWacYuZDAf9w9n8SfKi+n/Kn6VsQ9C7VjLeGAdFhT0wVUW4/BFcUHIkA6C iA9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=christina-quast.de); spf=pass (google.com: domain of linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCUQkFkmFAvkfxFuCMtGFeeECZxHtvt544UHuFAG14YVG4NG4OV74OV20cBeWpjQWLtNX1a2j/2n69KcCaF3yl6iuZO2PA== Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id o12-20020ac87c4c000000b0042be8dbb129si27038qtv.166.2024.02.01.10.12.07 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 10:12:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=christina-quast.de); spf=pass (google.com: domain of linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-48662-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D56A91C29F0C for <ouuuleilei@gmail.com>; Thu, 1 Feb 2024 18:11:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D408B12E1DB; Thu, 1 Feb 2024 18:07:20 +0000 (UTC) Received: from mail.someserver.de (mail.someserver.de [116.202.193.223]) (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 8050884FC5; Thu, 1 Feb 2024 18:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=116.202.193.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706810839; cv=none; b=lhmOxoCR6j9xG30P71NDE43OYBogv2Sahw1MOflrNVBGKJdHjP9u/7HaCQB40l1wMp4f/eEel5S2anzX3vgJJlwUwB8HnJh0nRBNUOsU7Soun0NS2sO2N5JALXZEdz8gayxJEcsFv9QZ+tQAjVF6aHOGJ/vYimuKbflChKlQsqo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706810839; c=relaxed/simple; bh=I9yo8gFF9g6Nktp5khK01f/99bXfCpCeui/xCrTFEX0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=jaeqw0/DX8LyMACjAD6mrdbcIz4pYRKBWCFCG3ZBMpXtzxZ9FtnUyN2ofn6v7Q3NXiKnBrpozmsSo97HYZF5ECKasOAPURAIUCzpbLqGmW400oBpq8qj55DrKRWncVNAg6px67UKO37LRd50tBJQ/Lw6C6KzLMagDv0SnbtIRkw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=christina-quast.de; spf=pass smtp.mailfrom=christina-quast.de; arc=none smtp.client-ip=116.202.193.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=christina-quast.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=christina-quast.de Received: from localhost (unknown [195.162.191.218]) by mail.someserver.de (Postfix) with ESMTPSA id 2965DA21AE; Thu, 1 Feb 2024 19:07:13 +0100 (CET) From: Christina Quast <contact@christina-quast.de> Date: Thu, 01 Feb 2024 19:06:58 +0100 Subject: [PATCH v2 1/3] DONOTMERGE: rust: prelude: add bit function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240201-rockchip-rust-phy_depend-v2-1-c5fa4faab924@christina-quast.de> References: <20240201-rockchip-rust-phy_depend-v2-0-c5fa4faab924@christina-quast.de> In-Reply-To: <20240201-rockchip-rust-phy_depend-v2-0-c5fa4faab924@christina-quast.de> To: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Wedson Almeida Filho <wedsonaf@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, Benno Lossin <benno.lossin@proton.me>, Andreas Hindborg <a.hindborg@samsung.com>, Alice Ryhl <aliceryhl@google.com>, FUJITA Tomonori <fujita.tomonori@gmail.com>, Trevor Gross <tmgross@umich.edu>, Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Heiko Stuebner <heiko@sntech.de> Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, Christina Quast <contact@christina-quast.de> X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1706810819; l=1166; i=contact@christina-quast.de; s=20240130; h=from:subject:message-id; bh=I9yo8gFF9g6Nktp5khK01f/99bXfCpCeui/xCrTFEX0=; b=PD/auZkWvS/a6RAELm9LZMt+cqhgGaqOca8QQUD5tdAWmf0dbh8OFZXYaJmqZgB58v2xzsXPY 6aq5k52d6jBD1X+2SRUI45jUSSAeNaaKZovXt/2kXeZa7O2MuqHekKw X-Developer-Key: i=contact@christina-quast.de; a=ed25519; pk=aoQfinjbnr265vCkIZdYteLDcmIqLBhY1m74WfFUU9E= X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789721185352118387 X-GMAIL-MSGID: 1789721185352118387 |
Series |
Add Rust Rockchip PHY driver
|
|
Commit Message
Christina Quast
Feb. 1, 2024, 6:06 p.m. UTC
In order to create masks easily, the define BIT() is used in C code.
This commit adds the same functionality to the rust kernel.
Do not merge this commit, because rust/kernel/types.rs in Rust-for-Linux
already contains this functionality and will be merged into next-net
soon.
But this driver does not compile without this commit, so I am adding it
to the patchset to get more feedback on the actual driver.
Signed-off-by: Christina Quast <contact@christina-quast.de>
---
rust/kernel/prelude.rs | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Comments
On Thu, Feb 1, 2024 at 7:07 PM Christina Quast <contact@christina-quast.de> wrote: > > In order to create masks easily, the define BIT() is used in C code. > This commit adds the same functionality to the rust kernel. Note that it is the same kernel :) Typically we would say "to the Rust side" or similar. > Do not merge this commit, because rust/kernel/types.rs in Rust-for-Linux > already contains this functionality and will be merged into next-net > soon. I think you mean the archived `rust` branch (it is useful to point this out -- Rust for Linux is not just that branch). However, has the `Bit` type (assuming you mean that) been submitted? I don't recall seeing it, and normally something like that would not go through `net-next`. If it has been, could you please send the Lore link? > But this driver does not compile without this commit, so I am adding it > to the patchset to get more feedback on the actual driver. Assuming the patch was not sent, I would suggest replacing this commit with the dependency you want to use, e.g. the `Bit` type, since it is a small enough one. In addition, this series has v2 in the title -- I think you did that because this patch was already submitted, but this is not really a v2 of that series since this is mainly about the driver (and anyway this patch in particular is not meant to be merged; plus you didn't change it from what I can see). Thanks! Cheers, Miguel
diff --git a/rust/kernel/prelude.rs b/rust/kernel/prelude.rs index ae21600970b3..16e483de2f27 100644 --- a/rust/kernel/prelude.rs +++ b/rust/kernel/prelude.rs @@ -38,3 +38,19 @@ pub use super::init::{InPlaceInit, Init, PinInit}; pub use super::current; + +/// Returns a `u32` number that has only the `n`th bit set. +/// +/// # Arguments +/// +/// * `n` - A `u32` that specifies the bit position (zero-based index) +/// +/// # Example +/// +/// ``` +/// let b = bit(2); +/// assert_eq!(b, 4); +#[inline] +pub const fn bit(n: u32) -> u32 { + 1 << n +}