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 46DB130146A; Tue, 26 Aug 2025 10:57:50 +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=1756205870; cv=none; b=rKvj6sL3DVmm+GfQoaxu1NNVFFITHL6c9tRsGgbvsGxhm11kkqAz7Fqr8BcTnBwI64dYlcdkQl6GbRDMmxbnzNUG0luNBZ/0gMJFz76AQdnJYv8QsEtEIYbITUOPwj6hQUJTr0TxALaHh0dRFogGUYQu1xYn6gLbH5lyKg15mSg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756205870; c=relaxed/simple; bh=uyrxk6x5endfgPWV1unzyAKLaF962HHKgN9da8/FKKs=; h=Mime-Version:Content-Type:Date:Message-Id:From:Subject:Cc:To: References:In-Reply-To; b=E+qYfvV7j8hhNoysAAx8F0WsYWQhCkVQl0uNxQ43AvMJbamQUtywOHrJQ01wTL+/thpNLS7q87ipsamSu3QHdTr+zQsxdQHpnHHflCqI6ce2Kloc0m/M7LN6MKyvHJ/JZkt/dmpy6sBgSAmhuAk5Nsgugv6DNQXrz81GJAAGwkk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=WpjsMpJj; 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="WpjsMpJj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2FC94C4CEF1; Tue, 26 Aug 2025 10:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756205869; bh=uyrxk6x5endfgPWV1unzyAKLaF962HHKgN9da8/FKKs=; h=Date:From:Subject:Cc:To:References:In-Reply-To:From; b=WpjsMpJjsBtNATzL7Df/XfKezd9fKPIfPD55b76UExPKSjxg0UjACnw7Uw62Z5aEZ LjghjDxcM8/mR3k0lI63BcIcz5IStg54rDXg1udfSR9vCLSzmJMlfE/FQVRyu3lOnt ZgWbxQ6g+SupQmQFfMqSw76nITdx531IH4gxvclOk6rR26TsBedtlycUjNlYBnaHLN ajQsJdTr09ROul4jZtkXySnC2U4UfRELbVyW2WjzrMR7cODqLxa7VpYHOXZwSQ1za6 YSDbxmb7L+yeENclwWZGHdbRUfxVq+8gWoNvXLax0tEoDoa/hAwzV6KZ1RB8au7CWP 6OH1eUpWzBNDw== 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: Tue, 26 Aug 2025 12:57:44 +0200 Message-Id: From: "Danilo Krummrich" Subject: Re: [PATCH v4 1/2] rust: alloc: add from_raw method to Flags Cc: , , "Uladzislau Rezki" , "Alice Ryhl" , "Vlastimil Babka" , "Lorenzo Stoakes" , "Liam R . Howlett" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , "Bjorn Roy Baron" , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Johannes Weiner" , "Yosry Ahmed" , "Nhat Pham" , To: "Vitaly Wool" References: <20250823130420.867133-1-vitaly.wool@konsulko.se> <20250823130508.867235-1-vitaly.wool@konsulko.se> In-Reply-To: <20250823130508.867235-1-vitaly.wool@konsulko.se> On Sat Aug 23, 2025 at 3:05 PM CEST, Vitaly Wool wrote: > diff --git a/rust/kernel/alloc.rs b/rust/kernel/alloc.rs > index b39c279236f5..808bd4281164 100644 > --- a/rust/kernel/alloc.rs > +++ b/rust/kernel/alloc.rs > @@ -41,6 +41,11 @@ > pub struct Flags(u32); > =20 > impl Flags { > + /// Create from the raw representation > + pub(crate) fn from_raw(f: u32) -> Self { The argument shoould probably be of type bindings::gfp_t instead. However, = the alloc::Flags type itself uses u32. So, for this patch using u32 is fine. Bu= t I think in general we should fix this up. > + Self(f) > + } > + I think you forgot to document that the given value must be a valid combina= tion of GFP flags. Please also write full sentences and end them with a period.