git: 3ea682e21eed - main - linuxkpi: Move lkpi_pci_devres_get_alloc into .c file

From: Warner Losh <imp_at_FreeBSD.org>
Date: Tue, 05 Apr 2022 05:10:04 UTC
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=3ea682e21eed92f31dcfb8a34409580d36c452f7

commit 3ea682e21eed92f31dcfb8a34409580d36c452f7
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:06:06 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 05:06:06 +0000

    linuxkpi: Move lkpi_pci_devres_get_alloc into .c file
    
    lkpi_pci_devres_get_alloc encodes the struct pci_devres into its
    code. Move from .h file to .c file to move this knowledge into linuxkpi
    module.
    
    Sponsored by:           Netflix
    Reviewed by:            hselasky, emaste
    Differential Revision:  https://reviews.freebsd.org/D34772
---
 sys/compat/linuxkpi/common/include/linux/pci.h | 16 +---------------
 sys/compat/linuxkpi/common/src/linux_pci.c     | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 15 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index 0b4cee0f8dc2..ed653361b6af 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -318,6 +318,7 @@ struct pcim_iomap_devres {
 
 /* Internal helper function(s). */
 struct pci_dev *lkpinew_pci_dev(device_t);
+struct pci_devres *lkpi_pci_devres_get_alloc(struct pci_dev *pdev);
 void lkpi_pci_devres_release(struct device *, void *);
 void lkpi_pcim_iomap_table_release(struct device *, void *);
 
@@ -520,21 +521,6 @@ done:
 	return (pdev->bus->self);
 }
 
-static inline struct pci_devres *
-lkpi_pci_devres_get_alloc(struct pci_dev *pdev)
-{
-	struct pci_devres *dr;
-
-	dr = lkpi_devres_find(&pdev->dev, lkpi_pci_devres_release, NULL, NULL);
-	if (dr == NULL) {
-		dr = lkpi_devres_alloc(lkpi_pci_devres_release, sizeof(*dr),
-		    GFP_KERNEL | __GFP_ZERO);
-		if (dr != NULL)
-			lkpi_devres_add(&pdev->dev, dr);
-	}
-
-	return (dr);
-}
 static inline struct pci_devres *
 lkpi_pci_devres_find(struct pci_dev *pdev)
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c
index 34bac3843378..5c94f4691a1d 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -509,6 +509,22 @@ lkpi_pci_disable_dev(struct device *dev)
 	return (0);
 }
 
+struct pci_devres *
+lkpi_pci_devres_get_alloc(struct pci_dev *pdev)
+{
+	struct pci_devres *dr;
+
+	dr = lkpi_devres_find(&pdev->dev, lkpi_pci_devres_release, NULL, NULL);
+	if (dr == NULL) {
+		dr = lkpi_devres_alloc(lkpi_pci_devres_release, sizeof(*dr),
+		    GFP_KERNEL | __GFP_ZERO);
+		if (dr != NULL)
+			lkpi_devres_add(&pdev->dev, dr);
+	}
+
+	return (dr);
+}
+
 void
 lkpi_pci_devres_release(struct device *dev, void *p)
 {