Staging: rtl8187se/rtl8192e/rtl8192su: allow module unload
authorHerton Ronaldo Krzesinski <herton@mandriva.com.br>
Fri, 2 Oct 2009 14:03:38 +0000 (11:03 -0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 30 Oct 2009 21:47:43 +0000 (14:47 -0700)
On rtl81* additions, they had its wireless stack made builtin instead of
separated modules. But try_module_get/module_put in stack were kept,
they are uneeded with the stack builtin and makes rtl81* modules
impossible to remove on a system with an rtl81* card. request_module
calls are also uneeded with stack builtin, so remove them too.

Signed-off-by: Herton Ronaldo Krzesinski <herton@mandriva.com.br>
Cc: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
12 files changed:
drivers/staging/rtl8187se/ieee80211/ieee80211_crypt.c
drivers/staging/rtl8187se/ieee80211/ieee80211_module.c
drivers/staging/rtl8187se/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8187se/ieee80211/ieee80211_wx.c
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c
drivers/staging/rtl8192e/ieee80211/ieee80211_module.c
drivers/staging/rtl8192e/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192e/ieee80211/ieee80211_wx.c
drivers/staging/rtl8192su/ieee80211/ieee80211_crypt.c
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c
drivers/staging/rtl8192su/ieee80211/ieee80211_wx.c

index 013c3e19ae25a4486e6bab3e8bed44afa30922c8..4c5d63fd583364dfccbcc4c5b72ab8a46f898819 100644 (file)
@@ -53,10 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
 
                list_del(ptr);
 
-               if (entry->ops) {
+               if (entry->ops)
                        entry->ops->deinit(entry->priv);
-                       module_put(entry->ops->owner);
-               }
                kfree(entry);
        }
 }
index 6fbe4890cb669fa88303c082cab5b65123d1ca1a..18392fce487deb22dab8054c3ae248c282237c2a 100644 (file)
@@ -189,10 +189,8 @@ void free_ieee80211(struct net_device *dev)
        for (i = 0; i < WEP_KEYS; i++) {
                struct ieee80211_crypt_data *crypt = ieee->crypt[i];
                if (crypt) {
-                       if (crypt->ops) {
+                       if (crypt->ops)
                                crypt->ops->deinit(crypt->priv);
-                               module_put(crypt->ops->owner);
-                       }
                        kfree(crypt);
                        ieee->crypt[i] = NULL;
                }
index 59b2ab48cdcf697ef1b99a9f08c061c9b89367a8..334e4c7ec61bda83a9a80792a5f95f4e6db5dade 100644 (file)
@@ -2839,16 +2839,12 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                goto skip_host_crypt;
 
        ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
-               request_module("ieee80211_crypt_wep");
+       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
-               request_module("ieee80211_crypt_tkip");
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
-               request_module("ieee80211_crypt_ccmp");
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       }
        if (ops == NULL) {
                printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
                param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -2869,7 +2865,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                }
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ops;
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+               if (new_crypt->ops)
                        new_crypt->priv =
                                new_crypt->ops->init(param->u.crypt.idx);
 
index 8d8bdd0a130ea80bd2890b3a63b8f4b157bdcc78..a08b97a09512a92c4544d1cfe22983945b1e7464 100644 (file)
@@ -331,12 +331,10 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
                        return -ENOMEM;
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               if (!new_crypt->ops) {
-                       request_module("ieee80211_crypt_wep");
+               if (!new_crypt->ops)
                        new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               }
 
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+               if (new_crypt->ops)
                        new_crypt->priv = new_crypt->ops->init(key);
 
                if (!new_crypt->ops || !new_crypt->priv) {
@@ -483,7 +481,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
         int i, idx, ret = 0;
         int group_key = 0;
-        const char *alg, *module;
+        const char *alg;
         struct ieee80211_crypto_ops *ops;
         struct ieee80211_crypt_data **crypt;
 
@@ -539,15 +537,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         switch (ext->alg) {
         case IW_ENCODE_ALG_WEP:
                 alg = "WEP";
-                module = "ieee80211_crypt_wep";
                 break;
         case IW_ENCODE_ALG_TKIP:
                 alg = "TKIP";
-                module = "ieee80211_crypt_tkip";
                 break;
         case IW_ENCODE_ALG_CCMP:
                 alg = "CCMP";
-                module = "ieee80211_crypt_ccmp";
                 break;
         default:
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -558,10 +553,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
 //     printk("8-09-08-9=====>%s, alg name:%s\n",__func__, alg);
 
         ops = ieee80211_get_crypto_ops(alg);
-        if (ops == NULL) {
-                request_module(module);
+        if (ops == NULL)
                 ops = ieee80211_get_crypto_ops(alg);
-        }
         if (ops == NULL) {
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
                                    dev->name, ext->alg);
@@ -581,7 +574,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
                         goto done;
                 }
                 new_crypt->ops = ops;
-                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+                if (new_crypt->ops)
                         new_crypt->priv = new_crypt->ops->init(idx);
                 if (new_crypt->priv == NULL) {
                         kfree(new_crypt);
index 1a8ea8a40c3c9bb6e92b895bce1b1e32c39f8a7b..b1c54932da3e5931cf602d9bd7cb8f0108ef4df3 100644 (file)
@@ -53,14 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
 
                list_del(ptr);
 
-               if (entry->ops) {
+               if (entry->ops)
                        entry->ops->deinit(entry->priv);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-                       module_put(entry->ops->owner);
-#else
-                       __MOD_DEC_USE_COUNT(entry->ops->owner);
-#endif
-               }
                kfree(entry);
        }
 }
index 16256a31f993f75dbb66c87ed4a257b3bca3e696..12c2a18e1fa2a832803aa1fdc11f661b837bc5ed 100644 (file)
@@ -242,14 +242,8 @@ void free_ieee80211(struct net_device *dev)
        for (i = 0; i < WEP_KEYS; i++) {
                struct ieee80211_crypt_data *crypt = ieee->crypt[i];
                if (crypt) {
-                       if (crypt->ops) {
+                       if (crypt->ops)
                                crypt->ops->deinit(crypt->priv);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-                               module_put(crypt->ops->owner);
-#else
-                               __MOD_DEC_USE_COUNT(crypt->ops->owner);
-#endif
-                       }
                        kfree(crypt);
                        ieee->crypt[i] = NULL;
                }
index 2fc04df872cabacd64bde7995a05dfbcfe9ce7e6..eae7c4579a681d8ab4b0f2fb9a4ec98e013c6197 100644 (file)
@@ -3284,17 +3284,14 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                goto skip_host_crypt;
 
        ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
-               request_module("ieee80211_crypt_wep");
+       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-               //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
-               request_module("ieee80211_crypt_tkip");
+               /* set WEP40 first, it will be modified according to WEP104 or
+                * WEP40 at other place */
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
-               request_module("ieee80211_crypt_ccmp");
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       }
        if (ops == NULL) {
                printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
                param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -3315,11 +3312,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                }
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ops;
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-#else
-               if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif
+               if (new_crypt->ops)
                        new_crypt->priv =
                                new_crypt->ops->init(param->u.crypt.idx);
 
index 223483126b0e774975472a6352754b81c2162a34..4e34a1f4c66b5a3159339724e3253c57722216a5 100644 (file)
@@ -482,15 +482,9 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
                        return -ENOMEM;
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               if (!new_crypt->ops) {
-                       request_module("ieee80211_crypt_wep");
+               if (!new_crypt->ops)
                        new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               }
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
-#else
-               if (new_crypt->ops && try_inc_mod_count(new_crypt->ops->owner))
-#endif
+               if (new_crypt->ops)
                        new_crypt->priv = new_crypt->ops->init(key);
 
                if (!new_crypt->ops || !new_crypt->priv) {
@@ -644,7 +638,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
         int i, idx;
         int group_key = 0;
-        const char *alg, *module;
+        const char *alg;
         struct ieee80211_crypto_ops *ops;
         struct ieee80211_crypt_data **crypt;
 
@@ -711,15 +705,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         switch (ext->alg) {
         case IW_ENCODE_ALG_WEP:
                 alg = "WEP";
-                module = "ieee80211_crypt_wep";
                 break;
         case IW_ENCODE_ALG_TKIP:
                 alg = "TKIP";
-                module = "ieee80211_crypt_tkip";
                 break;
         case IW_ENCODE_ALG_CCMP:
                 alg = "CCMP";
-                module = "ieee80211_crypt_ccmp";
                 break;
         default:
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -730,10 +721,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
        printk("alg name:%s\n",alg);
 
         ops = ieee80211_get_crypto_ops(alg);
-        if (ops == NULL) {
-                request_module(module);
+        if (ops == NULL)
                 ops = ieee80211_get_crypto_ops(alg);
-        }
         if (ops == NULL) {
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
                                    dev->name, ext->alg);
@@ -758,7 +747,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
                         goto done;
                 }
                 new_crypt->ops = ops;
-                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+                if (new_crypt->ops)
                         new_crypt->priv = new_crypt->ops->init(idx);
                 if (new_crypt->priv == NULL) {
                         kfree(new_crypt);
index d76a54d59d2ffce04a8d2f1978e83e058a56f573..521e7b989934eae69614cfa1a74ba32ec4dcd52f 100644 (file)
@@ -53,10 +53,8 @@ void ieee80211_crypt_deinit_entries(struct ieee80211_device *ieee,
 
                list_del(ptr);
 
-               if (entry->ops) {
+               if (entry->ops)
                        entry->ops->deinit(entry->priv);
-                       module_put(entry->ops->owner);
-               }
                kfree(entry);
        }
 }
index 68dc8fa094ccea523f3b40aca0bbc48261b50862..c3383bb8b760dda21229cedbca5daffe2988a1b0 100644 (file)
@@ -216,10 +216,8 @@ void free_ieee80211(struct net_device *dev)
        for (i = 0; i < WEP_KEYS; i++) {
                struct ieee80211_crypt_data *crypt = ieee->crypt[i];
                if (crypt) {
-                       if (crypt->ops) {
+                       if (crypt->ops)
                                crypt->ops->deinit(crypt->priv);
-                               module_put(crypt->ops->owner);
-                       }
                        kfree(crypt);
                        ieee->crypt[i] = NULL;
                }
index c64ae03f68a085ab9712d40b921282f58292ddc0..fd8e11252f1b254ca5e5a8b01182839d3ee024bd 100644 (file)
@@ -3026,17 +3026,14 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                goto skip_host_crypt;
 
        ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
-               request_module("ieee80211_crypt_wep");
+       if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-               //set WEP40 first, it will be modified according to WEP104 or WEP40 at other place
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
-               request_module("ieee80211_crypt_tkip");
+               /* set WEP40 first, it will be modified according to WEP104 or
+                * WEP40 at other place */
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
-               request_module("ieee80211_crypt_ccmp");
+       else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0)
                ops = ieee80211_get_crypto_ops(param->u.crypt.alg);
-       }
        if (ops == NULL) {
                printk("unknown crypto alg '%s'\n", param->u.crypt.alg);
                param->u.crypt.err = IEEE_CRYPT_ERR_UNKNOWN_ALG;
@@ -3058,7 +3055,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ops;
 
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+               if (new_crypt->ops)
                        new_crypt->priv =
                                new_crypt->ops->init(param->u.crypt.idx);
 
index 10775902433540e063de4e5370555e078232a9a1..6146c6435ddeebbf4ac63ee70f9f39fcc49ce52b 100644 (file)
@@ -358,11 +358,9 @@ int ieee80211_wx_set_encode(struct ieee80211_device *ieee,
                        return -ENOMEM;
                memset(new_crypt, 0, sizeof(struct ieee80211_crypt_data));
                new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               if (!new_crypt->ops) {
-                       request_module("ieee80211_crypt_wep");
+               if (!new_crypt->ops)
                        new_crypt->ops = ieee80211_get_crypto_ops("WEP");
-               }
-               if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+               if (new_crypt->ops)
                        new_crypt->priv = new_crypt->ops->init(key);
 
                if (!new_crypt->ops || !new_crypt->priv) {
@@ -507,7 +505,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         struct iw_encode_ext *ext = (struct iw_encode_ext *)extra;
         int i, idx;
         int group_key = 0;
-        const char *alg, *module;
+        const char *alg;
         struct ieee80211_crypto_ops *ops;
         struct ieee80211_crypt_data **crypt;
 
@@ -570,15 +568,12 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
         switch (ext->alg) {
         case IW_ENCODE_ALG_WEP:
                 alg = "WEP";
-                module = "ieee80211_crypt_wep";
                 break;
         case IW_ENCODE_ALG_TKIP:
                 alg = "TKIP";
-                module = "ieee80211_crypt_tkip";
                 break;
         case IW_ENCODE_ALG_CCMP:
                 alg = "CCMP";
-                module = "ieee80211_crypt_ccmp";
                 break;
         default:
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
@@ -589,10 +584,8 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
        printk("alg name:%s\n",alg);
 
         ops = ieee80211_get_crypto_ops(alg);
-        if (ops == NULL) {
-                request_module("%s", module);
+        if (ops == NULL)
                 ops = ieee80211_get_crypto_ops(alg);
-        }
         if (ops == NULL) {
                 IEEE80211_DEBUG_WX("%s: unknown crypto alg %d\n",
                                    dev->name, ext->alg);
@@ -612,7 +605,7 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee,
                         goto done;
                 }
                 new_crypt->ops = ops;
-                if (new_crypt->ops && try_module_get(new_crypt->ops->owner))
+                if (new_crypt->ops)
                         new_crypt->priv = new_crypt->ops->init(idx);
                 if (new_crypt->priv == NULL) {
                         kfree(new_crypt);