mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
LinuxKPI: pci: add [linuxkpi_]pci_get_device()
Add a version of pci_get_device() as linuxkpi_pci_get_device() not (yet) supporting the last argument. Due to conflicts we cannot redefine it as we would normally do in LinuxKPI so drivers have to be adjusted. MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D37593
This commit is contained in:
parent
e9715b1c44
commit
8f61992d7c
2 changed files with 31 additions and 0 deletions
|
|
@ -344,6 +344,7 @@ 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 *);
|
||||
struct pci_dev *lkpi_pci_get_device(uint16_t, uint16_t, struct pci_dev *);
|
||||
|
||||
static inline bool
|
||||
dev_is_pci(struct device *dev)
|
||||
|
|
@ -1584,6 +1585,19 @@ err:
|
|||
return (-EINVAL);
|
||||
}
|
||||
|
||||
/*
|
||||
* We cannot simply re-define pci_get_device() as we would normally do
|
||||
* and then hide it in linux_pci.c as too many semi-native drivers still
|
||||
* inlucde linux/pci.h and run into the conflict with native PCI. Linux drivers
|
||||
* using pci_get_device() need to be changed to call linuxkpi_pci_get_device().
|
||||
*/
|
||||
static inline struct pci_dev *
|
||||
linuxkpi_pci_get_device(uint16_t vendor, uint16_t device, struct pci_dev *odev)
|
||||
{
|
||||
|
||||
return (lkpi_pci_get_device(vendor, device, odev));
|
||||
}
|
||||
|
||||
/* This is a FreeBSD extension so we can use bus_*(). */
|
||||
static inline void
|
||||
linuxkpi_pcim_want_to_use_bus_functions(struct pci_dev *pdev)
|
||||
|
|
|
|||
|
|
@ -271,6 +271,23 @@ linux_pci_find(device_t dev, const struct pci_device_id **idp)
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
struct pci_dev *
|
||||
lkpi_pci_get_device(uint16_t vendor, uint16_t device, struct pci_dev *odev)
|
||||
{
|
||||
struct pci_dev *pdev;
|
||||
|
||||
KASSERT(odev == NULL, ("%s: odev argument not yet supported\n", __func__));
|
||||
|
||||
spin_lock(&pci_lock);
|
||||
list_for_each_entry(pdev, &pci_devices, links) {
|
||||
if (pdev->vendor == vendor && pdev->device == device)
|
||||
break;
|
||||
}
|
||||
spin_unlock(&pci_lock);
|
||||
|
||||
return (pdev);
|
||||
}
|
||||
|
||||
static void
|
||||
lkpi_pci_dev_release(struct device *dev)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue