Skip to contentSkip to conversation

libertas and endianness

PATCH In review Geert Uytterhoeven 3 participants 5 messages Oct 7, 2007 – Oct 8, 2007

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

Somehow (haven't found out why it suddenly got compiled, no .config changes) this showed up in the list of warnings in 2.6.23-rc9 compared to -rc8 on one of my m68k builds:

| drivers/net/wireless/libertas/cmd.c:189: warning: large integer implicitly truncated to unsigned type | drivers/net/wireless/libertas/cmd.c:195: warning: large integer implicitly truncated to unsigned type

The offending lines are:

| wep->keytype[i] = cpu_to_le16(cmd_type_wep_40_bit); | wep->keytype[i] = cpu_to_le16(cmd_type_wep_104_bit);

I.e. it tries to store 0x0100 resp. 0x0200 into keytype[i], which is is u8.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#1 lore raw
Quoted 4 lines

I.e. it tries to store 0x0100 resp. 0x0200 into keytype[i], which is is u8.

Gr{oetje,eeting}s,

Dan Williams partially fixed this on 2nd August. Seems that libertas patches needs ages to trickle upwards.

The patch is buried in the libertas-2.6 tree, in the branch "libertas". See here:

http://git.infradead.org/?p=libertas-2.6.git;a=commitdiff;h=1bf710a1f1bd816897be3b0441d3c916ea1b9ab9

However, in my next mail I'm attaching a cosmetic change for this. There's no need to define a constant for an u8 as 0x0001 and 0x0002 ...

#2 lore raw
Quoted 7 lines · Holger Schurig
Quoted 4 lines

I.e. it tries to store 0x0100 resp. 0x0200 into keytype[i], which is is u8.

Gr{oetje,eeting}s,

Dan Williams partially fixed this on 2nd August. Seems that libertas patches needs ages to trickle upwards.

The patches are queued for 2.6.24 and are already in net-2.6.24. They've been in net-2.6.24 for quite a while. Anything that's in libertas-2.6 is already queued for 2.6.24 when the merge window opens.

http://git.kernel.org/?p=linux/kernel/git/davem/net-2.6.24.git;a=commit;h=1118759a15da6e97e8101a7f025b2947f190505f

The order is:

libertas-2.6 -> wireless-2.6 -> net-2.6.x -> linus

So these will go upstream. Where these patches _could_ go is to stable, for fixing up what's already out there in 2.6.22 and 2.6.23.

Dan

Quoted 14 lines

The patch is buried in the libertas-2.6 tree, in the branch "libertas". See here:

http://git.infradead.org/?p=libertas-2.6.git;a=commitdiff;h=1bf710a1f1bd816897be3b0441d3c916ea1b9ab9

However, in my next mail I'm attaching a cosmetic change for this. There's no need to define a constant for an u8 as 0x0001 and 0x0002 ...
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#3 lore raw

PATCH 1/1 libertas: fix u8 constant

In reply to Geert Uytterhoeven

Don't write constants that are (per documentation and struct) u8 as 0x0001, use 0x01 instead. Also remove an useless cast.

drivers/net/wireless/libertas/host.h +2 -2
Index: libertas-2.6/drivers/net/wireless/libertas/host.h
===================================================================
@@ -138,8 +138,8 @@
 #define CMD_ACT_REMOVE                      0x0004
 #define CMD_ACT_USE_DEFAULT                 0x0008
 
-#define CMD_TYPE_WEP_40_BIT                 0x0001
-#define CMD_TYPE_WEP_104_BIT                0x0002
+#define CMD_TYPE_WEP_40_BIT                 0x01
+#define CMD_TYPE_WEP_104_BIT                0x02
 
 #define CMD_NUM_OF_WEP_KEYS                 4
 
drivers/net/wireless/libertas/cmd.c +2 -2
Index: libertas-2.6/drivers/net/wireless/libertas/cmd.c
===================================================================
@@ -181,13 +181,13 @@ static int wlan_cmd_802_11_set_wep(wlan_
 
 			switch (pkey->len) {
 			case KEY_LEN_WEP_40:
-				wep->keytype[i] = (u8)CMD_TYPE_WEP_40_BIT;
+				wep->keytype[i] = CMD_TYPE_WEP_40_BIT;
 				memmove(&wep->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
 				break;
 			case KEY_LEN_WEP_104:
-				wep->keytype[i] = (u8)CMD_TYPE_WEP_104_BIT;
+				wep->keytype[i] = CMD_TYPE_WEP_104_BIT;
 				memmove(&wep->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH] libertas: fix u8 constant

Quoted 4 lines · Holger Schurig

Don't write constants that are (per documentation and struct) u8 as 0x0001, use 0x01 instead. Also remove an useless cast.

Quoted 36 lines

Index: libertas-2.6/drivers/net/wireless/libertas/host.h
===================================================================

drivers/net/wireless/libertas/host.h +2 -2
@@ -138,8 +138,8 @@
 #define CMD_ACT_REMOVE                      0x0004
 #define CMD_ACT_USE_DEFAULT                 0x0008
 
-#define CMD_TYPE_WEP_40_BIT                 0x0001
-#define CMD_TYPE_WEP_104_BIT                0x0002
+#define CMD_TYPE_WEP_40_BIT                 0x01
+#define CMD_TYPE_WEP_104_BIT                0x02
 
 #define CMD_NUM_OF_WEP_KEYS                 4
 

Index: libertas-2.6/drivers/net/wireless/libertas/cmd.c
===================================================================

drivers/net/wireless/libertas/cmd.c +2 -2
@@ -181,13 +181,13 @@ static int wlan_cmd_802_11_set_wep(wlan_
 
 			switch (pkey->len) {
 			case KEY_LEN_WEP_40:
-				wep->keytype[i] = (u8)CMD_TYPE_WEP_40_BIT;
+				wep->keytype[i] = CMD_TYPE_WEP_40_BIT;
 				memmove(&wep->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (40 bit)\n", i);
 				break;
 			case KEY_LEN_WEP_104:
-				wep->keytype[i] = (u8)CMD_TYPE_WEP_104_BIT;
+				wep->keytype[i] = CMD_TYPE_WEP_104_BIT;
 				memmove(&wep->keymaterial[i], pkey->key,
 				        pkey->len);
 				lbs_deb_cmd("SET_WEP: add key %d (104 bit)\n", i);