Skip to contentSkip to conversation

ath9k: use correct type for test_bit/set_bit

PATCH In review Christoph Hellwig 3 participants 4 messages Jul 23, 2008 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ath9k: use correct type for test_bit/set_bit

The test_bit/set_bit/etc family of routines operates on arrays of unsigned long, so declare sc_keymap as such using the DECLARE_BITMAP helper.

drivers/net/wireless/ath9k/core.h +1 -1
Index: linux-2.6/drivers/net/wireless/ath9k/core.h
===================================================================
@@ -1042,7 +1042,7 @@ struct ath_softc {
 
 	/* Crypto */
 	u_int                   sc_keymax;      /* size of key cache */
-	u_int8_t                sc_keymap[ATH_KEYBYTES];/* key use bit map */
+	DECLARE_BITMAP		(sc_keymap, ATH_KEYBYTES);/* key use bit map */
 	u_int8_t		sc_splitmic;	/* split TKIP MIC keys */
 	int                     sc_keytype;     /* type of the key being used */
 
#2 lore raw
In reply to Christoph Hellwig
Quoted 9 lines · Christoph Hellwig

The test_bit/set_bit/etc family of routines operates on arrays of unsigned long, so declare sc_keymap as such using the DECLARE_BITMAP helper.

Index: linux-2.6/drivers/net/wireless/ath9k/core.h =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=

=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Quoted 1 line

--- linux-2.6.orig/drivers/net/wireless/ath9k/core.h 2008-07-23 18:36=

:39.000000000 +0200

Quoted 1 line

+++ linux-2.6/drivers/net/wireless/ath9k/core.h 2008-07-23 18:37:28.0=

00000000 +0200

drivers/net/wireless/ath9k/core.h struct ath_softc {

Quoted 5 lines
(quoted diff) +0 -0
@@ -1042,7 +1042,7 @@ struct ath_softc {

=20

drivers/net/wireless/ath9k/core.h +0 -1
 	/* Crypto */
 	u_int                   sc_keymax;      /* size of key cache */
-	u_int8_t                sc_keymap[ATH_KEYBYTES];/* key use bit map =

*/

drivers/net/wireless/ath9k/core.h struct ath_softc { · line 1045

Quoted 1 line
drivers/net/wireless/ath9k/core.h +1 -0
+	DECLARE_BITMAP		(sc_keymap, ATH_KEYBYTES);/* key use bit map */

DECLARE_BITMAP expects the number of bits, not bytes.

Andreas.

--=20
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstra=DFe 5, 90409 N=FCrnberg, Germany PGP key fingerprint =3D 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4= ED5
"And now for something completely different."
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw
Quoted 3 lines · Andreas Schwab

Review

Quoted 1 line
(quoted diff) +1 -0
+	DECLARE_BITMAP		(sc_keymap, ATH_KEYBYTES);/* key use bit map */

DECLARE_BITMAP expects the number of bits, not bytes.

Indeed, updated version below:

drivers/net/wireless/ath9k/core.h +1 -2
Index: linux-2.6/drivers/net/wireless/ath9k/core.h
===================================================================
@@ -888,7 +888,6 @@ void ath_setdefantenna(void *sc, u_int a
  * up to ATH_KEYMAX entries (could dynamically allocate state).
  */
 #define	ATH_KEYMAX	        128        /* max key cache size we handle */
-#define	ATH_KEYBYTES	        (ATH_KEYMAX/NBBY) /* storage space in bytes */
 
 #define RESET_RETRY_TXQ         0x00000001
 #define ATH_IF_ID_ANY   	0xff
@@ -1042,7 +1041,7 @@ struct ath_softc {
 
 	/* Crypto */
 	u_int                   sc_keymax;      /* size of key cache */
-	u_int8_t                sc_keymap[ATH_KEYBYTES];/* key use bit map */
+	DECLARE_BITMAP		(sc_keymap, ATH_KEYMAX);/* key use bit map */
 	u_int8_t		sc_splitmic;	/* split TKIP MIC keys */
 	int                     sc_keytype;     /* type of the key being used */