PCI: Move devres code from pci.c to devres.c
authorPhilipp Stanner <pstanner@redhat.com>
Wed, 31 Jan 2024 09:00:23 +0000 (10:00 +0100)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 12 Feb 2024 16:36:17 +0000 (10:36 -0600)
commit815a3909ead7440e2827042e5ec618f4396f022c
tree0ab07a4035ccd6f8536aae7918d535f4fe111698
parentacc2364fe661069637c60ed5bbd32ea2a2c5ef61
PCI: Move devres code from pci.c to devres.c

The file pci.c is very large and contains a number of devres functions.
These functions should now reside in devres.c.

Move as much devres-specific code from pci.c to devres.c as possible.

There are a few callers left in pci.c that do devres operations. These
should be ported in the future. Add corresponding TODOs.

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.

In summary, this commit serves as a preparation step for a following
patch series that will cleanly separate the PCI's managed and unmanaged
API.

Link: https://lore.kernel.org/r/20240131090023.12331-5-pstanner@redhat.com
Suggested-by: Danilo Krummrich <dakr@redhat.com>
Signed-off-by: Philipp Stanner <pstanner@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/devres.c
drivers/pci/pci.c
drivers/pci/pci.h