diff options
| author | Yue Ma <yuem@codeaurora.org> | 2018-09-10 17:20:54 -0700 |
|---|---|---|
| committer | Yue Ma <yuem@codeaurora.org> | 2018-09-13 11:04:22 -0700 |
| commit | ee4241b76814f06438dbf14b19681af191f079f1 (patch) | |
| tree | d5297175a8420972d738a7148307cfa288837410 | |
| parent | 1af739995e3eccd2406e1d85ba903ce0cc41af7b (diff) | |
cnss2: Add API to check if WLAN PCIe device is down
API provision for WLAN host driver to check if WLAN PCIe device
is down.
Change-Id: I91efcd781af67c72b787c89e6b619c4cc49da34b
Signed-off-by: Yue Ma <yuem@codeaurora.org>
| -rw-r--r-- | drivers/net/wireless/cnss2/pci.c | 21 | ||||
| -rw-r--r-- | include/net/cnss2.h | 1 |
2 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/wireless/cnss2/pci.c b/drivers/net/wireless/cnss2/pci.c index 4869b33c8526..8f9bc213cac3 100644 --- a/drivers/net/wireless/cnss2/pci.c +++ b/drivers/net/wireless/cnss2/pci.c @@ -236,6 +236,27 @@ static int cnss_set_pci_link(struct cnss_pci_data *pci_priv, bool link_up) } #endif /* CONFIG_PCI_MSM */ +int cnss_pci_is_device_down(struct device *dev) +{ + struct cnss_plat_data *plat_priv = cnss_bus_dev_to_plat_priv(dev); + struct cnss_pci_data *pci_priv; + + if (!plat_priv) { + cnss_pr_err("plat_priv is NULL\n"); + return -ENODEV; + } + + pci_priv = plat_priv->bus_priv; + if (!pci_priv) { + cnss_pr_err("pci_priv is NULL\n"); + return -ENODEV; + } + + return test_bit(CNSS_DEV_ERR_NOTIFY, &plat_priv->driver_state) | + pci_priv->pci_link_down_ind; +} +EXPORT_SYMBOL(cnss_pci_is_device_down); + int cnss_pci_recovery_update_status(struct cnss_pci_data *pci_priv) { struct cnss_plat_data *plat_priv; diff --git a/include/net/cnss2.h b/include/net/cnss2.h index 3a8b503c1938..e06f0b670d90 100644 --- a/include/net/cnss2.h +++ b/include/net/cnss2.h @@ -167,6 +167,7 @@ static inline int cnss_wlan_pm_control(struct device *dev, bool vote) return 0; } #endif /* CONFIG_PCI_MSM */ +extern int cnss_pci_is_device_down(struct device *dev); extern void cnss_schedule_recovery(struct device *dev, enum cnss_recovery_reason reason); extern int cnss_self_recovery(struct device *dev, |
