diff options
author | John W. Linville <linville@tuxdriver.com> | 2010-05-05 16:14:16 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-05 16:14:16 -0400 |
commit | 83163244f845c296a118ce85c653872dbff6abfe (patch) | |
tree | ce2eac695a1c198f23d537e20ed86c16ece21f7e /drivers/net/wireless/orinoco/main.c | |
parent | 0a12761bcd5646691c5d16dd93df84d1b8849285 (diff) | |
parent | adfba3c7c026a6a5560d2a43fefc9b198cb74462 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6 into for-davem
Conflicts:
drivers/net/wireless/libertas_tf/cmd.c
drivers/net/wireless/libertas_tf/main.c
Diffstat (limited to 'drivers/net/wireless/orinoco/main.c')
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 137 |
1 files changed, 76 insertions, 61 deletions
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index 413e9ab6cab3..1d60c7e4392a 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -254,7 +254,7 @@ void set_port_type(struct orinoco_private *priv) | |||
254 | /* Device methods */ | 254 | /* Device methods */ |
255 | /********************************************************************/ | 255 | /********************************************************************/ |
256 | 256 | ||
257 | static int orinoco_open(struct net_device *dev) | 257 | int orinoco_open(struct net_device *dev) |
258 | { | 258 | { |
259 | struct orinoco_private *priv = ndev_priv(dev); | 259 | struct orinoco_private *priv = ndev_priv(dev); |
260 | unsigned long flags; | 260 | unsigned long flags; |
@@ -272,8 +272,9 @@ static int orinoco_open(struct net_device *dev) | |||
272 | 272 | ||
273 | return err; | 273 | return err; |
274 | } | 274 | } |
275 | EXPORT_SYMBOL(orinoco_open); | ||
275 | 276 | ||
276 | static int orinoco_stop(struct net_device *dev) | 277 | int orinoco_stop(struct net_device *dev) |
277 | { | 278 | { |
278 | struct orinoco_private *priv = ndev_priv(dev); | 279 | struct orinoco_private *priv = ndev_priv(dev); |
279 | int err = 0; | 280 | int err = 0; |
@@ -281,25 +282,27 @@ static int orinoco_stop(struct net_device *dev) | |||
281 | /* We mustn't use orinoco_lock() here, because we need to be | 282 | /* We mustn't use orinoco_lock() here, because we need to be |
282 | able to close the interface even if hw_unavailable is set | 283 | able to close the interface even if hw_unavailable is set |
283 | (e.g. as we're released after a PC Card removal) */ | 284 | (e.g. as we're released after a PC Card removal) */ |
284 | spin_lock_irq(&priv->lock); | 285 | orinoco_lock_irq(priv); |
285 | 286 | ||
286 | priv->open = 0; | 287 | priv->open = 0; |
287 | 288 | ||
288 | err = __orinoco_down(priv); | 289 | err = __orinoco_down(priv); |
289 | 290 | ||
290 | spin_unlock_irq(&priv->lock); | 291 | orinoco_unlock_irq(priv); |
291 | 292 | ||
292 | return err; | 293 | return err; |
293 | } | 294 | } |
295 | EXPORT_SYMBOL(orinoco_stop); | ||
294 | 296 | ||
295 | static struct net_device_stats *orinoco_get_stats(struct net_device *dev) | 297 | struct net_device_stats *orinoco_get_stats(struct net_device *dev) |
296 | { | 298 | { |
297 | struct orinoco_private *priv = ndev_priv(dev); | 299 | struct orinoco_private *priv = ndev_priv(dev); |
298 | 300 | ||
299 | return &priv->stats; | 301 | return &priv->stats; |
300 | } | 302 | } |
303 | EXPORT_SYMBOL(orinoco_get_stats); | ||
301 | 304 | ||
302 | static void orinoco_set_multicast_list(struct net_device *dev) | 305 | void orinoco_set_multicast_list(struct net_device *dev) |
303 | { | 306 | { |
304 | struct orinoco_private *priv = ndev_priv(dev); | 307 | struct orinoco_private *priv = ndev_priv(dev); |
305 | unsigned long flags; | 308 | unsigned long flags; |
@@ -313,8 +316,9 @@ static void orinoco_set_multicast_list(struct net_device *dev) | |||
313 | __orinoco_set_multicast_list(dev); | 316 | __orinoco_set_multicast_list(dev); |
314 | orinoco_unlock(priv, &flags); | 317 | orinoco_unlock(priv, &flags); |
315 | } | 318 | } |
319 | EXPORT_SYMBOL(orinoco_set_multicast_list); | ||
316 | 320 | ||
317 | static int orinoco_change_mtu(struct net_device *dev, int new_mtu) | 321 | int orinoco_change_mtu(struct net_device *dev, int new_mtu) |
318 | { | 322 | { |
319 | struct orinoco_private *priv = ndev_priv(dev); | 323 | struct orinoco_private *priv = ndev_priv(dev); |
320 | 324 | ||
@@ -330,6 +334,7 @@ static int orinoco_change_mtu(struct net_device *dev, int new_mtu) | |||
330 | 334 | ||
331 | return 0; | 335 | return 0; |
332 | } | 336 | } |
337 | EXPORT_SYMBOL(orinoco_change_mtu); | ||
333 | 338 | ||
334 | /********************************************************************/ | 339 | /********************************************************************/ |
335 | /* Tx path */ | 340 | /* Tx path */ |
@@ -400,8 +405,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
400 | memset(&desc, 0, sizeof(desc)); | 405 | memset(&desc, 0, sizeof(desc)); |
401 | 406 | ||
402 | *txcntl = cpu_to_le16(tx_control); | 407 | *txcntl = cpu_to_le16(tx_control); |
403 | err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), | 408 | err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), |
404 | txfid, 0); | 409 | txfid, 0); |
405 | if (err) { | 410 | if (err) { |
406 | if (net_ratelimit()) | 411 | if (net_ratelimit()) |
407 | printk(KERN_ERR "%s: Error %d writing Tx " | 412 | printk(KERN_ERR "%s: Error %d writing Tx " |
@@ -414,8 +419,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
414 | memset(&desc, 0, sizeof(desc)); | 419 | memset(&desc, 0, sizeof(desc)); |
415 | 420 | ||
416 | desc.tx_control = cpu_to_le16(tx_control); | 421 | desc.tx_control = cpu_to_le16(tx_control); |
417 | err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), | 422 | err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), |
418 | txfid, 0); | 423 | txfid, 0); |
419 | if (err) { | 424 | if (err) { |
420 | if (net_ratelimit()) | 425 | if (net_ratelimit()) |
421 | printk(KERN_ERR "%s: Error %d writing Tx " | 426 | printk(KERN_ERR "%s: Error %d writing Tx " |
@@ -458,8 +463,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
458 | memcpy(eh, &hdr, sizeof(hdr)); | 463 | memcpy(eh, &hdr, sizeof(hdr)); |
459 | } | 464 | } |
460 | 465 | ||
461 | err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len, | 466 | err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, |
462 | txfid, HERMES_802_3_OFFSET); | 467 | txfid, HERMES_802_3_OFFSET); |
463 | if (err) { | 468 | if (err) { |
464 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", | 469 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", |
465 | dev->name, err); | 470 | dev->name, err); |
@@ -490,8 +495,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
490 | skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); | 495 | skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); |
491 | 496 | ||
492 | /* Write the MIC */ | 497 | /* Write the MIC */ |
493 | err = hermes_bap_pwrite(hw, USER_BAP, &mic_buf[0], len, | 498 | err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, |
494 | txfid, HERMES_802_3_OFFSET + offset); | 499 | txfid, HERMES_802_3_OFFSET + offset); |
495 | if (err) { | 500 | if (err) { |
496 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", | 501 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", |
497 | dev->name, err); | 502 | dev->name, err); |
@@ -502,7 +507,7 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
502 | /* Finally, we actually initiate the send */ | 507 | /* Finally, we actually initiate the send */ |
503 | netif_stop_queue(dev); | 508 | netif_stop_queue(dev); |
504 | 509 | ||
505 | err = hermes_docmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, | 510 | err = hw->ops->cmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, |
506 | txfid, NULL); | 511 | txfid, NULL); |
507 | if (err) { | 512 | if (err) { |
508 | netif_start_queue(dev); | 513 | netif_start_queue(dev); |
@@ -572,9 +577,9 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
572 | return; /* Nothing's really happened */ | 577 | return; /* Nothing's really happened */ |
573 | 578 | ||
574 | /* Read part of the frame header - we need status and addr1 */ | 579 | /* Read part of the frame header - we need status and addr1 */ |
575 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, | 580 | err = hw->ops->bap_pread(hw, IRQ_BAP, &hdr, |
576 | sizeof(struct hermes_txexc_data), | 581 | sizeof(struct hermes_txexc_data), |
577 | fid, 0); | 582 | fid, 0); |
578 | 583 | ||
579 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); | 584 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); |
580 | stats->tx_errors++; | 585 | stats->tx_errors++; |
@@ -615,7 +620,7 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
615 | netif_wake_queue(dev); | 620 | netif_wake_queue(dev); |
616 | } | 621 | } |
617 | 622 | ||
618 | static void orinoco_tx_timeout(struct net_device *dev) | 623 | void orinoco_tx_timeout(struct net_device *dev) |
619 | { | 624 | { |
620 | struct orinoco_private *priv = ndev_priv(dev); | 625 | struct orinoco_private *priv = ndev_priv(dev); |
621 | struct net_device_stats *stats = &priv->stats; | 626 | struct net_device_stats *stats = &priv->stats; |
@@ -630,6 +635,7 @@ static void orinoco_tx_timeout(struct net_device *dev) | |||
630 | 635 | ||
631 | schedule_work(&priv->reset_work); | 636 | schedule_work(&priv->reset_work); |
632 | } | 637 | } |
638 | EXPORT_SYMBOL(orinoco_tx_timeout); | ||
633 | 639 | ||
634 | /********************************************************************/ | 640 | /********************************************************************/ |
635 | /* Rx path (data frames) */ | 641 | /* Rx path (data frames) */ |
@@ -764,9 +770,9 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
764 | 770 | ||
765 | /* If any, copy the data from the card to the skb */ | 771 | /* If any, copy the data from the card to the skb */ |
766 | if (datalen > 0) { | 772 | if (datalen > 0) { |
767 | err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), | 773 | err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), |
768 | ALIGN(datalen, 2), rxfid, | 774 | ALIGN(datalen, 2), rxfid, |
769 | HERMES_802_2_OFFSET); | 775 | HERMES_802_2_OFFSET); |
770 | if (err) { | 776 | if (err) { |
771 | printk(KERN_ERR "%s: error %d reading monitor frame\n", | 777 | printk(KERN_ERR "%s: error %d reading monitor frame\n", |
772 | dev->name, err); | 778 | dev->name, err); |
@@ -792,7 +798,7 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
792 | stats->rx_dropped++; | 798 | stats->rx_dropped++; |
793 | } | 799 | } |
794 | 800 | ||
795 | static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | 801 | void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) |
796 | { | 802 | { |
797 | struct orinoco_private *priv = ndev_priv(dev); | 803 | struct orinoco_private *priv = ndev_priv(dev); |
798 | struct net_device_stats *stats = &priv->stats; | 804 | struct net_device_stats *stats = &priv->stats; |
@@ -814,8 +820,8 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | |||
814 | 820 | ||
815 | rxfid = hermes_read_regn(hw, RXFID); | 821 | rxfid = hermes_read_regn(hw, RXFID); |
816 | 822 | ||
817 | err = hermes_bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), | 823 | err = hw->ops->bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), |
818 | rxfid, 0); | 824 | rxfid, 0); |
819 | if (err) { | 825 | if (err) { |
820 | printk(KERN_ERR "%s: error %d reading Rx descriptor. " | 826 | printk(KERN_ERR "%s: error %d reading Rx descriptor. " |
821 | "Frame dropped.\n", dev->name, err); | 827 | "Frame dropped.\n", dev->name, err); |
@@ -882,9 +888,9 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | |||
882 | nothing is removed. 2 is for aligning the IP header. */ | 888 | nothing is removed. 2 is for aligning the IP header. */ |
883 | skb_reserve(skb, ETH_HLEN + 2); | 889 | skb_reserve(skb, ETH_HLEN + 2); |
884 | 890 | ||
885 | err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length), | 891 | err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, length), |
886 | ALIGN(length, 2), rxfid, | 892 | ALIGN(length, 2), rxfid, |
887 | HERMES_802_2_OFFSET); | 893 | HERMES_802_2_OFFSET); |
888 | if (err) { | 894 | if (err) { |
889 | printk(KERN_ERR "%s: error %d reading frame. " | 895 | printk(KERN_ERR "%s: error %d reading frame. " |
890 | "Frame dropped.\n", dev->name, err); | 896 | "Frame dropped.\n", dev->name, err); |
@@ -913,6 +919,7 @@ update_stats: | |||
913 | out: | 919 | out: |
914 | kfree(desc); | 920 | kfree(desc); |
915 | } | 921 | } |
922 | EXPORT_SYMBOL(__orinoco_ev_rx); | ||
916 | 923 | ||
917 | static void orinoco_rx(struct net_device *dev, | 924 | static void orinoco_rx(struct net_device *dev, |
918 | struct hermes_rx_descriptor *desc, | 925 | struct hermes_rx_descriptor *desc, |
@@ -1145,9 +1152,9 @@ static void orinoco_join_ap(struct work_struct *work) | |||
1145 | goto out; | 1152 | goto out; |
1146 | 1153 | ||
1147 | /* Read scan results from the firmware */ | 1154 | /* Read scan results from the firmware */ |
1148 | err = hermes_read_ltv(hw, USER_BAP, | 1155 | err = hw->ops->read_ltv(hw, USER_BAP, |
1149 | HERMES_RID_SCANRESULTSTABLE, | 1156 | HERMES_RID_SCANRESULTSTABLE, |
1150 | MAX_SCAN_LEN, &len, buf); | 1157 | MAX_SCAN_LEN, &len, buf); |
1151 | if (err) { | 1158 | if (err) { |
1152 | printk(KERN_ERR "%s: Cannot read scan results\n", | 1159 | printk(KERN_ERR "%s: Cannot read scan results\n", |
1153 | dev->name); | 1160 | dev->name); |
@@ -1194,8 +1201,8 @@ static void orinoco_send_bssid_wevent(struct orinoco_private *priv) | |||
1194 | union iwreq_data wrqu; | 1201 | union iwreq_data wrqu; |
1195 | int err; | 1202 | int err; |
1196 | 1203 | ||
1197 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, | 1204 | err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, |
1198 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); | 1205 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); |
1199 | if (err != 0) | 1206 | if (err != 0) |
1200 | return; | 1207 | return; |
1201 | 1208 | ||
@@ -1217,8 +1224,8 @@ static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv) | |||
1217 | if (!priv->has_wpa) | 1224 | if (!priv->has_wpa) |
1218 | return; | 1225 | return; |
1219 | 1226 | ||
1220 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, | 1227 | err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, |
1221 | sizeof(buf), NULL, &buf); | 1228 | sizeof(buf), NULL, &buf); |
1222 | if (err != 0) | 1229 | if (err != 0) |
1223 | return; | 1230 | return; |
1224 | 1231 | ||
@@ -1247,8 +1254,9 @@ static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv) | |||
1247 | if (!priv->has_wpa) | 1254 | if (!priv->has_wpa) |
1248 | return; | 1255 | return; |
1249 | 1256 | ||
1250 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_RESP_INFO, | 1257 | err = hw->ops->read_ltv(hw, USER_BAP, |
1251 | sizeof(buf), NULL, &buf); | 1258 | HERMES_RID_CURRENT_ASSOC_RESP_INFO, |
1259 | sizeof(buf), NULL, &buf); | ||
1252 | if (err != 0) | 1260 | if (err != 0) |
1253 | return; | 1261 | return; |
1254 | 1262 | ||
@@ -1353,7 +1361,7 @@ static void orinoco_process_scan_results(struct work_struct *work) | |||
1353 | spin_unlock_irqrestore(&priv->scan_lock, flags); | 1361 | spin_unlock_irqrestore(&priv->scan_lock, flags); |
1354 | } | 1362 | } |
1355 | 1363 | ||
1356 | static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | 1364 | void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) |
1357 | { | 1365 | { |
1358 | struct orinoco_private *priv = ndev_priv(dev); | 1366 | struct orinoco_private *priv = ndev_priv(dev); |
1359 | u16 infofid; | 1367 | u16 infofid; |
@@ -1371,8 +1379,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1371 | infofid = hermes_read_regn(hw, INFOFID); | 1379 | infofid = hermes_read_regn(hw, INFOFID); |
1372 | 1380 | ||
1373 | /* Read the info frame header - don't try too hard */ | 1381 | /* Read the info frame header - don't try too hard */ |
1374 | err = hermes_bap_pread(hw, IRQ_BAP, &info, sizeof(info), | 1382 | err = hw->ops->bap_pread(hw, IRQ_BAP, &info, sizeof(info), |
1375 | infofid, 0); | 1383 | infofid, 0); |
1376 | if (err) { | 1384 | if (err) { |
1377 | printk(KERN_ERR "%s: error %d reading info frame. " | 1385 | printk(KERN_ERR "%s: error %d reading info frame. " |
1378 | "Frame dropped.\n", dev->name, err); | 1386 | "Frame dropped.\n", dev->name, err); |
@@ -1393,8 +1401,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1393 | len = sizeof(tallies); | 1401 | len = sizeof(tallies); |
1394 | } | 1402 | } |
1395 | 1403 | ||
1396 | err = hermes_bap_pread(hw, IRQ_BAP, &tallies, len, | 1404 | err = hw->ops->bap_pread(hw, IRQ_BAP, &tallies, len, |
1397 | infofid, sizeof(info)); | 1405 | infofid, sizeof(info)); |
1398 | if (err) | 1406 | if (err) |
1399 | break; | 1407 | break; |
1400 | 1408 | ||
@@ -1429,8 +1437,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1429 | break; | 1437 | break; |
1430 | } | 1438 | } |
1431 | 1439 | ||
1432 | err = hermes_bap_pread(hw, IRQ_BAP, &linkstatus, len, | 1440 | err = hw->ops->bap_pread(hw, IRQ_BAP, &linkstatus, len, |
1433 | infofid, sizeof(info)); | 1441 | infofid, sizeof(info)); |
1434 | if (err) | 1442 | if (err) |
1435 | break; | 1443 | break; |
1436 | newstatus = le16_to_cpu(linkstatus.linkstatus); | 1444 | newstatus = le16_to_cpu(linkstatus.linkstatus); |
@@ -1494,8 +1502,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1494 | } | 1502 | } |
1495 | 1503 | ||
1496 | /* Read scan data */ | 1504 | /* Read scan data */ |
1497 | err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len, | 1505 | err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) buf, len, |
1498 | infofid, sizeof(info)); | 1506 | infofid, sizeof(info)); |
1499 | if (err) { | 1507 | if (err) { |
1500 | kfree(buf); | 1508 | kfree(buf); |
1501 | qabort_scan(priv); | 1509 | qabort_scan(priv); |
@@ -1547,8 +1555,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1547 | break; | 1555 | break; |
1548 | 1556 | ||
1549 | /* Read scan data */ | 1557 | /* Read scan data */ |
1550 | err = hermes_bap_pread(hw, IRQ_BAP, (void *) bss, len, | 1558 | err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) bss, len, |
1551 | infofid, sizeof(info)); | 1559 | infofid, sizeof(info)); |
1552 | if (err) | 1560 | if (err) |
1553 | kfree(bss); | 1561 | kfree(bss); |
1554 | else | 1562 | else |
@@ -1571,6 +1579,7 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1571 | 1579 | ||
1572 | return; | 1580 | return; |
1573 | } | 1581 | } |
1582 | EXPORT_SYMBOL(__orinoco_ev_info); | ||
1574 | 1583 | ||
1575 | static void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw) | 1584 | static void __orinoco_ev_infdrop(struct net_device *dev, hermes_t *hw) |
1576 | { | 1585 | { |
@@ -1647,7 +1656,7 @@ static int orinoco_reinit_firmware(struct orinoco_private *priv) | |||
1647 | struct hermes *hw = &priv->hw; | 1656 | struct hermes *hw = &priv->hw; |
1648 | int err; | 1657 | int err; |
1649 | 1658 | ||
1650 | err = hermes_init(hw); | 1659 | err = hw->ops->init(hw); |
1651 | if (priv->do_fw_download && !err) { | 1660 | if (priv->do_fw_download && !err) { |
1652 | err = orinoco_download(priv); | 1661 | err = orinoco_download(priv); |
1653 | if (err) | 1662 | if (err) |
@@ -1735,7 +1744,7 @@ void orinoco_reset(struct work_struct *work) | |||
1735 | } | 1744 | } |
1736 | 1745 | ||
1737 | /* This has to be called from user context */ | 1746 | /* This has to be called from user context */ |
1738 | spin_lock_irq(&priv->lock); | 1747 | orinoco_lock_irq(priv); |
1739 | 1748 | ||
1740 | priv->hw_unavailable--; | 1749 | priv->hw_unavailable--; |
1741 | 1750 | ||
@@ -1750,7 +1759,7 @@ void orinoco_reset(struct work_struct *work) | |||
1750 | dev->trans_start = jiffies; | 1759 | dev->trans_start = jiffies; |
1751 | } | 1760 | } |
1752 | 1761 | ||
1753 | spin_unlock_irq(&priv->lock); | 1762 | orinoco_unlock_irq(priv); |
1754 | 1763 | ||
1755 | return; | 1764 | return; |
1756 | disable: | 1765 | disable: |
@@ -1984,7 +1993,7 @@ int orinoco_init(struct orinoco_private *priv) | |||
1984 | priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; | 1993 | priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; |
1985 | 1994 | ||
1986 | /* Initialize the firmware */ | 1995 | /* Initialize the firmware */ |
1987 | err = hermes_init(hw); | 1996 | err = hw->ops->init(hw); |
1988 | if (err != 0) { | 1997 | if (err != 0) { |
1989 | dev_err(dev, "Failed to initialize firmware (err = %d)\n", | 1998 | dev_err(dev, "Failed to initialize firmware (err = %d)\n", |
1990 | err); | 1999 | err); |
@@ -2067,9 +2076,9 @@ int orinoco_init(struct orinoco_private *priv) | |||
2067 | 2076 | ||
2068 | /* Make the hardware available, as long as it hasn't been | 2077 | /* Make the hardware available, as long as it hasn't been |
2069 | * removed elsewhere (e.g. by PCMCIA hot unplug) */ | 2078 | * removed elsewhere (e.g. by PCMCIA hot unplug) */ |
2070 | spin_lock_irq(&priv->lock); | 2079 | orinoco_lock_irq(priv); |
2071 | priv->hw_unavailable--; | 2080 | priv->hw_unavailable--; |
2072 | spin_unlock_irq(&priv->lock); | 2081 | orinoco_unlock_irq(priv); |
2073 | 2082 | ||
2074 | dev_dbg(dev, "Ready\n"); | 2083 | dev_dbg(dev, "Ready\n"); |
2075 | 2084 | ||
@@ -2192,7 +2201,8 @@ EXPORT_SYMBOL(alloc_orinocodev); | |||
2192 | */ | 2201 | */ |
2193 | int orinoco_if_add(struct orinoco_private *priv, | 2202 | int orinoco_if_add(struct orinoco_private *priv, |
2194 | unsigned long base_addr, | 2203 | unsigned long base_addr, |
2195 | unsigned int irq) | 2204 | unsigned int irq, |
2205 | const struct net_device_ops *ops) | ||
2196 | { | 2206 | { |
2197 | struct wiphy *wiphy = priv_to_wiphy(priv); | 2207 | struct wiphy *wiphy = priv_to_wiphy(priv); |
2198 | struct wireless_dev *wdev; | 2208 | struct wireless_dev *wdev; |
@@ -2211,12 +2221,17 @@ int orinoco_if_add(struct orinoco_private *priv, | |||
2211 | 2221 | ||
2212 | /* Setup / override net_device fields */ | 2222 | /* Setup / override net_device fields */ |
2213 | dev->ieee80211_ptr = wdev; | 2223 | dev->ieee80211_ptr = wdev; |
2214 | dev->netdev_ops = &orinoco_netdev_ops; | ||
2215 | dev->watchdog_timeo = HZ; /* 1 second timeout */ | 2224 | dev->watchdog_timeo = HZ; /* 1 second timeout */ |
2216 | dev->wireless_handlers = &orinoco_handler_def; | 2225 | dev->wireless_handlers = &orinoco_handler_def; |
2217 | #ifdef WIRELESS_SPY | 2226 | #ifdef WIRELESS_SPY |
2218 | dev->wireless_data = &priv->wireless_data; | 2227 | dev->wireless_data = &priv->wireless_data; |
2219 | #endif | 2228 | #endif |
2229 | /* Default to standard ops if not set */ | ||
2230 | if (ops) | ||
2231 | dev->netdev_ops = ops; | ||
2232 | else | ||
2233 | dev->netdev_ops = &orinoco_netdev_ops; | ||
2234 | |||
2220 | /* we use the default eth_mac_addr for setting the MAC addr */ | 2235 | /* we use the default eth_mac_addr for setting the MAC addr */ |
2221 | 2236 | ||
2222 | /* Reserve space in skb for the SNAP header */ | 2237 | /* Reserve space in skb for the SNAP header */ |
@@ -2305,7 +2320,7 @@ int orinoco_up(struct orinoco_private *priv) | |||
2305 | unsigned long flags; | 2320 | unsigned long flags; |
2306 | int err; | 2321 | int err; |
2307 | 2322 | ||
2308 | spin_lock_irqsave(&priv->lock, flags); | 2323 | priv->hw.ops->lock_irqsave(&priv->lock, &flags); |
2309 | 2324 | ||
2310 | err = orinoco_reinit_firmware(priv); | 2325 | err = orinoco_reinit_firmware(priv); |
2311 | if (err) { | 2326 | if (err) { |
@@ -2325,7 +2340,7 @@ int orinoco_up(struct orinoco_private *priv) | |||
2325 | } | 2340 | } |
2326 | 2341 | ||
2327 | exit: | 2342 | exit: |
2328 | spin_unlock_irqrestore(&priv->lock, flags); | 2343 | priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); |
2329 | 2344 | ||
2330 | return 0; | 2345 | return 0; |
2331 | } | 2346 | } |
@@ -2337,7 +2352,7 @@ void orinoco_down(struct orinoco_private *priv) | |||
2337 | unsigned long flags; | 2352 | unsigned long flags; |
2338 | int err; | 2353 | int err; |
2339 | 2354 | ||
2340 | spin_lock_irqsave(&priv->lock, flags); | 2355 | priv->hw.ops->lock_irqsave(&priv->lock, &flags); |
2341 | err = __orinoco_down(priv); | 2356 | err = __orinoco_down(priv); |
2342 | if (err) | 2357 | if (err) |
2343 | printk(KERN_WARNING "%s: Error %d downing interface\n", | 2358 | printk(KERN_WARNING "%s: Error %d downing interface\n", |
@@ -2345,7 +2360,7 @@ void orinoco_down(struct orinoco_private *priv) | |||
2345 | 2360 | ||
2346 | netif_device_detach(dev); | 2361 | netif_device_detach(dev); |
2347 | priv->hw_unavailable++; | 2362 | priv->hw_unavailable++; |
2348 | spin_unlock_irqrestore(&priv->lock, flags); | 2363 | priv->hw.ops->unlock_irqrestore(&priv->lock, &flags); |
2349 | } | 2364 | } |
2350 | EXPORT_SYMBOL(orinoco_down); | 2365 | EXPORT_SYMBOL(orinoco_down); |
2351 | 2366 | ||