iwlwifi: make mac80211 ops a device config
authorJohannes Berg <johannes.berg@intel.com>
Sat, 23 Oct 2010 16:15:39 +0000 (09:15 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 15 Nov 2010 18:24:50 +0000 (13:24 -0500)
In the future, 4965 and modern AGN devices will
need to have different mac80211 callbacks since
they have different capabilities. Prepare for
that by making the mac80211 operations a device
config.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-3945.c
drivers/net/wireless/iwlwifi/iwl-3945.h
drivers/net/wireless/iwlwifi/iwl-4965.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn.c
drivers/net/wireless/iwlwifi/iwl-agn.h
drivers/net/wireless/iwlwifi/iwl-core.c
drivers/net/wireless/iwlwifi/iwl-core.h
drivers/net/wireless/iwlwifi/iwl3945-base.c

index db540910b1104d42b5d20d15e542c3fc5da7649c..4266c855a76769c51638c150c585fc44e15781e3 100644 (file)
@@ -243,6 +243,7 @@ static const struct iwl_ops iwl1000_ops = {
        .hcmd = &iwlagn_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static struct iwl_base_params iwl1000_base_params = {
index 4d7130c9b72ca204e71dd7235fe962e839d11d93..95fed11584527f4abd26c6aa74bdc625bba6bc38 100644 (file)
@@ -2753,6 +2753,7 @@ static const struct iwl_ops iwl3945_ops = {
        .hcmd = &iwl3945_hcmd,
        .utils = &iwl3945_hcmd_utils,
        .led = &iwl3945_led_ops,
+       .ieee80211_ops = &iwl3945_hw_ops,
 };
 
 static struct iwl_base_params iwl3945_base_params = {
index 09391f0ee61f03c9d486a75f5f3c195b04381e24..b27f07cbf3558cd89d1edf7d0a10a538ec4cf86c 100644 (file)
@@ -282,6 +282,8 @@ extern int iwl3945_commit_rxon(struct iwl_priv *priv,
  */
 extern u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
 
+extern struct ieee80211_ops iwl3945_hw_ops;
+
 /*
  * Forward declare iwl-3945.c functions for iwl-base.c
  */
index ee9c582c8cf2a3577abd6c4c31b5461ee7abe38c..7921a910b34ab7f1f5459a368bdf744d10717d76 100644 (file)
@@ -2305,6 +2305,7 @@ static const struct iwl_ops iwl4965_ops = {
        .hcmd = &iwl4965_hcmd,
        .utils = &iwl4965_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static struct iwl_base_params iwl4965_base_params = {
index fd9fbc93ea1b21d20b9d494f7f7a6a04422e679b..5f03277216928fbb8bb19ddaf63f1bb830167fc4 100644 (file)
@@ -485,6 +485,7 @@ static const struct iwl_ops iwl5000_ops = {
        .hcmd = &iwlagn_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static const struct iwl_ops iwl5150_ops = {
@@ -492,6 +493,7 @@ static const struct iwl_ops iwl5150_ops = {
        .hcmd = &iwlagn_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static struct iwl_base_params iwl5000_base_params = {
index 11e6532fc573d1ed93d5ec4aaf886342d0fe8073..85bde701351ea8a155bf0f71bfe44fc16d449a93 100644 (file)
@@ -439,6 +439,7 @@ static const struct iwl_ops iwl6000_ops = {
        .hcmd = &iwlagn_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static const struct iwl_ops iwl6050_ops = {
@@ -447,6 +448,7 @@ static const struct iwl_ops iwl6050_ops = {
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
        .nic = &iwl6050_nic_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static const struct iwl_ops iwl6050g2_ops = {
@@ -455,6 +457,7 @@ static const struct iwl_ops iwl6050g2_ops = {
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
        .nic = &iwl6050g2_nic_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static const struct iwl_ops iwl6000g2b_ops = {
@@ -462,6 +465,7 @@ static const struct iwl_ops iwl6000g2b_ops = {
        .hcmd = &iwlagn_bt_hcmd,
        .utils = &iwlagn_hcmd_utils,
        .led = &iwlagn_led_ops,
+       .ieee80211_ops = &iwlagn_hw_ops,
 };
 
 static struct iwl_base_params iwl6000_base_params = {
index 0027bb8299a8d6a1ca9d512af1d8d8d68a06502b..e3533a89ec9c74be7d836928439f204be3c95157 100644 (file)
@@ -4211,7 +4211,7 @@ static void iwl_uninit_drv(struct iwl_priv *priv)
        kfree(priv->scan_cmd);
 }
 
-static struct ieee80211_ops iwl_hw_ops = {
+struct ieee80211_ops iwlagn_hw_ops = {
        .tx = iwl_mac_tx,
        .start = iwl_mac_start,
        .stop = iwl_mac_stop,
@@ -4300,10 +4300,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        if (cfg->mod_params->disable_hw_scan) {
                dev_printk(KERN_DEBUG, &(pdev->dev),
                        "sw scan support is deprecated\n");
-               iwl_hw_ops.hw_scan = NULL;
+               iwlagn_hw_ops.hw_scan = NULL;
        }
 
-       hw = iwl_alloc_all(cfg, &iwl_hw_ops);
+       hw = iwl_alloc_all(cfg);
        if (!hw) {
                err = -ENOMEM;
                goto out;
index f525d55f2c0fb208c92b5e60d56ab5386da4acc4..ba88e78e6116d43af6091987ce17d541a242e344 100644 (file)
@@ -102,6 +102,8 @@ extern struct iwl_hcmd_ops iwlagn_hcmd;
 extern struct iwl_hcmd_ops iwlagn_bt_hcmd;
 extern struct iwl_hcmd_utils_ops iwlagn_hcmd_utils;
 
+extern struct ieee80211_ops iwlagn_hw_ops;
+
 int iwl_reset_ict(struct iwl_priv *priv);
 void iwl_disable_ict(struct iwl_priv *priv);
 int iwl_alloc_isr_ict(struct iwl_priv *priv);
index 2a4d40e5b9f49681bac62732695eedb205a647c2..c93368083e1aa5ba3bbd50ac684382fc0a30a8e8 100644 (file)
@@ -77,15 +77,15 @@ EXPORT_SYMBOL(iwl_bcast_addr);
 
 
 /* This function both allocates and initializes hw and priv. */
-struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
-               struct ieee80211_ops *hw_ops)
+struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg)
 {
        struct iwl_priv *priv;
-
        /* mac80211 allocates memory for this device instance, including
         *   space for this driver's private structure */
-       struct ieee80211_hw *hw =
-               ieee80211_alloc_hw(sizeof(struct iwl_priv), hw_ops);
+       struct ieee80211_hw *hw;
+
+       hw = ieee80211_alloc_hw(sizeof(struct iwl_priv),
+                               cfg->ops->ieee80211_ops);
        if (hw == NULL) {
                pr_err("%s: Can not allocate network device\n",
                       cfg->name);
index b17de8214eb5151ecfd48a6a7bf0e15449977653..917d42eae55ad6b71141be1bb0a14271e834f3ad 100644 (file)
@@ -241,6 +241,7 @@ struct iwl_ops {
        const struct iwl_hcmd_utils_ops *utils;
        const struct iwl_led_ops *led;
        const struct iwl_nic_ops *nic;
+       const struct ieee80211_ops *ieee80211_ops;
 };
 
 struct iwl_mod_params {
@@ -396,8 +397,7 @@ struct iwl_cfg {
  *   L i b                 *
  ***************************/
 
-struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg,
-               struct ieee80211_ops *hw_ops);
+struct ieee80211_hw *iwl_alloc_all(struct iwl_cfg *cfg);
 int iwl_mac_conf_tx(struct ieee80211_hw *hw, u16 queue,
                    const struct ieee80211_tx_queue_params *params);
 int iwl_mac_tx_last_beacon(struct ieee80211_hw *hw);
index 9b71921dc2b69e8e165f2b1d582f09b750efbffc..d42bb22e5ed5626327e529a0dc9fcc6b181653b0 100644 (file)
@@ -3824,7 +3824,7 @@ static struct attribute_group iwl3945_attribute_group = {
        .attrs = iwl3945_sysfs_entries,
 };
 
-static struct ieee80211_ops iwl3945_hw_ops = {
+struct ieee80211_ops iwl3945_hw_ops = {
        .tx = iwl3945_mac_tx,
        .start = iwl3945_mac_start,
        .stop = iwl3945_mac_stop,
@@ -3966,7 +3966,7 @@ static int iwl3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *e
 
        /* mac80211 allocates memory for this device instance, including
         *   space for this driver's private structure */
-       hw = iwl_alloc_all(cfg, &iwl3945_hw_ops);
+       hw = iwl_alloc_all(cfg);
        if (hw == NULL) {
                pr_err("Can not allocate network device\n");
                err = -ENOMEM;