diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 6c22780eb..dc945ed6d 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c @@ -462,6 +462,33 @@ static void wakeup_source_deactivate(struct wakeup_source *ws) wake_up(&wakeup_count_wait_queue); } +static bool wakeup_source_blocker(struct wakeup_source *ws) +{ + unsigned int wslen = 0; + + if (ws && ws->active) { + wslen = strlen(ws->name); + + if ((!enable_ipa_ws && !strncmp(ws->name, "IPA_WS", wslen)) || + (!enable_wlan_extscan_wl_ws && + !strncmp(ws->name, "wlan_extscan_wl", wslen)) || + (!enable_qcom_rx_wakelock_ws && + !strncmp(ws->name, "qcom_rx_wakelock", wslen)) || + (!enable_wlan_ws && + !strncmp(ws->name, "wlan", wslen)) || + (!enable_timerfd_ws && + !strncmp(ws->name, "[timerfd]", wslen)) || + (!enable_netlink_ws && + !strncmp(ws->name, "NETLINK", wslen))) { + wakeup_source_deactivate(ws); + pr_info("forcefully deactivate wakeup source: %s\n", ws->name); + return true; + } + } + + return false; +} + /* * The functions below use the observation that each wakeup event starts a * period in which the system should not be suspended. The moment this period @@ -502,6 +529,9 @@ static void wakeup_source_activate(struct wakeup_source *ws) { unsigned int cec; + if (wakeup_source_blocker(ws)) + return; + /* * active wakeup source should bring the system * out of PM_SUSPEND_FREEZE state @@ -752,26 +782,10 @@ void pm_print_active_wakeup_sources(void) rcu_read_lock(); list_for_each_entry_rcu(ws, &wakeup_sources, entry) { if (ws->active) { - int wslen = strlen(ws->name); - pr_info("active wakeup source: %s\n", ws->name); - if ((!enable_ipa_ws && !strncmp(ws->name, "IPA_WS", wslen)) || - (!enable_wlan_extscan_wl_ws && - !strncmp(ws->name, "wlan_extscan_wl", wslen)) || - (!enable_qcom_rx_wakelock_ws && - !strncmp(ws->name, "qcom_rx_wakelock", wslen)) || - (!enable_wlan_ws && - !strncmp(ws->name, "wlan", wslen)) || - (!enable_timerfd_ws && - !strncmp(ws->name, "[timerfd]", wslen)) || - (!enable_netlink_ws && - !strncmp(ws->name, "NETLINK", wslen))) { - wakeup_source_deactivate(ws); - pr_info("forcefully deactivate wakeup source: %s\n", ws->name); - } else { + if (!wakeup_source_blocker(ws)) active = 1; - } } else if (!active && (!last_activity_ws || ktime_to_ns(ws->last_time) >