aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/cw1200/cw1200.h2
-rw-r--r--drivers/net/wireless/cw1200/cw1200_spi.c32
-rw-r--r--drivers/net/wireless/cw1200/hwio.c18
-rw-r--r--drivers/net/wireless/cw1200/hwio.h31
-rw-r--r--drivers/net/wireless/cw1200/main.c4
-rw-r--r--drivers/net/wireless/cw1200/queue.c2
-rw-r--r--drivers/net/wireless/cw1200/sta.c23
-rw-r--r--drivers/net/wireless/cw1200/txrx.c9
-rw-r--r--drivers/net/wireless/cw1200/wsm.c33
-rw-r--r--drivers/net/wireless/cw1200/wsm.h45
10 files changed, 102 insertions, 97 deletions
diff --git a/drivers/net/wireless/cw1200/cw1200.h b/drivers/net/wireless/cw1200/cw1200.h
index 243e96353d13..1ad7d3602520 100644
--- a/drivers/net/wireless/cw1200/cw1200.h
+++ b/drivers/net/wireless/cw1200/cw1200.h
@@ -267,7 +267,7 @@ struct cw1200_common {
267 struct delayed_work bss_loss_work; 267 struct delayed_work bss_loss_work;
268 spinlock_t bss_loss_lock; /* Protect BSS loss state */ 268 spinlock_t bss_loss_lock; /* Protect BSS loss state */
269 int bss_loss_state; 269 int bss_loss_state;
270 int bss_loss_confirm_id; 270 u32 bss_loss_confirm_id;
271 int delayed_link_loss; 271 int delayed_link_loss;
272 struct work_struct bss_params_work; 272 struct work_struct bss_params_work;
273 273
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c
index 953bd1904d3d..d06376014bcd 100644
--- a/drivers/net/wireless/cw1200/cw1200_spi.c
+++ b/drivers/net/wireless/cw1200/cw1200_spi.c
@@ -61,7 +61,7 @@ static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
61 void *dst, int count) 61 void *dst, int count)
62{ 62{
63 int ret, i; 63 int ret, i;
64 uint16_t regaddr; 64 u16 regaddr;
65 struct spi_message m; 65 struct spi_message m;
66 66
67 struct spi_transfer t_addr = { 67 struct spi_transfer t_addr = {
@@ -76,15 +76,18 @@ static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
76 regaddr = (SDIO_TO_SPI_ADDR(addr))<<12; 76 regaddr = (SDIO_TO_SPI_ADDR(addr))<<12;
77 regaddr |= SET_READ; 77 regaddr |= SET_READ;
78 regaddr |= (count>>1); 78 regaddr |= (count>>1);
79 regaddr = cpu_to_le16(regaddr);
80 79
81#ifdef SPI_DEBUG 80#ifdef SPI_DEBUG
82 pr_info("READ : %04d from 0x%02x (%04x)\n", count, addr, 81 pr_info("READ : %04d from 0x%02x (%04x)\n", count, addr, regaddr);
83 le16_to_cpu(regaddr));
84#endif 82#endif
85 83
84 /* Header is LE16 */
85 regaddr = cpu_to_le16(regaddr);
86
87 /* We have to byteswap if the SPI bus is limited to 8b operation
88 or we are running on a Big Endian system
89 */
86#if defined(__LITTLE_ENDIAN) 90#if defined(__LITTLE_ENDIAN)
87 /* We have to byteswap if the SPI bus is limited to 8b operation */
88 if (self->func->bits_per_word == 8) 91 if (self->func->bits_per_word == 8)
89#endif 92#endif
90 regaddr = swab16(regaddr); 93 regaddr = swab16(regaddr);
@@ -104,8 +107,10 @@ static int cw1200_spi_memcpy_fromio(struct hwbus_priv *self,
104 printk("\n"); 107 printk("\n");
105#endif 108#endif
106 109
110 /* We have to byteswap if the SPI bus is limited to 8b operation
111 or we are running on a Big Endian system
112 */
107#if defined(__LITTLE_ENDIAN) 113#if defined(__LITTLE_ENDIAN)
108 /* We have to byteswap if the SPI bus is limited to 8b operation */
109 if (self->func->bits_per_word == 8) 114 if (self->func->bits_per_word == 8)
110#endif 115#endif
111 { 116 {
@@ -122,7 +127,7 @@ static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
122 const void *src, int count) 127 const void *src, int count)
123{ 128{
124 int rval, i; 129 int rval, i;
125 uint16_t regaddr; 130 u16 regaddr;
126 struct spi_transfer t_addr = { 131 struct spi_transfer t_addr = {
127 .tx_buf = &regaddr, 132 .tx_buf = &regaddr,
128 .len = sizeof(regaddr), 133 .len = sizeof(regaddr),
@@ -136,20 +141,23 @@ static int cw1200_spi_memcpy_toio(struct hwbus_priv *self,
136 regaddr = (SDIO_TO_SPI_ADDR(addr))<<12; 141 regaddr = (SDIO_TO_SPI_ADDR(addr))<<12;
137 regaddr &= SET_WRITE; 142 regaddr &= SET_WRITE;
138 regaddr |= (count>>1); 143 regaddr |= (count>>1);
139 regaddr = cpu_to_le16(regaddr);
140 144
141#ifdef SPI_DEBUG 145#ifdef SPI_DEBUG
142 pr_info("WRITE: %04d to 0x%02x (%04x)\n", count, addr, 146 pr_info("WRITE: %04d to 0x%02x (%04x)\n", count, addr, regaddr);
143 le16_to_cpu(regaddr));
144#endif 147#endif
145 148
149 /* Header is LE16 */
150 regaddr = cpu_to_le16(regaddr);
151
152 /* We have to byteswap if the SPI bus is limited to 8b operation
153 or we are running on a Big Endian system
154 */
146#if defined(__LITTLE_ENDIAN) 155#if defined(__LITTLE_ENDIAN)
147 /* We have to byteswap if the SPI bus is limited to 8b operation */
148 if (self->func->bits_per_word == 8) 156 if (self->func->bits_per_word == 8)
149#endif 157#endif
150 { 158 {
151 uint16_t *buf = (uint16_t *)src; 159 uint16_t *buf = (uint16_t *)src;
152 regaddr = swab16(regaddr); 160 regaddr = swab16(regaddr);
153 for (i = 0; i < ((count + 1) >> 1); i++) 161 for (i = 0; i < ((count + 1) >> 1); i++)
154 buf[i] = swab16(buf[i]); 162 buf[i] = swab16(buf[i]);
155 } 163 }
diff --git a/drivers/net/wireless/cw1200/hwio.c b/drivers/net/wireless/cw1200/hwio.c
index dad3fb331818..ff230b7aeedd 100644
--- a/drivers/net/wireless/cw1200/hwio.c
+++ b/drivers/net/wireless/cw1200/hwio.c
@@ -69,31 +69,33 @@ static int __cw1200_reg_write(struct cw1200_common *priv, u16 addr,
69static inline int __cw1200_reg_read_32(struct cw1200_common *priv, 69static inline int __cw1200_reg_read_32(struct cw1200_common *priv,
70 u16 addr, u32 *val) 70 u16 addr, u32 *val)
71{ 71{
72 int i = __cw1200_reg_read(priv, addr, val, sizeof(*val), 0); 72 __le32 tmp;
73 *val = le32_to_cpu(*val); 73 int i = __cw1200_reg_read(priv, addr, &tmp, sizeof(tmp), 0);
74 *val = le32_to_cpu(tmp);
74 return i; 75 return i;
75} 76}
76 77
77static inline int __cw1200_reg_write_32(struct cw1200_common *priv, 78static inline int __cw1200_reg_write_32(struct cw1200_common *priv,
78 u16 addr, u32 val) 79 u16 addr, u32 val)
79{ 80{
80 val = cpu_to_le32(val); 81 __le32 tmp = cpu_to_le32(val);
81 return __cw1200_reg_write(priv, addr, &val, sizeof(val), 0); 82 return __cw1200_reg_write(priv, addr, &tmp, sizeof(tmp), 0);
82} 83}
83 84
84static inline int __cw1200_reg_read_16(struct cw1200_common *priv, 85static inline int __cw1200_reg_read_16(struct cw1200_common *priv,
85 u16 addr, u16 *val) 86 u16 addr, u16 *val)
86{ 87{
87 int i = __cw1200_reg_read(priv, addr, val, sizeof(*val), 0); 88 __le16 tmp;
88 *val = le16_to_cpu(*val); 89 int i = __cw1200_reg_read(priv, addr, &tmp, sizeof(tmp), 0);
90 *val = le16_to_cpu(tmp);
89 return i; 91 return i;
90} 92}
91 93
92static inline int __cw1200_reg_write_16(struct cw1200_common *priv, 94static inline int __cw1200_reg_write_16(struct cw1200_common *priv,
93 u16 addr, u16 val) 95 u16 addr, u16 val)
94{ 96{
95 val = cpu_to_le16(val); 97 __le16 tmp = cpu_to_le16(val);
96 return __cw1200_reg_write(priv, addr, &val, sizeof(val), 0); 98 return __cw1200_reg_write(priv, addr, &tmp, sizeof(tmp), 0);
97} 99}
98 100
99int cw1200_reg_read(struct cw1200_common *priv, u16 addr, void *buf, 101int cw1200_reg_read(struct cw1200_common *priv, u16 addr, void *buf,
diff --git a/drivers/net/wireless/cw1200/hwio.h b/drivers/net/wireless/cw1200/hwio.h
index 563329cfead6..ddf52669dc5b 100644
--- a/drivers/net/wireless/cw1200/hwio.h
+++ b/drivers/net/wireless/cw1200/hwio.h
@@ -169,35 +169,34 @@ int cw1200_reg_write(struct cw1200_common *priv, u16 addr,
169static inline int cw1200_reg_read_16(struct cw1200_common *priv, 169static inline int cw1200_reg_read_16(struct cw1200_common *priv,
170 u16 addr, u16 *val) 170 u16 addr, u16 *val)
171{ 171{
172 u32 tmp; 172 __le32 tmp;
173 int i; 173 int i;
174 i = cw1200_reg_read(priv, addr, &tmp, sizeof(tmp)); 174 i = cw1200_reg_read(priv, addr, &tmp, sizeof(tmp));
175 tmp = le32_to_cpu(tmp); 175 *val = le32_to_cpu(tmp) & 0xfffff;
176 *val = tmp & 0xffff;
177 return i; 176 return i;
178} 177}
179 178
180static inline int cw1200_reg_write_16(struct cw1200_common *priv, 179static inline int cw1200_reg_write_16(struct cw1200_common *priv,
181 u16 addr, u16 val) 180 u16 addr, u16 val)
182{ 181{
183 u32 tmp = val; 182 __le32 tmp = cpu_to_le32((u32)val);
184 tmp = cpu_to_le32(tmp);
185 return cw1200_reg_write(priv, addr, &tmp, sizeof(tmp)); 183 return cw1200_reg_write(priv, addr, &tmp, sizeof(tmp));
186} 184}
187 185
188static inline int cw1200_reg_read_32(struct cw1200_common *priv, 186static inline int cw1200_reg_read_32(struct cw1200_common *priv,
189 u16 addr, u32 *val) 187 u16 addr, u32 *val)
190{ 188{
191 int i = cw1200_reg_read(priv, addr, val, sizeof(*val)); 189 __le32 tmp;
192 *val = le32_to_cpu(*val); 190 int i = cw1200_reg_read(priv, addr, &tmp, sizeof(tmp));
191 *val = le32_to_cpu(tmp);
193 return i; 192 return i;
194} 193}
195 194
196static inline int cw1200_reg_write_32(struct cw1200_common *priv, 195static inline int cw1200_reg_write_32(struct cw1200_common *priv,
197 u16 addr, u32 val) 196 u16 addr, u32 val)
198{ 197{
199 val = cpu_to_le32(val); 198 __le32 tmp = cpu_to_le32(val);
200 return cw1200_reg_write(priv, addr, &val, sizeof(val)); 199 return cw1200_reg_write(priv, addr, &tmp, sizeof(val));
201} 200}
202 201
203int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf, 202int cw1200_indirect_read(struct cw1200_common *priv, u32 addr, void *buf,
@@ -224,22 +223,24 @@ static inline int cw1200_ahb_read(struct cw1200_common *priv, u32 addr,
224static inline int cw1200_apb_read_32(struct cw1200_common *priv, 223static inline int cw1200_apb_read_32(struct cw1200_common *priv,
225 u32 addr, u32 *val) 224 u32 addr, u32 *val)
226{ 225{
227 int i = cw1200_apb_read(priv, addr, val, sizeof(*val)); 226 __le32 tmp;
228 *val = le32_to_cpu(*val); 227 int i = cw1200_apb_read(priv, addr, &tmp, sizeof(tmp));
228 *val = le32_to_cpu(tmp);
229 return i; 229 return i;
230} 230}
231 231
232static inline int cw1200_apb_write_32(struct cw1200_common *priv, 232static inline int cw1200_apb_write_32(struct cw1200_common *priv,
233 u32 addr, u32 val) 233 u32 addr, u32 val)
234{ 234{
235 val = cpu_to_le32(val); 235 __le32 tmp = cpu_to_le32(val);
236 return cw1200_apb_write(priv, addr, &val, sizeof(val)); 236 return cw1200_apb_write(priv, addr, &tmp, sizeof(val));
237} 237}
238static inline int cw1200_ahb_read_32(struct cw1200_common *priv, 238static inline int cw1200_ahb_read_32(struct cw1200_common *priv,
239 u32 addr, u32 *val) 239 u32 addr, u32 *val)
240{ 240{
241 int i = cw1200_ahb_read(priv, addr, val, sizeof(*val)); 241 __le32 tmp;
242 *val = le32_to_cpu(*val); 242 int i = cw1200_ahb_read(priv, addr, &tmp, sizeof(tmp));
243 *val = le32_to_cpu(tmp);
243 return i; 244 return i;
244} 245}
245 246
diff --git a/drivers/net/wireless/cw1200/main.c b/drivers/net/wireless/cw1200/main.c
index da885036ca5f..3724e739cbf4 100644
--- a/drivers/net/wireless/cw1200/main.c
+++ b/drivers/net/wireless/cw1200/main.c
@@ -238,8 +238,8 @@ static const struct ieee80211_ops cw1200_ops = {
238 /*.cancel_remain_on_channel = cw1200_cancel_remain_on_channel, */ 238 /*.cancel_remain_on_channel = cw1200_cancel_remain_on_channel, */
239}; 239};
240 240
241int cw1200_ba_rx_tids = -1; 241static int cw1200_ba_rx_tids = -1;
242int cw1200_ba_tx_tids = -1; 242static int cw1200_ba_tx_tids = -1;
243module_param(cw1200_ba_rx_tids, int, 0644); 243module_param(cw1200_ba_rx_tids, int, 0644);
244module_param(cw1200_ba_tx_tids, int, 0644); 244module_param(cw1200_ba_tx_tids, int, 0644);
245MODULE_PARM_DESC(cw1200_ba_rx_tids, "Block ACK RX TIDs"); 245MODULE_PARM_DESC(cw1200_ba_rx_tids, "Block ACK RX TIDs");
diff --git a/drivers/net/wireless/cw1200/queue.c b/drivers/net/wireless/cw1200/queue.c
index 8510454d5db1..9c3925f58d79 100644
--- a/drivers/net/wireless/cw1200/queue.c
+++ b/drivers/net/wireless/cw1200/queue.c
@@ -355,7 +355,7 @@ int cw1200_queue_get(struct cw1200_queue *queue,
355 *tx = (struct wsm_tx *)item->skb->data; 355 *tx = (struct wsm_tx *)item->skb->data;
356 *tx_info = IEEE80211_SKB_CB(item->skb); 356 *tx_info = IEEE80211_SKB_CB(item->skb);
357 *txpriv = &item->txpriv; 357 *txpriv = &item->txpriv;
358 (*tx)->packet_id = __cpu_to_le32(item->packet_id); 358 (*tx)->packet_id = item->packet_id;
359 list_move_tail(&item->head, &queue->pending); 359 list_move_tail(&item->head, &queue->pending);
360 ++queue->num_pending; 360 ++queue->num_pending;
361 --queue->link_map_cache[item->txpriv.link_id]; 361 --queue->link_map_cache[item->txpriv.link_id];
diff --git a/drivers/net/wireless/cw1200/sta.c b/drivers/net/wireless/cw1200/sta.c
index 4cd0352b508d..7365674366f4 100644
--- a/drivers/net/wireless/cw1200/sta.c
+++ b/drivers/net/wireless/cw1200/sta.c
@@ -621,7 +621,7 @@ int cw1200_conf_tx(struct ieee80211_hw *dev, struct ieee80211_vif *vif,
621 mutex_lock(&priv->conf_mutex); 621 mutex_lock(&priv->conf_mutex);
622 622
623 if (queue < dev->queues) { 623 if (queue < dev->queues) {
624 old_uapsd_flags = priv->uapsd_info.uapsd_flags; 624 old_uapsd_flags = le16_to_cpu(priv->uapsd_info.uapsd_flags);
625 625
626 WSM_TX_QUEUE_SET(&priv->tx_queue_params, queue, 0, 0, 0); 626 WSM_TX_QUEUE_SET(&priv->tx_queue_params, queue, 0, 0, 0);
627 ret = wsm_set_tx_queue_params(priv, 627 ret = wsm_set_tx_queue_params(priv,
@@ -645,7 +645,7 @@ int cw1200_conf_tx(struct ieee80211_hw *dev, struct ieee80211_vif *vif,
645 ret = cw1200_set_uapsd_param(priv, &priv->edca); 645 ret = cw1200_set_uapsd_param(priv, &priv->edca);
646 if (!ret && priv->setbssparams_done && 646 if (!ret && priv->setbssparams_done &&
647 (priv->join_status == CW1200_JOIN_STATUS_STA) && 647 (priv->join_status == CW1200_JOIN_STATUS_STA) &&
648 (old_uapsd_flags != priv->uapsd_info.uapsd_flags)) 648 (old_uapsd_flags != le16_to_cpu(priv->uapsd_info.uapsd_flags)))
649 ret = cw1200_set_pm(priv, &priv->powersave_mode); 649 ret = cw1200_set_pm(priv, &priv->powersave_mode);
650 } 650 }
651 } else { 651 } else {
@@ -1089,18 +1089,18 @@ static int cw1200_parse_sdd_file(struct cw1200_common *priv)
1089 ret = -1; 1089 ret = -1;
1090 break; 1090 break;
1091 } 1091 }
1092 v = le16_to_cpu(*((u16 *)(p + 2))); 1092 v = le16_to_cpu(*((__le16 *)(p + 2)));
1093 if (!v) /* non-zero means this is enabled */ 1093 if (!v) /* non-zero means this is enabled */
1094 break; 1094 break;
1095 1095
1096 v = le16_to_cpu(*((u16 *)(p + 4))); 1096 v = le16_to_cpu(*((__le16 *)(p + 4)));
1097 priv->conf_listen_interval = (v >> 7) & 0x1F; 1097 priv->conf_listen_interval = (v >> 7) & 0x1F;
1098 pr_debug("PTA found; Listen Interval %d\n", 1098 pr_debug("PTA found; Listen Interval %d\n",
1099 priv->conf_listen_interval); 1099 priv->conf_listen_interval);
1100 break; 1100 break;
1101 } 1101 }
1102 case SDD_REFERENCE_FREQUENCY_ELT_ID: { 1102 case SDD_REFERENCE_FREQUENCY_ELT_ID: {
1103 u16 clk = le16_to_cpu(*((u16 *)(p + 2))); 1103 u16 clk = le16_to_cpu(*((__le16 *)(p + 2)));
1104 if (clk != priv->hw_refclk) 1104 if (clk != priv->hw_refclk)
1105 pr_warn("SDD file doesn't match configured refclk (%d vs %d)\n", 1105 pr_warn("SDD file doesn't match configured refclk (%d vs %d)\n",
1106 clk, priv->hw_refclk); 1106 clk, priv->hw_refclk);
@@ -1785,9 +1785,9 @@ static int cw1200_set_btcoexinfo(struct cw1200_common *priv)
1785 } else { 1785 } else {
1786 pr_debug("[STA] STA has non ERP rates\n"); 1786 pr_debug("[STA] STA has non ERP rates\n");
1787 /* B only mode */ 1787 /* B only mode */
1788 arg.internalTxRate = (__ffs(priv->association_mode.basic_rate_set)); 1788 arg.internalTxRate = (__ffs(le32_to_cpu(priv->association_mode.basic_rate_set)));
1789 } 1789 }
1790 arg.nonErpInternalTxRate = (__ffs(priv->association_mode.basic_rate_set)); 1790 arg.nonErpInternalTxRate = (__ffs(le32_to_cpu(priv->association_mode.basic_rate_set)));
1791 } else { 1791 } else {
1792 /* P2P mode */ 1792 /* P2P mode */
1793 arg.internalTxRate = (__ffs(priv->bss_params.operational_rate_set & ~0xF)); 1793 arg.internalTxRate = (__ffs(priv->bss_params.operational_rate_set & ~0xF));
@@ -1908,7 +1908,7 @@ void cw1200_bss_info_changed(struct ieee80211_hw *dev,
1908 1908
1909 if (info->assoc || info->ibss_joined) { 1909 if (info->assoc || info->ibss_joined) {
1910 struct ieee80211_sta *sta = NULL; 1910 struct ieee80211_sta *sta = NULL;
1911 u32 val = 0; 1911 __le32 htprot = 0;
1912 1912
1913 if (info->dtim_period) 1913 if (info->dtim_period)
1914 priv->join_dtim_period = info->dtim_period; 1914 priv->join_dtim_period = info->dtim_period;
@@ -1935,19 +1935,18 @@ void cw1200_bss_info_changed(struct ieee80211_hw *dev,
1935 /* Non Greenfield stations present */ 1935 /* Non Greenfield stations present */
1936 if (priv->ht_info.operation_mode & 1936 if (priv->ht_info.operation_mode &
1937 IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT) 1937 IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)
1938 val |= WSM_NON_GREENFIELD_STA_PRESENT; 1938 htprot |= cpu_to_le32(WSM_NON_GREENFIELD_STA_PRESENT);
1939 1939
1940 /* Set HT protection method */ 1940 /* Set HT protection method */
1941 val |= (priv->ht_info.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION) << 2; 1941 htprot |= cpu_to_le32((priv->ht_info.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION) << 2);
1942 1942
1943 /* TODO: 1943 /* TODO:
1944 * STBC_param.dual_cts 1944 * STBC_param.dual_cts
1945 * STBC_param.LSIG_TXOP_FILL 1945 * STBC_param.LSIG_TXOP_FILL
1946 */ 1946 */
1947 1947
1948 val = cpu_to_le32(val);
1949 wsm_write_mib(priv, WSM_MIB_ID_SET_HT_PROTECTION, 1948 wsm_write_mib(priv, WSM_MIB_ID_SET_HT_PROTECTION,
1950 &val, sizeof(val)); 1949 &htprot, sizeof(htprot));
1951 1950
1952 priv->association_mode.greenfield = 1951 priv->association_mode.greenfield =
1953 cw1200_ht_greenfield(&priv->ht_info); 1952 cw1200_ht_greenfield(&priv->ht_info);
diff --git a/drivers/net/wireless/cw1200/txrx.c b/drivers/net/wireless/cw1200/txrx.c
index 44ca10cb0d39..5862c373d714 100644
--- a/drivers/net/wireless/cw1200/txrx.c
+++ b/drivers/net/wireless/cw1200/txrx.c
@@ -599,15 +599,15 @@ cw1200_tx_h_bt(struct cw1200_common *priv,
599 } else if (ieee80211_is_data(t->hdr->frame_control)) { 599 } else if (ieee80211_is_data(t->hdr->frame_control)) {
600 /* Skip LLC SNAP header (+6) */ 600 /* Skip LLC SNAP header (+6) */
601 u8 *payload = &t->skb->data[t->hdrlen]; 601 u8 *payload = &t->skb->data[t->hdrlen];
602 u16 *ethertype = (u16 *)&payload[6]; 602 __be16 *ethertype = (__be16 *)&payload[6];
603 if (*ethertype == __be16_to_cpu(ETH_P_PAE)) 603 if (be16_to_cpu(*ethertype) == ETH_P_PAE)
604 priority = WSM_EPTA_PRIORITY_EAPOL; 604 priority = WSM_EPTA_PRIORITY_EAPOL;
605 } else if (ieee80211_is_assoc_req(t->hdr->frame_control) || 605 } else if (ieee80211_is_assoc_req(t->hdr->frame_control) ||
606 ieee80211_is_reassoc_req(t->hdr->frame_control)) { 606 ieee80211_is_reassoc_req(t->hdr->frame_control)) {
607 struct ieee80211_mgmt *mgt_frame = 607 struct ieee80211_mgmt *mgt_frame =
608 (struct ieee80211_mgmt *)t->hdr; 608 (struct ieee80211_mgmt *)t->hdr;
609 609
610 if (mgt_frame->u.assoc_req.listen_interval < 610 if (le16_to_cpu(mgt_frame->u.assoc_req.listen_interval) <
611 priv->listen_interval) { 611 priv->listen_interval) {
612 pr_debug("Modified Listen Interval to %d from %d\n", 612 pr_debug("Modified Listen Interval to %d from %d\n",
613 priv->listen_interval, 613 priv->listen_interval,
@@ -615,8 +615,7 @@ cw1200_tx_h_bt(struct cw1200_common *priv,
615 /* Replace listen interval derieved from 615 /* Replace listen interval derieved from
616 * the one read from SDD 616 * the one read from SDD
617 */ 617 */
618 mgt_frame->u.assoc_req.listen_interval = 618 mgt_frame->u.assoc_req.listen_interval = cpu_to_le16(priv->listen_interval);
619 priv->listen_interval;
620 } 619 }
621 } 620 }
622 621
diff --git a/drivers/net/wireless/cw1200/wsm.c b/drivers/net/wireless/cw1200/wsm.c
index d95094fdcc50..cbb74d7a9be5 100644
--- a/drivers/net/wireless/cw1200/wsm.c
+++ b/drivers/net/wireless/cw1200/wsm.c
@@ -42,19 +42,19 @@
42 (buf)->data += size; \ 42 (buf)->data += size; \
43 } while (0) 43 } while (0)
44 44
45#define __WSM_GET(buf, type, cvt) \ 45#define __WSM_GET(buf, type, type2, cvt) \
46 ({ \ 46 ({ \
47 type val; \ 47 type val; \
48 if ((buf)->data + sizeof(type) > (buf)->end) \ 48 if ((buf)->data + sizeof(type) > (buf)->end) \
49 goto underflow; \ 49 goto underflow; \
50 val = cvt(*(type *)(buf)->data); \ 50 val = cvt(*(type2 *)(buf)->data); \
51 (buf)->data += sizeof(type); \ 51 (buf)->data += sizeof(type); \
52 val; \ 52 val; \
53 }) 53 })
54 54
55#define WSM_GET8(buf) __WSM_GET(buf, u8, (u8)) 55#define WSM_GET8(buf) __WSM_GET(buf, u8, u8, (u8))
56#define WSM_GET16(buf) __WSM_GET(buf, u16, __le16_to_cpu) 56#define WSM_GET16(buf) __WSM_GET(buf, u16, __le16, __le16_to_cpu)
57#define WSM_GET32(buf) __WSM_GET(buf, u32, __le32_to_cpu) 57#define WSM_GET32(buf) __WSM_GET(buf, u32, __le32, __le32_to_cpu)
58 58
59#define WSM_PUT(buf, ptr, size) \ 59#define WSM_PUT(buf, ptr, size) \
60 do { \ 60 do { \
@@ -65,18 +65,18 @@
65 (buf)->data += size; \ 65 (buf)->data += size; \
66 } while (0) 66 } while (0)
67 67
68#define __WSM_PUT(buf, val, type, cvt) \ 68#define __WSM_PUT(buf, val, type, type2, cvt) \
69 do { \ 69 do { \
70 if ((buf)->data + sizeof(type) > (buf)->end) \ 70 if ((buf)->data + sizeof(type) > (buf)->end) \
71 if (wsm_buf_reserve((buf), sizeof(type))) \ 71 if (wsm_buf_reserve((buf), sizeof(type))) \
72 goto nomem; \ 72 goto nomem; \
73 *(type *)(buf)->data = cvt(val); \ 73 *(type2 *)(buf)->data = cvt(val); \
74 (buf)->data += sizeof(type); \ 74 (buf)->data += sizeof(type); \
75 } while (0) 75 } while (0)
76 76
77#define WSM_PUT8(buf, val) __WSM_PUT(buf, val, u8, (u8)) 77#define WSM_PUT8(buf, val) __WSM_PUT(buf, val, u8, u8, (u8))
78#define WSM_PUT16(buf, val) __WSM_PUT(buf, val, u16, __cpu_to_le16) 78#define WSM_PUT16(buf, val) __WSM_PUT(buf, val, u16, __le16, __cpu_to_le16)
79#define WSM_PUT32(buf, val) __WSM_PUT(buf, val, u32, __cpu_to_le32) 79#define WSM_PUT32(buf, val) __WSM_PUT(buf, val, u32, __le32, __cpu_to_le32)
80 80
81static void wsm_buf_reset(struct wsm_buf *buf); 81static void wsm_buf_reset(struct wsm_buf *buf);
82static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size); 82static int wsm_buf_reserve(struct wsm_buf *buf, size_t extra_size);
@@ -931,8 +931,8 @@ static int wsm_event_indication(struct cw1200_common *priv, struct wsm_buf *buf)
931 if (!event) 931 if (!event)
932 return -ENOMEM; 932 return -ENOMEM;
933 933
934 event->evt.id = __le32_to_cpu(WSM_GET32(buf)); 934 event->evt.id = WSM_GET32(buf);
935 event->evt.data = __le32_to_cpu(WSM_GET32(buf)); 935 event->evt.data = WSM_GET32(buf);
936 936
937 pr_debug("[WSM] Event: %d(%d)\n", 937 pr_debug("[WSM] Event: %d(%d)\n",
938 event->evt.id, event->evt.data); 938 event->evt.id, event->evt.data);
@@ -1311,7 +1311,7 @@ int wsm_handle_rx(struct cw1200_common *priv, u16 id,
1311 1311
1312 wsm_buf.begin = (u8 *)&wsm[0]; 1312 wsm_buf.begin = (u8 *)&wsm[0];
1313 wsm_buf.data = (u8 *)&wsm[1]; 1313 wsm_buf.data = (u8 *)&wsm[1];
1314 wsm_buf.end = &wsm_buf.begin[__le32_to_cpu(wsm->len)]; 1314 wsm_buf.end = &wsm_buf.begin[__le16_to_cpu(wsm->len)];
1315 1315
1316 pr_debug("[WSM] <<< 0x%.4X (%td)\n", id, 1316 pr_debug("[WSM] <<< 0x%.4X (%td)\n", id,
1317 wsm_buf.end - wsm_buf.begin); 1317 wsm_buf.end - wsm_buf.begin);
@@ -1550,7 +1550,7 @@ static bool wsm_handle_tx_data(struct cw1200_common *priv,
1550 */ 1550 */
1551 pr_debug("[WSM] Convert probe request to scan.\n"); 1551 pr_debug("[WSM] Convert probe request to scan.\n");
1552 wsm_lock_tx_async(priv); 1552 wsm_lock_tx_async(priv);
1553 priv->pending_frame_id = __le32_to_cpu(wsm->packet_id); 1553 priv->pending_frame_id = wsm->packet_id;
1554 if (queue_delayed_work(priv->workqueue, 1554 if (queue_delayed_work(priv->workqueue,
1555 &priv->scan.probe_work, 0) <= 0) 1555 &priv->scan.probe_work, 0) <= 0)
1556 wsm_unlock_tx(priv); 1556 wsm_unlock_tx(priv);
@@ -1558,15 +1558,14 @@ static bool wsm_handle_tx_data(struct cw1200_common *priv,
1558 break; 1558 break;
1559 case do_drop: 1559 case do_drop:
1560 pr_debug("[WSM] Drop frame (0x%.4X).\n", fctl); 1560 pr_debug("[WSM] Drop frame (0x%.4X).\n", fctl);
1561 BUG_ON(cw1200_queue_remove(queue, 1561 BUG_ON(cw1200_queue_remove(queue, wsm->packet_id));
1562 __le32_to_cpu(wsm->packet_id)));
1563 handled = true; 1562 handled = true;
1564 break; 1563 break;
1565 case do_wep: 1564 case do_wep:
1566 pr_debug("[WSM] Issue set_default_wep_key.\n"); 1565 pr_debug("[WSM] Issue set_default_wep_key.\n");
1567 wsm_lock_tx_async(priv); 1566 wsm_lock_tx_async(priv);
1568 priv->wep_default_key_id = tx_info->control.hw_key->keyidx; 1567 priv->wep_default_key_id = tx_info->control.hw_key->keyidx;
1569 priv->pending_frame_id = __le32_to_cpu(wsm->packet_id); 1568 priv->pending_frame_id = wsm->packet_id;
1570 if (queue_work(priv->workqueue, &priv->wep_key_work) <= 0) 1569 if (queue_work(priv->workqueue, &priv->wep_key_work) <= 0)
1571 wsm_unlock_tx(priv); 1570 wsm_unlock_tx(priv);
1572 handled = true; 1571 handled = true;
diff --git a/drivers/net/wireless/cw1200/wsm.h b/drivers/net/wireless/cw1200/wsm.h
index 2816171f7a1d..7afc613c3706 100644
--- a/drivers/net/wireless/cw1200/wsm.h
+++ b/drivers/net/wireless/cw1200/wsm.h
@@ -806,7 +806,7 @@ struct wsm_tx {
806 struct wsm_hdr hdr; 806 struct wsm_hdr hdr;
807 807
808 /* Packet identifier that meant to be used in completion. */ 808 /* Packet identifier that meant to be used in completion. */
809 __le32 packet_id; 809 u32 packet_id; /* Note this is actually a cookie */
810 810
811 /* WSM_TRANSMIT_RATE_... */ 811 /* WSM_TRANSMIT_RATE_... */
812 u8 max_tx_rate; 812 u8 max_tx_rate;
@@ -825,18 +825,18 @@ struct wsm_tx {
825 u8 flags; 825 u8 flags;
826 826
827 /* Should be 0. */ 827 /* Should be 0. */
828 __le32 reserved; 828 u32 reserved;
829 829
830 /* The elapsed time in TUs, after the initial transmission */ 830 /* The elapsed time in TUs, after the initial transmission */
831 /* of an MSDU, after which further attempts to transmit */ 831 /* of an MSDU, after which further attempts to transmit */
832 /* the MSDU shall be terminated. Overrides the global */ 832 /* the MSDU shall be terminated. Overrides the global */
833 /* dot11MaxTransmitMsduLifeTime setting [optional] */ 833 /* dot11MaxTransmitMsduLifeTime setting [optional] */
834 /* Device will set the default value if this is 0. */ 834 /* Device will set the default value if this is 0. */
835 __le32 expire_time; 835 u32 expire_time;
836 836
837 /* WSM_HT_TX_... */ 837 /* WSM_HT_TX_... */
838 __le32 ht_tx_parameters; 838 __le32 ht_tx_parameters;
839}; 839} __packed;
840 840
841/* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */ 841/* = sizeof(generic hi hdr) + sizeof(wsm hdr) + sizeof(alignment) */
842#define WSM_TX_EXTRA_HEADROOM (28) 842#define WSM_TX_EXTRA_HEADROOM (28)
@@ -846,10 +846,10 @@ struct wsm_tx {
846 846
847struct wsm_rx { 847struct wsm_rx {
848 /* WSM_STATUS_... */ 848 /* WSM_STATUS_... */
849 __le32 status; 849 u32 status;
850 850
851 /* Specifies the channel of the received packet. */ 851 /* Specifies the channel of the received packet. */
852 __le16 channel_number; 852 u16 channel_number;
853 853
854 /* WSM_TRANSMIT_RATE_... */ 854 /* WSM_TRANSMIT_RATE_... */
855 u8 rx_rate; 855 u8 rx_rate;
@@ -859,11 +859,8 @@ struct wsm_rx {
859 u8 rcpi_rssi; 859 u8 rcpi_rssi;
860 860
861 /* WSM_RX_STATUS_... */ 861 /* WSM_RX_STATUS_... */
862 __le32 flags; 862 u32 flags;
863 863};
864 /* Payload */
865 u8 data[0];
866} __packed;
867 864
868/* = sizeof(generic hi hdr) + sizeof(wsm hdr) */ 865/* = sizeof(generic hi hdr) + sizeof(wsm hdr) */
869#define WSM_RX_EXTRA_HEADROOM (16) 866#define WSM_RX_EXTRA_HEADROOM (16)
@@ -1119,22 +1116,22 @@ int wsm_set_tx_queue_params(struct cw1200_common *priv,
1119#define WSM_EDCA_PARAMS_RESP_ID 0x0413 1116#define WSM_EDCA_PARAMS_RESP_ID 0x0413
1120struct wsm_edca_queue_params { 1117struct wsm_edca_queue_params {
1121 /* CWmin (in slots) for the access class. */ 1118 /* CWmin (in slots) for the access class. */
1122 __le16 cwmin; 1119 u16 cwmin;
1123 1120
1124 /* CWmax (in slots) for the access class. */ 1121 /* CWmax (in slots) for the access class. */
1125 __le16 cwmax; 1122 u16 cwmax;
1126 1123
1127 /* AIFS (in slots) for the access class. */ 1124 /* AIFS (in slots) for the access class. */
1128 __le16 aifns; 1125 u16 aifns;
1129 1126
1130 /* TX OP Limit (in microseconds) for the access class. */ 1127 /* TX OP Limit (in microseconds) for the access class. */
1131 __le16 txop_limit; 1128 u16 txop_limit;
1132 1129
1133 /* dot11MaxReceiveLifetime to be used for the specified */ 1130 /* dot11MaxReceiveLifetime to be used for the specified */
1134 /* the access class. Overrides the global */ 1131 /* the access class. Overrides the global */
1135 /* dot11MaxReceiveLifetime value */ 1132 /* dot11MaxReceiveLifetime value */
1136 __le32 max_rx_lifetime; 1133 u32 max_rx_lifetime;
1137} __packed; 1134};
1138 1135
1139struct wsm_edca_params { 1136struct wsm_edca_params {
1140 /* NOTE: index is a linux queue id. */ 1137 /* NOTE: index is a linux queue id. */
@@ -1147,12 +1144,12 @@ struct wsm_edca_params {
1147 __uapsd) \ 1144 __uapsd) \
1148 do { \ 1145 do { \
1149 struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \ 1146 struct wsm_edca_queue_params *p = &(__edca)->params[__queue]; \
1150 p->cwmin = (__cw_min); \ 1147 p->cwmin = __cw_min; \
1151 p->cwmax = (__cw_max); \ 1148 p->cwmax = __cw_max; \
1152 p->aifns = (__aifs); \ 1149 p->aifns = __aifs; \
1153 p->txop_limit = ((__txop) * TXOP_UNIT); \ 1150 p->txop_limit = ((__txop) * TXOP_UNIT); \
1154 p->max_rx_lifetime = (__lifetime); \ 1151 p->max_rx_lifetime = __lifetime; \
1155 (__edca)->uapsd_enable[__queue] = (__uapsd); \ 1152 (__edca)->uapsd_enable[__queue] = (__uapsd); \
1156 } while (0) 1153 } while (0)
1157 1154
1158int wsm_set_edca_params(struct cw1200_common *priv, 1155int wsm_set_edca_params(struct cw1200_common *priv,
@@ -1475,7 +1472,7 @@ static inline int wsm_set_template_frame(struct cw1200_common *priv,
1475 u8 *p = skb_push(arg->skb, 4); 1472 u8 *p = skb_push(arg->skb, 4);
1476 p[0] = arg->frame_type; 1473 p[0] = arg->frame_type;
1477 p[1] = arg->rate; 1474 p[1] = arg->rate;
1478 ((u16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4); 1475 ((__le16 *)p)[1] = __cpu_to_le16(arg->skb->len - 4);
1479 ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len); 1476 ret = wsm_write_mib(priv, WSM_MIB_ID_TEMPLATE_FRAME, p, arg->skb->len);
1480 skb_pull(arg->skb, 4); 1477 skb_pull(arg->skb, 4);
1481 return ret; 1478 return ret;