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 36E8935975; Thu, 26 Jun 2025 15:25: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=1750951537; cv=none; b=IAzqnk7gXi9RSiKhaKrT+QzV0tZSM0Q8GE/SXwjUEgRx2iTt7JwEOFimwxkVEoKZrEVihOG1u/w184FEaoyrc5JAORUJcP9Se2xxpyDaxcEi3m2iR8dentvA8GHrarHfEHsFVPjI9CnpQzUFkIF9rYZ9PBW+VRzNy6uGSpORmkU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750951537; c=relaxed/simple; bh=bUyuSpIXa48k5y8qyPnFT3SJWO3XGosa1vIwLaD8jjk=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Wcsa2/kXiT1748nxcoLGe466vkSdrRBOjSuKwtoaM8wHY5dXJ40wKzssSbzVQEb2VAm3YnpN4zx1rK+QlDZoSuVdsC1QhXi9FwJ2bYQb+JQZOYxKUZE51/ucYwcZKHSCc1aWZm4veYSlhVy5PfctlizzC+VjZGUQmNmzcXo4VwU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=L325dsHB; 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="L325dsHB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 33DCEC4CEEE; Thu, 26 Jun 2025 15:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1750951536; bh=bUyuSpIXa48k5y8qyPnFT3SJWO3XGosa1vIwLaD8jjk=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=L325dsHBl28/R3isb72xBnqJpcXq8jgW8dClg2huIIWwG81xeCDbYPIP88TMG0Uq6 o8+dvKbi8wFkVE/xZhd7Mv3+mq2lH2UST0Iyf66/STB2IOLUO/0AbU/ZQAEDbAhr7y hSbSbR6BLKKSdycRWriQ2pYsyKNOZHH6WWdZnvAm/zPn9gEZzJ+DdMZSPtPdgHo+yk b4N73VtPPaMyDqPiBSZaqsITE24nj6YCITllkxnOfZn55DJv/bxkd5ypgdbmGlOjkB A2/6tJvpGP5jgcRxW1AH9Y3tv+aNWsotMKuBoERZ2pnM7k/7GwzwnE5theEK7oSKN8 pXQo9aW7EmRjg== Message-ID: Date: Thu, 26 Jun 2025 17:25:29 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v8 4/9] rust: acpi: add `acpi::DeviceId` abstraction To: Igor Korotin Cc: "Rafael J . Wysocki" , Alex Gaynor , Greg Kroah-Hartman , Miguel Ojeda , Rob Herring , Saravana Kannan , Alex Hung , Andrew Morton , Jakub Kicinski , Jonathan Cameron , Krzysztof Kozlowski , Mauro Carvalho Chehab , Remo Senekowitsch , Tamir Duberstein , Viresh Kumar , Wedson Almeida Filho , Xiangfei Ding , devicetree@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org, =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Alice Ryhl , Andreas Hindborg , Benno Lossin , Boqun Feng , Gary Guo , Len Brown , Trevor Gross References: <20250620150914.276272-1-igor.korotin.linux@gmail.com> <20250620152425.285683-1-igor.korotin.linux@gmail.com> From: Danilo Krummrich Content-Language: en-US In-Reply-To: <20250620152425.285683-1-igor.korotin.linux@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 6/20/25 5:24 PM, Igor Korotin wrote: > +impl DeviceId { > + const ACPI_ID_LEN: usize = 16; > + > + /// Create a new device id from an ACPI 'id' string. > + pub const fn new(id: &[u8; N]) -> Self { Didn't notice before, but why was this silently changed from &CStr to &[u8; N] from v6 to v7? > + build_assert!(N <= Self::ACPI_ID_LEN, "ID exceeds 16 bytes"); > + // Replace with `bindings::acpi_device_id::default()` once stabilized for `const`. > + // SAFETY: FFI type is valid to be zero-initialized. > + let mut acpi: bindings::acpi_device_id = unsafe { core::mem::zeroed() }; > + let mut i = 0; > + while i < N { > + acpi.id[i] = id[i]; > + i += 1; > + } > + > + Self(acpi) > + } > +}