cnss: Add cnss_get_restart_level() support

WLAN host driver requires this API to get SSR state, avoid doing
ramdump when SSR happen and quick restart WLAN subsys.

Add back subsys_get_restart_level() support and fix return -EIVAL
in cnss_put_hw_resources().

Change-Id: I902d81b5693ab76028ed7e97183e07ea970930c1
CRs-Fixed: 2945893
Signed-off-by: Will Huang <wilhuang@codeaurora.org>
This commit is contained in:
Will Huang 2021-05-14 17:32:47 +08:00
commit e67e76d6d1
3 changed files with 16 additions and 4 deletions

View file

@ -274,7 +274,7 @@ static int cnss_put_hw_resources(struct device *dev)
info->cnss_hw_state = false;
return ret;
return 0;
}
static int cnss_get_hw_resources(struct device *dev)
@ -678,9 +678,9 @@ int cnss_get_restart_level(void)
ssr_info = &cnss_pdata->ssr_info;
if (!ssr_info->subsys)
return CNSS_RESET_SOC;
#ifdef CNSS_COMPLIE_ISSUE_FIX_LATER_IFNEEDED
level = subsys_get_restart_level(ssr_info->subsys);
#endif
switch (level) {
case RESET_SOC:
return CNSS_RESET_SOC;

View file

@ -328,6 +328,12 @@ static ssize_t system_debug_store(struct device *dev,
}
static DEVICE_ATTR_RW(system_debug);
int subsys_get_restart_level(struct subsys_device *dev)
{
return dev->restart_level;
}
EXPORT_SYMBOL(subsys_get_restart_level);
static void subsys_set_state(struct subsys_device *subsys,
enum subsys_state state)
{

View file

@ -1,6 +1,6 @@
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2014-2019, The Linux Foundation. All rights reserved.
* Copyright (c) 2014-2019 2021, The Linux Foundation. All rights reserved.
*/
#ifndef __SUBSYS_RESTART_H
@ -132,6 +132,7 @@ struct notif_data {
#if IS_ENABLED(CONFIG_MSM_SUBSYSTEM_RESTART)
extern int subsys_get_restart_level(struct subsys_device *dev);
extern int subsystem_restart_dev(struct subsys_device *dev);
extern int subsystem_restart(const char *name);
extern int subsystem_crashed(const char *name);
@ -157,6 +158,11 @@ static inline void complete_shutdown_ack(struct subsys_desc *desc)
struct subsys_device *find_subsys_device(const char *str);
#else
static inline int subsys_get_restart_level(struct subsys_device *dev)
{
return 0;
}
static inline int subsystem_restart_dev(struct subsys_device *dev)
{
return 0;