diff options
author | dim <dim@FreeBSD.org> | 2016-01-15 17:55:00 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2016-01-15 17:55:00 +0000 |
commit | 6b1f1a14c5a8532e9a6ee8c10ba741fcc55896fe (patch) | |
tree | 402d8f6984826f9801b169f8bc8a5dae20ed1c60 /sys/compat/linuxkpi/common/src/linux_pci.c | |
parent | 8e5c968a84ceadc1d422b13933e1edc45c5372ea (diff) | |
parent | 5ac53a20e575001384d1acfb426a65ae8c309c24 (diff) | |
download | FreeBSD-src-6b1f1a14c5a8532e9a6ee8c10ba741fcc55896fe.zip FreeBSD-src-6b1f1a14c5a8532e9a6ee8c10ba741fcc55896fe.tar.gz |
Merge ^/head r293850 through r294089.
Diffstat (limited to 'sys/compat/linuxkpi/common/src/linux_pci.c')
-rw-r--r-- | sys/compat/linuxkpi/common/src/linux_pci.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/sys/compat/linuxkpi/common/src/linux_pci.c b/sys/compat/linuxkpi/common/src/linux_pci.c index 7c49a54..74d4f77 100644 --- a/sys/compat/linuxkpi/common/src/linux_pci.c +++ b/sys/compat/linuxkpi/common/src/linux_pci.c @@ -61,11 +61,17 @@ __FBSDID("$FreeBSD$"); static device_probe_t linux_pci_probe; static device_attach_t linux_pci_attach; static device_detach_t linux_pci_detach; +static device_suspend_t linux_pci_suspend; +static device_resume_t linux_pci_resume; +static device_shutdown_t linux_pci_shutdown; static device_method_t pci_methods[] = { DEVMETHOD(device_probe, linux_pci_probe), DEVMETHOD(device_attach, linux_pci_attach), DEVMETHOD(device_detach, linux_pci_detach), + DEVMETHOD(device_suspend, linux_pci_suspend), + DEVMETHOD(device_resume, linux_pci_resume), + DEVMETHOD(device_shutdown, linux_pci_shutdown), DEVMETHOD_END }; @@ -169,6 +175,46 @@ linux_pci_detach(device_t dev) return (0); } +static int +linux_pci_suspend(device_t dev) +{ + struct pm_message pm = { }; + struct pci_dev *pdev; + int err; + + pdev = device_get_softc(dev); + if (pdev->pdrv->suspend != NULL) + err = -pdev->pdrv->suspend(pdev, pm); + else + err = 0; + return (err); +} + +static int +linux_pci_resume(device_t dev) +{ + struct pci_dev *pdev; + int err; + + pdev = device_get_softc(dev); + if (pdev->pdrv->resume != NULL) + err = -pdev->pdrv->resume(pdev); + else + err = 0; + return (err); +} + +static int +linux_pci_shutdown(device_t dev) +{ + struct pci_dev *pdev; + + pdev = device_get_softc(dev); + if (pdev->pdrv->shutdown != NULL) + pdev->pdrv->shutdown(pdev); + return (0); +} + int pci_register_driver(struct pci_driver *pdrv) { |