mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
cnss2: Add sanity check for cnss pm runtime APIs
The cnss pm runtime APIs will be bypassed if the RPM is not enabled. Change-Id: I41bbf30e1f12426670606b90a88e3af4d0840c9c Signed-off-by: Tiger Yu <tfyu@codeaurora.org>
This commit is contained in:
parent
2a1334dded
commit
86af8dc6c3
1 changed files with 21 additions and 0 deletions
|
|
@ -2547,6 +2547,9 @@ int cnss_pci_pm_request_resume(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return 0;
|
||||
|
||||
status = dev->power.runtime_status;
|
||||
if (status == RPM_SUSPENDING || status == RPM_SUSPENDED)
|
||||
cnss_pr_vdbg("Runtime PM resume is requested by %ps\n",
|
||||
|
|
@ -2565,6 +2568,9 @@ int cnss_pci_pm_runtime_resume(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return 0;
|
||||
|
||||
status = dev->power.runtime_status;
|
||||
if (status == RPM_SUSPENDING || status == RPM_SUSPENDED)
|
||||
cnss_pr_vdbg("Runtime PM resume is requested by %ps\n",
|
||||
|
|
@ -2583,6 +2589,9 @@ int cnss_pci_pm_runtime_get(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return 0;
|
||||
|
||||
status = dev->power.runtime_status;
|
||||
if (status == RPM_SUSPENDING || status == RPM_SUSPENDED)
|
||||
cnss_pr_vdbg("Runtime PM resume is requested by %ps\n",
|
||||
|
|
@ -2601,6 +2610,9 @@ int cnss_pci_pm_runtime_get_sync(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return 0;
|
||||
|
||||
status = dev->power.runtime_status;
|
||||
if (status == RPM_SUSPENDING || status == RPM_SUSPENDED)
|
||||
cnss_pr_vdbg("Runtime PM resume is requested by %ps\n",
|
||||
|
|
@ -2614,6 +2626,9 @@ void cnss_pci_pm_runtime_get_noresume(struct cnss_pci_data *pci_priv)
|
|||
if (!pci_priv)
|
||||
return;
|
||||
|
||||
if (!pm_runtime_enabled(&pci_priv->pci_dev->dev))
|
||||
return;
|
||||
|
||||
pm_runtime_get_noresume(&pci_priv->pci_dev->dev);
|
||||
}
|
||||
|
||||
|
|
@ -2626,6 +2641,9 @@ int cnss_pci_pm_runtime_put_autosuspend(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return 0;
|
||||
|
||||
if (atomic_read(&dev->power.usage_count) == 0) {
|
||||
cnss_pr_dbg("Ignore excessive runtime PM put operation\n");
|
||||
return -EINVAL;
|
||||
|
|
@ -2643,6 +2661,9 @@ void cnss_pci_pm_runtime_put_noidle(struct cnss_pci_data *pci_priv)
|
|||
|
||||
dev = &pci_priv->pci_dev->dev;
|
||||
|
||||
if (!pm_runtime_enabled(dev))
|
||||
return;
|
||||
|
||||
if (atomic_read(&dev->power.usage_count) == 0) {
|
||||
cnss_pr_dbg("Ignore excessive runtime PM put operation\n");
|
||||
return;
|
||||
|
|
|
|||
Loading…
Reference in a new issue