]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/net/wireless/mwifiex/join.c
wireless: Remove casts to same type
[karo-tx-linux.git] / drivers / net / wireless / mwifiex / join.c
index 8a390982463ecd909c0262a0fc2c380109ed5066..82e63cee1e9770bf100a11e8e76b68531741df8d 100644 (file)
@@ -1349,22 +1349,16 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
 {
        u8 mac_address[ETH_ALEN];
        int ret;
-       u8 zero_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
 
-       if (mac) {
-               if (!memcmp(mac, zero_mac, sizeof(zero_mac)))
-                       memcpy((u8 *) &mac_address,
-                              (u8 *) &priv->curr_bss_params.bss_descriptor.
-                              mac_address, ETH_ALEN);
-               else
-                       memcpy((u8 *) &mac_address, (u8 *) mac, ETH_ALEN);
-       } else {
-               memcpy((u8 *) &mac_address, (u8 *) &priv->curr_bss_params.
-                      bss_descriptor.mac_address, ETH_ALEN);
-       }
+       if (!mac || is_zero_ether_addr(mac))
+               memcpy(mac_address,
+                      priv->curr_bss_params.bss_descriptor.mac_address,
+                      ETH_ALEN);
+       else
+               memcpy(mac_address, mac, ETH_ALEN);
 
        ret = mwifiex_send_cmd_sync(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,
-                                   HostCmd_ACT_GEN_SET, 0, &mac_address);
+                                   HostCmd_ACT_GEN_SET, 0, mac_address);
 
        return ret;
 }
@@ -1374,22 +1368,28 @@ static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)
  *
  * In case of infra made, it sends deauthentication request, and
  * in case of ad-hoc mode, a stop network request is sent to the firmware.
+ * In AP mode, a command to stop bss is sent to firmware.
  */
 int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)
 {
-       int ret = 0;
+       if (!priv->media_connected)
+               return 0;
 
-       if (priv->media_connected) {
-               if (priv->bss_mode == NL80211_IFTYPE_STATION) {
-                       ret = mwifiex_deauthenticate_infra(priv, mac);
-               } else if (priv->bss_mode == NL80211_IFTYPE_ADHOC) {
-                       ret = mwifiex_send_cmd_sync(priv,
-                                               HostCmd_CMD_802_11_AD_HOC_STOP,
-                                               HostCmd_ACT_GEN_SET, 0, NULL);
-               }
+       switch (priv->bss_mode) {
+       case NL80211_IFTYPE_STATION:
+               return mwifiex_deauthenticate_infra(priv, mac);
+       case NL80211_IFTYPE_ADHOC:
+               return mwifiex_send_cmd_sync(priv,
+                                            HostCmd_CMD_802_11_AD_HOC_STOP,
+                                            HostCmd_ACT_GEN_SET, 0, NULL);
+       case NL80211_IFTYPE_AP:
+               return mwifiex_send_cmd_sync(priv, HostCmd_CMD_UAP_BSS_STOP,
+                                            HostCmd_ACT_GEN_SET, 0, NULL);
+       default:
+               break;
        }
 
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(mwifiex_deauthenticate);