Re: [PATCH v2 2/4] lib: move pci-specific devres code to drivers/pci/
From: Philipp Stanner
Date: Fri Dec 01 2023 - 14:00:13 EST
On Fri, 2023-12-01 at 15:44 +0100, Arnd Bergmann wrote:
> On Fri, Dec 1, 2023, at 13:16, Philipp Stanner wrote:
> > The pcim_*() functions in lib/devres.c are guarded by an #ifdef
> > CONFIG_PCI and, thus, don't belong to this file. They are only ever
> > used
> > for pci and are not generic infrastructure.
> >
> > Move all pcim_*() functions in lib/devres.c to
> > drivers/pci/devres.c.
> > Adjust the Makefile.
> >
> > Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> > Signed-off-by: Philipp Stanner <pstanner@xxxxxxxxxx>
> > ---
> > drivers/pci/Makefile | 2 +-
> > drivers/pci/devres.c | 207
> > ++++++++++++++++++++++++++++++++++++++++++
> > lib/devres.c | 208 +--------------------------------------
> > ----
>
> I still think this should go into drivers/pci/pci_iomap.c along
> with the other functions.
I understand where you're coming from, but the technical reason I'm
doing it this way is the same topic as in patch №1:
@@ -14,6 +14,7 @@ ifdef CONFIG_PCI
obj-$(CONFIG_PROC_FS) += proc.o
obj-$(CONFIG_SYSFS) += slot.o
obj-$(CONFIG_ACPI) += pci-acpi.o
+obj-$(CONFIG_GENERIC_PCI_IOMAP) += iomap.o
endif
As you pointed out very correctly, I removed the #ifdef PCI in the
iomap.c functions, which would result in build failure, because the
file has to be made empty if GENERIC_PCI_IOMAP is selected and PCI is
not
The devres functions have different compile rules than the iomap
functions have.
I would dislike it very much to need yet another preprocessor
instruction, especially if we're talking about #ifdef PCI within the
very PCI driver.
P.
>
> Arnd
>