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>
This commit is contained in:
Yue Ma 2018-09-10 17:20:54 -07:00
parent 1af739995e
commit ee4241b768
2 changed files with 22 additions and 0 deletions

View file

@ -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;

View file

@ -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,