Guest User

Untitled

a guest
Aug 27th, 2012
203
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- ar5523.c.old 2012-08-27 10:10:24.254933100 +0100
  2. +++ ar5523.c 2012-08-25 17:10:39.527080619 +0100
  3. @@ -69,7 +69,7 @@
  4. usb_rcvbulkpipe((dev), AR5523_DATA_RX_PIPE)
  5.  
  6. enum {
  7. - // XXX: msec or HZ?
  8. + /* XXX: msec or HZ? */
  9. AR5523_DATA_TIMEOUT = 10000,
  10. AR5523_CMD_TIMEOUT = 1000,
  11. };
  12. @@ -100,7 +100,6 @@
  13. struct ar5523_tx_data {
  14. struct ar5523 *ar;
  15. struct sk_buff *skb;
  16. - struct ieee80211_tx_control *control;
  17. };
  18.  
  19. struct ar5523_rx_data {
  20. @@ -129,7 +128,7 @@
  21.  
  22. struct ieee80211_channel channels[14];
  23. struct ieee80211_rate rates[12];
  24. - struct ieee80211_hw_mode modes[2];
  25. + struct ieee80211_supported_band band;
  26. int mode;
  27.  
  28. };
  29. @@ -416,12 +415,13 @@
  30.  
  31. memset(&chan, 0, sizeof(chan));
  32. chan.flags = cpu_to_be32(0x1400);
  33. - chan.freq = cpu_to_be32(conf->freq);
  34. + chan.freq = cpu_to_be32(conf->channel->center_freq);
  35. chan.magic1 = cpu_to_be32(20);
  36. chan.magic2 = cpu_to_be32(50);
  37. chan.magic3 = cpu_to_be32(1);
  38.  
  39. - ar5523_dbg(ar, "switching to channel %d\n", conf->channel);
  40. + ar5523_dbg(ar, "switching to channel %d\n",
  41. + ieee80211_frequency_to_channel(conf->channel->center_freq));
  42.  
  43. return ar5523_cmd_write(ar, AR5523_CMD_SET_CHAN,
  44. &chan, sizeof(chan), 0);
  45. @@ -499,20 +499,14 @@
  46. return error;
  47. }
  48.  
  49. -static int ar5523_set_rates(struct ar5523 *ar, struct ieee80211_if_conf *ifconf)
  50. +static int ar5523_set_rates(struct ar5523 *ar,
  51. + struct ieee80211_bss_conf *ifconf)
  52. {
  53. struct ar5523_cmd_rates rates;
  54.  
  55. memset(&rates, 0, sizeof(rates));
  56. rates.magic1 = cpu_to_be32(0x02);
  57. -#if 0
  58. - rates.size = cpu_to_be32(1 + sizeof(rates.rates));
  59. - rates.nrates = rs->rs_nrates;
  60. - memcpy(rates.rates, rs->rs_rates, rs->rs_nrates);
  61. -#endif
  62. -
  63. -// ar5523_dbg(ar, "setting supported rates nrates=%d\n", rs->rs_nrates);
  64. -
  65. +
  66. return ar5523_cmd_write(ar, AR5523_CMD_SET_RATES,
  67. &rates, sizeof(rates), 0);
  68. }
  69. @@ -530,15 +524,21 @@
  70. int error;
  71.  
  72. /* sync/async unlink faults aren't errors */
  73. - if (urb->status) {
  74. - ar5523_dbg(ar, "non-zero write bulk status received: %d\n",
  75. - urb->status);
  76. + if (urb->status && (urb->status != -ENOENT &&
  77. + urb->status != -ECONNRESET && urb->status != -ESHUTDOWN)) {
  78. + ar5523_dbg(ar,
  79. + "nonzero write bulk status received: %d\n",
  80. + urb->status);
  81. goto skip;
  82. }
  83.  
  84. + if (urb->status) {
  85. + /* do not try to resubmit urb */
  86. + return;
  87. + }
  88. +
  89. if (len < AR5523_MIN_RXBUFSZ) {
  90. ar5523_err(ar, "wrong xfer size (len=%d)\n", len);
  91. -// ifp->if_ierrors++;
  92. goto skip;
  93. }
  94.  
  95. @@ -551,7 +551,6 @@
  96. if (be32_to_cpu(desc->len) > ar->rxbufsz) {
  97. ar5523_err(ar, "bad descriptor (len=%d)\n",
  98. be32_to_cpu(desc->len));
  99. -// ifp->if_ierrors++;
  100. goto skip;
  101. }
  102.  
  103. @@ -574,12 +573,12 @@
  104. * need to poke into the descriptor if there might be more useful
  105. * information in there.
  106. */
  107. - rx_status.freq = be32_to_cpu(desc->freq);
  108. - rx_status.channel = hw->conf.channel;
  109. - rx_status.phymode = hw->conf.phymode;
  110. - rx_status.ssi = be32_to_cpu(desc->rssi);
  111. -
  112. - ieee80211_rx_irqsafe(hw, data->skb, &rx_status);
  113. + rx_status.freq = be32_to_cpu(desc->freq);
  114. + rx_status.band = hw->conf.channel->band;
  115. + rx_status.signal = be32_to_cpu(desc->rssi);
  116. +
  117. + memcpy(IEEE80211_SKB_RXCB(data->skb), &rx_status, sizeof(rx_status));
  118. + ieee80211_rx_irqsafe(hw, data->skb);
  119.  
  120. data->skb = __dev_alloc_skb(ar->rxbufsz, GFP_ATOMIC);
  121. if (!data->skb) {
  122. @@ -595,7 +594,7 @@
  123.  
  124. error = usb_submit_urb(urb, GFP_ATOMIC);
  125. if (error) {
  126. - // XXX: handle
  127. + /* XXX: handle */
  128. ar5523_err(ar, "error %d when resubmitting rx data urb\n",
  129. error);
  130. }
  131. @@ -704,16 +703,6 @@
  132.  
  133. ar5523_dbg(ar, "command 07h return code: %x\n", be32_to_cpu(val));
  134.  
  135. -#if 0
  136. - /* set default channel */
  137. - ic->ic_bss->ni_chan = ic->ic_ibss_chan;
  138. - error = ar5523_set_chan(ar, ic->ic_bss->ni_chan);
  139. - if (error) {
  140. - ar5523_err(ar, "could not set channel\n");
  141. - goto fail;
  142. - }
  143. -#endif
  144. -
  145. error = ar5523_wme_init(ar);
  146. if (error) {
  147. ar5523_err(ar, "could not setup WME parameters\n");
  148. @@ -786,29 +775,30 @@
  149. struct sk_buff *skb = urb->context;
  150. struct ar5523_tx_data *data = (struct ar5523_tx_data *)skb->cb;
  151. struct ar5523 *ar = data->ar;
  152. - struct ieee80211_tx_status status = { {0} };
  153. + struct ieee80211_tx_info *txi;
  154.  
  155. ar5523_dbg(ar, "data tx urb completed\n");
  156.  
  157. /* sync/async unlink faults aren't errors */
  158. - if (urb->status) {
  159. - ar5523_dbg(ar, "non-zero write bulk status received: %d\n",
  160. - urb->status);
  161. + if (urb->status && (urb->status != -ENOENT &&
  162. + urb->status != -ECONNRESET && urb->status != -ESHUTDOWN)) {
  163. + ar5523_dbg(ar,
  164. + "nonzero write bulk status received: %d\n",
  165. + urb->status);
  166. goto out;
  167. }
  168.  
  169. - memcpy(&status.control, data->control, sizeof(status.control));
  170. + txi = IEEE80211_SKB_CB(skb);
  171. skb_pull(skb, sizeof(struct ar5523_tx_desc) + sizeof(__be32));
  172.  
  173. - status.flags |= IEEE80211_TX_STATUS_ACK;
  174. - ieee80211_tx_status_irqsafe(ar->hw, skb, &status);
  175. + txi->flags |= IEEE80211_TX_STAT_ACK;
  176. + ieee80211_tx_status_irqsafe(ar->hw, skb);
  177. out:
  178. atomic_dec(&ar->tx_data_queued);
  179. usb_free_urb(urb);
  180. }
  181.  
  182. -static int ar5523_tx(struct ieee80211_hw *hw, struct sk_buff *skb,
  183. - struct ieee80211_tx_control *control)
  184. +static void ar5523_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
  185. {
  186. struct ieee80211_hdr *wh = (struct ieee80211_hdr *)skb->data;
  187. struct ar5523 *ar = hw->priv;
  188. @@ -823,7 +813,7 @@
  189.  
  190. if (atomic_read(&ar->tx_data_queued) >= AR5523_TX_DATA_COUNT) {
  191. ar5523_dbg(ar, "tx queue full\n");
  192. - return NETDEV_TX_BUSY;
  193. + return;
  194. }
  195.  
  196. urb = usb_alloc_urb(0, GFP_ATOMIC);
  197. @@ -834,10 +824,6 @@
  198. data = (struct ar5523_tx_data *)skb->cb;
  199. data->ar = ar;
  200.  
  201. - data->control = kmemdup(control, sizeof(*control), GFP_ATOMIC);
  202. - if (!data->control)
  203. - goto out_free_urb;
  204. -
  205. desc = (struct ar5523_tx_desc *)skb_push(skb, sizeof(*desc));
  206. hdr = (__be32 *)skb_push(skb, sizeof(__be32));
  207.  
  208. @@ -868,39 +854,37 @@
  209. error = usb_submit_urb(urb, GFP_ATOMIC);
  210. if (error) {
  211. ar5523_err(ar, "error %d when submitting tx urb\n", error);
  212. - goto out_free_control;
  213. + goto out_free_urb;
  214. }
  215.  
  216.  
  217. atomic_inc(&ar->tx_data_queued);
  218.  
  219. - return NETDEV_TX_OK;
  220. + return;
  221.  
  222. - out_free_control:
  223. - kfree(control);
  224. out_free_urb:
  225. usb_free_urb(urb);
  226. out_free_skb:
  227. kfree_skb(skb);
  228. - return NETDEV_TX_BUSY;
  229. + return;
  230. }
  231.  
  232. static int ar5523_add_interface(struct ieee80211_hw *hw,
  233. - struct ieee80211_if_init_conf *conf)
  234. + struct ieee80211_vif *conf)
  235. {
  236. struct ar5523 *ar = hw->priv;
  237.  
  238. ar5523_dbg(ar, "add interface called\n");
  239.  
  240. - /* NOTE: using IEEE80211_IF_TYPE_MNTR to indicate no mode selected */
  241. - if (ar->mode != IEEE80211_IF_TYPE_MNTR) {
  242. + /* NOTE: using NL80211_IFTYPE_MONITOR to indicate no mode selected */
  243. + if (ar->mode != NL80211_IFTYPE_MONITOR) {
  244. ar5523_dbg(ar, "invalid add_interface\n");
  245. return -EOPNOTSUPP;
  246. }
  247.  
  248. switch (conf->type) {
  249. - case IEEE80211_IF_TYPE_STA:
  250. - case IEEE80211_IF_TYPE_MNTR:
  251. + case NL80211_IFTYPE_STATION:
  252. + case NL80211_IFTYPE_MONITOR:
  253. ar->mode = conf->type;
  254. break;
  255. default:
  256. @@ -917,12 +901,13 @@
  257.  
  258. ar5523_dbg(ar, "remove interface called\n");
  259.  
  260. - ar->mode = IEEE80211_IF_TYPE_MNTR;
  261. + ar->mode = NL80211_IFTYPE_MONITOR;
  262. }
  263.  
  264. -static int ar5523_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
  265. +static int ar5523_config(struct ieee80211_hw *hw, u32 changed)
  266. {
  267. struct ar5523 *ar = hw->priv;
  268. + struct ieee80211_conf *conf = &hw->conf;
  269. __be32 val;
  270. int error;
  271.  
  272. @@ -966,8 +951,10 @@
  273. return 0;
  274. }
  275.  
  276. -static int ar5523_config_interface(struct ieee80211_hw *hw, int if_id,
  277. - struct ieee80211_if_conf *ifconf)
  278. +static void ar5523_bss_info_changed(struct ieee80211_hw *hw,
  279. + struct ieee80211_vif *vif,
  280. + struct ieee80211_bss_conf *ifconf,
  281. + u32 changed)
  282. {
  283. struct ar5523 *ar = hw->priv;
  284. struct ar5523_cmd_bssid bssid;
  285. @@ -976,10 +963,13 @@
  286. __be32 val;
  287. int error;
  288.  
  289. - ar5523_dbg(ar, "config_interface called\n");
  290. + ar5523_dbg(ar, "bss_info_changed called\n");
  291.  
  292. ar5523_cmd_write(ar, AR5523_CMD_24, NULL, 0, 0);
  293.  
  294. + if (!(changed & BSS_CHANGED_BSSID))
  295. + return;
  296. +
  297. memset(&bssid, 0, sizeof(bssid));
  298. bssid.len = cpu_to_be32(AR5523_ADDR_LEN);
  299. memcpy(&bssid.bssid, &ifconf->bssid, AR5523_ADDR_LEN);
  300. @@ -999,7 +989,7 @@
  301. error = ar5523_set_rates(ar, ifconf);
  302. if (error) {
  303. ar5523_err(ar, "could not set negotiated rate set\n");
  304. - return error;
  305. + return;
  306. }
  307.  
  308.  
  309. @@ -1025,13 +1015,11 @@
  310.  
  311. /* start statistics timer */
  312. mod_timer(&ar->stat_timer, jiffies + HZ);
  313. -
  314. - return 0;
  315. }
  316.  
  317. static void ar5523_configure_filter(struct ieee80211_hw *hw,
  318. unsigned int changed_flags, unsigned int *total_flags,
  319. - int mc_count, struct dev_addr_list *mc_list)
  320. + u64 multicast)
  321. {
  322. struct ar5523 *ar = hw->priv;
  323.  
  324. @@ -1049,7 +1037,7 @@
  325. .add_interface = ar5523_add_interface,
  326. .remove_interface = ar5523_remove_interface,
  327. .config = ar5523_config,
  328. - .config_interface = ar5523_config_interface,
  329. + .bss_info_changed = ar5523_bss_info_changed,
  330. .configure_filter = ar5523_configure_filter,
  331. };
  332.  
  333. @@ -1076,12 +1064,19 @@
  334. int error;
  335.  
  336. /* sync/async unlink faults aren't errors */
  337. - if (urb->status) {
  338. - ar5523_dbg(ar, "non-zero write bulk status received: %d\n",
  339. - urb->status);
  340. + if (urb->status && (urb->status != -ENOENT &&
  341. + urb->status != -ECONNRESET && urb->status != -ESHUTDOWN)) {
  342. + ar5523_dbg(ar,
  343. + "nonzero write bulk status received: %d\n",
  344. + urb->status);
  345. goto resubmit;
  346. }
  347.  
  348. + if (urb->status) {
  349. + /* do not try to resubmit urb */
  350. + return;
  351. + }
  352. +
  353. switch (be32_to_cpu(hdr->code) & 0xff) {
  354. default:
  355. /* reply to a read command */
  356. @@ -1109,7 +1104,7 @@
  357. resubmit:
  358. error = usb_submit_urb(urb, GFP_ATOMIC);
  359. if (error) {
  360. - // XXX: handle
  361. + /* XXX: handle */
  362. ar5523_err(ar, "error %d when resubmitting rx urb\n", error);
  363. }
  364. }
  365. @@ -1122,7 +1117,7 @@
  366. struct ar5523_tx_cmd *cmd = &ar->tx_cmd[i];
  367.  
  368. usb_kill_urb(cmd->urb);
  369. - usb_buffer_free(ar->dev, AR5523_MAX_TXCMDSZ,
  370. + usb_free_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
  371. cmd->buf, cmd->urb->transfer_dma);
  372. usb_free_urb(cmd->urb);
  373. }
  374. @@ -1142,7 +1137,7 @@
  375. ar5523_err(ar, "could not allocate tx urb\n");
  376. goto out;
  377. }
  378. - cmd->buf = usb_buffer_alloc(ar->dev, AR5523_MAX_TXCMDSZ,
  379. + cmd->buf = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
  380. GFP_KERNEL,
  381. &cmd->urb->transfer_dma);
  382. if (!cmd->buf) {
  383. @@ -1159,7 +1154,7 @@
  384. while (--i >= 0) {
  385. struct ar5523_tx_cmd *cmd = &ar->tx_cmd[i];
  386.  
  387. - usb_buffer_free(ar->dev, AR5523_MAX_TXCMDSZ,
  388. + usb_free_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
  389. cmd->buf, cmd->urb->transfer_dma);
  390. usb_free_urb(cmd->urb);
  391. }
  392. @@ -1175,7 +1170,7 @@
  393. struct ar5523_rx_cmd *cmd = &ar->rx_cmd[i];
  394.  
  395. usb_kill_urb(cmd->urb);
  396. - usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
  397. + usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
  398. cmd->buf, cmd->urb->transfer_dma);
  399. usb_free_urb(cmd->urb);
  400. }
  401. @@ -1195,7 +1190,7 @@
  402. ar5523_err(ar, "could not allocate rx urb\n");
  403. goto out;
  404. }
  405. - cmd->buf = usb_buffer_alloc(ar->dev, AR5523_MAX_TXCMDSZ,
  406. + cmd->buf = usb_alloc_coherent(ar->dev, AR5523_MAX_TXCMDSZ,
  407. GFP_KERNEL,
  408. &cmd->urb->transfer_dma);
  409. if (!cmd->buf) {
  410. @@ -1213,7 +1208,7 @@
  411. if (error) {
  412. ar5523_err(ar, "error %d when submitting rx urb\n",
  413. error);
  414. - usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
  415. + usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
  416. cmd->buf, cmd->urb->transfer_dma);
  417. usb_free_urb(cmd->urb);
  418. return error;
  419. @@ -1228,7 +1223,7 @@
  420.  
  421. usb_kill_urb(cmd->urb);
  422.  
  423. - usb_buffer_free(ar->dev, AR5523_MAX_RXCMDSZ,
  424. + usb_free_coherent(ar->dev, AR5523_MAX_RXCMDSZ,
  425. cmd->buf, cmd->urb->transfer_dma);
  426. usb_free_urb(cmd->urb);
  427. }
  428. @@ -1280,15 +1275,16 @@
  429. static int ar5523_query_eeprom(struct ar5523 *ar)
  430. {
  431. int error;
  432. + u8 perm_addr[ETH_ALEN];
  433. __be32 tmp;
  434.  
  435. /* retrieve MAC address */
  436. - error = ar5523_read_eeprom(ar, AR5523_EEPROM_MACADDR,
  437. - &ar->hw->wiphy->perm_addr);
  438. + error = ar5523_read_eeprom(ar, AR5523_EEPROM_MACADDR, perm_addr);
  439. if (error) {
  440. ar5523_err(ar, "could not read MAC address\n");
  441. return error;
  442. }
  443. + SET_IEEE80211_PERM_ADDR(ar->hw, perm_addr);
  444.  
  445. /* retrieve the maximum frame size that the hardware can receive */
  446. error = ar5523_read_eeprom(ar, AR5523_EEPROM_RXBUFSZ, &tmp);
  447. @@ -1307,101 +1303,51 @@
  448. * to common code as in OpenBSD.
  449. */
  450. static const struct ieee80211_rate ar5523_rates[] = {
  451. - { .rate = 10,
  452. - .val = 0,
  453. - .flags = IEEE80211_RATE_CCK },
  454. - { .rate = 20,
  455. - .val = 1,
  456. - .flags = IEEE80211_RATE_CCK },
  457. - { .rate = 55,
  458. - .val = 2,
  459. - .flags = IEEE80211_RATE_CCK },
  460. - { .rate = 110,
  461. - .val = 3,
  462. - .flags = IEEE80211_RATE_CCK },
  463. - { .rate = 60,
  464. - .val = 4,
  465. - .flags = IEEE80211_RATE_OFDM },
  466. - { .rate = 90,
  467. - .val = 5,
  468. - .flags = IEEE80211_RATE_OFDM },
  469. - { .rate = 120,
  470. - .val = 6,
  471. - .flags = IEEE80211_RATE_OFDM },
  472. - { .rate = 180,
  473. - .val = 7,
  474. - .flags = IEEE80211_RATE_OFDM },
  475. - { .rate = 240,
  476. - .val = 8,
  477. - .flags = IEEE80211_RATE_OFDM },
  478. - { .rate = 360,
  479. - .val = 9,
  480. - .flags = IEEE80211_RATE_OFDM },
  481. - { .rate = 480,
  482. - .val = 10,
  483. - .flags = IEEE80211_RATE_OFDM },
  484. - { .rate = 540,
  485. - .val = 11,
  486. - .flags = IEEE80211_RATE_OFDM },
  487. + { .bitrate = 10, .hw_value = 0, },
  488. + { .bitrate = 20, .hw_value = 1, },
  489. + { .bitrate = 55, .hw_value = 2, },
  490. + { .bitrate = 110, .hw_value = 3, },
  491. + { .bitrate = 60, .hw_value = 4, },
  492. + { .bitrate = 90, .hw_value = 5, },
  493. + { .bitrate = 120, .hw_value = 6, },
  494. + { .bitrate = 180, .hw_value = 7, },
  495. + { .bitrate = 240, .hw_value = 8, },
  496. + { .bitrate = 360, .hw_value = 9, },
  497. + { .bitrate = 480, .hw_value = 10, },
  498. + { .bitrate = 540, .hw_value = 11, },
  499. };
  500.  
  501. static const struct ieee80211_channel ar5523_channels[] = {
  502. - { .chan = 1,
  503. - .freq = 2412},
  504. - { .chan = 2,
  505. - .freq = 2417},
  506. - { .chan = 3,
  507. - .freq = 2422},
  508. - { .chan = 4,
  509. - .freq = 2427},
  510. - { .chan = 5,
  511. - .freq = 2432},
  512. - { .chan = 6,
  513. - .freq = 2437},
  514. - { .chan = 7,
  515. - .freq = 2442},
  516. - { .chan = 8,
  517. - .freq = 2447},
  518. - { .chan = 9,
  519. - .freq = 2452},
  520. - { .chan = 10,
  521. - .freq = 2457},
  522. - { .chan = 11,
  523. - .freq = 2462},
  524. - { .chan = 12,
  525. - .freq = 2467},
  526. - { .chan = 13,
  527. - .freq = 2472},
  528. - { .chan = 14,
  529. - .freq = 2484},
  530. + { .center_freq = 2412 },
  531. + { .center_freq = 2417 },
  532. + { .center_freq = 2422 },
  533. + { .center_freq = 2427 },
  534. + { .center_freq = 2432 },
  535. + { .center_freq = 2437 },
  536. + { .center_freq = 2442 },
  537. + { .center_freq = 2447 },
  538. + { .center_freq = 2452 },
  539. + { .center_freq = 2457 },
  540. + { .center_freq = 2462 },
  541. + { .center_freq = 2467 },
  542. + { .center_freq = 2472 },
  543. + { .center_freq = 2484 },
  544. };
  545.  
  546. static int ar5523_init_modes(struct ar5523 *ar)
  547. {
  548. - int error;
  549. + BUILD_BUG_ON(sizeof(ar->channels) != sizeof(ar5523_channels));
  550. + BUILD_BUG_ON(sizeof(ar->rates) != sizeof(ar5523_rates));
  551.  
  552. memcpy(ar->channels, ar5523_channels, sizeof(ar5523_channels));
  553. memcpy(ar->rates, ar5523_rates, sizeof(ar5523_rates));
  554.  
  555. - ar->modes[0].mode = MODE_IEEE80211G;
  556. - ar->modes[0].num_rates = ARRAY_SIZE(ar5523_rates);
  557. - ar->modes[0].rates = ar->rates;
  558. - ar->modes[0].num_channels = ARRAY_SIZE(ar5523_channels);
  559. - ar->modes[0].channels = ar->channels;
  560. -
  561. - error = ieee80211_register_hwmode(ar->hw, &ar->modes[0]);
  562. - if (error)
  563. - return error;
  564. -
  565. - ar->modes[1].mode = MODE_IEEE80211B;
  566. - ar->modes[1].num_rates = 4;
  567. - ar->modes[1].rates = ar->rates;
  568. - ar->modes[1].num_channels = ARRAY_SIZE(ar5523_channels);
  569. - ar->modes[1].channels = ar->channels;
  570. -
  571. - error = ieee80211_register_hwmode(ar->hw, &ar->modes[1]);
  572. - if (error)
  573. - return error;
  574. + ar->band.band = IEEE80211_BAND_2GHZ;
  575. + ar->band.channels = ar->channels;
  576. + ar->band.n_channels = ARRAY_SIZE(ar5523_channels);
  577. + ar->band.bitrates = ar->rates;
  578. + ar->band.n_bitrates = ARRAY_SIZE(ar5523_rates);
  579. + ar->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar->band;
  580.  
  581. return 0;
  582. }
  583. @@ -1417,7 +1363,7 @@
  584. const struct firmware *fw;
  585. void *fwbuf;
  586. int len, offset;
  587. - int foolen; // XXX(hch): handle short transfers
  588. + int foolen; /* XXX(hch): handle short transfers */
  589. int error = -ENXIO;
  590.  
  591. if (request_firmware(&fw, AR5523_FIRMWARE_FILE, &dev->dev)) {
  592. @@ -1558,10 +1504,11 @@
  593.  
  594. setup_timer(&ar->stat_timer, ar5523_stat, (unsigned long)ar);
  595.  
  596. - ar->mode = IEEE80211_IF_TYPE_MNTR;
  597. + ar->mode = NL80211_IFTYPE_MONITOR;
  598.  
  599. hw->flags |= IEEE80211_HW_RX_INCLUDES_FCS;
  600. hw->extra_tx_headroom = sizeof(struct ar5523_tx_desc) + sizeof(__be32);
  601. + hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
  602. hw->queues = 1;
  603.  
  604. error = ar5523_init_modes(ar);
  605. @@ -1628,8 +1575,10 @@
  606. AR5523_DEVICE_UX(0x2001, 0x3a04), /* Dlink / DWLAG122 */
  607. AR5523_DEVICE_UG(0x1690, 0x0712), /* Gigaset / AR5523 */
  608. AR5523_DEVICE_UG(0x1690, 0x0710), /* Gigaset / SMCWUSBTG */
  609. + AR5523_DEVICE_UG(0x129b, 0x160c), /* Gigaset / USB stick 108 (CyberTAN Technology) */
  610. AR5523_DEVICE_UG(0x16ab, 0x7801), /* Globalsun / AR5523_1 */
  611. AR5523_DEVICE_UX(0x16ab, 0x7811), /* Globalsun / AR5523_2 */
  612. + AR5523_DEVICE_UG(0x0d8e, 0x7802), /* Globalsun / AR5523_3 */
  613. AR5523_DEVICE_UX(0x0846, 0x4300), /* Netgear / WG111U */
  614. AR5523_DEVICE_UG(0x0846, 0x4250), /* Netgear / WG111T */
  615. AR5523_DEVICE_UG(0x0846, 0x5f00), /* Netgear / WPN111 */
  616. @@ -1640,6 +1589,7 @@
  617. AR5523_DEVICE_UX(0x1435, 0x0828), /* Wistronneweb / AR5523_2 */
  618. AR5523_DEVICE_UG(0x0cde, 0x0012), /* Zcom / AR5523 */
  619. AR5523_DEVICE_UG(0x1385, 0x4250), /* Netgear3 / WG111T (2) */
  620. + AR5523_DEVICE_UG(0x1385, 0x5f00), /* Netgear / WPN111 */
  621. { }
  622. };
  623. MODULE_DEVICE_TABLE(usb, ar5523_id_table);
  624. @@ -1661,7 +1611,8 @@
  625. usb_deregister(&ar5523_driver);
  626. }
  627.  
  628. -MODULE_LICENSE("GPL");
  629. +MODULE_LICENSE("Dual BSD/GPL");
  630. +MODULE_FIRMWARE(AR5523_FIRMWARE_FILE);
  631.  
  632. module_init(ar5523_init);
  633. module_exit(ar5523_exit);
RAW Paste Data