From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (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 588C4385D7C for ; Thu, 21 May 2026 16:58:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779382729; cv=none; b=btEertnC8qJKpblAVT02pN8y45oQYZ7FUGjEVCUmAKTm8FEtjWoHVukAh2tExOCseLHhPlgU7nuTX4iRBVWAwKynyD2r9d2AHcZPkNSVnlrBvNfUaKMLclwRt457jgD4GAggpt1Vw5EtUTSat4O7E2CJZs+dso9H1LRDIdF+FCk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779382729; c=relaxed/simple; bh=12jDDR1pst6bwML7xhRynvYD5v8sHBp/LgldnVtRs5c=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=tYooDyNxhbKfzSgs6Ukz6cJwYJ+QEfQrfUdpE+9bBcGKpUPEaV7gnvIXwvp8NMlu/1Pm/blWsMvyFeAUfUnWXS05FYNf9xt1eU8sxR2EibRpMrpuLs1F95U8IKaUqmbqVJcJZEsngEO6NadhSBNeLePoWSuZaErbplyuxDdL3SE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=d48Qh+Ao; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="d48Qh+Ao" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-2b458ca2296so46398515ad.0 for ; Thu, 21 May 2026 09:58:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779382728; x=1779987528; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=Qvcp/MxZM0KDVupq1J9TtiDnKmBEHG5Xhz/Dxyng960=; b=d48Qh+AoafoQ9WxQv90cow23D8LfxqtrKL2puhU57B1uoIpWeFWBtxF1uaTc1auOkD w0KdJDMuvNKsn5I7ETjdyP7iaxF0pZl5t85f5v5dpR8RJ9SnPEL1KyAwykXuH3y/iEbL qY7ICzA7TIyGXu1UFIcRD4zh5Q/XafcwwhQTjRyqlmXjQJrlhbwfUK5nb0A3zoKFjL8M XMGzn4KAwzNKCvVSCRAfjgM6DBceMwU6TQxgsahz4mBhpG8jxqlqQRTsASqNC8utBnKu PctHW+HncNbCkjQsuBpuH94eNm7xiLlwlr3JSXv6U1YpnbHFzzjJxfKxd52shcozJqCm CNgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779382728; x=1779987528; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Qvcp/MxZM0KDVupq1J9TtiDnKmBEHG5Xhz/Dxyng960=; b=GXWNkla53AHXoZVvy1QHozX5HZGzJM+V27C9/iqO2LBb8Xk0Y9ezPqSrnL1OXgyE6n q6rCmNwO/Nx7AefxT9ttuzw2x/sMwOBPmx8NwRnzC0bpc/xvmueax9LI0ogNLQsOYMOa myE1jijl9m0/cANqgAzt4ktfij5JicY96/i1RorBGJB2woRklg08LGnSlguy3ztr+ujy e2hQCD8u58vGsllP/FL+RJbdAExTFNwwJF1ba1P7qVCqN6rFLNu9e3ha865iCvxQ6OlT GSuGXGecSBWxBF5RKXLInmXGIhhAxCkDcXuwswAojf/MvSuWJy6nGHtVQMfMHQmTFoAo JiOQ== X-Forwarded-Encrypted: i=1; AFNElJ+vSYtlerPknx0HTl5yzp9LSsGUxG9QcxHxAMyr4fFzmDYtbRABibsjK/G70rTn/kD7ZvBmzHLvCJO/emw=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9QDMkBtvbk1Bm+rBuH4ysbQMLXJIsJTeuYykA1YTfXiVaL1n3 Alb+7dYtrikop3fhY5hLlrngN3Anumvh232meEkHOMZh7gtO/gpbz2QF X-Gm-Gg: Acq92OElOvRYgCIyFhf3L1xsaYnyc5MOj+JrI0Mcrd/YJKIBiD9aY4owPpyHtm4vhCo ONOltwBFD2x7Sw2keWMqXCk2K6TaglWw/vMa79+hRmMO/Ti3u1cVYwAvSAbjkU3PTi0eJe2tOL1 GGzMdQ5M0ljj0S9WCtkSHqdvlvYtV/QjcO0hAxbzJqquEUrJuzolJ+LC2Yni+i2/W8krk5qsA83 F+EyamHZgQ1H2lhhrCMfxSymUGM2O4tiJAdOpz8/vSNxmmREMOXxRvsXDaCJ5tj5kH6mNSL038b +4Q0T1MREr6XOZ0BKgrsNmIYu01mLrg2LMc1k+QdXDfo2WC5K58/5yCHybH7Pn18r7+FG83A9Sx ODCrLGnu53HzZAzA3wHGh7LFJaS2yei9HnErH/a76jgP18nyGEOfBXufYEyL3FpPEScQfBqOnky 9RPPmYQIfjw1wB/SJ3VVb0rAsb5a2rb1c= X-Received: by 2002:a17:903:a90:b0:2bd:ef15:9fce with SMTP id d9443c01a7336-2bea3345f6bmr43355335ad.20.1779382727492; Thu, 21 May 2026 09:58:47 -0700 (PDT) Received: from fedora ([2405:201:5501:4861:a13b:83fe:88b1:ec13]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2bea98eca1esm15943285ad.49.2026.05.21.09.58.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 May 2026 09:58:47 -0700 (PDT) Date: Thu, 21 May 2026 22:32:54 +0530 From: Ritvik Gupta To: Miguel Ojeda Cc: tglx@kernel.org, peterz@infradead.org, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, aliceryhl@google.com, tmgross@umich.edu, dakr@kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, skhan@linuxfoundation.org Subject: Re: [PATCH v2 2/2] rust: cpu: use `unsafe_precondition_assert!` Message-ID: References: <20260518230125.476165-1-ritvikfoss@gmail.com> <20260518230125.476165-3-ritvikfoss@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, May 19, 2026 at 07:41:59AM +0200, Miguel Ojeda wrote: > On Tue, May 19, 2026 at 12:57 AM Ritvik Gupta wrote: > > > > Replace `debug_assert!` invocations with > > `unsafe_precondition_assert!` in `from_i32_unchecked` > > and `from_u32_unchecked` unsafe functions. > > The commit message doesn't mention why the messages were added -- I > asked for it because I am not sure if it is worth providing a message > for each assertion, especially since the original code decided to > avoid it, i.e. the change to the new macro is good on its own, > regardless of the messages. > Actually, I added messages from UX standpoint, as having explicit failure reason is helpful for debugging, when an assertion is hit. I can update the commit message to clarify this, or remove it if maintainers prefer keeping it as is. > > -use crate::{bindings, device::Device, error::Result, prelude::ENODEV}; > > +use crate::{bindings, device::Device, error::Result, prelude::*}; > > By the way, we could remove `error::Result` from the list since we > have the entire prelude now, and also take the chance to use the new > style: > > https://docs.kernel.org/rust/coding-guidelines.html#imports > Sure, will remove `error::Result` and use vertical-import style. > But maybe wait to see if the maintainers have other feedback before v3. > > Thanks! > > Cheers, > Miguel Yeah, will wait for some time. Thanks for your feedback :)