[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DFUFO3WUQL1K.3JH3SS0J1Y0CQ@kernel.org>
Date: Wed, 21 Jan 2026 18:12:11 +0100
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Gary Guo" <gary@...yguo.net>
Cc: "Zhi Wang" <zhiw@...dia.com>, <rust-for-linux@...r.kernel.org>,
<linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<aliceryhl@...gle.com>, <bhelgaas@...gle.com>, <kwilczynski@...nel.org>,
<ojeda@...nel.org>, <alex.gaynor@...il.com>, <boqun.feng@...il.com>,
<bjorn3_gh@...tonmail.com>, <lossin@...nel.org>, <a.hindborg@...nel.org>,
<tmgross@...ch.edu>, <markus.probst@...teo.de>, <helgaas@...nel.org>,
<cjia@...dia.com>, <smitra@...dia.com>, <ankita@...dia.com>,
<aniketa@...dia.com>, <kwankhede@...dia.com>, <targupta@...dia.com>,
<acourbot@...dia.com>, <joelagnelf@...dia.com>, <jhubbard@...dia.com>,
<zhiwang@...nel.org>, <daniel.almeida@...labora.com>
Subject: Re: [PATCH v11 4/5] rust: pci: add config space read/write support
On Wed Jan 21, 2026 at 4:36 PM CET, Gary Guo wrote:
>> +/// The PCI configuration space of a device.
>> +///
>> +/// Provides typed read and write accessors for configuration registers
>> +/// using the standard `pci_read_config_*` and `pci_write_config_*` helpers.
>> +///
>> +/// The generic const parameter `SIZE` can be used to indicate the
>> +/// maximum size of the configuration space (e.g. `ConfigSpaceSize::Normal`
>> +/// or `ConfigSpaceSize::Extended`).
>> +pub struct ConfigSpace<'a, const SIZE: usize = { ConfigSpaceSize::Extended as usize }> {
>
> This is quite long to write. Given that it'll either be normal or extended, can
> we just have two marker types instead? So you have
>
> ConfigSpace<Normal> and ConfigSpace<Extended>
I think in practice users don't have the need to write it anyways. You'd access
the config space with either
let config = pdev.config_space()?;
or
let config = pdev.config_space_extended()?;
i.e. there is no need to store an instance of the struct anywhere.
Should it turn out that we do need it for some reason in the future we can do
this as follow-up, I think.
Powered by blists - more mailing lists