git: a84ef318c658 - releng/13.1 - linuxkpi: Move lkpi_pcim_iomap_devres_find to .c file

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 06 Apr 2022 17:46:11 UTC
The branch releng/13.1 has been updated by imp:

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

commit a84ef318c658f6b7901299ff129136ea3afffe8b
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:06:29 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-06 17:45:42 +0000

    linuxkpi: Move lkpi_pcim_iomap_devres_find to .c file
    
    lkpi_pcim_iomap_devres_find encodes the size of struct pcim_iomap_devres
    in the code, so move from .h to .c to move from client driver to
    linuxkpi module.
    
    Approved by:            re@ (gjb)
    Sponsored by:           Netflix
    Reviewed by:            hselasky
    Differential Revision:  https://reviews.freebsd.org/D34775
    
    (cherry picked from commit 2bf3361d56f70d87a19f5d2bc8d258d418fb7a24)
    (cherry picked from commit 211621030e19553c7bd321b05694418920517736)
---
 sys/compat/linuxkpi/common/include/linux/pci.h | 21 +--------------------
 sys/compat/linuxkpi/common/src/linux_pci.c     | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/pci.h b/sys/compat/linuxkpi/common/include/linux/pci.h
index e712477fbe9e..efe0780190b7 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -347,6 +347,7 @@ 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 *);
 struct resource *_lkpi_pci_iomap(struct pci_dev *pdev, int bar, int mmio_size);
+struct pcim_iomap_devres *lkpi_pcim_iomap_devres_find(struct pci_dev *pdev);
 void lkpi_pcim_iomap_table_release(struct device *, void *);
 
 static inline int
@@ -1431,26 +1432,6 @@ pcim_enable_device(struct pci_dev *pdev)
 	return (error);
 }
 
-static inline struct pcim_iomap_devres *
-lkpi_pcim_iomap_devres_find(struct pci_dev *pdev)
-{
-	struct pcim_iomap_devres *dr;
-
-	dr = lkpi_devres_find(&pdev->dev, lkpi_pcim_iomap_table_release,
-	    NULL, NULL);
-	if (dr == NULL) {
-		dr = lkpi_devres_alloc(lkpi_pcim_iomap_table_release,
-		    sizeof(*dr), GFP_KERNEL | __GFP_ZERO);
-		if (dr != NULL)
-			lkpi_devres_add(&pdev->dev, dr);
-	}
-
-	if (dr == NULL)
-		device_printf(pdev->dev.bsddev, "%s: NULL\n", __func__);
-
-	return (dr);
-}
-
 static inline void __iomem **
 pcim_iomap_table(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 328ca9c74bd1..acfc760f092f 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -550,6 +550,26 @@ lkpi_pci_devres_release(struct device *dev, void *p)
 	}
 }
 
+struct pcim_iomap_devres *
+lkpi_pcim_iomap_devres_find(struct pci_dev *pdev)
+{
+	struct pcim_iomap_devres *dr;
+
+	dr = lkpi_devres_find(&pdev->dev, lkpi_pcim_iomap_table_release,
+	    NULL, NULL);
+	if (dr == NULL) {
+		dr = lkpi_devres_alloc(lkpi_pcim_iomap_table_release,
+		    sizeof(*dr), GFP_KERNEL | __GFP_ZERO);
+		if (dr != NULL)
+			lkpi_devres_add(&pdev->dev, dr);
+	}
+
+	if (dr == NULL)
+		device_printf(pdev->dev.bsddev, "%s: NULL\n", __func__);
+
+	return (dr);
+}
+
 void
 lkpi_pcim_iomap_table_release(struct device *dev, void *p)
 {