cnss2: Fix a few issues during platform reboot or shutdown

Make unregister driver work unkillable to avoid WLAN host driver
handling issues after it is killed by platform reboot or shutdown.
Also add proper handlings and checks for platform reboot or shutdown
to avoid unnecessary asserts for calibration cases.

Change-Id: Ide137dc351ca48ef23573abb325db011b8460f54
Signed-off-by: Yue Ma <yuem@codeaurora.org>
This commit is contained in:
Yue Ma 2020-04-27 15:03:40 -07:00 • committed by Gerrit - the friendly Code Review server
commit ed35aa4349
2 changed files with 10 additions and 2 deletions

View file

@ -1971,6 +1971,7 @@ static ssize_t shutdown_store(struct kobject *kobj,
set_bit(CNSS_IN_REBOOT, &plat_priv->driver_state);
del_timer(&plat_priv->fw_boot_timer);
complete_all(&plat_priv->power_up_complete);
complete_all(&plat_priv->cal_complete);
}
cnss_pr_dbg("Received shutdown notification\n");
@ -2112,6 +2113,7 @@ static int cnss_reboot_notifier(struct notifier_block *nb,
set_bit(CNSS_IN_REBOOT, &plat_priv->driver_state);
del_timer(&plat_priv->fw_boot_timer);
complete_all(&plat_priv->power_up_complete);
complete_all(&plat_priv->cal_complete);
cnss_pr_dbg("Reboot is in progress with action %d\n", action);
return NOTIFY_DONE;

View file

@ -2138,7 +2138,8 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
msecs_to_jiffies(timeout) << 2);
if (!ret) {
cnss_pr_err("Timeout waiting for calibration to complete\n");
CNSS_ASSERT(0);
if (!test_bit(CNSS_IN_REBOOT, &plat_priv->driver_state))
CNSS_ASSERT(0);
cal_info = kzalloc(sizeof(*cal_info), GFP_KERNEL);
if (!cal_info)
@ -2150,6 +2151,11 @@ int cnss_wlan_register_driver(struct cnss_wlan_driver *driver_ops)
0, cal_info);
}
if (test_bit(CNSS_IN_REBOOT, &plat_priv->driver_state)) {
cnss_pr_dbg("Reboot or shutdown is in progress, ignore register driver\n");
return -EINVAL;
}
register_driver:
ret = cnss_driver_event_post(plat_priv,
CNSS_DRIVER_EVENT_REGISTER_DRIVER,
@ -2205,7 +2211,7 @@ skip_wait_idle_restart:
skip_wait_recovery:
cnss_driver_event_post(plat_priv,
CNSS_DRIVER_EVENT_UNREGISTER_DRIVER,
CNSS_EVENT_SYNC_UNINTERRUPTIBLE, NULL);
CNSS_EVENT_SYNC_UNKILLABLE, NULL);
}
EXPORT_SYMBOL(cnss_wlan_unregister_driver);