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 760F52609D9; Fri, 11 Jul 2025 09:11:40 +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=1752225100; cv=none; b=DuVw9ZntP/Du3YYsVdyiT6v4ayop5LQodnI7W3wm2cE/xZqzs1da/IbinAkNleCFAi8svirqL/zvfCxPL/0oK5doyfkgiohKUWQ5X6YQ85040slkuQGNUYmyIymY5nIHv5XjhaQ6df0dUB8RHdVQCtovP4PA+2xTkKsY5MZ32F0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752225100; c=relaxed/simple; bh=tudeVcSNoXzHGy2LFEpMNuqRRFSL77J7jE48/SmT3GE=; h=Mime-Version:Content-Type:Date:Message-Id:To:Cc:Subject:From: References:In-Reply-To; b=b/bws/LgZ0fMdtW/aPyvNaUst4Ioigg3ToHcoL3McFTNCjZ6A5V3ANpIR+Dm5vNYR91No+fJ7u503QJtA88wGBWqXYngBnXfcMcJ8IdO5nPXeylLeHZQuy2RZpLGK+Gntnkg3UMJCuFpfBodgfOSzcXAtEihwNjOX0xughoN3ds= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t5zHYcJ6; 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="t5zHYcJ6" Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2042C4CEED; Fri, 11 Jul 2025 09:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1752225100; bh=tudeVcSNoXzHGy2LFEpMNuqRRFSL77J7jE48/SmT3GE=; h=Date:To:Cc:Subject:From:References:In-Reply-To:From; b=t5zHYcJ6NmMa69kELTdf+KaS3dNYHjoWcKpG2Y2O9Gc5IhR2dRmmd8nNw/esLbwrT KqFf2FoMJI5CakGjKAfF+CouVfT0sqaZxzHQAUCKV/4IR3ZObCuXeFLfuSFXzbmVmG Yaj6gKOpcyThw772ug+LAVjyO0eOgm+0N8LrGCrZzSiQLYZRroEt/x3aoEhqpQsO7U 7uK53atW8y5q4ul8Wgtiu+4+DEZG64S/CQ2hWPuJNhykFDeFbCrnL6wGSwkXEqKMB4 f7H4rSZ1Cvgwn0dyVuoLjCPljpPWIUZhse4jBF9DhfDaHn8cnIc3feIDmyt5bOtJI1 hIi0z+skNoajA== Precedence: bulk X-Mailing-List: rust-for-linux@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: Fri, 11 Jul 2025 11:11:33 +0200 Message-Id: To: "Alice Ryhl" , "Danilo Krummrich" Cc: "Greg Kroah-Hartman" , "Dave Ertman" , "Ira Weiny" , "Leon Romanovsky" , "Miguel Ojeda" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Trevor Gross" , "Thomas Gleixner" , "Peter Zijlstra" , "Rafael J. Wysocki" , "David Airlie" , "Simona Vetter" , "Maarten Lankhorst" , "Maxime Ripard" , "Thomas Zimmermann" , "FUJITA Tomonori" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , , , , , Subject: Re: [PATCH v2 2/2] drm: rust: rename as_ref() to from_raw() for drm constructors From: "Benno Lossin" X-Mailer: aerc 0.20.1 References: <20250711-device-as-ref-v2-0-1b16ab6402d7@google.com> <20250711-device-as-ref-v2-2-1b16ab6402d7@google.com> In-Reply-To: <20250711-device-as-ref-v2-2-1b16ab6402d7@google.com> On Fri Jul 11, 2025 at 10:04 AM CEST, Alice Ryhl wrote: > The prefix as_* should not be used for a constructor. Constructors > usually use the prefix from_* instead. > > Some prior art in the stdlib: Box::from_raw, CString::from_raw, > Rc::from_raw, Arc::from_raw, Waker::from_raw, File::from_raw_fd. > > There is also prior art in the kernel crate: cpufreq::Policy::from_raw, > fs::File::from_raw_file, Kuid::from_raw, ARef::from_raw, > SeqFile::from_raw, VmaNew::from_raw, Io::from_raw. > > Link: https://lore.kernel.org/r/aCd8D5IA0RXZvtcv@pollux > Signed-off-by: Alice Ryhl Reviewed-by: Benno Lossin --- Cheers, Benno > --- > rust/kernel/drm/device.rs | 2 +- > rust/kernel/drm/file.rs | 8 ++++---- > rust/kernel/drm/gem/mod.rs | 16 ++++++++-------- > rust/kernel/drm/ioctl.rs | 4 ++-- > 4 files changed, 15 insertions(+), 15 deletions(-)