Skip to content

Commit

Permalink
iwlagn: introduce iwl-shared.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Emmanuel Grumbach authored and John W. Linville committed Aug 29, 2011
1 parent a294b96 commit 48f20d3
Show file tree
Hide file tree
Showing 18 changed files with 140 additions and 48 deletions.
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-2000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-5000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-6000.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-agn-lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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 */
};

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
32 changes: 17 additions & 15 deletions drivers/net/wireless/iwlwifi/iwl-agn.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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");

Expand Down Expand Up @@ -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

Expand All @@ -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)");

Expand Down
2 changes: 0 additions & 2 deletions drivers/net/wireless/iwlwifi/iwl-agn.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/wireless/iwlwifi/iwl-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@
#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 */
Expand Down
24 changes: 0 additions & 24 deletions drivers/net/wireless/iwlwifi/iwl-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 6 additions & 3 deletions drivers/net/wireless/iwlwifi/iwl-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-led.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion drivers/net/wireless/iwlwifi/iwl-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@
#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 */
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-power.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/iwlwifi/iwl-rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "iwl-helpers.h"
#include "iwl-agn-calib.h"
#include "iwl-agn.h"
#include "iwl-shared.h"


/******************************************************************************
Expand Down
100 changes: 100 additions & 0 deletions drivers/net/wireless/iwlwifi/iwl-shared.h
Original file line number Diff line number Diff line change
@@ -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__ */
Loading

0 comments on commit 48f20d3

Please sign in to comment.