diff options
author | Holger Schurig <hs4233@mail.mn-solutions.de> | 2007-08-02 11:53:36 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:49:53 -0400 |
commit | 6b63cd0f420c3c3002024da6c9eff252a3772021 (patch) | |
tree | 87df4e20432a393b9137952a4ad6aa0cc63163b5 /drivers/net/wireless/libertas/cmdresp.c | |
parent | ece561919326236c7fb791a5e883f0eb76af029e (diff) |
[PATCH] libertas: remove a hundred CMD_RET_xxx definitions
types.h contains the same amount of CMD_RET_xxx and CMD_xxx definitions.
They contains the same info: the firmware command opcode and, when the
firmware sends back a result, the command opcode ORed with 0x8000.
Having the same data twice in the source code is redundant and can lead to
errors (e.g. if you update or delete only one instance). This patch removed
all CMD_RET_xxx definitions and introduces a simple CMD_RET() macro.
Signed-off-by: Holger Schurig <hs4233@mail.mn-solutions.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/libertas/cmdresp.c')
-rw-r--r-- | drivers/net/wireless/libertas/cmdresp.c | 101 |
1 files changed, 51 insertions, 50 deletions
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c index 6166bbc0528e..ae11e1f2739f 100644 --- a/drivers/net/wireless/libertas/cmdresp.c +++ b/drivers/net/wireless/libertas/cmdresp.c | |||
@@ -124,7 +124,7 @@ static int wlan_ret_reg_access(wlan_private * priv, | |||
124 | lbs_deb_enter(LBS_DEB_CMD); | 124 | lbs_deb_enter(LBS_DEB_CMD); |
125 | 125 | ||
126 | switch (type) { | 126 | switch (type) { |
127 | case CMD_RET_MAC_REG_ACCESS: | 127 | case CMD_RET(CMD_MAC_REG_ACCESS): |
128 | { | 128 | { |
129 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; | 129 | struct cmd_ds_mac_reg_access *reg = &resp->params.macreg; |
130 | 130 | ||
@@ -133,7 +133,7 @@ static int wlan_ret_reg_access(wlan_private * priv, | |||
133 | break; | 133 | break; |
134 | } | 134 | } |
135 | 135 | ||
136 | case CMD_RET_BBP_REG_ACCESS: | 136 | case CMD_RET(CMD_BBP_REG_ACCESS): |
137 | { | 137 | { |
138 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; | 138 | struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg; |
139 | 139 | ||
@@ -142,7 +142,7 @@ static int wlan_ret_reg_access(wlan_private * priv, | |||
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | 144 | ||
145 | case CMD_RET_RF_REG_ACCESS: | 145 | case CMD_RET(CMD_RF_REG_ACCESS): |
146 | { | 146 | { |
147 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; | 147 | struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg; |
148 | 148 | ||
@@ -560,134 +560,135 @@ static inline int handle_cmd_response(u16 respcmd, | |||
560 | wlan_adapter *adapter = priv->adapter; | 560 | wlan_adapter *adapter = priv->adapter; |
561 | 561 | ||
562 | switch (respcmd) { | 562 | switch (respcmd) { |
563 | case CMD_RET_MAC_REG_ACCESS: | 563 | case CMD_RET(CMD_MAC_REG_ACCESS): |
564 | case CMD_RET_BBP_REG_ACCESS: | 564 | case CMD_RET(CMD_BBP_REG_ACCESS): |
565 | case CMD_RET_RF_REG_ACCESS: | 565 | case CMD_RET(CMD_RF_REG_ACCESS): |
566 | ret = wlan_ret_reg_access(priv, respcmd, resp); | 566 | ret = wlan_ret_reg_access(priv, respcmd, resp); |
567 | break; | 567 | break; |
568 | 568 | ||
569 | case CMD_RET_HW_SPEC_INFO: | 569 | case CMD_RET(CMD_GET_HW_SPEC): |
570 | ret = wlan_ret_get_hw_spec(priv, resp); | 570 | ret = wlan_ret_get_hw_spec(priv, resp); |
571 | break; | 571 | break; |
572 | 572 | ||
573 | case CMD_RET_802_11_SCAN: | 573 | case CMD_RET(CMD_802_11_SCAN): |
574 | ret = libertas_ret_80211_scan(priv, resp); | 574 | ret = libertas_ret_80211_scan(priv, resp); |
575 | break; | 575 | break; |
576 | 576 | ||
577 | case CMD_RET_802_11_GET_LOG: | 577 | case CMD_RET(CMD_802_11_GET_LOG): |
578 | ret = wlan_ret_get_log(priv, resp); | 578 | ret = wlan_ret_get_log(priv, resp); |
579 | break; | 579 | break; |
580 | 580 | ||
581 | case CMD_RET_802_11_ASSOCIATE: | 581 | case CMD_RET_802_11_ASSOCIATE: |
582 | case CMD_RET_802_11_REASSOCIATE: | 582 | case CMD_RET(CMD_802_11_ASSOCIATE): |
583 | case CMD_RET(CMD_802_11_REASSOCIATE): | ||
583 | ret = libertas_ret_80211_associate(priv, resp); | 584 | ret = libertas_ret_80211_associate(priv, resp); |
584 | break; | 585 | break; |
585 | 586 | ||
586 | case CMD_RET_802_11_DISASSOCIATE: | 587 | case CMD_RET(CMD_802_11_DISASSOCIATE): |
587 | case CMD_RET_802_11_DEAUTHENTICATE: | 588 | case CMD_RET(CMD_802_11_DEAUTHENTICATE): |
588 | ret = libertas_ret_80211_disassociate(priv, resp); | 589 | ret = libertas_ret_80211_disassociate(priv, resp); |
589 | break; | 590 | break; |
590 | 591 | ||
591 | case CMD_RET_802_11_AD_HOC_START: | 592 | case CMD_RET(CMD_802_11_AD_HOC_START): |
592 | case CMD_RET_802_11_AD_HOC_JOIN: | 593 | case CMD_RET(CMD_802_11_AD_HOC_JOIN): |
593 | ret = libertas_ret_80211_ad_hoc_start(priv, resp); | 594 | ret = libertas_ret_80211_ad_hoc_start(priv, resp); |
594 | break; | 595 | break; |
595 | 596 | ||
596 | case CMD_RET_802_11_STAT: | 597 | case CMD_RET(CMD_802_11_GET_STAT): |
597 | ret = wlan_ret_802_11_stat(priv, resp); | 598 | ret = wlan_ret_802_11_stat(priv, resp); |
598 | break; | 599 | break; |
599 | 600 | ||
600 | case CMD_RET_802_11_SNMP_MIB: | 601 | case CMD_RET(CMD_802_11_SNMP_MIB): |
601 | ret = wlan_ret_802_11_snmp_mib(priv, resp); | 602 | ret = wlan_ret_802_11_snmp_mib(priv, resp); |
602 | break; | 603 | break; |
603 | 604 | ||
604 | case CMD_RET_802_11_RF_TX_POWER: | 605 | case CMD_RET(CMD_802_11_RF_TX_POWER): |
605 | ret = wlan_ret_802_11_rf_tx_power(priv, resp); | 606 | ret = wlan_ret_802_11_rf_tx_power(priv, resp); |
606 | break; | 607 | break; |
607 | 608 | ||
608 | case CMD_RET_802_11_SET_AFC: | 609 | case CMD_RET(CMD_802_11_SET_AFC): |
609 | case CMD_RET_802_11_GET_AFC: | 610 | case CMD_RET(CMD_802_11_GET_AFC): |
610 | spin_lock_irqsave(&adapter->driver_lock, flags); | 611 | spin_lock_irqsave(&adapter->driver_lock, flags); |
611 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, | 612 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.afc, |
612 | sizeof(struct cmd_ds_802_11_afc)); | 613 | sizeof(struct cmd_ds_802_11_afc)); |
613 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 614 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
614 | 615 | ||
615 | break; | 616 | break; |
616 | case CMD_RET_802_11_RF_ANTENNA: | 617 | case CMD_RET(CMD_802_11_RF_ANTENNA): |
617 | ret = wlan_ret_802_11_rf_antenna(priv, resp); | 618 | ret = wlan_ret_802_11_rf_antenna(priv, resp); |
618 | break; | 619 | break; |
619 | 620 | ||
620 | case CMD_RET_MAC_MULTICAST_ADR: | 621 | case CMD_RET(CMD_MAC_MULTICAST_ADR): |
621 | case CMD_RET_MAC_CONTROL: | 622 | case CMD_RET(CMD_MAC_CONTROL): |
622 | case CMD_RET_802_11_SET_WEP: | 623 | case CMD_RET(CMD_802_11_SET_WEP): |
623 | case CMD_RET_802_11_RESET: | 624 | case CMD_RET(CMD_802_11_RESET): |
624 | case CMD_RET_802_11_AUTHENTICATE: | 625 | case CMD_RET(CMD_802_11_AUTHENTICATE): |
625 | case CMD_RET_802_11_RADIO_CONTROL: | 626 | case CMD_RET(CMD_802_11_RADIO_CONTROL): |
626 | case CMD_RET_802_11_BEACON_STOP: | 627 | case CMD_RET(CMD_802_11_BEACON_STOP): |
627 | break; | 628 | break; |
628 | 629 | ||
629 | case CMD_RET_802_11_ENABLE_RSN: | 630 | case CMD_RET(CMD_802_11_ENABLE_RSN): |
630 | ret = libertas_ret_802_11_enable_rsn(priv, resp); | 631 | ret = libertas_ret_802_11_enable_rsn(priv, resp); |
631 | break; | 632 | break; |
632 | 633 | ||
633 | case CMD_RET_802_11_DATA_RATE: | 634 | case CMD_RET(CMD_802_11_DATA_RATE): |
634 | ret = wlan_ret_802_11_data_rate(priv, resp); | 635 | ret = wlan_ret_802_11_data_rate(priv, resp); |
635 | break; | 636 | break; |
636 | case CMD_RET_802_11_RATE_ADAPT_RATESET: | 637 | case CMD_RET(CMD_802_11_RATE_ADAPT_RATESET): |
637 | ret = wlan_ret_802_11_rate_adapt_rateset(priv, resp); | 638 | ret = wlan_ret_802_11_rate_adapt_rateset(priv, resp); |
638 | break; | 639 | break; |
639 | case CMD_RET_802_11_RF_CHANNEL: | 640 | case CMD_RET(CMD_802_11_RF_CHANNEL): |
640 | ret = wlan_ret_802_11_rf_channel(priv, resp); | 641 | ret = wlan_ret_802_11_rf_channel(priv, resp); |
641 | break; | 642 | break; |
642 | 643 | ||
643 | case CMD_RET_802_11_RSSI: | 644 | case CMD_RET(CMD_802_11_RSSI): |
644 | ret = wlan_ret_802_11_rssi(priv, resp); | 645 | ret = wlan_ret_802_11_rssi(priv, resp); |
645 | break; | 646 | break; |
646 | 647 | ||
647 | case CMD_RET_802_11_MAC_ADDRESS: | 648 | case CMD_RET(CMD_802_11_MAC_ADDRESS): |
648 | ret = wlan_ret_802_11_mac_address(priv, resp); | 649 | ret = wlan_ret_802_11_mac_address(priv, resp); |
649 | break; | 650 | break; |
650 | 651 | ||
651 | case CMD_RET_802_11_AD_HOC_STOP: | 652 | case CMD_RET(CMD_802_11_AD_HOC_STOP): |
652 | ret = libertas_ret_80211_ad_hoc_stop(priv, resp); | 653 | ret = libertas_ret_80211_ad_hoc_stop(priv, resp); |
653 | break; | 654 | break; |
654 | 655 | ||
655 | case CMD_RET_802_11_KEY_MATERIAL: | 656 | case CMD_RET(CMD_802_11_KEY_MATERIAL): |
656 | lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n"); | 657 | lbs_deb_cmd("CMD_RESP: KEY_MATERIAL command response\n"); |
657 | ret = wlan_ret_802_11_key_material(priv, resp); | 658 | ret = wlan_ret_802_11_key_material(priv, resp); |
658 | break; | 659 | break; |
659 | 660 | ||
660 | case CMD_RET_802_11_EEPROM_ACCESS: | 661 | case CMD_RET(CMD_802_11_EEPROM_ACCESS): |
661 | ret = wlan_ret_802_11_eeprom_access(priv, resp); | 662 | ret = wlan_ret_802_11_eeprom_access(priv, resp); |
662 | break; | 663 | break; |
663 | 664 | ||
664 | case CMD_RET_802_11D_DOMAIN_INFO: | 665 | case CMD_RET(CMD_802_11D_DOMAIN_INFO): |
665 | ret = libertas_ret_802_11d_domain_info(priv, resp); | 666 | ret = libertas_ret_802_11d_domain_info(priv, resp); |
666 | break; | 667 | break; |
667 | 668 | ||
668 | case CMD_RET_802_11_SLEEP_PARAMS: | 669 | case CMD_RET(CMD_802_11_SLEEP_PARAMS): |
669 | ret = wlan_ret_802_11_sleep_params(priv, resp); | 670 | ret = wlan_ret_802_11_sleep_params(priv, resp); |
670 | break; | 671 | break; |
671 | case CMD_RET_802_11_INACTIVITY_TIMEOUT: | 672 | case CMD_RET(CMD_802_11_INACTIVITY_TIMEOUT): |
672 | spin_lock_irqsave(&adapter->driver_lock, flags); | 673 | spin_lock_irqsave(&adapter->driver_lock, flags); |
673 | *((u16 *) adapter->cur_cmd->pdata_buf) = | 674 | *((u16 *) adapter->cur_cmd->pdata_buf) = |
674 | le16_to_cpu(resp->params.inactivity_timeout.timeout); | 675 | le16_to_cpu(resp->params.inactivity_timeout.timeout); |
675 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 676 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
676 | break; | 677 | break; |
677 | 678 | ||
678 | case CMD_RET_802_11_TPC_CFG: | 679 | case CMD_RET(CMD_802_11_TPC_CFG): |
679 | spin_lock_irqsave(&adapter->driver_lock, flags); | 680 | spin_lock_irqsave(&adapter->driver_lock, flags); |
680 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, | 681 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.tpccfg, |
681 | sizeof(struct cmd_ds_802_11_tpc_cfg)); | 682 | sizeof(struct cmd_ds_802_11_tpc_cfg)); |
682 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 683 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
683 | break; | 684 | break; |
684 | case CMD_RET_802_11_LED_GPIO_CTRL: | 685 | case CMD_RET(CMD_802_11_LED_GPIO_CTRL): |
685 | spin_lock_irqsave(&adapter->driver_lock, flags); | 686 | spin_lock_irqsave(&adapter->driver_lock, flags); |
686 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, | 687 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.ledgpio, |
687 | sizeof(struct cmd_ds_802_11_led_ctrl)); | 688 | sizeof(struct cmd_ds_802_11_led_ctrl)); |
688 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 689 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
689 | break; | 690 | break; |
690 | case CMD_RET_802_11_PWR_CFG: | 691 | case CMD_RET(CMD_802_11_PWR_CFG): |
691 | spin_lock_irqsave(&adapter->driver_lock, flags); | 692 | spin_lock_irqsave(&adapter->driver_lock, flags); |
692 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, | 693 | memmove(adapter->cur_cmd->pdata_buf, &resp->params.pwrcfg, |
693 | sizeof(struct cmd_ds_802_11_pwr_cfg)); | 694 | sizeof(struct cmd_ds_802_11_pwr_cfg)); |
@@ -695,32 +696,32 @@ static inline int handle_cmd_response(u16 respcmd, | |||
695 | 696 | ||
696 | break; | 697 | break; |
697 | 698 | ||
698 | case CMD_RET_GET_TSF: | 699 | case CMD_RET(CMD_GET_TSF): |
699 | spin_lock_irqsave(&adapter->driver_lock, flags); | 700 | spin_lock_irqsave(&adapter->driver_lock, flags); |
700 | memcpy(priv->adapter->cur_cmd->pdata_buf, | 701 | memcpy(priv->adapter->cur_cmd->pdata_buf, |
701 | &resp->params.gettsf.tsfvalue, sizeof(u64)); | 702 | &resp->params.gettsf.tsfvalue, sizeof(u64)); |
702 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 703 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
703 | break; | 704 | break; |
704 | case CMD_RET_BT_ACCESS: | 705 | case CMD_RET(CMD_BT_ACCESS): |
705 | spin_lock_irqsave(&adapter->driver_lock, flags); | 706 | spin_lock_irqsave(&adapter->driver_lock, flags); |
706 | if (adapter->cur_cmd->pdata_buf) | 707 | if (adapter->cur_cmd->pdata_buf) |
707 | memcpy(adapter->cur_cmd->pdata_buf, | 708 | memcpy(adapter->cur_cmd->pdata_buf, |
708 | &resp->params.bt.addr1, 2 * ETH_ALEN); | 709 | &resp->params.bt.addr1, 2 * ETH_ALEN); |
709 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 710 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
710 | break; | 711 | break; |
711 | case CMD_RET_FWT_ACCESS: | 712 | case CMD_RET(CMD_FWT_ACCESS): |
712 | spin_lock_irqsave(&adapter->driver_lock, flags); | 713 | spin_lock_irqsave(&adapter->driver_lock, flags); |
713 | if (adapter->cur_cmd->pdata_buf) | 714 | if (adapter->cur_cmd->pdata_buf) |
714 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, | 715 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.fwt, |
715 | sizeof(resp->params.fwt)); | 716 | sizeof(resp->params.fwt)); |
716 | spin_unlock_irqrestore(&adapter->driver_lock, flags); | 717 | spin_unlock_irqrestore(&adapter->driver_lock, flags); |
717 | break; | 718 | break; |
718 | case CMD_RET_MESH_ACCESS: | 719 | case CMD_RET(CMD_MESH_ACCESS): |
719 | if (adapter->cur_cmd->pdata_buf) | 720 | if (adapter->cur_cmd->pdata_buf) |
720 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, | 721 | memcpy(adapter->cur_cmd->pdata_buf, &resp->params.mesh, |
721 | sizeof(resp->params.mesh)); | 722 | sizeof(resp->params.mesh)); |
722 | break; | 723 | break; |
723 | case CMD_RTE_802_11_TX_RATE_QUERY: | 724 | case CMD_RET(CMD_802_11_TX_RATE_QUERY): |
724 | priv->adapter->txrate = resp->params.txrate.txrate; | 725 | priv->adapter->txrate = resp->params.txrate.txrate; |
725 | break; | 726 | break; |
726 | default: | 727 | default: |
@@ -782,7 +783,7 @@ int libertas_process_rx_command(wlan_private * priv) | |||
782 | /* Store the response code to cur_cmd_retcode. */ | 783 | /* Store the response code to cur_cmd_retcode. */ |
783 | adapter->cur_cmd_retcode = result;; | 784 | adapter->cur_cmd_retcode = result;; |
784 | 785 | ||
785 | if (respcmd == CMD_RET_802_11_PS_MODE) { | 786 | if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) { |
786 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; | 787 | struct cmd_ds_802_11_ps_mode *psmode = &resp->params.psmode; |
787 | u16 action = le16_to_cpu(psmode->action); | 788 | u16 action = le16_to_cpu(psmode->action); |
788 | 789 | ||
@@ -852,8 +853,8 @@ int libertas_process_rx_command(wlan_private * priv) | |||
852 | * Handling errors here | 853 | * Handling errors here |
853 | */ | 854 | */ |
854 | switch (respcmd) { | 855 | switch (respcmd) { |
855 | case CMD_RET_HW_SPEC_INFO: | 856 | case CMD_RET(CMD_GET_HW_SPEC): |
856 | case CMD_RET_802_11_RESET: | 857 | case CMD_RET(CMD_802_11_RESET): |
857 | lbs_deb_cmd("CMD_RESP: Reset command failed\n"); | 858 | lbs_deb_cmd("CMD_RESP: Reset command failed\n"); |
858 | break; | 859 | break; |
859 | 860 | ||