File Index
Files and directories
Sign in
FILE

stmmac_libpci.c

File preview with syntax highlighting.

linux-6.19.14/drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.c C
 1// SPDX-License-Identifier: GPL-2.0-only
 2/*
 3 * PCI bus helpers for STMMAC driver
 4 * Copyright (C) 2025 Yao Zi <ziyao@disroot.org>
 5 */
 6
 7#include <linux/device.h>
 8#include <linux/pci.h>
 9
10#include "stmmac_libpci.h"
11
12int stmmac_pci_plat_suspend(struct device *dev, void *bsp_priv)
13{
14	struct pci_dev *pdev = to_pci_dev(dev);
15	int ret;
16
17	ret = pci_save_state(pdev);
18	if (ret)
19		return ret;
20
21	pci_disable_device(pdev);
22	pci_wake_from_d3(pdev, true);
23
24	return 0;
25}
26EXPORT_SYMBOL_GPL(stmmac_pci_plat_suspend);
27
28int stmmac_pci_plat_resume(struct device *dev, void *bsp_priv)
29{
30	struct pci_dev *pdev = to_pci_dev(dev);
31	int ret;
32
33	pci_restore_state(pdev);
34	pci_set_power_state(pdev, PCI_D0);
35
36	ret = pci_enable_device(pdev);
37	if (ret)
38		return ret;
39
40	pci_set_master(pdev);
41
42	return 0;
43}
44EXPORT_SYMBOL_GPL(stmmac_pci_plat_resume);
45
46MODULE_DESCRIPTION("STMMAC PCI helper library");
47MODULE_AUTHOR("Yao Zi <ziyao@disroot.org>");
48MODULE_LICENSE("GPL");
~/ Read-only file preview.