Re: [PATCH 3/4] pci: move devres code from pci.c to devres.c

From: Arnd Bergmann
Date: Tue Nov 21 2023 - 05:19:36 EST


On Mon, Nov 20, 2023, at 22:59, Philipp Stanner wrote:
> The file pci.c is very large and contains a number of devres-functions.
> These functions should now reside in devres.c
>
> There are a few callers left in pci.c that do devres operations. These
> should be ported in the future. Corresponding TODOs are added by this
> commit.
>
> The reason they are not moved right now in this commit is that pci's
> devres currently implements a sort of "hybrid-mode":
> pci_request_region(), for instance, does not have a corresponding pcim_
> equivalent, yet. Instead, the function can be made managed by previously
> calling pcim_enable_device() (instead of pci_enable_device()). This
> makes it unreasonable to move pci_request_region() to devres.c
> Moving the functions would require changes to pci's API and is,
> therefore, left for future work.
>
> Move as much devres-specific code from pci.c to devres.c as possible.
>
> Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Philipp Stanner <pstanner@xxxxxxxxxx>
> ---
> drivers/pci/devres.c | 243 +++++++++++++++++++++++++++++++++++++++++
> drivers/pci/pci.c | 249 -------------------------------------------
> drivers/pci/pci.h | 24 +++++
> 3 files changed, 267 insertions(+), 249 deletions(-)

I had just commented in the other mail that you'd have to move
these functions to devres.c for the file to make sense, but that
I think the existing state is better.

Just to clarify again here: this patch does not seem to improve
anything to me, I'd much prefer leaving it the way it is, and
moving the pcim_iomap family to corresponding drivers/pci/iomap.c.

Arnd