aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorLarry Finger <Larry.Finger@lwfinger.net>2011-02-19 17:30:02 -0500
committerJohn W. Linville <linville@tuxdriver.com>2011-02-21 15:39:59 -0500
commit9e0bc671873c96104b8f793b03661f443e1c4b5a (patch)
tree46ddf6da465f1ce8b4c6d887d4fdc4e9ac11480a /drivers/net
parent17c9ac62812b58aacefc7336215aecbb522f6547 (diff)
rtlwifi: Remove obsolete/unused macros
The original code has many macros that are no longer needed. Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/rtlwifi/base.h38
-rw-r--r--drivers/net/wireless/rtlwifi/wifi.h97
2 files changed, 33 insertions, 102 deletions
diff --git a/drivers/net/wireless/rtlwifi/base.h b/drivers/net/wireless/rtlwifi/base.h
index c95982b030da..043045342bc7 100644
--- a/drivers/net/wireless/rtlwifi/base.h
+++ b/drivers/net/wireless/rtlwifi/base.h
@@ -53,46 +53,22 @@
53#define FRAME_OFFSET_SEQUENCE 22 53#define FRAME_OFFSET_SEQUENCE 22
54#define FRAME_OFFSET_ADDRESS4 24 54#define FRAME_OFFSET_ADDRESS4 24
55 55
56#define SET_80211_HDR_FRAME_CONTROL(_hdr, _val) \
57 WRITEEF2BYTE(_hdr, _val)
58#define SET_80211_HDR_TYPE_AND_SUBTYPE(_hdr, _val) \
59 WRITEEF1BYTE(_hdr, _val)
60#define SET_80211_HDR_PWR_MGNT(_hdr, _val) \
61 SET_BITS_TO_LE_2BYTE(_hdr, 12, 1, _val)
62#define SET_80211_HDR_TO_DS(_hdr, _val) \
63 SET_BITS_TO_LE_2BYTE(_hdr, 8, 1, _val)
64 56
65#define SET_80211_PS_POLL_AID(_hdr, _val) \ 57#define SET_80211_PS_POLL_AID(_hdr, _val) \
66 WRITEEF2BYTE(((u8 *)(_hdr)) + 2, _val) 58 (*(u16 *)((u8 *)(_hdr) + 2) = le16_to_cpu(_val))
67#define SET_80211_PS_POLL_BSSID(_hdr, _val) \ 59#define SET_80211_PS_POLL_BSSID(_hdr, _val) \
68 CP_MACADDR(((u8 *)(_hdr)) + 4, (u8 *)(_val)) 60 memcpy(((u8 *)(_hdr)) + 4, (u8 *)(_val), ETH_ALEN)
69#define SET_80211_PS_POLL_TA(_hdr, _val) \ 61#define SET_80211_PS_POLL_TA(_hdr, _val) \
70 CP_MACADDR(((u8 *)(_hdr)) + 10, (u8 *)(_val)) 62 memcpy(((u8 *)(_hdr)) + 10, (u8 *)(_val), ETH_ALEN)
71 63
72#define SET_80211_HDR_DURATION(_hdr, _val) \ 64#define SET_80211_HDR_DURATION(_hdr, _val) \
73 WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_DURATION, _val) 65 (*(u16 *)((u8 *)(_hdr) + FRAME_OFFSET_DURATION) = le16_to_cpu(_val))
74#define SET_80211_HDR_ADDRESS1(_hdr, _val) \ 66#define SET_80211_HDR_ADDRESS1(_hdr, _val) \
75 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8*)(_val)) 67 memcpy((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS1, (u8*)(_val), ETH_ALEN)
76#define SET_80211_HDR_ADDRESS2(_hdr, _val) \ 68#define SET_80211_HDR_ADDRESS2(_hdr, _val) \
77 CP_MACADDR((u8 *)(_hdr) + FRAME_OFFSET_ADDRESS2, (u8 *)(_val)) 69 memcpy((u8 *)(_hdr) + FRAME_OFFSET_ADDRESS2, (u8 *)(_val), ETH_ALEN)
78#define SET_80211_HDR_ADDRESS3(_hdr, _val) \ 70#define SET_80211_HDR_ADDRESS3(_hdr, _val) \
79 CP_MACADDR((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val)) 71 memcpy((u8 *)(_hdr)+FRAME_OFFSET_ADDRESS3, (u8 *)(_val), ETH_ALEN)
80#define SET_80211_HDR_FRAGMENT_SEQUENCE(_hdr, _val) \
81 WRITEEF2BYTE((u8 *)(_hdr)+FRAME_OFFSET_SEQUENCE, _val)
82
83#define SET_BEACON_PROBE_RSP_TIME_STAMP_LOW(__phdr, __val) \
84 WRITEEF4BYTE(((u8 *)(__phdr)) + 24, __val)
85#define SET_BEACON_PROBE_RSP_TIME_STAMP_HIGH(__phdr, __val) \
86 WRITEEF4BYTE(((u8 *)(__phdr)) + 28, __val)
87#define SET_BEACON_PROBE_RSP_BEACON_INTERVAL(__phdr, __val) \
88 WRITEEF2BYTE(((u8 *)(__phdr)) + 32, __val)
89#define GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) \
90 READEF2BYTE(((u8 *)(__phdr)) + 34)
91#define SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
92 WRITEEF2BYTE(((u8 *)(__phdr)) + 34, __val)
93#define MASK_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, __val) \
94 SET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr, \
95 (GET_BEACON_PROBE_RSP_CAPABILITY_INFO(__phdr) & (~(__val))))
96 72
97int rtl_init_core(struct ieee80211_hw *hw); 73int rtl_init_core(struct ieee80211_hw *hw);
98void rtl_deinit_core(struct ieee80211_hw *hw); 74void rtl_deinit_core(struct ieee80211_hw *hw);
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 053943967a1c..4b90b35f211e 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -1632,7 +1632,7 @@ struct bt_coexist_info {
1632 2. Before write integer to IO. 1632 2. Before write integer to IO.
1633 3. After read integer from IO. 1633 3. After read integer from IO.
1634****************************************/ 1634****************************************/
1635/* Convert little data endian to host */ 1635/* Convert little data endian to host ordering */
1636#define EF1BYTE(_val) \ 1636#define EF1BYTE(_val) \
1637 ((u8)(_val)) 1637 ((u8)(_val))
1638#define EF2BYTE(_val) \ 1638#define EF2BYTE(_val) \
@@ -1640,27 +1640,21 @@ struct bt_coexist_info {
1640#define EF4BYTE(_val) \ 1640#define EF4BYTE(_val) \
1641 (le32_to_cpu(_val)) 1641 (le32_to_cpu(_val))
1642 1642
1643/* Read data from memory */ 1643/* Read le16 data from memory and convert to host ordering */
1644#define READEF1BYTE(_ptr) \
1645 EF1BYTE(*((u8 *)(_ptr)))
1646#define READEF2BYTE(_ptr) \ 1644#define READEF2BYTE(_ptr) \
1647 EF2BYTE(*((u16 *)(_ptr))) 1645 EF2BYTE(*((u16 *)(_ptr)))
1648#define READEF4BYTE(_ptr) \
1649 EF4BYTE(*((__le32 *)(_ptr)))
1650 1646
1651/* Write data to memory */ 1647/* Write le16 data to memory in host ordering */
1652#define WRITEEF1BYTE(_ptr, _val) \
1653 (*((u8 *)(_ptr))) = EF1BYTE(_val)
1654#define WRITEEF2BYTE(_ptr, _val) \ 1648#define WRITEEF2BYTE(_ptr, _val) \
1655 (*((u16 *)(_ptr))) = EF2BYTE(_val) 1649 (*((u16 *)(_ptr))) = EF2BYTE(_val)
1656#define WRITEEF4BYTE(_ptr, _val) \ 1650
1657 (*((u32 *)(_ptr))) = EF4BYTE(_val) 1651/* Create a bit mask
1658 1652 * Examples:
1659/*Example: 1653 * BIT_LEN_MASK_32(0) => 0x00000000
1660BIT_LEN_MASK_32(0) => 0x00000000 1654 * BIT_LEN_MASK_32(1) => 0x00000001
1661BIT_LEN_MASK_32(1) => 0x00000001 1655 * BIT_LEN_MASK_32(2) => 0x00000003
1662BIT_LEN_MASK_32(2) => 0x00000003 1656 * BIT_LEN_MASK_32(32) => 0xFFFFFFFF
1663BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/ 1657 */
1664#define BIT_LEN_MASK_32(__bitlen) \ 1658#define BIT_LEN_MASK_32(__bitlen) \
1665 (0xFFFFFFFF >> (32 - (__bitlen))) 1659 (0xFFFFFFFF >> (32 - (__bitlen)))
1666#define BIT_LEN_MASK_16(__bitlen) \ 1660#define BIT_LEN_MASK_16(__bitlen) \
@@ -1668,9 +1662,11 @@ BIT_LEN_MASK_32(32) => 0xFFFFFFFF*/
1668#define BIT_LEN_MASK_8(__bitlen) \ 1662#define BIT_LEN_MASK_8(__bitlen) \
1669 (0xFF >> (8 - (__bitlen))) 1663 (0xFF >> (8 - (__bitlen)))
1670 1664
1671/*Example: 1665/* Create an offset bit mask
1672BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003 1666 * Examples:
1673BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/ 1667 * BIT_OFFSET_LEN_MASK_32(0, 2) => 0x00000003
1668 * BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000
1669 */
1674#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \ 1670#define BIT_OFFSET_LEN_MASK_32(__bitoffset, __bitlen) \
1675 (BIT_LEN_MASK_32(__bitlen) << (__bitoffset)) 1671 (BIT_LEN_MASK_32(__bitlen) << (__bitoffset))
1676#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \ 1672#define BIT_OFFSET_LEN_MASK_16(__bitoffset, __bitlen) \
@@ -1679,8 +1675,9 @@ BIT_OFFSET_LEN_MASK_32(16, 2) => 0x00030000*/
1679 (BIT_LEN_MASK_8(__bitlen) << (__bitoffset)) 1675 (BIT_LEN_MASK_8(__bitlen) << (__bitoffset))
1680 1676
1681/*Description: 1677/*Description:
1682Return 4-byte value in host byte ordering from 1678 * Return 4-byte value in host byte ordering from
16834-byte pointer in little-endian system.*/ 1679 * 4-byte pointer in little-endian system.
1680 */
1684#define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \ 1681#define LE_P4BYTE_TO_HOST_4BYTE(__pstart) \
1685 (EF4BYTE(*((u32 *)(__pstart)))) 1682 (EF4BYTE(*((u32 *)(__pstart))))
1686#define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \ 1683#define LE_P2BYTE_TO_HOST_2BYTE(__pstart) \
@@ -1688,28 +1685,10 @@ Return 4-byte value in host byte ordering from
1688#define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \ 1685#define LE_P1BYTE_TO_HOST_1BYTE(__pstart) \
1689 (EF1BYTE(*((u8 *)(__pstart)))) 1686 (EF1BYTE(*((u8 *)(__pstart))))
1690 1687
1691/*Description: 1688/* Description:
1692Translate subfield (continuous bits in little-endian) of 4-byte 1689 * Mask subfield (continuous bits in little-endian) of 4-byte value
1693value to host byte ordering.*/ 1690 * and return the result in 4-byte value in host byte ordering.
1694#define LE_BITS_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ 1691 */
1695 ( \
1696 (LE_P4BYTE_TO_HOST_4BYTE(__pstart) >> (__bitoffset)) & \
1697 BIT_LEN_MASK_32(__bitlen) \
1698 )
1699#define LE_BITS_TO_2BYTE(__pstart, __bitoffset, __bitlen) \
1700 ( \
1701 (LE_P2BYTE_TO_HOST_2BYTE(__pstart) >> (__bitoffset)) & \
1702 BIT_LEN_MASK_16(__bitlen) \
1703 )
1704#define LE_BITS_TO_1BYTE(__pstart, __bitoffset, __bitlen) \
1705 ( \
1706 (LE_P1BYTE_TO_HOST_1BYTE(__pstart) >> (__bitoffset)) & \
1707 BIT_LEN_MASK_8(__bitlen) \
1708 )
1709
1710/*Description:
1711Mask subfield (continuous bits in little-endian) of 4-byte value
1712and return the result in 4-byte value in host byte ordering.*/
1713#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \ 1692#define LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) \
1714 ( \ 1693 ( \
1715 LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \ 1694 LE_P4BYTE_TO_HOST_4BYTE(__pstart) & \
@@ -1726,20 +1705,9 @@ and return the result in 4-byte value in host byte ordering.*/
1726 (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \ 1705 (~BIT_OFFSET_LEN_MASK_8(__bitoffset, __bitlen)) \
1727 ) 1706 )
1728 1707
1729/*Description: 1708/* Description:
1730Set subfield of little-endian 4-byte value to specified value. */ 1709 * Set subfield of little-endian 4-byte value to specified value.
1731#define SET_BITS_TO_LE_4BYTE(__pstart, __bitoffset, __bitlen, __val) \ 1710 */
1732 *((u32 *)(__pstart)) = EF4BYTE \
1733 ( \
1734 LE_BITS_CLEARED_TO_4BYTE(__pstart, __bitoffset, __bitlen) | \
1735 ((((u32)__val) & BIT_LEN_MASK_32(__bitlen)) << (__bitoffset)) \
1736 );
1737#define SET_BITS_TO_LE_2BYTE(__pstart, __bitoffset, __bitlen, __val) \
1738 *((u16 *)(__pstart)) = EF2BYTE \
1739 ( \
1740 LE_BITS_CLEARED_TO_2BYTE(__pstart, __bitoffset, __bitlen) | \
1741 ((((u16)__val) & BIT_LEN_MASK_16(__bitlen)) << (__bitoffset)) \
1742 );
1743#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \ 1711#define SET_BITS_TO_LE_1BYTE(__pstart, __bitoffset, __bitlen, __val) \
1744 *((u8 *)(__pstart)) = EF1BYTE \ 1712 *((u8 *)(__pstart)) = EF1BYTE \
1745 ( \ 1713 ( \
@@ -1747,16 +1715,12 @@ Set subfield of little-endian 4-byte value to specified value. */
1747 ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \ 1715 ((((u8)__val) & BIT_LEN_MASK_8(__bitlen)) << (__bitoffset)) \
1748 ); 1716 );
1749 1717
1750#define N_BYTE_ALIGMENT(__value, __aligment) ((__aligment == 1) ? \
1751 (__value) : (((__value + __aligment - 1) / __aligment) * __aligment))
1752
1753/**************************************** 1718/****************************************
1754 mem access macro define end 1719 mem access macro define end
1755****************************************/ 1720****************************************/
1756 1721
1757#define byte(x, n) ((x >> (8 * n)) & 0xff) 1722#define byte(x, n) ((x >> (8 * n)) & 0xff)
1758 1723
1759#define packet_get_type(_packet) (EF1BYTE((_packet).octet[0]) & 0xFC)
1760#define RTL_WATCH_DOG_TIME 2000 1724#define RTL_WATCH_DOG_TIME 2000
1761#define MSECS(t) msecs_to_jiffies(t) 1725#define MSECS(t) msecs_to_jiffies(t)
1762#define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS) 1726#define WLAN_FC_GET_VERS(fc) (le16_to_cpu(fc) & IEEE80211_FCTL_VERS)
@@ -1791,15 +1755,6 @@ Set subfield of little-endian 4-byte value to specified value. */
1791#define container_of_dwork_rtl(x, y, z) \ 1755#define container_of_dwork_rtl(x, y, z) \
1792 container_of(container_of(x, struct delayed_work, work), y, z) 1756 container_of(container_of(x, struct delayed_work, work), y, z)
1793 1757
1794#define FILL_OCTET_STRING(_os, _octet, _len) \
1795 do { \
1796 (_os). octet = (u8 *)(_octet); \
1797 (_os). length = (_len); \
1798 } while (0);
1799
1800#define CP_MACADDR(des, src) \
1801 memcpy((des), (src), ETH_ALEN)
1802
1803static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr) 1758static inline u8 rtl_read_byte(struct rtl_priv *rtlpriv, u32 addr)
1804{ 1759{
1805 return rtlpriv->io.read8_sync(rtlpriv, addr); 1760 return rtlpriv->io.read8_sync(rtlpriv, addr);