From patchwork Sun Mar 16 06:14:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Hickey X-Patchwork-Id: 14018361 Received: from mail-yb1-f170.google.com (mail-yb1-f170.google.com [209.85.219.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34BBE198A19 for ; Sun, 16 Mar 2025 06:20:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742106048; cv=none; b=bw14c/oNUgnF+jNES0X5RUYJg5Km6O5rlMg/lEZsumNIV9Z4DlRADd7ShAA+QfZz/KjuwZgH4BIr1K2q3CIUnlg50ogqR9WYT9CwbXQRG5mg8/t/MRUa7gpXFMN0beu8SAol73Md5Hh136POru+A7QZKPkMhtBByKs09OW2u7Sg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1742106048; c=relaxed/simple; bh=DCCZ3zSHAje0FWAK8UKvdqHAHS2xwd6Ei/WwMlNchpE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iBUmoi/CAoOHD0p5lIh+F3hjkZYLbHTy3+QWEb7Q/G6vpMUuBKE5du91NAOvOs3kID5SE+GUvE+OjSGytNphj0jFT7+f7s5wRSPlvdfAgEl9x/iJiG8SQ3182z/MtjOPe+PkxAmsKC5egl9lSzxIEBwE2FGX0pa61TruyUkL9Aw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=byte-forge.io; spf=pass smtp.mailfrom=byte-forge.io; dkim=pass (2048-bit key) header.d=byte-forge-io.20230601.gappssmtp.com header.i=@byte-forge-io.20230601.gappssmtp.com header.b=v9QkjAhr; arc=none smtp.client-ip=209.85.219.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=byte-forge.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=byte-forge.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=byte-forge-io.20230601.gappssmtp.com header.i=@byte-forge-io.20230601.gappssmtp.com header.b="v9QkjAhr" Received: by mail-yb1-f170.google.com with SMTP id 3f1490d57ef6-e5ad75ca787so2890265276.0 for ; Sat, 15 Mar 2025 23:20:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=byte-forge-io.20230601.gappssmtp.com; s=20230601; t=1742106046; x=1742710846; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lgXYCZoIbp3+FQSUFxgLFXAA6h9RyUssleXI5NM4+uk=; b=v9QkjAhrRPErcO5472Th54wIuu2Wru7bUTQJGZasm7OrPwRxpmuvOtJitzSxPMst7s EmNWry2wG+wJ0aVXIhZwWqYkCm6qrRpIUZ8vdYXMmQCYEUDEfz+GB0YVSW+gf0m3wzOI wwhoVDZROE7LgTJE4GsJsl2YZozKYKz0THCt5H2Rhnn9SPC9F1m9GGTEsBQe7ohVJtMf +M5BfbRf02rhE2kMNm/f27K3dVs+odRElOKXJv2/pjnHWLobExqFRAseltodeXTx0R8D q6XzaOO3Npk6S9ApCGQrOftSN1CoGLFNK2ybpCmrGCACvYK9Cy4KKW7UOEjD55d7qH7z p6fQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1742106046; x=1742710846; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lgXYCZoIbp3+FQSUFxgLFXAA6h9RyUssleXI5NM4+uk=; b=w/g3O6UJzZ5eCnqbK/SzKMhLesUNi6X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VLbNQXTg== X-Received: by 2002:a05:6902:2788:b0:e63:c936:c07f with SMTP id 3f1490d57ef6-e63f870c83dmr9695475276.2.1742106046218; Sat, 15 Mar 2025 23:20:46 -0700 (PDT) Received: from Machine.lan (107-219-75-226.lightspeed.wepbfl.sbcglobal.net. [107.219.75.226]) by smtp.gmail.com with ESMTPSA id 3f1490d57ef6-e63e53fd277sm1618673276.11.2025.03.15.23.20.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Mar 2025 23:20:45 -0700 (PDT) From: Antonio Hickey X-Google-Original-From: Antonio Hickey To: FUJITA Tomonori , Trevor Gross , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Danilo Krummrich Cc: Antonio Hickey , netdev@vger.kernel.org, rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 11/16] rust: net: phy: refactor to use `&raw [const|mut]` Date: Sun, 16 Mar 2025 02:14:20 -0400 Message-ID: <20250316061429.817126-12-contact@antoniohickey.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250316061429.817126-1-contact@antoniohickey.com> References: <20250316061429.817126-1-contact@antoniohickey.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Replacing all occurrences of `addr_of!(place)` and `addr_of_mut!(place)` with `&raw const place` and `&raw mut place` respectively. This will allow us to reduce macro complexity, and improve consistency with existing reference syntax as `&raw const`, `&raw mut` are similar to `&`, `&mut` making it fit more naturally with other existing code. Suggested-by: Benno Lossin Link: https://github.com/Rust-for-Linux/linux/issues/1148 Signed-off-by: Antonio Hickey --- rust/kernel/net/phy.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rust/kernel/net/phy.rs b/rust/kernel/net/phy.rs index a59469c785e3..757db052cc09 100644 --- a/rust/kernel/net/phy.rs +++ b/rust/kernel/net/phy.rs @@ -7,7 +7,7 @@ //! C headers: [`include/linux/phy.h`](srctree/include/linux/phy.h). use crate::{error::*, prelude::*, types::Opaque}; -use core::{marker::PhantomData, ptr::addr_of_mut}; +use core::marker::PhantomData; pub mod reg; @@ -285,7 +285,7 @@ impl AsRef for Device { fn as_ref(&self) -> &kernel::device::Device { let phydev = self.0.get(); // SAFETY: The struct invariant ensures that `mdio.dev` is valid. - unsafe { kernel::device::Device::as_ref(addr_of_mut!((*phydev).mdio.dev)) } + unsafe { kernel::device::Device::as_ref(&raw mut (*phydev).mdio.dev) } } }