From 99580edb0096c497efb39c9c583c381aba9761d1 Mon Sep 17 00:00:00 2001 From: Wade Song Date: Sun, 4 Sep 2022 21:10:22 +0800 Subject: [PATCH] cnss2: Remove function cnss_pm_notify To protect firmware download not be processed when system goes into suspend, before we add semaphore cnss_pm_sem in cnss driver. Function cnss_pm_notify, PM_POST_SUSPEND may be got before PM_SUSPEND_PREPARE. Once it happens, the count of cnss_pm_sem will be abnormal. And, ROME firmware download is in qcacld driver. Not in cnss driver. So, remove function cnss_pm_notify, and the export symbol cnss_lock_pm_sem and cnss_release_pm_sem. Move the protection to qcacld driver. In qcacld driver, use wakeup source to protect ROME firmware download. Change-Id: I7768fdbeb1fa8cd6ef3b260eb0aafb231aeed324 CRs-Fixed: 3294347 --- cnss2/main.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) diff --git a/cnss2/main.c b/cnss2/main.c index 5cfe85d27d..67ee3aaa7c 100644 --- a/cnss2/main.c +++ b/cnss2/main.c @@ -92,8 +92,6 @@ static struct cnss_plat_data *plat_env; static bool cnss_allow_driver_loading; -static DECLARE_RWSEM(cnss_pm_sem); - static struct cnss_fw_files FW_FILES_QCA6174_FW_3_0 = { "qwlan30.bin", "bdwlan30.bin", "otp30.bin", "utf30.bin", "utfbd30.bin", "epping30.bin", "evicted30.bin" @@ -251,25 +249,6 @@ int cnss_get_feature_list(struct cnss_plat_data *plat_priv, return 0; } -static int cnss_pm_notify(struct notifier_block *b, - unsigned long event, void *p) -{ - switch (event) { - case PM_SUSPEND_PREPARE: - down_write(&cnss_pm_sem); - break; - case PM_POST_SUSPEND: - up_write(&cnss_pm_sem); - break; - } - - return NOTIFY_DONE; -} - -static struct notifier_block cnss_pm_notifier = { - .notifier_call = cnss_pm_notify, -}; - void cnss_pm_stay_awake(struct cnss_plat_data *plat_priv) { if (atomic_inc_return(&plat_priv->pm_count) != 1) @@ -296,18 +275,6 @@ void cnss_pm_relax(struct cnss_plat_data *plat_priv) pm_relax(&plat_priv->plat_dev->dev); } -void cnss_lock_pm_sem(struct device *dev) -{ - down_read(&cnss_pm_sem); -} -EXPORT_SYMBOL(cnss_lock_pm_sem); - -void cnss_release_pm_sem(struct device *dev) -{ - up_read(&cnss_pm_sem); -} -EXPORT_SYMBOL(cnss_release_pm_sem); - int cnss_get_fw_files_for_target(struct device *dev, struct cnss_fw_files *pfw_files, u32 target_type, u32 target_version) @@ -3831,10 +3798,6 @@ static int cnss_misc_init(struct cnss_plat_data *plat_priv) timer_setup(&plat_priv->fw_boot_timer, cnss_bus_fw_boot_timeout_hdlr, 0); - ret = register_pm_notifier(&cnss_pm_notifier); - if (ret) - cnss_pr_err("Failed to register PM notifier, err = %d\n", ret); - plat_priv->reboot_nb.notifier_call = cnss_reboot_notifier; ret = register_reboot_notifier(&plat_priv->reboot_nb); if (ret) @@ -3885,7 +3848,6 @@ static void cnss_misc_deinit(struct cnss_plat_data *plat_priv) complete_all(&plat_priv->daemon_connected); device_init_wakeup(&plat_priv->plat_dev->dev, false); unregister_reboot_notifier(&plat_priv->reboot_nb); - unregister_pm_notifier(&cnss_pm_notifier); del_timer(&plat_priv->fw_boot_timer); wakeup_source_unregister(plat_priv->recovery_ws); cnss_deinit_sol_gpio(plat_priv);