Skip to contentSkip to conversation

ath5k: move nohwcrypt to ath_common structure

PATCH New John W. Linville 3 participants 7 messages Jan 5, 2011

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ath5k: move nohwcrypt to ath_common structure

---
 drivers/net/wireless/ath/ath.h                |    1 +
 drivers/net/wireless/ath/ath5k/base.c         |    3 ++-
 drivers/net/wireless/ath/ath5k/mac80211-ops.c |    3 +--
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath.h +1 -0
index e43210c..3c2999f 100644
@@ -165,6 +165,7 @@ struct ath_common {
 	const struct ath_bus_ops *bus_ops;
 
 	bool btcoex_enabled;
+	bool nohwcrypt;
 };
 
 struct sk_buff *ath_rxbuf_alloc(struct ath_common *common,
drivers/net/wireless/ath/ath5k/base.c +2 -1
index fce9a98..e7be051 100644
@@ -61,7 +61,7 @@
 #include "debug.h"
 #include "ani.h"
 
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption.");
 
@@ -2395,6 +2395,7 @@ ath5k_init_softc(struct ath5k_softc *sc, const struct ath_bus_ops *bus_ops)
 	common->ah = sc->ah;
 	common->hw = hw;
 	common->priv = sc;
+	common->nohwcrypt = modparam_nohwcrypt;
 
 	/*
 	 * Cache line size is used to size and align various
drivers/net/wireless/ath/ath5k/mac80211-ops.c +1 -2
index de257a3..309c551 100644
@@ -46,7 +46,6 @@
 #include "base.h"
 #include "reg.h"
 
-extern int modparam_nohwcrypt;
 
 /* functions used from base.c */
 void set_beacon_filter(struct ieee80211_hw *hw, bool enable);
@@ -485,7 +484,7 @@ ath5k_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 	struct ath_common *common = ath5k_hw_common(ah);
 	int ret = 0;
 
-	if (modparam_nohwcrypt)
+	if (common->nohwcrypt)
 		return -EOPNOTSUPP;
 
 	switch (key->cipher) {
Signature · 1 line
1.7.3.4
#1 lore raw

PATCH 2/3 ath9k: use nohwcrypt in ath_common structure

---
 drivers/net/wireless/ath/ath9k/ath9k.h |    1 -
 drivers/net/wireless/ath/ath9k/init.c  |    5 +++--
 drivers/net/wireless/ath/ath9k/main.c  |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/ath9k.h +0 -1
index fcc087c..0e97352 100644
@@ -664,7 +664,6 @@ static inline void ath_read_cachesize(struct ath_common *common, int *csz)
 }
 
 extern struct ieee80211_ops ath9k_ops;
-extern int modparam_nohwcrypt;
 extern int led_blink;
 extern int ath9k_pm_qos_value;
 extern bool is_ath9k_unloaded;
drivers/net/wireless/ath/ath9k/init.c +3 -2
index b6643b5..9aafd29 100644
@@ -29,7 +29,7 @@ static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
 MODULE_PARM_DESC(debug, "Debugging mask");
 
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
 
@@ -552,6 +552,7 @@ static int ath9k_init_softc(u16 devid, struct ath_softc *sc, u16 subsysid,
 	common->priv = sc;
 	common->debug_mask = ath9k_debug;
 	common->btcoex_enabled = ath9k_btcoex_enable == 1;
+	common->nohwcrypt = modparam_nohwcrypt;
 	spin_lock_init(&common->cc_lock);
 
 	spin_lock_init(&sc->wiphy_lock);
@@ -653,7 +654,7 @@ void ath9k_set_hw_capab(struct ath_softc *sc, struct ieee80211_hw *hw)
 	if (sc->sc_ah->caps.hw_caps & ATH9K_HW_CAP_HT)
 		 hw->flags |= IEEE80211_HW_AMPDU_AGGREGATION;
 
-	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || modparam_nohwcrypt)
+	if (AR_SREV_9160_10_OR_LATER(sc->sc_ah) || common->nohwcrypt)
 		hw->flags |= IEEE80211_HW_MFP_CAPABLE;
 
 	hw->wiphy->interface_modes =
drivers/net/wireless/ath/ath9k/main.c +1 -1
index a818e4f..b2149ee 100644
@@ -1829,7 +1829,7 @@ static int ath9k_set_key(struct ieee80211_hw *hw,
 	struct ath_common *common = ath9k_hw_common(sc->sc_ah);
 	int ret = 0;
 
-	if (modparam_nohwcrypt)
+	if (common->nohwcrypt)
 		return -ENOSPC;
 
 	mutex_lock(&sc->mutex);
Signature · 1 line
1.7.3.4
#2 lore raw

PATCH 3/3 ath9k_htc: use nohwcrypt in ath_common structure

In reply to John W. Linville
---
 drivers/net/wireless/ath/ath9k/htc.h          |    1 -
 drivers/net/wireless/ath/ath9k/htc_drv_init.c |    5 +++--
 drivers/net/wireless/ath/ath9k/htc_drv_main.c |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath9k/htc.h +0 -1
index a099b3e..64d1684 100644
@@ -42,7 +42,6 @@
 	((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
 
 extern struct ieee80211_ops ath9k_htc_ops;
-extern int htc_modparam_nohwcrypt;
 
 enum htc_phymode {
 	HTC_MODE_AUTO		= 0,
drivers/net/wireless/ath/ath9k/htc_drv_init.c +3 -2
index 38433f9..2f1d494 100644
@@ -24,8 +24,8 @@ static unsigned int ath9k_debug = ATH_DBG_DEFAULT;
 module_param_named(debug, ath9k_debug, uint, 0);
 MODULE_PARM_DESC(debug, "Debugging mask");
 
-int htc_modparam_nohwcrypt;
-module_param_named(nohwcrypt, htc_modparam_nohwcrypt, int, 0444);
+static int modparam_nohwcrypt;
+module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
 MODULE_PARM_DESC(nohwcrypt, "Disable hardware encryption");
 
 #define CHAN2G(_freq, _idx)  { \
@@ -641,6 +641,7 @@ static int ath9k_init_priv(struct ath9k_htc_priv *priv,
 	common->hw = priv->hw;
 	common->priv = priv;
 	common->debug_mask = ath9k_debug;
+	common->nohwcrypt = modparam_nohwcrypt;
 
 	spin_lock_init(&priv->wmi->wmi_lock);
 	spin_lock_init(&priv->beacon_lock);
drivers/net/wireless/ath/ath9k/htc_drv_main.c +1 -1
index 845b4c9..4c7ca46 100644
@@ -1372,7 +1372,7 @@ static int ath9k_htc_set_key(struct ieee80211_hw *hw,
 	struct ath_common *common = ath9k_hw_common(priv->ah);
 	int ret = 0;
 
-	if (htc_modparam_nohwcrypt)
+	if (common->nohwcrypt)
 		return -ENOSPC;
 
 	mutex_lock(&priv->mutex);
Signature · 1 line
1.7.3.4
#3 lore raw

PATCH 1/3 ath5k: move nohwcrypt to ath_common structure

In reply to John W. Linville

drivers/net/wireless/ath/ath.h

Quoted 1 line · John W. Linville
drivers/net/wireless/ath/ath.h +0 -0

[]

drivers/net/wireless/ath/ath5k/base.c line 65

Quoted 6 lines
drivers/net/wireless/ath/ath.h +1 -0
+	bool nohwcrypt;
drivers/net/wireless/ath/ath5k/base.c +1 -1
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);

bool/int matching?

Perhaps the modparam_nohwcrypts should be
bool and S_IRUGO

Review

Quoted 1 line
(quoted diff) +0 -0

[]

Review

Quoted 5 lines
drivers/net/wireless/ath/ath5k/base.c +1 -1
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
(quoted diff) +0 -0

[]

Quoted 4 lines
(quoted diff) +2 -2
-int htc_modparam_nohwcrypt;
-module_param_named(nohwcrypt, htc_modparam_nohwcrypt, int, 0444);
+static int modparam_nohwcrypt;
+module_param_named(nohwcrypt, modparam_nohwcrypt, int, 0444);
#4 lore raw

PATCH 1/3 ath5k: move nohwcrypt to ath_common structure

Quoted 4 lines · Joe Perches

drivers/net/wireless/ath/ath.h

Quoted 1 line · John W. Linville
drivers/net/wireless/ath/ath.h +0 -0

[]

Quoted 8 lines
Quoted 6 lines

+ ? ? bool nohwcrypt;

drivers/net/wireless/ath/ath5k/base.c +1 -1
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;

?module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);

bool/int matching?

It used to be the case that you had to use ints here. Google tells me that changed about 2 years ago, so bool should be ok.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com
#5 lore raw

PATCH 1/3 ath5k: move nohwcrypt to ath_common structure

Quoted 4 lines · Bob Copeland
Quoted 3 lines · Joe Perches

drivers/net/wireless/ath/ath.h

Quoted 1 line · John W. Linville
drivers/net/wireless/ath/ath.h +0 -0

[]

Quoted 8 lines
Quoted 6 lines

drivers/net/wireless/ath/ath5k/base.c line 65

Quoted 5 lines
drivers/net/wireless/ath/ath.h +1 -0
+     bool nohwcrypt;
drivers/net/wireless/ath/ath5k/base.c +1 -1
-int modparam_nohwcrypt;
+static int modparam_nohwcrypt;
 module_param_named(nohwcrypt, modparam_nohwcrypt, bool, S_IRUGO);

bool/int matching?

It used to be the case that you had to use ints here. Google tells me that changed about 2 years ago, so bool should be ok.

bool is OK.

modparam_nohwcrypt is declared int and should be declared bool. Also should be declared and used as bool in ath9k and ath9k_htc too.

#6 lore raw

PATCH 1/3 ath5k: move nohwcrypt to ath_common structure

Quoted 3 lines · Joe Perches

bool is OK.

Yes, I was agreeing, just pointing out (for my own benefit, I guess) that the old rule of using int for bool modparams no longer holds.

Signature · 1 line
Bob Copeland %% www.bobcopeland.com