Commit 83f7d57c37e83ab11009d58565e1010597b88db6

Authored by Al Viro
Committed by John W. Linville
1 parent 19d30e0299

ipw2200 annotations and fixes

a) a bunch of printks in error-handling assums that ->status is
big-endian.
b) bitfields trouble
c) missing annotations

NB: a bunch of structs is declared packed for no good reason, AFAICS.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 2 changed files with 64 additions and 60 deletions Side-by-side Diff

drivers/net/wireless/ipw2200.c
... ... @@ -4495,9 +4495,9 @@
4495 4495 priv->
4496 4496 essid_len),
4497 4497 print_mac(mac, priv->bssid),
4498   - ntohs(auth->status),
  4498 + le16_to_cpu(auth->status),
4499 4499 ipw_get_status_code
4500   - (ntohs
  4500 + (le16_to_cpu
4501 4501 (auth->status)));
4502 4502  
4503 4503 priv->status &=
4504 4504  
... ... @@ -4532,9 +4532,9 @@
4532 4532 IPW_DL_STATE |
4533 4533 IPW_DL_ASSOC,
4534 4534 "association failed (0x%04X): %s\n",
4535   - ntohs(resp->status),
  4535 + le16_to_cpu(resp->status),
4536 4536 ipw_get_status_code
4537   - (ntohs
  4537 + (le16_to_cpu
4538 4538 (resp->status)));
4539 4539 }
4540 4540  
... ... @@ -4591,8 +4591,8 @@
4591 4591 IPW_DEBUG(IPW_DL_NOTIF | IPW_DL_STATE |
4592 4592 IPW_DL_ASSOC,
4593 4593 "authentication failed (0x%04X): %s\n",
4594   - ntohs(auth->status),
4595   - ipw_get_status_code(ntohs
  4594 + le16_to_cpu(auth->status),
  4595 + ipw_get_status_code(le16_to_cpu
4596 4596 (auth->
4597 4597 status)));
4598 4598 }
drivers/net/wireless/ipw2200.h
... ... @@ -385,73 +385,73 @@
385 385 dma_addr_t dma_addr; /**< physical addr for BD's */
386 386 int low_mark; /**< low watermark, resume queue if free space more than this */
387 387 int high_mark; /**< high watermark, stop queue if free space less than this */
388   -} __attribute__ ((packed));
  388 +} __attribute__ ((packed)); /* XXX */
389 389  
390 390 struct machdr32 {
391 391 __le16 frame_ctl;
392   - u16 duration; // watch out for endians!
  392 + __le16 duration; // watch out for endians!
393 393 u8 addr1[MACADRR_BYTE_LEN];
394 394 u8 addr2[MACADRR_BYTE_LEN];
395 395 u8 addr3[MACADRR_BYTE_LEN];
396   - u16 seq_ctrl; // more endians!
  396 + __le16 seq_ctrl; // more endians!
397 397 u8 addr4[MACADRR_BYTE_LEN];
398 398 __le16 qos_ctrl;
399 399 } __attribute__ ((packed));
400 400  
401 401 struct machdr30 {
402 402 __le16 frame_ctl;
403   - u16 duration; // watch out for endians!
  403 + __le16 duration; // watch out for endians!
404 404 u8 addr1[MACADRR_BYTE_LEN];
405 405 u8 addr2[MACADRR_BYTE_LEN];
406 406 u8 addr3[MACADRR_BYTE_LEN];
407   - u16 seq_ctrl; // more endians!
  407 + __le16 seq_ctrl; // more endians!
408 408 u8 addr4[MACADRR_BYTE_LEN];
409 409 } __attribute__ ((packed));
410 410  
411 411 struct machdr26 {
412 412 __le16 frame_ctl;
413   - u16 duration; // watch out for endians!
  413 + __le16 duration; // watch out for endians!
414 414 u8 addr1[MACADRR_BYTE_LEN];
415 415 u8 addr2[MACADRR_BYTE_LEN];
416 416 u8 addr3[MACADRR_BYTE_LEN];
417   - u16 seq_ctrl; // more endians!
  417 + __le16 seq_ctrl; // more endians!
418 418 __le16 qos_ctrl;
419 419 } __attribute__ ((packed));
420 420  
421 421 struct machdr24 {
422 422 __le16 frame_ctl;
423   - u16 duration; // watch out for endians!
  423 + __le16 duration; // watch out for endians!
424 424 u8 addr1[MACADRR_BYTE_LEN];
425 425 u8 addr2[MACADRR_BYTE_LEN];
426 426 u8 addr3[MACADRR_BYTE_LEN];
427   - u16 seq_ctrl; // more endians!
  427 + __le16 seq_ctrl; // more endians!
428 428 } __attribute__ ((packed));
429 429  
430 430 // TX TFD with 32 byte MAC Header
431 431 struct tx_tfd_32 {
432 432 struct machdr32 mchdr; // 32
433   - u32 uivplaceholder[2]; // 8
  433 + __le32 uivplaceholder[2]; // 8
434 434 } __attribute__ ((packed));
435 435  
436 436 // TX TFD with 30 byte MAC Header
437 437 struct tx_tfd_30 {
438 438 struct machdr30 mchdr; // 30
439 439 u8 reserved[2]; // 2
440   - u32 uivplaceholder[2]; // 8
  440 + __le32 uivplaceholder[2]; // 8
441 441 } __attribute__ ((packed));
442 442  
443 443 // tx tfd with 26 byte mac header
444 444 struct tx_tfd_26 {
445 445 struct machdr26 mchdr; // 26
446 446 u8 reserved1[2]; // 2
447   - u32 uivplaceholder[2]; // 8
  447 + __le32 uivplaceholder[2]; // 8
448 448 u8 reserved2[4]; // 4
449 449 } __attribute__ ((packed));
450 450  
451 451 // tx tfd with 24 byte mac header
452 452 struct tx_tfd_24 {
453 453 struct machdr24 mchdr; // 24
454   - u32 uivplaceholder[2]; // 8
  454 + __le32 uivplaceholder[2]; // 8
455 455 u8 reserved[8]; // 8
456 456 } __attribute__ ((packed));
457 457  
... ... @@ -460,7 +460,7 @@
460 460 struct tfd_command {
461 461 u8 index;
462 462 u8 length;
463   - u16 reserved;
  463 + __le16 reserved;
464 464 u8 payload[0];
465 465 } __attribute__ ((packed));
466 466  
... ... @@ -562,27 +562,27 @@
562 562 struct ipw_cmd_stats {
563 563 u8 cmd_id;
564 564 u8 seq_num;
565   - u16 good_sfd;
566   - u16 bad_plcp;
567   - u16 wrong_bssid;
568   - u16 valid_mpdu;
569   - u16 bad_mac_header;
570   - u16 reserved_frame_types;
571   - u16 rx_ina;
572   - u16 bad_crc32;
573   - u16 invalid_cts;
574   - u16 invalid_acks;
575   - u16 long_distance_ina_fina;
576   - u16 dsp_silence_unreachable;
577   - u16 accumulated_rssi;
578   - u16 rx_ovfl_frame_tossed;
579   - u16 rssi_silence_threshold;
580   - u16 rx_ovfl_frame_supplied;
581   - u16 last_rx_frame_signal;
582   - u16 last_rx_frame_noise;
583   - u16 rx_autodetec_no_ofdm;
584   - u16 rx_autodetec_no_barker;
585   - u16 reserved;
  565 + __le16 good_sfd;
  566 + __le16 bad_plcp;
  567 + __le16 wrong_bssid;
  568 + __le16 valid_mpdu;
  569 + __le16 bad_mac_header;
  570 + __le16 reserved_frame_types;
  571 + __le16 rx_ina;
  572 + __le16 bad_crc32;
  573 + __le16 invalid_cts;
  574 + __le16 invalid_acks;
  575 + __le16 long_distance_ina_fina;
  576 + __le16 dsp_silence_unreachable;
  577 + __le16 accumulated_rssi;
  578 + __le16 rx_ovfl_frame_tossed;
  579 + __le16 rssi_silence_threshold;
  580 + __le16 rx_ovfl_frame_supplied;
  581 + __le16 last_rx_frame_signal;
  582 + __le16 last_rx_frame_noise;
  583 + __le16 rx_autodetec_no_ofdm;
  584 + __le16 rx_autodetec_no_barker;
  585 + __le16 reserved;
586 586 } __attribute__ ((packed));
587 587  
588 588 struct notif_channel_result {
... ... @@ -637,7 +637,7 @@
637 637 struct notif_authenticate {
638 638 u8 state;
639 639 struct machdr24 addr;
640   - u16 status;
  640 + __le16 status;
641 641 } __attribute__ ((packed));
642 642  
643 643 struct notif_calibration {
644 644  
... ... @@ -732,14 +732,14 @@
732 732 struct alive_command_responce {
733 733 u8 alive_command;
734 734 u8 sequence_number;
735   - u16 software_revision;
  735 + __le16 software_revision;
736 736 u8 device_identifier;
737 737 u8 reserved1[5];
738   - u16 reserved2;
739   - u16 reserved3;
740   - u16 clock_settle_time;
741   - u16 powerup_settle_time;
742   - u16 reserved4;
  738 + __le16 reserved2;
  739 + __le16 reserved3;
  740 + __le16 clock_settle_time;
  741 + __le16 powerup_settle_time;
  742 + __le16 reserved4;
743 743 u8 time_stamp[5]; /* month, day, year, hours, minutes */
744 744 u8 ucode_valid;
745 745 } __attribute__ ((packed));
746 746  
... ... @@ -878,7 +878,11 @@
878 878  
879 879 struct ipw_associate {
880 880 u8 channel;
  881 +#ifdef __LITTLE_ENDIAN_BITFIELD
881 882 u8 auth_type:4, auth_key:4;
  883 +#else
  884 + u8 auth_key:4, auth_type:4;
  885 +#endif
882 886 u8 assoc_type;
883 887 u8 reserved;
884 888 __le16 policy_support;
885 889  
... ... @@ -918,12 +922,12 @@
918 922 struct ipw_retry_limit {
919 923 u8 short_retry_limit;
920 924 u8 long_retry_limit;
921   - u16 reserved;
  925 + __le16 reserved;
922 926 } __attribute__ ((packed));
923 927  
924 928 struct ipw_dino_config {
925   - u32 dino_config_addr;
926   - u16 dino_config_size;
  929 + __le32 dino_config_addr;
  930 + __le16 dino_config_size;
927 931 u8 dino_response;
928 932 u8 reserved;
929 933 } __attribute__ ((packed));
... ... @@ -998,7 +1002,7 @@
998 1002 * - \a status contains status;
999 1003 * - \a param filled with status parameters.
1000 1004 */
1001   -struct ipw_cmd {
  1005 +struct ipw_cmd { /* XXX */
1002 1006 u32 cmd; /**< Host command */
1003 1007 u32 status;/**< Status */
1004 1008 u32 status_len;
... ... @@ -1092,7 +1096,7 @@
1092 1096 struct list_head list;
1093 1097 };
1094 1098  
1095   -struct ipw_error_elem {
  1099 +struct ipw_error_elem { /* XXX */
1096 1100 u32 desc;
1097 1101 u32 time;
1098 1102 u32 blink1;
1099 1103  
... ... @@ -1102,13 +1106,13 @@
1102 1106 u32 data;
1103 1107 };
1104 1108  
1105   -struct ipw_event {
  1109 +struct ipw_event { /* XXX */
1106 1110 u32 event;
1107 1111 u32 time;
1108 1112 u32 data;
1109 1113 } __attribute__ ((packed));
1110 1114  
1111   -struct ipw_fw_error {
  1115 +struct ipw_fw_error { /* XXX */
1112 1116 unsigned long jiffies;
1113 1117 u32 status;
1114 1118 u32 config;
... ... @@ -1153,7 +1157,7 @@
1153 1157 */
1154 1158 struct ipw_rt_hdr {
1155 1159 struct ieee80211_radiotap_header rt_hdr;
1156   - u64 rt_tsf; /* TSF */
  1160 + u64 rt_tsf; /* TSF */ /* XXX */
1157 1161 u8 rt_flags; /* radiotap packet flags */
1158 1162 u8 rt_rate; /* rate in 500kb/s */
1159 1163 __le16 rt_channel; /* channel in mhz */
... ... @@ -1940,8 +1944,8 @@
1940 1944 #define IPW_MEM_FIXED_OVERRIDE (IPW_SHARED_LOWER_BOUND + 0x41C)
1941 1945  
1942 1946 struct ipw_fixed_rate {
1943   - u16 tx_rates;
1944   - u16 reserved;
  1947 + __le16 tx_rates;
  1948 + __le16 reserved;
1945 1949 } __attribute__ ((packed));
1946 1950  
1947 1951 #define IPW_INDIRECT_ADDR_MASK (~0x3ul)
1948 1952  
... ... @@ -1951,12 +1955,12 @@
1951 1955 u8 len;
1952 1956 u16 reserved;
1953 1957 u32 *param;
1954   -} __attribute__ ((packed));
  1958 +} __attribute__ ((packed)); /* XXX */
1955 1959  
1956 1960 struct cmdlog_host_cmd {
1957 1961 u8 cmd;
1958 1962 u8 len;
1959   - u16 reserved;
  1963 + __le16 reserved;
1960 1964 char param[124];
1961 1965 } __attribute__ ((packed));
1962 1966