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 6C1BEDDAB; Mon, 25 Aug 2025 20:49:36 +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=1756154977; cv=none; b=eQc5o4BS070dsq16063SIPgdPBE5pob2snl7oVsRYyXfTZ/YCHNX1JOIoW5BcfysfRwWFYHBnWfNDHRgCvg3QtTx7i7mRh+0WM+XGUimZZpZqjsmx1wuOafJ+XvJXCKllCuwudQxuam/SGuCsPYLv/8lf09WaMMxbLtl5qmLND0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756154977; c=relaxed/simple; bh=lfQ3Sx0ChDYUCraVA7DOv+MmxiNhx8zbUKzH+AEUEYA=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=So0VSZaieEiGYhUyAfdl9i9C26B79JH/KVVwlpgQOxnkvfOsD+cwdE3gRf4AI0292CYYgmmpId0NxIOqywcFgo4eYN8q0V73HdqRLqMCIUdpxVXbRQkZpLCYY39yd4hBBcRJE3wO1gyuq0JMnMwQ2IgnXrmPu3mv8cau7Gk7ldc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FUGMML64; 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="FUGMML64" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30860C4CEED; Mon, 25 Aug 2025 20:49:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1756154975; bh=lfQ3Sx0ChDYUCraVA7DOv+MmxiNhx8zbUKzH+AEUEYA=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=FUGMML64tNEXag+bV1SOBjlKU7UPDgtS2WtS/70r75bdfkZI3P62/8iZLJJkVL5Gn sOXc7kAaNx3wKASAjcisGE3UHjZL2wsQKxH0x2b6fjHqE+y4bBL+ocVb6x8gt+O5+D i1UXN3OivVflrV/X0y+SL4wuzpW+AzHxmGvNygOWJv/hGYuL0XPONspc1a2go6BRKt ufKKOyRs4yGB0OWtoflT+E9ii7nc9YwC7djooPX/e4YZHZi6DMAgHU0MZd9yGqIspW eaOVQTV+yJJxw50LC1h7B3ECyxEFN7adbxfeSZGOyvoJDgfxuN83/f1rA510H4Gj0P YJT2XyK13+Pdw== Precedence: bulk X-Mailing-List: linux-usb@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: Mon, 25 Aug 2025 22:49:31 +0200 Message-Id: Subject: Re: [PATCH 1/2] rust: usb: add basic USB abstractions From: "Benno Lossin" To: "Daniel Almeida" , "Miguel Ojeda" , "Alex Gaynor" , "Boqun Feng" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Danilo Krummrich" , "Greg Kroah-Hartman" Cc: , , X-Mailer: aerc 0.20.1 References: <20250825-b4-usb-v1-0-7aa024de7ae8@collabora.com> <20250825-b4-usb-v1-1-7aa024de7ae8@collabora.com> In-Reply-To: <20250825-b4-usb-v1-1-7aa024de7ae8@collabora.com> On Mon Aug 25, 2025 at 8:18 PM CEST, Daniel Almeida wrote: > +impl DeviceId { > + /// Equivalent to C's `USB_DEVICE` macro. > + pub const fn from_id(vendor: u16, product: u16) -> Self { > + Self(bindings::usb_device_id { > + match_flags: bindings::USB_DEVICE_ID_MATCH_DEVICE as u16, > + idVendor: vendor, > + idProduct: product, > + // SAFETY: It is safe to use all zeroes for the other fields= of `usb_device_id`. > + ..unsafe { MaybeUninit::zeroed().assume_init() } You can avoid this usage of `unsafe` with this patch series: https://lore.kernel.org/all/20250814093046.2071971-1-lossin@kernel.org I'd like to avoid introducing any new one of these. --- Cheers, Benno > + }) > + }