git: 2cd55de380d3 - stable/13 - linuxkpi: Move lkpi_pci_devres_get_alloc into .c file
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 05 Apr 2022 14:42:31 UTC
The branch stable/13 has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=2cd55de380d3d6f02c9b40ea53a319b477268f1c
commit 2cd55de380d3d6f02c9b40ea53a319b477268f1c
Author: Warner Losh <imp@FreeBSD.org>
AuthorDate: 2022-04-05 05:06:06 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-04-05 14:40:10 +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
(cherry picked from commit 3ea682e21eed92f31dcfb8a34409580d36c452f7)
---
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 c4d30a6e293a..f655c8f5ccdf 100644
--- a/sys/compat/linuxkpi/common/include/linux/pci.h
+++ b/sys/compat/linuxkpi/common/include/linux/pci.h
@@ -340,6 +340,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 *);
@@ -542,21 +543,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 0e952c17d7f7..b396b512e176 100644
--- a/sys/compat/linuxkpi/common/src/linux_pci.c
+++ b/sys/compat/linuxkpi/common/src/linux_pci.c
@@ -506,6 +506,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)
{