diff --git a/hif/src/pcie/if_pci.c b/hif/src/pcie/if_pci.c index 36471e44df56..f4dd2d9fac44 100644 --- a/hif/src/pcie/if_pci.c +++ b/hif/src/pcie/if_pci.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -3912,6 +3912,9 @@ int hif_pm_runtime_get_sync(struct hif_opaque_softc *hif_ctx) if (!sc) return -EINVAL; + if (!pm_runtime_enabled(sc->dev)) + return 0; + pm_state = qdf_atomic_read(&sc->pm_state); if (pm_state == HIF_PM_RUNTIME_STATE_SUSPENDED || pm_state == HIF_PM_RUNTIME_STATE_SUSPENDING) @@ -3956,6 +3959,9 @@ int hif_pm_runtime_put_sync_suspend(struct hif_opaque_softc *hif_ctx) if (!sc) return -EINVAL; + if (!pm_runtime_enabled(sc->dev)) + return 0; + usage_count = atomic_read(&sc->dev->power.usage_count); if (usage_count == 1) { pm_state = qdf_atomic_read(&sc->pm_state); @@ -3982,6 +3988,9 @@ int hif_pm_runtime_request_resume(struct hif_opaque_softc *hif_ctx) if (!sc) return -EINVAL; + if (!pm_runtime_enabled(sc->dev)) + return 0; + pm_state = qdf_atomic_read(&sc->pm_state); if (pm_state == HIF_PM_RUNTIME_STATE_SUSPENDED || pm_state == HIF_PM_RUNTIME_STATE_SUSPENDING) @@ -4014,6 +4023,9 @@ void hif_pm_runtime_get_noresume(struct hif_opaque_softc *hif_ctx) if (!sc) return; + if (!pm_runtime_enabled(sc->dev)) + return; + sc->pm_stats.runtime_get++; pm_runtime_get_noresume(sc->dev); } @@ -4043,6 +4055,9 @@ int hif_pm_runtime_get(struct hif_opaque_softc *hif_ctx) return -EFAULT; } + if (!pm_runtime_enabled(sc->dev)) + return 0; + pm_state = qdf_atomic_read(&sc->pm_state); if (pm_state == HIF_PM_RUNTIME_STATE_ON || @@ -4107,6 +4122,10 @@ int hif_pm_runtime_put(struct hif_opaque_softc *hif_ctx) __func__); return -EFAULT; } + + if (!pm_runtime_enabled(sc->dev)) + return 0; + usage_count = atomic_read(&sc->dev->power.usage_count); if (usage_count == 1) {