libertas: Use lbs_is_cmd_allowed() check in command handling routines.

lbs_is_cmd_allowed() check is added in __lbs_cmd_async() and
lbs_prepare_and_send_command(). The check is removed from other places.

Signed-off-by: Amitkumar Karwar <akarwar@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Acked-by: Dan Williams <dcbw@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Amitkumar Karwar
2009-10-06 19:20:28 -07:00
committed by John W. Linville
parent 536b3a7a10
commit 63f275df64
5 changed files with 34 additions and 191 deletions

View File

@@ -74,6 +74,30 @@ static u8 is_command_allowed_in_ps(u16 cmd)
return 0;
}
/**
* @brief This function checks if the command is allowed.
*
* @param priv A pointer to lbs_private structure
* @return allowed or not allowed.
*/
static int lbs_is_cmd_allowed(struct lbs_private *priv)
{
int ret = 1;
lbs_deb_enter(LBS_DEB_CMD);
if (!priv->is_auto_deep_sleep_enabled) {
if (priv->is_deep_sleep) {
lbs_deb_cmd("command not allowed in deep sleep\n");
ret = 0;
}
}
lbs_deb_leave(LBS_DEB_CMD);
return ret;
}
/**
* @brief Updates the hardware details like MAC address and regulatory region
*
@@ -1452,6 +1476,11 @@ int lbs_prepare_and_send_command(struct lbs_private *priv,
goto done;
}
if (!lbs_is_cmd_allowed(priv)) {
ret = -EBUSY;
goto done;
}
cmdnode = lbs_get_cmd_ctrl_node(priv);
if (cmdnode == NULL) {
@@ -2104,6 +2133,11 @@ static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv,
goto done;
}
if (!lbs_is_cmd_allowed(priv)) {
cmdnode = ERR_PTR(-EBUSY);
goto done;
}
cmdnode = lbs_get_cmd_ctrl_node(priv);
if (cmdnode == NULL) {
lbs_deb_host("PREP_CMD: cmdnode is NULL\n");