rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tiago Lam <tiagolam@gmail.com>
To: "Alice Ryhl" <aliceryhl@google.com>,
	"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>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <benno.lossin@proton.me>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/4] rust: sync: update integer types in CondVar
Date: Mon, 18 Dec 2023 08:33:43 +0000	[thread overview]
Message-ID: <80e69cc3-5ee2-48de-83a2-6e2b95f17121@gmail.com> (raw)
In-Reply-To: <20231216-rb-new-condvar-methods-v2-4-b05ab61e6d5b@google.com>

On 16/12/2023 15:31, Alice Ryhl wrote:
> Reduce the chances of compilation failures due to integer type
> mismatches in `CondVar`.
> 
> When an integer is defined using a #define in C, bindgen doesn't know
> which integer type it is supposed to be, so it will just use `u32` by
> default (if it fits in an u32). Whenever the right type is something
> else, we insert a cast in Rust. However, this means that the code has a
> lot of extra casts, and sometimes the code will be missing casts if u32
> happens to be correct on the developer's machine, even though the type
> might be something else on a different platform.
> 
> This patch updates all uses of such constants in
> `rust/kernel/sync/condvar.rs` to use constants defined with the right
> type. This allows us to remove various unnecessary casts, while also
> future-proofing for the case where `unsigned int != u32`.
> 
> I wrote this patch at the suggestion of Benno in [1].
> 
> Link: https://lore.kernel.org/all/nAEg-6vbtX72ZY3oirDhrSEf06TBWmMiTt73EklMzEAzN4FD4mF3TPEyAOxBZgZtjzoiaBYtYr3s8sa9wp1uYH9vEWRf2M-Lf4I0BY9rAgk=@proton.me/ [1]
> Suggested-by: Benno Lossin <benno.lossin@proton.me>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>

Reviewed-by: Tiago Lam <tiagolam@gmail.com>

  parent reply	other threads:[~2023-12-18  8:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-16 15:31 [PATCH v2 0/4] Additional CondVar methods needed by Rust Binder Alice Ryhl
2023-12-16 15:31 ` [PATCH v2 1/4] rust: sync: add `CondVar::notify_sync` Alice Ryhl
2023-12-18  8:31   ` Tiago Lam
2023-12-16 15:31 ` [PATCH v2 2/4] rust: time: add msecs to jiffies conversion Alice Ryhl
2023-12-16 16:30   ` Martin Rodriguez Reboredo
2023-12-18  8:32   ` Tiago Lam
2023-12-18 17:43   ` Benno Lossin
2023-12-18 21:07   ` Boqun Feng
2024-01-04 13:53     ` Alice Ryhl
2023-12-16 15:31 ` [PATCH v2 3/4] rust: sync: add `CondVar::wait_timeout` Alice Ryhl
2023-12-16 16:37   ` Martin Rodriguez Reboredo
2023-12-18  8:32   ` Tiago Lam
2023-12-18 21:15   ` Boqun Feng
2024-01-04 13:48     ` Alice Ryhl
2023-12-20 11:31   ` Benno Lossin
2023-12-21 16:54     ` Boqun Feng
2024-01-04 13:49       ` Alice Ryhl
2023-12-16 15:31 ` [PATCH v2 4/4] rust: sync: update integer types in CondVar Alice Ryhl
2023-12-16 16:42   ` Martin Rodriguez Reboredo
2024-01-04 13:50     ` Alice Ryhl
2023-12-18  8:33   ` Tiago Lam [this message]
2023-12-18 17:45   ` Benno Lossin
2023-12-18 21:18   ` Boqun Feng
2024-01-04 13:54     ` Alice Ryhl

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80e69cc3-5ee2-48de-83a2-6e2b95f17121@gmail.com \
    --to=tiagolam@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=wedsonaf@gmail.com \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).