mirror of
https://github.com/lwfinger/rtl8188eu.git
synced 2025-05-07 05:53:06 +00:00
rtl8188eu: Fix some sparse warnings
The driver did not work on PowerPC, which is big endian. This patch fixes all the sparse warnings concerning improper use of __le16 and __le32 variables. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
This commit is contained in:
parent
77e8b5de91
commit
7c7f632ac7
25 changed files with 502 additions and 684 deletions
|
@ -59,167 +59,138 @@
|
|||
* 3. After read integer from IO.
|
||||
*/
|
||||
|
||||
//
|
||||
// Byte Swapping routine.
|
||||
//
|
||||
#define EF1Byte
|
||||
#define EF2Byte le16_to_cpu
|
||||
#define EF4Byte le32_to_cpu
|
||||
/* Convert little data endian to host ordering */
|
||||
#define EF1BYTE(_val) \
|
||||
((u8)(_val))
|
||||
#define EF2BYTE(_val) \
|
||||
(le16_to_cpu(_val))
|
||||
#define EF4BYTE(_val) \
|
||||
(le32_to_cpu(_val))
|
||||
|
||||
//
|
||||
// Read LE format data from memory
|
||||
//
|
||||
#define ReadEF1Byte(_ptr) EF1Byte(*((u8 *)(_ptr)))
|
||||
#define ReadEF2Byte(_ptr) EF2Byte(*((u16 *)(_ptr)))
|
||||
#define ReadEF4Byte(_ptr) EF4Byte(*((u32 *)(_ptr)))
|
||||
/* Read data from memory */
|
||||
#define READEF1BYTE(_ptr) \
|
||||
EF1BYTE(*((u8 *)(_ptr)))
|
||||
/* Read le16 data from memory and convert to host ordering */
|
||||
#define READEF2BYTE(_ptr) \
|
||||
EF2BYTE(*(_ptr))
|
||||
#define READEF4BYTE(_ptr) \
|
||||
EF4BYTE(*(_ptr))
|
||||
|
||||
//
|
||||
// Write LE data to memory
|
||||
//
|
||||
#define WriteEF1Byte(_ptr, _val) (*((u8 *)(_ptr)))=EF1Byte(_val)
|
||||
#define WriteEF2Byte(_ptr, _val) (*((u16 *)(_ptr)))=EF2Byte(_val)
|
||||
#define WriteEF4Byte(_ptr, _val) (*((u32 *)(_ptr)))=EF4Byte(_val)
|
||||
/* Write data to memory */
|
||||
#define WRITEEF1BYTE(_ptr, _val) \
|
||||
do { \
|
||||
(*((u8 *)(_ptr))) = EF1BYTE(_val) \
|
||||
} while (0)
|
||||
/* Write le data to memory in host ordering */
|
||||
#define WRITEEF2BYTE(_ptr, _val) \
|
||||
do { \
|
||||
(*((u16 *)(_ptr))) = EF2BYTE(_val) \
|
||||
} while (0)
|
||||
|
||||
//
|
||||
// Example:
|
||||
// BIT_LEN_MASK_32(0) => 0x00000000
|
||||
// BIT_LEN_MASK_32(1) => 0x00000001
|
||||
// BIT_LEN_MASK_32(2) => 0x00000003
|
||||
// BIT_LEN_MASK_32(32) => 0xFFFFFFFF
|
||||
//
|
||||
#define BIT_LEN_MASK_32(__BitLen) \
|
||||
(0xFFFFFFFF >> (32 - (__BitLen)))
|
||||
//
|
||||
// Example:
|
||||
// BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
|
||||
// BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
|
||||
//
|
||||
#define BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) \
|
||||
(BIT_LEN_MASK_32(__BitLen) << (__BitOffset))
|
||||
#define WRITEEF4BYTE(_ptr, _val) \
|
||||
do { \
|
||||
(*((u32 *)(_ptr))) = EF2BYTE(_val) \
|
||||
} while (0)
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Return 4-byte value in host byte ordering from
|
||||
// 4-byte pointer in litten-endian system.
|
||||
//
|
||||
#define LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
|
||||
(EF4Byte(*((u32 *)(__pStart))))
|
||||
/* Create a bit mask
|
||||
* Examples:
|
||||
* BIT_LEN_MASK_32(0) => 0x00000000
|
||||
* BIT_LEN_MASK_32(1) => 0x00000001
|
||||
* BIT_LEN_MASK_32(2) => 0x00000003
|
||||
* BIT_LEN_MASK_32(32) => 0xFFFFFFFF
|
||||
*/
|
||||
#define BIT_LEN_MASK_32(__bitlen) \
|
||||
(0xFFFFFFFF >> (32 - (__bitlen)))
|
||||
#define BIT_LEN_MASK_16(__bitlen) \
|
||||
(0xFFFF >> (16 - (__bitlen)))
|
||||
#define BIT_LEN_MASK_8(__bitlen) \
|
||||
(0xFF >> (8 - (__bitlen)))
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Translate subfield (continuous bits in little-endian) of 4-byte value in litten byte to
|
||||
// 4-byte value in host byte ordering.
|
||||
//
|
||||
#define LE_BITS_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
/* Create an offset bit mask
|
||||
* Examples:
|
||||
* BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
|
||||
* BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
|
||||
*/
|
||||
#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \
|
||||
(BIT_LEN_MASK_32(__bitlen) << (__bitoffset))
|
||||
#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \
|
||||
(BIT_LEN_MASK_16(__bitlen) << (__bitoffset))
|
||||
#define BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen) \
|
||||
(BIT_LEN_MASK_8(__bitlen) << (__bitoffset))
|
||||
|
||||
/*Description:
|
||||
* Return 4-byte value in host byte ordering from
|
||||
* 4-byte pointer in little-endian system.
|
||||
*/
|
||||
#define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \
|
||||
(EF4BYTE(*((__le32 *)(__pstart))))
|
||||
#define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \
|
||||
(EF2BYTE(*((__le16 *)(__pstart))))
|
||||
#define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \
|
||||
(EF1BYTE(*((u8 *)(__pstart))))
|
||||
|
||||
/*Description:
|
||||
Translate subfield (continuous bits in little-endian) of 4-byte
|
||||
value to host byte ordering.*/
|
||||
#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
( LE_P4BYTE_TO_HOST_4BYTE(__pStart) >> (__BitOffset) ) \
|
||||
& \
|
||||
BIT_LEN_MASK_32(__BitLen) \
|
||||
(LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \
|
||||
BIT_LEN_MASK_32(__bitlen) \
|
||||
)
|
||||
#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
(LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \
|
||||
BIT_LEN_MASK_16(__bitlen) \
|
||||
)
|
||||
#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
(LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \
|
||||
BIT_LEN_MASK_8(__bitlen) \
|
||||
)
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Mask subfield (continuous bits in little-endian) of 4-byte value in litten byte oredering
|
||||
// and return the result in 4-byte value in host byte ordering.
|
||||
//
|
||||
#define LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
/* Description:
|
||||
* Mask subfield (continuous bits in little-endian) of 4-byte value
|
||||
* and return the result in 4-byte value in host byte ordering.
|
||||
*/
|
||||
#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
LE_P4BYTE_TO_HOST_4BYTE(__pStart) \
|
||||
& \
|
||||
( ~BIT_OFFSET_LEN_MASK_32(__BitOffset, __BitLen) ) \
|
||||
LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \
|
||||
(~BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen)) \
|
||||
)
|
||||
#define LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
LE_P2BYTE_TO_HOST_2BYTE(__pstart) & \
|
||||
(~BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen)) \
|
||||
)
|
||||
#define LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
|
||||
( \
|
||||
LE_P1BYTE_TO_HOST_1BYTE(__pstart) & \
|
||||
(~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \
|
||||
)
|
||||
|
||||
//
|
||||
// Description:
|
||||
// Set subfield of little-endian 4-byte value to specified value.
|
||||
//
|
||||
#define SET_BITS_TO_LE_4BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||
*((u32 *)(__pStart)) = \
|
||||
EF4Byte( \
|
||||
LE_BITS_CLEARED_TO_4BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
| \
|
||||
( (((u32)__Value) & BIT_LEN_MASK_32(__BitLen)) << (__BitOffset) ) \
|
||||
/* Description:
|
||||
* Set subfield of little-endian 4-byte value to specified value.
|
||||
*/
|
||||
#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \
|
||||
*((u32 *)(__pstart)) = \
|
||||
( \
|
||||
LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
|
||||
((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
|
||||
)
|
||||
|
||||
#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
|
||||
*((u16 *)(__pstart)) = \
|
||||
( \
|
||||
LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
|
||||
((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
|
||||
);
|
||||
|
||||
|
||||
#define BIT_LEN_MASK_16(__BitLen) \
|
||||
(0xFFFF >> (16 - (__BitLen)))
|
||||
|
||||
#define BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) \
|
||||
(BIT_LEN_MASK_16(__BitLen) << (__BitOffset))
|
||||
|
||||
#define LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
|
||||
(EF2Byte(*((u16 *)(__pStart))))
|
||||
|
||||
#define LE_BITS_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
( \
|
||||
( LE_P2BYTE_TO_HOST_2BYTE(__pStart) >> (__BitOffset) ) \
|
||||
& \
|
||||
BIT_LEN_MASK_16(__BitLen) \
|
||||
)
|
||||
|
||||
#define LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
( \
|
||||
LE_P2BYTE_TO_HOST_2BYTE(__pStart) \
|
||||
& \
|
||||
( ~BIT_OFFSET_LEN_MASK_16(__BitOffset, __BitLen) ) \
|
||||
)
|
||||
|
||||
#define SET_BITS_TO_LE_2BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||
*((u16 *)(__pStart)) = \
|
||||
EF2Byte( \
|
||||
LE_BITS_CLEARED_TO_2BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
| \
|
||||
( (((u16)__Value) & BIT_LEN_MASK_16(__BitLen)) << (__BitOffset) ) \
|
||||
);
|
||||
|
||||
#define BIT_LEN_MASK_8(__BitLen) \
|
||||
(0xFF >> (8 - (__BitLen)))
|
||||
|
||||
#define BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) \
|
||||
(BIT_LEN_MASK_8(__BitLen) << (__BitOffset))
|
||||
|
||||
#define LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||
(EF1Byte(*((u8 *)(__pStart))))
|
||||
|
||||
#define LE_BITS_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
( \
|
||||
( LE_P1BYTE_TO_HOST_1BYTE(__pStart) >> (__BitOffset) ) \
|
||||
& \
|
||||
BIT_LEN_MASK_8(__BitLen) \
|
||||
)
|
||||
|
||||
#define LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
( \
|
||||
LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||
& \
|
||||
( ~BIT_OFFSET_LEN_MASK_8(__BitOffset, __BitLen) ) \
|
||||
)
|
||||
|
||||
#define SET_BITS_TO_LE_1BYTE(__pStart, __BitOffset, __BitLen, __Value) \
|
||||
*((u8 *)(__pStart)) = \
|
||||
EF1Byte( \
|
||||
LE_BITS_CLEARED_TO_1BYTE(__pStart, __BitOffset, __BitLen) \
|
||||
| \
|
||||
( (((u8)__Value) & BIT_LEN_MASK_8(__BitLen)) << (__BitOffset) ) \
|
||||
);
|
||||
|
||||
//pclint
|
||||
#define LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
|
||||
( \
|
||||
LE_P1BYTE_TO_HOST_1BYTE(__pStart) \
|
||||
)
|
||||
|
||||
//pclint
|
||||
#define SET_BITS_TO_LE_1BYTE_8BIT(__pStart, __BitOffset, __BitLen, __Value) \
|
||||
{ \
|
||||
*((u8 *)(__pStart)) = \
|
||||
EF1Byte( \
|
||||
LE_BITS_CLEARED_TO_1BYTE_8BIT(__pStart, __BitOffset, __BitLen) \
|
||||
| \
|
||||
((u8)__Value) \
|
||||
); \
|
||||
}
|
||||
#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
|
||||
*((u8 *)(__pstart)) = EF1BYTE \
|
||||
( \
|
||||
LE_BITS_CLEARED_TO_1BYTE(__pstart, __bitoffset, __bitlen) | \
|
||||
((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
|
||||
)
|
||||
|
||||
// Get the N-bytes aligment offset from the current length
|
||||
#define N_BYTE_ALIGMENT(__Value, __Aligment) ((__Aligment == 1) ? (__Value) : (((__Value + __Aligment - 1) / __Aligment) * __Aligment))
|
||||
|
|
|
@ -145,7 +145,7 @@ void rtl8188e_set_p2p_ps_offload_cmd(struct adapter *padapter, u8 p2p_ps_state);
|
|||
#endif //CONFIG_P2P
|
||||
|
||||
void CheckFwRsvdPageContent(struct adapter *padapter);
|
||||
void rtl8188e_set_FwMediaStatus_cmd(struct adapter *padapter, u16 mstatus_rpt );
|
||||
void rtl8188e_set_FwMediaStatus_cmd(struct adapter *padapter, __le16 mstatus_rpt );
|
||||
|
||||
#ifdef CONFIG_TSF_RESET_OFFLOAD
|
||||
//u8 rtl8188e_reset_tsf(struct adapter *padapter, u8 reset_port);
|
||||
|
|
|
@ -113,10 +113,10 @@ typedef struct _RT_8188E_FIRMWARE_HDR
|
|||
// 8-byte alinment required
|
||||
|
||||
//--- LONG WORD 0 ----
|
||||
u16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
|
||||
__le16 Signature; // 92C0: test chip; 92C, 88C0: test chip; 88C1: MP A-cut; 92C1: MP A-cut
|
||||
u8 Category; // AP/NIC and USB/PCI
|
||||
u8 Function; // Reserved for different FW function indcation, for further use when driver needs to download different FW in different conditions
|
||||
u16 Version; // FW Version
|
||||
__le16 Version; // FW Version
|
||||
u8 Subversion; // FW Subversion, default 0x00
|
||||
u16 Rsvd1;
|
||||
|
||||
|
@ -126,12 +126,12 @@ typedef struct _RT_8188E_FIRMWARE_HDR
|
|||
u8 Date; // Release time Date field
|
||||
u8 Hour; // Release time Hour field
|
||||
u8 Minute; // Release time Minute field
|
||||
u16 RamCodeSize; // The size of RAM code
|
||||
__le16 RamCodeSize; // The size of RAM code
|
||||
u8 Foundry;
|
||||
u8 Rsvd2;
|
||||
|
||||
//--- LONG WORD 2 ----
|
||||
u32 SvnIdx; // The SVN entry index
|
||||
__le32 SvnIdx; // The SVN entry index
|
||||
u32 Rsvd3;
|
||||
|
||||
//--- LONG WORD 3 ----
|
||||
|
|
|
@ -72,5 +72,7 @@ struct br_ext_info {
|
|||
|
||||
void nat25_db_cleanup(struct adapter *priv);
|
||||
void netdev_br_init(struct net_device *netdev);
|
||||
void *scdb_findEntry(struct adapter *priv, unsigned char *macAddr,
|
||||
unsigned char *ipAddr);
|
||||
|
||||
#endif // _RTW_BR_EXT_H_
|
||||
|
|
|
@ -39,9 +39,9 @@ int rtw_IOL_append_END_cmd(struct xmit_frame *xmit_frame);
|
|||
struct ioreg_cfg{
|
||||
u8 length;
|
||||
u8 cmd_id;
|
||||
u16 address;
|
||||
u32 data;
|
||||
u32 mask;
|
||||
__le16 address;
|
||||
__le32 data;
|
||||
__le32 mask;
|
||||
};
|
||||
enum ioreg_cmd{
|
||||
IOREG_CMD_LLT = 0x01,
|
||||
|
|
|
@ -189,12 +189,12 @@ struct rx_pkt_attrib {
|
|||
#define RXDESC_OFFSET RXDESC_SIZE
|
||||
|
||||
struct recv_stat {
|
||||
unsigned int rxdw0;
|
||||
unsigned int rxdw1;
|
||||
unsigned int rxdw2;
|
||||
unsigned int rxdw3;
|
||||
unsigned int rxdw4;
|
||||
unsigned int rxdw5;
|
||||
__le32 rxdw0;
|
||||
__le32 rxdw1;
|
||||
__le32 rxdw2;
|
||||
__le32 rxdw3;
|
||||
__le32 rxdw4;
|
||||
__le32 rxdw5;
|
||||
};
|
||||
|
||||
#define EOR BIT(30)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue