aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorReinette Chatre <reinette.chatre@intel.com>2008-03-28 19:21:09 -0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-01 17:13:19 -0400
commit897e1cf29e05e3373bf380a417d085cd3389a3c0 (patch)
tree8e60c677284c649ebcfaabf727da1ec607adba7c /drivers/net/wireless
parent0359facc7b7a37fd1223ac60649c80cd8daeaf73 (diff)
iwlwifi: move rate registration to module load
Having rate registration during module load enables the use of error checking as well as reliable registration/unregistration pairing. Previously this was not possible as rate registration was done during _probe where _probe could be run for more than one device on the system. Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-rs.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965-rs.h4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c22
7 files changed, 46 insertions, 20 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
index 157e572ebc83..8559f252a55f 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
@@ -976,12 +976,12 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
976 iwl3945_rates[rs_sta->start_rate].plcp); 976 iwl3945_rates[rs_sta->start_rate].plcp);
977} 977}
978 978
979void iwl3945_rate_control_register(struct ieee80211_hw *hw) 979int iwl3945_rate_control_register(void)
980{ 980{
981 ieee80211_rate_control_register(&rs_ops); 981 return ieee80211_rate_control_register(&rs_ops);
982} 982}
983 983
984void iwl3945_rate_control_unregister(struct ieee80211_hw *hw) 984void iwl3945_rate_control_unregister(void)
985{ 985{
986 ieee80211_rate_control_unregister(&rs_ops); 986 ieee80211_rate_control_unregister(&rs_ops);
987} 987}
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
index e88b1d31f56f..f085d330bdcf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.h
@@ -202,7 +202,7 @@ extern void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
202 * ieee80211_register_hw 202 * ieee80211_register_hw
203 * 203 *
204 */ 204 */
205extern void iwl3945_rate_control_register(struct ieee80211_hw *hw); 205extern int iwl3945_rate_control_register(void);
206 206
207/** 207/**
208 * iwl3945_rate_control_unregister - Unregister the rate control callbacks 208 * iwl3945_rate_control_unregister - Unregister the rate control callbacks
@@ -210,6 +210,6 @@ extern void iwl3945_rate_control_register(struct ieee80211_hw *hw);
210 * This should be called after calling ieee80211_unregister_hw, but before 210 * This should be called after calling ieee80211_unregister_hw, but before
211 * the driver is unloaded. 211 * the driver is unloaded.
212 */ 212 */
213extern void iwl3945_rate_control_unregister(struct ieee80211_hw *hw); 213extern void iwl3945_rate_control_unregister(void);
214 214
215#endif 215#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
index 735eadd57d18..90ecf26af280 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.c
@@ -2822,12 +2822,12 @@ void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
2822 priv->lq_mngr.lq_ready = 1; 2822 priv->lq_mngr.lq_ready = 1;
2823} 2823}
2824 2824
2825void iwl4965_rate_control_register(struct ieee80211_hw *hw) 2825int iwl4965_rate_control_register(void)
2826{ 2826{
2827 ieee80211_rate_control_register(&rs_ops); 2827 return ieee80211_rate_control_register(&rs_ops);
2828} 2828}
2829 2829
2830void iwl4965_rate_control_unregister(struct ieee80211_hw *hw) 2830void iwl4965_rate_control_unregister(void)
2831{ 2831{
2832 ieee80211_rate_control_unregister(&rs_ops); 2832 ieee80211_rate_control_unregister(&rs_ops);
2833} 2833}
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
index ae827e1fb0fb..866e378aa385 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965-rs.h
@@ -288,7 +288,7 @@ extern void iwl4965_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id);
288 * ieee80211_register_hw 288 * ieee80211_register_hw
289 * 289 *
290 */ 290 */
291extern void iwl4965_rate_control_register(struct ieee80211_hw *hw); 291extern int iwl4965_rate_control_register(void);
292 292
293/** 293/**
294 * iwl4965_rate_control_unregister - Unregister the rate control callbacks 294 * iwl4965_rate_control_unregister - Unregister the rate control callbacks
@@ -296,6 +296,6 @@ extern void iwl4965_rate_control_register(struct ieee80211_hw *hw);
296 * This should be called after calling ieee80211_unregister_hw, but before 296 * This should be called after calling ieee80211_unregister_hw, but before
297 * the driver is unloaded. 297 * the driver is unloaded.
298 */ 298 */
299extern void iwl4965_rate_control_unregister(struct ieee80211_hw *hw); 299extern void iwl4965_rate_control_unregister(void);
300 300
301#endif 301#endif
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.c b/drivers/net/wireless/iwlwifi/iwl-4965.c
index 3ab5d8292502..add6311393d3 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.c
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.c
@@ -177,7 +177,6 @@ static int iwl4965_init_drv(struct iwl_priv *priv)
177 goto err_free_channel_map; 177 goto err_free_channel_map;
178 } 178 }
179 179
180 iwl4965_rate_control_register(priv->hw);
181 ret = ieee80211_register_hw(priv->hw); 180 ret = ieee80211_register_hw(priv->hw);
182 if (ret) { 181 if (ret) {
183 IWL_ERROR("Failed to register network device (error %d)\n", 182 IWL_ERROR("Failed to register network device (error %d)\n",
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 2a5245b63e32..8c2036850c89 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -8156,7 +8156,6 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
8156 goto out_free_channel_map; 8156 goto out_free_channel_map;
8157 } 8157 }
8158 8158
8159 iwl3945_rate_control_register(priv->hw);
8160 err = ieee80211_register_hw(priv->hw); 8159 err = ieee80211_register_hw(priv->hw);
8161 if (err) { 8160 if (err) {
8162 IWL_ERROR("Failed to register network device (error %d)\n", err); 8161 IWL_ERROR("Failed to register network device (error %d)\n", err);
@@ -8241,7 +8240,6 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev)
8241 8240
8242 if (priv->mac80211_registered) { 8241 if (priv->mac80211_registered) {
8243 ieee80211_unregister_hw(priv->hw); 8242 ieee80211_unregister_hw(priv->hw);
8244 iwl3945_rate_control_unregister(priv->hw);
8245 } 8243 }
8246 8244
8247 /*netif_stop_queue(dev); */ 8245 /*netif_stop_queue(dev); */
@@ -8322,21 +8320,35 @@ static int __init iwl3945_init(void)
8322 int ret; 8320 int ret;
8323 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 8321 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
8324 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 8322 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
8323
8324 ret = iwl3945_rate_control_register();
8325 if (ret) {
8326 IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
8327 return ret;
8328 }
8329
8325 ret = pci_register_driver(&iwl3945_driver); 8330 ret = pci_register_driver(&iwl3945_driver);
8326 if (ret) { 8331 if (ret) {
8327 IWL_ERROR("Unable to initialize PCI module\n"); 8332 IWL_ERROR("Unable to initialize PCI module\n");
8328 return ret; 8333 goto error_register;
8329 } 8334 }
8330#ifdef CONFIG_IWL3945_DEBUG 8335#ifdef CONFIG_IWL3945_DEBUG
8331 ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level); 8336 ret = driver_create_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8332 if (ret) { 8337 if (ret) {
8333 IWL_ERROR("Unable to create driver sysfs file\n"); 8338 IWL_ERROR("Unable to create driver sysfs file\n");
8334 pci_unregister_driver(&iwl3945_driver); 8339 goto error_debug;
8335 return ret;
8336 } 8340 }
8337#endif 8341#endif
8338 8342
8339 return ret; 8343 return ret;
8344
8345#ifdef CONFIG_IWL3945_DEBUG
8346error_debug:
8347 pci_unregister_driver(&iwl3945_driver);
8348#endif
8349error_register:
8350 iwl3945_rate_control_unregister();
8351 return ret;
8340} 8352}
8341 8353
8342static void __exit iwl3945_exit(void) 8354static void __exit iwl3945_exit(void)
@@ -8345,6 +8357,7 @@ static void __exit iwl3945_exit(void)
8345 driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level); 8357 driver_remove_file(&iwl3945_driver.driver, &driver_attr_debug_level);
8346#endif 8358#endif
8347 pci_unregister_driver(&iwl3945_driver); 8359 pci_unregister_driver(&iwl3945_driver);
8360 iwl3945_rate_control_unregister();
8348} 8361}
8349 8362
8350module_param_named(antenna, iwl3945_param_antenna, int, 0444); 8363module_param_named(antenna, iwl3945_param_antenna, int, 0444);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 29e843108e9f..ae4e53f5bedd 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -8243,7 +8243,6 @@ static void __devexit iwl4965_pci_remove(struct pci_dev *pdev)
8243 8243
8244 if (priv->mac80211_registered) { 8244 if (priv->mac80211_registered) {
8245 ieee80211_unregister_hw(priv->hw); 8245 ieee80211_unregister_hw(priv->hw);
8246 iwl4965_rate_control_unregister(priv->hw);
8247 } 8246 }
8248 8247
8249 /*netif_stop_queue(dev); */ 8248 /*netif_stop_queue(dev); */
@@ -8324,21 +8323,35 @@ static int __init iwl4965_init(void)
8324 int ret; 8323 int ret;
8325 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n"); 8324 printk(KERN_INFO DRV_NAME ": " DRV_DESCRIPTION ", " DRV_VERSION "\n");
8326 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n"); 8325 printk(KERN_INFO DRV_NAME ": " DRV_COPYRIGHT "\n");
8326
8327 ret = iwl4965_rate_control_register();
8328 if (ret) {
8329 IWL_ERROR("Unable to register rate control algorithm: %d\n", ret);
8330 return ret;
8331 }
8332
8327 ret = pci_register_driver(&iwl4965_driver); 8333 ret = pci_register_driver(&iwl4965_driver);
8328 if (ret) { 8334 if (ret) {
8329 IWL_ERROR("Unable to initialize PCI module\n"); 8335 IWL_ERROR("Unable to initialize PCI module\n");
8330 return ret; 8336 goto error_register;
8331 } 8337 }
8332#ifdef CONFIG_IWLWIFI_DEBUG 8338#ifdef CONFIG_IWLWIFI_DEBUG
8333 ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level); 8339 ret = driver_create_file(&iwl4965_driver.driver, &driver_attr_debug_level);
8334 if (ret) { 8340 if (ret) {
8335 IWL_ERROR("Unable to create driver sysfs file\n"); 8341 IWL_ERROR("Unable to create driver sysfs file\n");
8336 pci_unregister_driver(&iwl4965_driver); 8342 goto error_debug;
8337 return ret;
8338 } 8343 }
8339#endif 8344#endif
8340 8345
8341 return ret; 8346 return ret;
8347
8348#ifdef CONFIG_IWLWIFI_DEBUG
8349error_debug:
8350 pci_unregister_driver(&iwl4965_driver);
8351#endif
8352error_register:
8353 iwl4965_rate_control_unregister();
8354 return ret;
8342} 8355}
8343 8356
8344static void __exit iwl4965_exit(void) 8357static void __exit iwl4965_exit(void)
@@ -8347,6 +8360,7 @@ static void __exit iwl4965_exit(void)
8347 driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level); 8360 driver_remove_file(&iwl4965_driver.driver, &driver_attr_debug_level);
8348#endif 8361#endif
8349 pci_unregister_driver(&iwl4965_driver); 8362 pci_unregister_driver(&iwl4965_driver);
8363 iwl4965_rate_control_unregister();
8350} 8364}
8351 8365
8352module_exit(iwl4965_exit); 8366module_exit(iwl4965_exit);