]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
iwlagn: introduce iwl-shared.h
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Fri, 26 Aug 2011 06:10:36 +0000 (23:10 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 29 Aug 2011 19:25:30 +0000 (15:25 -0400)
It will hold declaration of functions and forward declaration of struct that
are used by several layers.
This will allow modules not to include iwl_priv. iwl_bus and iwl_trans are
still visible to all.

All the layers share the module parameters, move the struct to iwl-shared.h.
Also add all module parameters to iwl_mod_params instead of having them as
global static. This includes

* debug_level
* ant_coupling
* bt_ch_announce
* wanted_ucode_alternative

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
18 files changed:
drivers/net/wireless/iwlwifi/iwl-1000.c
drivers/net/wireless/iwlwifi/iwl-2000.c
drivers/net/wireless/iwlwifi/iwl-5000.c
drivers/net/wireless/iwlwifi/iwl-6000.c
drivers/net/wireless/iwlwifi/iwl-agn-lib.c
drivers/net/wireless/iwlwifi/iwl-agn-rxon.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/iwl-debug.h
drivers/net/wireless/iwlwifi/iwl-dev.h
drivers/net/wireless/iwlwifi/iwl-led.c
drivers/net/wireless/iwlwifi/iwl-pci.c
drivers/net/wireless/iwlwifi/iwl-power.c
drivers/net/wireless/iwlwifi/iwl-rx.c
drivers/net/wireless/iwlwifi/iwl-shared.h [new file with mode: 0644]
drivers/net/wireless/iwlwifi/iwl-trans.c

index ccdbed567171983641cfa4301c49ade2e3b1245d..4314c61c40bb7df68edb880ee22f97bdceb31ffc 100644 (file)
@@ -43,6 +43,7 @@
 #include "iwl-agn.h"
 #include "iwl-helpers.h"
 #include "iwl-agn-hw.h"
+#include "iwl-shared.h"
 
 /* Highest firmware API version supported */
 #define IWL1000_UCODE_API_MAX 6
index 3e1cdd36caefc98dfe26d8be57d1c0c09fc42011..e623870c0fe79dae90b754b2ed18b49d32e92bd0 100644 (file)
@@ -44,6 +44,7 @@
 #include "iwl-helpers.h"
 #include "iwl-agn-hw.h"
 #include "iwl-6000-hw.h"
+#include "iwl-shared.h"
 
 /* Highest firmware API version supported */
 #define IWL2030_UCODE_API_MAX 6
index a9adee5634d81c6d384a505b1d387e7a59917323..c79f1f7830b0cbd36ec60b4d1fb12b1e353d028d 100644 (file)
@@ -46,6 +46,7 @@
 #include "iwl-agn-hw.h"
 #include "iwl-5000-hw.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 /* Highest firmware API version supported */
 #define IWL5000_UCODE_API_MAX 5
index 850f9242a165b8533103c06f4fed32e776a9dbaf..bf84fa697209a64f53da5ca2bc9752ffb57fd129 100644 (file)
@@ -45,6 +45,7 @@
 #include "iwl-agn-hw.h"
 #include "iwl-6000-hw.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 /* Highest firmware API version supported */
 #define IWL6000_UCODE_API_MAX 4
index 4edb6cfc5488d05f871048bb1f17a3b6d64b78ae..dd95f47854d4d6a09b478897b50b494a08080b02 100644 (file)
@@ -40,6 +40,7 @@
 #include "iwl-agn.h"
 #include "iwl-sta.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 static inline u32 iwlagn_get_scd_ssn(struct iwlagn_tx_resp *tx_resp)
 {
@@ -609,6 +610,8 @@ struct iwl_mod_params iwlagn_mod_params = {
        .bt_coex_active = true,
        .no_sleep_autoadjust = true,
        .power_level = IWL_POWER_INDEX_1,
+       .bt_ch_announce = 1,
+       .wanted_ucode_alternative = 1,
        /* the rest are 0 by default */
 };
 
index d562e9359d97f7ae6fc85b0431e175189d97f1bd..2829bf843d0cbbc732ebe4f476b99aad3c8866d0 100644 (file)
@@ -31,6 +31,7 @@
 #include "iwl-agn-calib.h"
 #include "iwl-helpers.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 static int iwlagn_disable_bss(struct iwl_priv *priv,
                              struct iwl_rxon_context *ctx,
index 7f50d9d6f7cf1423776516dcf3e74362399161c5..cb8a9f9a22df7077ec91cc6a868b80d86ca2d637 100644 (file)
@@ -51,6 +51,7 @@
 #include "iwl-sta.h"
 #include "iwl-agn-calib.h"
 #include "iwl-agn.h"
+#include "iwl-shared.h"
 #include "iwl-bus.h"
 #include "iwl-trans.h"
 
@@ -79,9 +80,6 @@ MODULE_VERSION(DRV_VERSION);
 MODULE_AUTHOR(DRV_COPYRIGHT " " DRV_AUTHOR);
 MODULE_LICENSE("GPL");
 
-static int iwlagn_ant_coupling;
-static bool iwlagn_bt_ch_announce = 1;
-
 void iwl_update_chain_flags(struct iwl_priv *priv)
 {
        struct iwl_rxon_context *ctx;
@@ -818,8 +816,6 @@ static int iwlagn_load_legacy_firmware(struct iwl_priv *priv,
        return 0;
 }
 
-static int iwlagn_wanted_ucode_alternative = 1;
-
 static int iwlagn_load_firmware(struct iwl_priv *priv,
                                const struct firmware *ucode_raw,
                                struct iwlagn_firmware_pieces *pieces,
@@ -829,7 +825,8 @@ static int iwlagn_load_firmware(struct iwl_priv *priv,
        struct iwl_ucode_tlv *tlv;
        size_t len = ucode_raw->size;
        const u8 *data;
-       int wanted_alternative = iwlagn_wanted_ucode_alternative, tmp;
+       int wanted_alternative = iwlagn_mod_params.wanted_ucode_alternative;
+       int tmp;
        u64 alternatives;
        u32 tlv_len;
        enum iwl_ucode_tlv_type tlv_type;
@@ -1619,7 +1616,7 @@ int iwl_dump_nic_event_log(struct iwl_priv *priv, bool full_log,
        }
 
        /* enable/disable bt channel inhibition */
-       priv->bt_ch_announce = iwlagn_bt_ch_announce;
+       priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce;
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        if (!(iwl_get_debug_level(priv) & IWL_DL_FW_ERRORS) && !full_log)
@@ -3618,11 +3615,12 @@ int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg)
 
        /* is antenna coupling more than 35dB ? */
        priv->bt_ant_couple_ok =
-               (iwlagn_ant_coupling > IWL_BT_ANTENNA_COUPLING_THRESHOLD) ?
-               true : false;
+               (iwlagn_mod_params.ant_coupling >
+                       IWL_BT_ANTENNA_COUPLING_THRESHOLD) ?
+                       true : false;
 
        /* enable/disable bt channel inhibition */
-       priv->bt_ch_announce = iwlagn_bt_ch_announce;
+       priv->bt_ch_announce = iwlagn_mod_params.bt_ch_announce;
        IWL_DEBUG_INFO(priv, "BT channel inhibition is %s\n",
                       (priv->bt_ch_announce) ? "On" : "Off");
 
@@ -3863,7 +3861,8 @@ module_exit(iwl_exit);
 module_init(iwl_init);
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-module_param_named(debug, iwl_debug_level, uint, S_IRUGO | S_IWUSR);
+module_param_named(debug, iwlagn_mod_params.debug_level, uint,
+                  S_IRUGO | S_IWUSR);
 MODULE_PARM_DESC(debug, "debug output mask");
 #endif
 
@@ -3879,16 +3878,19 @@ MODULE_PARM_DESC(amsdu_size_8K, "enable 8K amsdu size");
 module_param_named(fw_restart, iwlagn_mod_params.restart_fw, int, S_IRUGO);
 MODULE_PARM_DESC(fw_restart, "restart firmware in case of error");
 
-module_param_named(ucode_alternative, iwlagn_wanted_ucode_alternative, int,
-                  S_IRUGO);
+module_param_named(ucode_alternative,
+                  iwlagn_mod_params.wanted_ucode_alternative,
+                  int, S_IRUGO);
 MODULE_PARM_DESC(ucode_alternative,
                 "specify ucode alternative to use from ucode file");
 
-module_param_named(antenna_coupling, iwlagn_ant_coupling, int, S_IRUGO);
+module_param_named(antenna_coupling, iwlagn_mod_params.ant_coupling,
+                  int, S_IRUGO);
 MODULE_PARM_DESC(antenna_coupling,
                 "specify antenna coupling in dB (defualt: 0 dB)");
 
-module_param_named(bt_ch_inhibition, iwlagn_bt_ch_announce, bool, S_IRUGO);
+module_param_named(bt_ch_inhibition, iwlagn_mod_params.bt_ch_announce,
+                  bool, S_IRUGO);
 MODULE_PARM_DESC(bt_ch_inhibition,
                 "Disable BT channel inhibition (default: enable)");
 
index a2f2f289611202f5f5128b9bd53b8fe7cbdfa092..ea2a5fe8da8f19d180c5442b8884a329d86ab275 100644 (file)
@@ -108,8 +108,6 @@ extern struct iwl_cfg iwl105_bgn_cfg;
 extern struct iwl_cfg iwl135_bg_cfg;
 extern struct iwl_cfg iwl135_bgn_cfg;
 
-extern struct iwl_mod_params iwlagn_mod_params;
-
 extern struct ieee80211_ops iwlagn_hw_ops;
 
 int iwl_reset_ict(struct iwl_priv *priv);
index 0d8fd5b0cd7c30b45f44852594f712c41ea39c0e..6c11f0dce0d1d4e44e039c8c38c6f935e646572e 100644 (file)
 #include "iwl-sta.h"
 #include "iwl-agn.h"
 #include "iwl-helpers.h"
+#include "iwl-shared.h"
 #include "iwl-agn.h"
 #include "iwl-trans.h"
 
-u32 iwl_debug_level;
-
 const u8 iwl_bcast_addr[ETH_ALEN] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
 
 #define MAX_BIT_RATE_40_MHZ 150 /* Mbps */
index 2c8b4a513a1210bfee17ce70015e4f52e045459c..fe46d0f7136269a4f64917bcc11c37696d2d61e3 100644 (file)
@@ -101,23 +101,6 @@ struct iwl_lib_ops {
        void (*temperature)(struct iwl_priv *priv);
 };
 
-struct iwl_mod_params {
-       int sw_crypto;          /* def: 0 = using hardware encryption */
-       int num_of_queues;      /* def: HW dependent */
-       int disable_11n;        /* def: 0 = 11n capabilities enabled */
-       int amsdu_size_8K;      /* def: 1 = enable 8K amsdu size */
-       int antenna;            /* def: 0 = both antennas (use diversity) */
-       int restart_fw;         /* def: 1 = restart firmware */
-       bool plcp_check;        /* def: true = enable plcp health check */
-       bool ack_check;         /* def: false = disable ack health check */
-       bool wd_disable;        /* def: false = enable stuck queue check */
-       bool bt_coex_active;    /* def: true = enable bt coex */
-       int led_mode;           /* def: 0 = system default */
-       bool no_sleep_autoadjust; /* def: true = disable autoadjust */
-       bool power_save;        /* def: false = disable power save */
-       int power_level;        /* def: 1 = power level */
-};
-
 /*
  * @max_ll_items: max number of OTP blocks
  * @shadow_ram_support: shadow support for OTP memory
@@ -389,13 +372,6 @@ u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);
 __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
                           u32 addon, u32 beacon_interval);
 
-#ifdef CONFIG_PM
-int iwl_suspend(struct iwl_priv *priv);
-int iwl_resume(struct iwl_priv *priv);
-#endif /* !CONFIG_PM */
-
-int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg);
-void __devexit iwl_remove(struct iwl_priv * priv);
 
 /*****************************************************
 *  Error Handling Debugging
index f9a407e40affdc4c3e79a762a51429e268eb8e41..0869eaa1308edb6470e862bf353375cdb540f63f 100644 (file)
@@ -30,7 +30,6 @@
 #define __iwl_debug_h__
 
 struct iwl_priv;
-extern u32 iwl_debug_level;
 
 #define IWL_ERR(p, f, a...) dev_err(p->bus->dev, f, ## a)
 #define IWL_WARN(p, f, a...) dev_warn(p->bus->dev, f, ## a)
index dd34c7c502facfb6eadbcc0edecf5f756be3b8cb..d0e65c82cce3bd10daca901e6309d4e42c651cac 100644 (file)
@@ -50,6 +50,7 @@
 #include "iwl-agn-tt.h"
 #include "iwl-bus.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 #define DRV_NAME        "iwlagn"
 
@@ -1513,7 +1514,7 @@ struct iwl_priv {
 #ifdef CONFIG_IWLWIFI_DEBUG
        /* debugging info */
        u32 debug_level; /* per device debugging will override global
-                           iwl_debug_level if set */
+                           iwlagn_mod_params.debug_level if set */
 #endif /* CONFIG_IWLWIFI_DEBUG */
 #ifdef CONFIG_IWLWIFI_DEBUGFS
        /* debugfs */
@@ -1562,6 +1563,8 @@ static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
        clear_bit(txq_id, &priv->txq_ctx_active_msk);
 }
 
+extern struct iwl_mod_params iwlagn_mod_params;
+
 #ifdef CONFIG_IWLWIFI_DEBUG
 /*
  * iwl_get_debug_level: Return active debug level for device
@@ -1575,12 +1578,12 @@ static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
        if (priv->debug_level)
                return priv->debug_level;
        else
-               return iwl_debug_level;
+               return iwlagn_mod_params.debug_level;
 }
 #else
 static inline u32 iwl_get_debug_level(struct iwl_priv *priv)
 {
-       return iwl_debug_level;
+       return iwlagn_mod_params.debug_level;
 }
 #endif
 
index 1a5252d8ca7359094681fd3fdeed8b70fc3fe193..d8049febe047181d57bd71e9232e00233ab3b984 100644 (file)
@@ -40,6 +40,7 @@
 #include "iwl-agn.h"
 #include "iwl-io.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 /* Throughput          OFF time(ms)    ON time (ms)
  *     >300                    25              25
index 69d4ec467dca70d8da0dbe0129677f42da2f2d30..a2441dd2fd503c3a676c1d1095532790de267359 100644 (file)
 #include <linux/pci-aspm.h>
 
 #include "iwl-bus.h"
+#include "iwl-shared.h"
 #include "iwl-agn.h"
-#include "iwl-core.h"
+
+/* TODO: iwl_set_bit and friends should be implemented in bus layer
+ * this would allow us not to include iwl-io.h here */
 #include "iwl-io.h"
 
 /* PCI registers */
index cd64df05f9ed7442c47bbffff722666e36808df1..b60e692a476517612b7dcbb546bd0a9d08156d40 100644 (file)
@@ -43,6 +43,7 @@
 #include "iwl-debug.h"
 #include "iwl-power.h"
 #include "iwl-trans.h"
+#include "iwl-shared.h"
 
 /*
  * Setting power level allows the card to go to sleep when not busy.
index 8e314003b63ac67a5412f03ed4d6332b5ae9de86..8b3a08958cc87ef2de5ea43371496196fe292bc2 100644 (file)
@@ -40,6 +40,7 @@
 #include "iwl-helpers.h"
 #include "iwl-agn-calib.h"
 #include "iwl-agn.h"
+#include "iwl-shared.h"
 
 
 /******************************************************************************
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
new file mode 100644 (file)
index 0000000..5d48d05
--- /dev/null
@@ -0,0 +1,100 @@
+/******************************************************************************
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2007 - 2011 Intel Corporation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called LICENSE.GPL.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless <ilw@linux.intel.com>
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2005 - 2011 Intel Corporation. All rights reserved.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *  * Neither the name Intel Corporation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ *****************************************************************************/
+#ifndef __iwl_shared_h__
+#define __iwl_shared_h__
+
+struct iwl_cfg;
+struct iwl_priv;
+
+extern struct iwl_mod_params iwlagn_mod_params;
+
+struct iwl_mod_params {
+       int sw_crypto;          /* def: 0 = using hardware encryption */
+       int num_of_queues;      /* def: HW dependent */
+       int disable_11n;        /* def: 0 = 11n capabilities enabled */
+       int amsdu_size_8K;      /* def: 1 = enable 8K amsdu size */
+       int antenna;            /* def: 0 = both antennas (use diversity) */
+       int restart_fw;         /* def: 1 = restart firmware */
+       bool plcp_check;        /* def: true = enable plcp health check */
+       bool ack_check;         /* def: false = disable ack health check */
+       bool wd_disable;        /* def: false = enable stuck queue check */
+       bool bt_coex_active;    /* def: true = enable bt coex */
+       int led_mode;           /* def: 0 = system default */
+       bool no_sleep_autoadjust; /* def: true = disable autoadjust */
+       bool power_save;        /* def: false = disable power save */
+       int power_level;        /* def: 1 = power level */
+       u32 debug_level;        /* levels are IWL_DL_* */
+       int ant_coupling;
+       bool bt_ch_announce;
+       int wanted_ucode_alternative;
+};
+
+#ifdef CONFIG_PM
+int iwl_suspend(struct iwl_priv *priv);
+int iwl_resume(struct iwl_priv *priv);
+#endif /* !CONFIG_PM */
+
+int iwl_probe(struct iwl_bus *bus, struct iwl_cfg *cfg);
+void __devexit iwl_remove(struct iwl_priv * priv);
+
+#endif /* #__iwl_shared_h__ */
index 3001bfb46e25211843cc451b7a9856567db5c4e0..e4a70fed8cf8153986d95f3a56b5282a1ddf3e83 100644 (file)
@@ -68,6 +68,7 @@
 /*TODO remove uneeded includes when the transport layer tx_free will be here */
 #include "iwl-agn.h"
 #include "iwl-core.h"
+#include "iwl-shared.h"
 
 static int iwl_trans_rx_alloc(struct iwl_priv *priv)
 {