diff options
author | David Kilroy <kilroyd@googlemail.com> | 2010-05-01 09:05:38 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-05-03 14:53:06 -0400 |
commit | b42f2074dedef559ecf72dce61a6501f9f9b273a (patch) | |
tree | d75bfd6c7e6db6fd5e81310b3326d2aad5829041 /drivers/net/wireless/orinoco/main.c | |
parent | f7c65594f7148b778f41d591a701e94bb22428e4 (diff) |
orinoco: add hermes_ops
Pave the way for introducing USB alternative functions.
Force callers to dereference ops instead of providing wrappers.
Signed-off-by: David Kilroy <kilroyd@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/orinoco/main.c')
-rw-r--r-- | drivers/net/wireless/orinoco/main.c | 83 |
1 files changed, 42 insertions, 41 deletions
diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index b42634c614b5..d90951f731ef 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c | |||
@@ -399,8 +399,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
399 | memset(&desc, 0, sizeof(desc)); | 399 | memset(&desc, 0, sizeof(desc)); |
400 | 400 | ||
401 | *txcntl = cpu_to_le16(tx_control); | 401 | *txcntl = cpu_to_le16(tx_control); |
402 | err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), | 402 | err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), |
403 | txfid, 0); | 403 | txfid, 0); |
404 | if (err) { | 404 | if (err) { |
405 | if (net_ratelimit()) | 405 | if (net_ratelimit()) |
406 | printk(KERN_ERR "%s: Error %d writing Tx " | 406 | printk(KERN_ERR "%s: Error %d writing Tx " |
@@ -413,8 +413,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
413 | memset(&desc, 0, sizeof(desc)); | 413 | memset(&desc, 0, sizeof(desc)); |
414 | 414 | ||
415 | desc.tx_control = cpu_to_le16(tx_control); | 415 | desc.tx_control = cpu_to_le16(tx_control); |
416 | err = hermes_bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), | 416 | err = hw->ops->bap_pwrite(hw, USER_BAP, &desc, sizeof(desc), |
417 | txfid, 0); | 417 | txfid, 0); |
418 | if (err) { | 418 | if (err) { |
419 | if (net_ratelimit()) | 419 | if (net_ratelimit()) |
420 | printk(KERN_ERR "%s: Error %d writing Tx " | 420 | printk(KERN_ERR "%s: Error %d writing Tx " |
@@ -457,8 +457,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
457 | memcpy(eh, &hdr, sizeof(hdr)); | 457 | memcpy(eh, &hdr, sizeof(hdr)); |
458 | } | 458 | } |
459 | 459 | ||
460 | err = hermes_bap_pwrite(hw, USER_BAP, skb->data, skb->len, | 460 | err = hw->ops->bap_pwrite(hw, USER_BAP, skb->data, skb->len, |
461 | txfid, HERMES_802_3_OFFSET); | 461 | txfid, HERMES_802_3_OFFSET); |
462 | if (err) { | 462 | if (err) { |
463 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", | 463 | printk(KERN_ERR "%s: Error %d writing packet to BAP\n", |
464 | dev->name, err); | 464 | dev->name, err); |
@@ -489,8 +489,8 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
489 | skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); | 489 | skb->data + ETH_HLEN, skb->len - ETH_HLEN, mic); |
490 | 490 | ||
491 | /* Write the MIC */ | 491 | /* Write the MIC */ |
492 | err = hermes_bap_pwrite(hw, USER_BAP, &mic_buf[0], len, | 492 | err = hw->ops->bap_pwrite(hw, USER_BAP, &mic_buf[0], len, |
493 | txfid, HERMES_802_3_OFFSET + offset); | 493 | txfid, HERMES_802_3_OFFSET + offset); |
494 | if (err) { | 494 | if (err) { |
495 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", | 495 | printk(KERN_ERR "%s: Error %d writing MIC to BAP\n", |
496 | dev->name, err); | 496 | dev->name, err); |
@@ -501,7 +501,7 @@ static netdev_tx_t orinoco_xmit(struct sk_buff *skb, struct net_device *dev) | |||
501 | /* Finally, we actually initiate the send */ | 501 | /* Finally, we actually initiate the send */ |
502 | netif_stop_queue(dev); | 502 | netif_stop_queue(dev); |
503 | 503 | ||
504 | err = hermes_docmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, | 504 | err = hw->ops->cmd_wait(hw, HERMES_CMD_TX | HERMES_CMD_RECL, |
505 | txfid, NULL); | 505 | txfid, NULL); |
506 | if (err) { | 506 | if (err) { |
507 | netif_start_queue(dev); | 507 | netif_start_queue(dev); |
@@ -571,9 +571,9 @@ static void __orinoco_ev_txexc(struct net_device *dev, hermes_t *hw) | |||
571 | return; /* Nothing's really happened */ | 571 | return; /* Nothing's really happened */ |
572 | 572 | ||
573 | /* Read part of the frame header - we need status and addr1 */ | 573 | /* Read part of the frame header - we need status and addr1 */ |
574 | err = hermes_bap_pread(hw, IRQ_BAP, &hdr, | 574 | err = hw->ops->bap_pread(hw, IRQ_BAP, &hdr, |
575 | sizeof(struct hermes_txexc_data), | 575 | sizeof(struct hermes_txexc_data), |
576 | fid, 0); | 576 | fid, 0); |
577 | 577 | ||
578 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); | 578 | hermes_write_regn(hw, TXCOMPLFID, DUMMY_FID); |
579 | stats->tx_errors++; | 579 | stats->tx_errors++; |
@@ -763,9 +763,9 @@ static void orinoco_rx_monitor(struct net_device *dev, u16 rxfid, | |||
763 | 763 | ||
764 | /* If any, copy the data from the card to the skb */ | 764 | /* If any, copy the data from the card to the skb */ |
765 | if (datalen > 0) { | 765 | if (datalen > 0) { |
766 | err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), | 766 | err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, datalen), |
767 | ALIGN(datalen, 2), rxfid, | 767 | ALIGN(datalen, 2), rxfid, |
768 | HERMES_802_2_OFFSET); | 768 | HERMES_802_2_OFFSET); |
769 | if (err) { | 769 | if (err) { |
770 | printk(KERN_ERR "%s: error %d reading monitor frame\n", | 770 | printk(KERN_ERR "%s: error %d reading monitor frame\n", |
771 | dev->name, err); | 771 | dev->name, err); |
@@ -813,8 +813,8 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | |||
813 | 813 | ||
814 | rxfid = hermes_read_regn(hw, RXFID); | 814 | rxfid = hermes_read_regn(hw, RXFID); |
815 | 815 | ||
816 | err = hermes_bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), | 816 | err = hw->ops->bap_pread(hw, IRQ_BAP, desc, sizeof(*desc), |
817 | rxfid, 0); | 817 | rxfid, 0); |
818 | if (err) { | 818 | if (err) { |
819 | printk(KERN_ERR "%s: error %d reading Rx descriptor. " | 819 | printk(KERN_ERR "%s: error %d reading Rx descriptor. " |
820 | "Frame dropped.\n", dev->name, err); | 820 | "Frame dropped.\n", dev->name, err); |
@@ -881,9 +881,9 @@ static void __orinoco_ev_rx(struct net_device *dev, hermes_t *hw) | |||
881 | nothing is removed. 2 is for aligning the IP header. */ | 881 | nothing is removed. 2 is for aligning the IP header. */ |
882 | skb_reserve(skb, ETH_HLEN + 2); | 882 | skb_reserve(skb, ETH_HLEN + 2); |
883 | 883 | ||
884 | err = hermes_bap_pread(hw, IRQ_BAP, skb_put(skb, length), | 884 | err = hw->ops->bap_pread(hw, IRQ_BAP, skb_put(skb, length), |
885 | ALIGN(length, 2), rxfid, | 885 | ALIGN(length, 2), rxfid, |
886 | HERMES_802_2_OFFSET); | 886 | HERMES_802_2_OFFSET); |
887 | if (err) { | 887 | if (err) { |
888 | printk(KERN_ERR "%s: error %d reading frame. " | 888 | printk(KERN_ERR "%s: error %d reading frame. " |
889 | "Frame dropped.\n", dev->name, err); | 889 | "Frame dropped.\n", dev->name, err); |
@@ -1144,9 +1144,9 @@ static void orinoco_join_ap(struct work_struct *work) | |||
1144 | goto out; | 1144 | goto out; |
1145 | 1145 | ||
1146 | /* Read scan results from the firmware */ | 1146 | /* Read scan results from the firmware */ |
1147 | err = hermes_read_ltv(hw, USER_BAP, | 1147 | err = hw->ops->read_ltv(hw, USER_BAP, |
1148 | HERMES_RID_SCANRESULTSTABLE, | 1148 | HERMES_RID_SCANRESULTSTABLE, |
1149 | MAX_SCAN_LEN, &len, buf); | 1149 | MAX_SCAN_LEN, &len, buf); |
1150 | if (err) { | 1150 | if (err) { |
1151 | printk(KERN_ERR "%s: Cannot read scan results\n", | 1151 | printk(KERN_ERR "%s: Cannot read scan results\n", |
1152 | dev->name); | 1152 | dev->name); |
@@ -1193,8 +1193,8 @@ static void orinoco_send_bssid_wevent(struct orinoco_private *priv) | |||
1193 | union iwreq_data wrqu; | 1193 | union iwreq_data wrqu; |
1194 | int err; | 1194 | int err; |
1195 | 1195 | ||
1196 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, | 1196 | err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENTBSSID, |
1197 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); | 1197 | ETH_ALEN, NULL, wrqu.ap_addr.sa_data); |
1198 | if (err != 0) | 1198 | if (err != 0) |
1199 | return; | 1199 | return; |
1200 | 1200 | ||
@@ -1216,8 +1216,8 @@ static void orinoco_send_assocreqie_wevent(struct orinoco_private *priv) | |||
1216 | if (!priv->has_wpa) | 1216 | if (!priv->has_wpa) |
1217 | return; | 1217 | return; |
1218 | 1218 | ||
1219 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, | 1219 | err = hw->ops->read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_REQ_INFO, |
1220 | sizeof(buf), NULL, &buf); | 1220 | sizeof(buf), NULL, &buf); |
1221 | if (err != 0) | 1221 | if (err != 0) |
1222 | return; | 1222 | return; |
1223 | 1223 | ||
@@ -1246,8 +1246,9 @@ static void orinoco_send_assocrespie_wevent(struct orinoco_private *priv) | |||
1246 | if (!priv->has_wpa) | 1246 | if (!priv->has_wpa) |
1247 | return; | 1247 | return; |
1248 | 1248 | ||
1249 | err = hermes_read_ltv(hw, USER_BAP, HERMES_RID_CURRENT_ASSOC_RESP_INFO, | 1249 | err = hw->ops->read_ltv(hw, USER_BAP, |
1250 | sizeof(buf), NULL, &buf); | 1250 | HERMES_RID_CURRENT_ASSOC_RESP_INFO, |
1251 | sizeof(buf), NULL, &buf); | ||
1251 | if (err != 0) | 1252 | if (err != 0) |
1252 | return; | 1253 | return; |
1253 | 1254 | ||
@@ -1370,8 +1371,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1370 | infofid = hermes_read_regn(hw, INFOFID); | 1371 | infofid = hermes_read_regn(hw, INFOFID); |
1371 | 1372 | ||
1372 | /* Read the info frame header - don't try too hard */ | 1373 | /* Read the info frame header - don't try too hard */ |
1373 | err = hermes_bap_pread(hw, IRQ_BAP, &info, sizeof(info), | 1374 | err = hw->ops->bap_pread(hw, IRQ_BAP, &info, sizeof(info), |
1374 | infofid, 0); | 1375 | infofid, 0); |
1375 | if (err) { | 1376 | if (err) { |
1376 | printk(KERN_ERR "%s: error %d reading info frame. " | 1377 | printk(KERN_ERR "%s: error %d reading info frame. " |
1377 | "Frame dropped.\n", dev->name, err); | 1378 | "Frame dropped.\n", dev->name, err); |
@@ -1392,8 +1393,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1392 | len = sizeof(tallies); | 1393 | len = sizeof(tallies); |
1393 | } | 1394 | } |
1394 | 1395 | ||
1395 | err = hermes_bap_pread(hw, IRQ_BAP, &tallies, len, | 1396 | err = hw->ops->bap_pread(hw, IRQ_BAP, &tallies, len, |
1396 | infofid, sizeof(info)); | 1397 | infofid, sizeof(info)); |
1397 | if (err) | 1398 | if (err) |
1398 | break; | 1399 | break; |
1399 | 1400 | ||
@@ -1428,8 +1429,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1428 | break; | 1429 | break; |
1429 | } | 1430 | } |
1430 | 1431 | ||
1431 | err = hermes_bap_pread(hw, IRQ_BAP, &linkstatus, len, | 1432 | err = hw->ops->bap_pread(hw, IRQ_BAP, &linkstatus, len, |
1432 | infofid, sizeof(info)); | 1433 | infofid, sizeof(info)); |
1433 | if (err) | 1434 | if (err) |
1434 | break; | 1435 | break; |
1435 | newstatus = le16_to_cpu(linkstatus.linkstatus); | 1436 | newstatus = le16_to_cpu(linkstatus.linkstatus); |
@@ -1493,8 +1494,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1493 | } | 1494 | } |
1494 | 1495 | ||
1495 | /* Read scan data */ | 1496 | /* Read scan data */ |
1496 | err = hermes_bap_pread(hw, IRQ_BAP, (void *) buf, len, | 1497 | err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) buf, len, |
1497 | infofid, sizeof(info)); | 1498 | infofid, sizeof(info)); |
1498 | if (err) { | 1499 | if (err) { |
1499 | kfree(buf); | 1500 | kfree(buf); |
1500 | qabort_scan(priv); | 1501 | qabort_scan(priv); |
@@ -1546,8 +1547,8 @@ static void __orinoco_ev_info(struct net_device *dev, hermes_t *hw) | |||
1546 | break; | 1547 | break; |
1547 | 1548 | ||
1548 | /* Read scan data */ | 1549 | /* Read scan data */ |
1549 | err = hermes_bap_pread(hw, IRQ_BAP, (void *) bss, len, | 1550 | err = hw->ops->bap_pread(hw, IRQ_BAP, (void *) bss, len, |
1550 | infofid, sizeof(info)); | 1551 | infofid, sizeof(info)); |
1551 | if (err) | 1552 | if (err) |
1552 | kfree(bss); | 1553 | kfree(bss); |
1553 | else | 1554 | else |
@@ -1646,7 +1647,7 @@ static int orinoco_reinit_firmware(struct orinoco_private *priv) | |||
1646 | struct hermes *hw = &priv->hw; | 1647 | struct hermes *hw = &priv->hw; |
1647 | int err; | 1648 | int err; |
1648 | 1649 | ||
1649 | err = hermes_init(hw); | 1650 | err = hw->ops->init(hw); |
1650 | if (priv->do_fw_download && !err) { | 1651 | if (priv->do_fw_download && !err) { |
1651 | err = orinoco_download(priv); | 1652 | err = orinoco_download(priv); |
1652 | if (err) | 1653 | if (err) |
@@ -1983,7 +1984,7 @@ int orinoco_init(struct orinoco_private *priv) | |||
1983 | priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; | 1984 | priv->nicbuf_size = IEEE80211_MAX_FRAME_LEN + ETH_HLEN; |
1984 | 1985 | ||
1985 | /* Initialize the firmware */ | 1986 | /* Initialize the firmware */ |
1986 | err = hermes_init(hw); | 1987 | err = hw->ops->init(hw); |
1987 | if (err != 0) { | 1988 | if (err != 0) { |
1988 | dev_err(dev, "Failed to initialize firmware (err = %d)\n", | 1989 | dev_err(dev, "Failed to initialize firmware (err = %d)\n", |
1989 | err); | 1990 | err); |