diff options
author | Amitkumar Karwar <akarwar@marvell.com> | 2009-10-06 22:20:28 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-10-07 16:39:53 -0400 |
commit | 63f275df64dc69a46bbc21e6a68d5506d2da9c51 (patch) | |
tree | 4d21f47420f0ef155e9e461512d3c6354019c31c /drivers/net/wireless/libertas/cmd.c | |
parent | 536b3a7a10c8fd39576a0602bfeca9bbd04658a6 (diff) |
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>
Diffstat (limited to 'drivers/net/wireless/libertas/cmd.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmd.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c index 3a3e8947e84a..0fb312576b8d 100644 --- a/drivers/net/wireless/libertas/cmd.c +++ b/drivers/net/wireless/libertas/cmd.c | |||
@@ -75,6 +75,30 @@ static u8 is_command_allowed_in_ps(u16 cmd) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * @brief This function checks if the command is allowed. | ||
79 | * | ||
80 | * @param priv A pointer to lbs_private structure | ||
81 | * @return allowed or not allowed. | ||
82 | */ | ||
83 | |||
84 | static int lbs_is_cmd_allowed(struct lbs_private *priv) | ||
85 | { | ||
86 | int ret = 1; | ||
87 | |||
88 | lbs_deb_enter(LBS_DEB_CMD); | ||
89 | |||
90 | if (!priv->is_auto_deep_sleep_enabled) { | ||
91 | if (priv->is_deep_sleep) { | ||
92 | lbs_deb_cmd("command not allowed in deep sleep\n"); | ||
93 | ret = 0; | ||
94 | } | ||
95 | } | ||
96 | |||
97 | lbs_deb_leave(LBS_DEB_CMD); | ||
98 | return ret; | ||
99 | } | ||
100 | |||
101 | /** | ||
78 | * @brief Updates the hardware details like MAC address and regulatory region | 102 | * @brief Updates the hardware details like MAC address and regulatory region |
79 | * | 103 | * |
80 | * @param priv A pointer to struct lbs_private structure | 104 | * @param priv A pointer to struct lbs_private structure |
@@ -1452,6 +1476,11 @@ int lbs_prepare_and_send_command(struct lbs_private *priv, | |||
1452 | goto done; | 1476 | goto done; |
1453 | } | 1477 | } |
1454 | 1478 | ||
1479 | if (!lbs_is_cmd_allowed(priv)) { | ||
1480 | ret = -EBUSY; | ||
1481 | goto done; | ||
1482 | } | ||
1483 | |||
1455 | cmdnode = lbs_get_cmd_ctrl_node(priv); | 1484 | cmdnode = lbs_get_cmd_ctrl_node(priv); |
1456 | 1485 | ||
1457 | if (cmdnode == NULL) { | 1486 | if (cmdnode == NULL) { |
@@ -2104,6 +2133,11 @@ static struct cmd_ctrl_node *__lbs_cmd_async(struct lbs_private *priv, | |||
2104 | goto done; | 2133 | goto done; |
2105 | } | 2134 | } |
2106 | 2135 | ||
2136 | if (!lbs_is_cmd_allowed(priv)) { | ||
2137 | cmdnode = ERR_PTR(-EBUSY); | ||
2138 | goto done; | ||
2139 | } | ||
2140 | |||
2107 | cmdnode = lbs_get_cmd_ctrl_node(priv); | 2141 | cmdnode = lbs_get_cmd_ctrl_node(priv); |
2108 | if (cmdnode == NULL) { | 2142 | if (cmdnode == NULL) { |
2109 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); | 2143 | lbs_deb_host("PREP_CMD: cmdnode is NULL\n"); |