aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorHolger Schurig <hs4233@mail.mn-solutions.de>2007-05-25 12:17:06 -0400
committerJohn W. Linville <linville@tuxdriver.com>2007-06-11 14:28:39 -0400
commit208fdd2f447899164bd139452c291b155e53cee9 (patch)
treec65f6dd5ad6846ea7179ece65594033a8dca9731 /drivers/net/wireless
parent0583e8ef149700ede2aa181509e217c39e565f28 (diff)
[PATCH] libertas: indirect all hardware access via hw_XXXX functions
This functions makes all libertas_sbi_XXX functions static to the if_usb.c file and renames them to if_usb_XXXX(). The get called from other places of the source code via priv->hw_XXXX(). 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')
-rw-r--r--drivers/net/wireless/libertas/cmd.c5
-rw-r--r--drivers/net/wireless/libertas/cmdresp.c1
-rw-r--r--drivers/net/wireless/libertas/decl.h5
-rw-r--r--drivers/net/wireless/libertas/defs.h7
-rw-r--r--drivers/net/wireless/libertas/dev.h8
-rw-r--r--drivers/net/wireless/libertas/ethtool.c2
-rw-r--r--drivers/net/wireless/libertas/fw.c3
-rw-r--r--drivers/net/wireless/libertas/if_usb.c32
-rw-r--r--drivers/net/wireless/libertas/main.c15
-rw-r--r--drivers/net/wireless/libertas/sbi.h30
-rw-r--r--drivers/net/wireless/libertas/tx.c11
11 files changed, 57 insertions, 62 deletions
diff --git a/drivers/net/wireless/libertas/cmd.c b/drivers/net/wireless/libertas/cmd.c
index c1d9902cac5d..899b115f4c14 100644
--- a/drivers/net/wireless/libertas/cmd.c
+++ b/drivers/net/wireless/libertas/cmd.c
@@ -6,7 +6,6 @@
6#include <net/iw_handler.h> 6#include <net/iw_handler.h>
7#include "host.h" 7#include "host.h"
8#include "hostcmd.h" 8#include "hostcmd.h"
9#include "sbi.h"
10#include "decl.h" 9#include "decl.h"
11#include "defs.h" 10#include "defs.h"
12#include "dev.h" 11#include "dev.h"
@@ -1014,7 +1013,7 @@ static int DownloadcommandToStation(wlan_private * priv,
1014 cmdnode->cmdwaitqwoken = 0; 1013 cmdnode->cmdwaitqwoken = 0;
1015 cmdsize = cpu_to_le16(cmdsize); 1014 cmdsize = cpu_to_le16(cmdsize);
1016 1015
1017 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize); 1016 ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) cmdptr, cmdsize);
1018 1017
1019 if (ret != 0) { 1018 if (ret != 0) {
1020 lbs_deb_cmd("DNLD_CMD: Host to Card failed\n"); 1019 lbs_deb_cmd("DNLD_CMD: Host to Card failed\n");
@@ -1841,7 +1840,7 @@ static int sendconfirmsleep(wlan_private * priv, u8 * cmdptr, u16 size)
1841 1840
1842 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size); 1841 lbs_dbg_hex("SEND_SLEEPC_CMD: Sleep confirm command", cmdptr, size);
1843 1842
1844 ret = libertas_sbi_host_to_card(priv, MVMS_CMD, cmdptr, size); 1843 ret = priv->hw_host_to_card(priv, MVMS_CMD, cmdptr, size);
1845 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED; 1844 priv->wlan_dev.dnld_sent = DNLD_RES_RECEIVED;
1846 1845
1847 spin_lock_irqsave(&adapter->driver_lock, flags); 1846 spin_lock_irqsave(&adapter->driver_lock, flags);
diff --git a/drivers/net/wireless/libertas/cmdresp.c b/drivers/net/wireless/libertas/cmdresp.c
index c8fce7bf6682..1efdc4beb7f0 100644
--- a/drivers/net/wireless/libertas/cmdresp.c
+++ b/drivers/net/wireless/libertas/cmdresp.c
@@ -9,7 +9,6 @@
9#include <net/iw_handler.h> 9#include <net/iw_handler.h>
10 10
11#include "host.h" 11#include "host.h"
12#include "sbi.h"
13#include "decl.h" 12#include "decl.h"
14#include "defs.h" 13#include "defs.h"
15#include "dev.h" 14#include "dev.h"
diff --git a/drivers/net/wireless/libertas/decl.h b/drivers/net/wireless/libertas/decl.h
index 96d22b1f25d8..4967005adfef 100644
--- a/drivers/net/wireless/libertas/decl.h
+++ b/drivers/net/wireless/libertas/decl.h
@@ -82,4 +82,9 @@ int wlan_remove_card(wlan_private *priv);
82int wlan_add_mesh(wlan_private *priv); 82int wlan_add_mesh(wlan_private *priv);
83void wlan_remove_mesh(wlan_private *priv); 83void wlan_remove_mesh(wlan_private *priv);
84 84
85/* preliminary here */
86int if_usb_register(void);
87void if_usb_unregister(void);
88
89
85#endif /* _WLAN_DECL_H_ */ 90#endif /* _WLAN_DECL_H_ */
diff --git a/drivers/net/wireless/libertas/defs.h b/drivers/net/wireless/libertas/defs.h
index 7e8e7ac21786..c081813410fd 100644
--- a/drivers/net/wireless/libertas/defs.h
+++ b/drivers/net/wireless/libertas/defs.h
@@ -155,6 +155,13 @@ static inline void lbs_dbg_hex(char *prompt, u8 * buf, int len)
155#define MRVDRV_MAX_BEACON_INTERVAL 1000 155#define MRVDRV_MAX_BEACON_INTERVAL 1000
156#define MRVDRV_BEACON_INTERVAL 100 156#define MRVDRV_BEACON_INTERVAL 100
157 157
158/** INT status Bit Definition*/
159#define his_cmddnldrdy 0x01
160#define his_cardevent 0x02
161#define his_cmdupldrdy 0x04
162
163#define SBI_EVENT_CAUSE_SHIFT 3
164
158/** TxPD status */ 165/** TxPD status */
159 166
160/* Station firmware use TxPD status field to report final Tx transmit 167/* Station firmware use TxPD status field to report final Tx transmit
diff --git a/drivers/net/wireless/libertas/dev.h b/drivers/net/wireless/libertas/dev.h
index d7673c91f480..32e2077617bb 100644
--- a/drivers/net/wireless/libertas/dev.h
+++ b/drivers/net/wireless/libertas/dev.h
@@ -162,6 +162,14 @@ struct _wlan_private {
162 162
163 struct delayed_work assoc_work; 163 struct delayed_work assoc_work;
164 struct workqueue_struct *assoc_thread; 164 struct workqueue_struct *assoc_thread;
165
166 /** Hardware access */
167 int (*hw_register_dev) (wlan_private * priv);
168 int (*hw_unregister_dev) (wlan_private *);
169 int (*hw_prog_firmware) (wlan_private *);
170 int (*hw_host_to_card) (wlan_private * priv, u8 type, u8 * payload, u16 nb);
171 int (*hw_get_int_status) (wlan_private * priv, u8 *);
172 int (*hw_read_event_cause) (wlan_private *);
165}; 173};
166 174
167/** Association request 175/** Association request
diff --git a/drivers/net/wireless/libertas/ethtool.c b/drivers/net/wireless/libertas/ethtool.c
index c3a26fce02ca..2be1815e2878 100644
--- a/drivers/net/wireless/libertas/ethtool.c
+++ b/drivers/net/wireless/libertas/ethtool.c
@@ -1,10 +1,8 @@
1
2#include <linux/netdevice.h> 1#include <linux/netdevice.h>
3#include <linux/ethtool.h> 2#include <linux/ethtool.h>
4#include <linux/delay.h> 3#include <linux/delay.h>
5 4
6#include "host.h" 5#include "host.h"
7#include "sbi.h"
8#include "decl.h" 6#include "decl.h"
9#include "defs.h" 7#include "defs.h"
10#include "dev.h" 8#include "dev.h"
diff --git a/drivers/net/wireless/libertas/fw.c b/drivers/net/wireless/libertas/fw.c
index 2c965b5341d4..dc3d48aefd68 100644
--- a/drivers/net/wireless/libertas/fw.c
+++ b/drivers/net/wireless/libertas/fw.c
@@ -5,7 +5,6 @@
5#include <linux/firmware.h> 5#include <linux/firmware.h>
6 6
7#include "host.h" 7#include "host.h"
8#include "sbi.h"
9#include "defs.h" 8#include "defs.h"
10#include "decl.h" 9#include "decl.h"
11#include "dev.h" 10#include "dev.h"
@@ -89,7 +88,7 @@ static int wlan_setup_station_hw(wlan_private * priv)
89 goto done; 88 goto done;
90 } 89 }
91 90
92 ret = libertas_sbi_prog_firmware(priv); 91 ret = priv->hw_prog_firmware(priv);
93 92
94 release_firmware(priv->firmware); 93 release_firmware(priv->firmware);
95 94
diff --git a/drivers/net/wireless/libertas/if_usb.c b/drivers/net/wireless/libertas/if_usb.c
index d4db8e668e78..5b0e0f76f404 100644
--- a/drivers/net/wireless/libertas/if_usb.c
+++ b/drivers/net/wireless/libertas/if_usb.c
@@ -7,7 +7,6 @@
7#include <linux/usb.h> 7#include <linux/usb.h>
8 8
9#include "host.h" 9#include "host.h"
10#include "sbi.h"
11#include "decl.h" 10#include "decl.h"
12#include "defs.h" 11#include "defs.h"
13#include "dev.h" 12#include "dev.h"
@@ -33,6 +32,12 @@ MODULE_DEVICE_TABLE(usb, if_usb_table);
33static void if_usb_receive(struct urb *urb); 32static void if_usb_receive(struct urb *urb);
34static void if_usb_receive_fwload(struct urb *urb); 33static void if_usb_receive_fwload(struct urb *urb);
35static int reset_device(wlan_private *priv); 34static int reset_device(wlan_private *priv);
35static int if_usb_register_dev(wlan_private * priv);
36static int if_usb_unregister_dev(wlan_private *);
37static int if_usb_prog_firmware(wlan_private *);
38static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
39static int if_usb_get_int_status(wlan_private * priv, u8 *);
40static int if_usb_read_event_cause(wlan_private *);
36 41
37/** 42/**
38 * @brief call back function to handle the status of the URB 43 * @brief call back function to handle the status of the URB
@@ -192,7 +197,7 @@ static int if_usb_probe(struct usb_interface *intf,
192 197
193 /* At this point wlan_add_card() will be called. Don't worry 198 /* At this point wlan_add_card() will be called. Don't worry
194 * about keeping pwlanpriv around since it will be set on our 199 * about keeping pwlanpriv around since it will be set on our
195 * usb device data in -> add() -> libertas_sbi_register_dev(). 200 * usb device data in -> add() -> hw_register_dev() -> if_usb_register_dev.
196 */ 201 */
197 if (!(priv = wlan_add_card(usb_cardp))) 202 if (!(priv = wlan_add_card(usb_cardp)))
198 goto dealloc; 203 goto dealloc;
@@ -200,6 +205,13 @@ static int if_usb_probe(struct usb_interface *intf,
200 if (wlan_add_mesh(priv)) 205 if (wlan_add_mesh(priv))
201 goto err_add_mesh; 206 goto err_add_mesh;
202 207
208 priv->hw_register_dev = if_usb_register_dev;
209 priv->hw_unregister_dev = if_usb_unregister_dev;
210 priv->hw_prog_firmware = if_usb_prog_firmware;
211 priv->hw_host_to_card = if_usb_host_to_card;
212 priv->hw_get_int_status = if_usb_get_int_status;
213 priv->hw_read_event_cause = if_usb_read_event_cause;
214
203 if (libertas_activate_card(priv)) 215 if (libertas_activate_card(priv))
204 goto err_activate_card; 216 goto err_activate_card;
205 217
@@ -702,7 +714,7 @@ rx_exit:
702 * @param len number of bytes 714 * @param len number of bytes
703 * @return 0 or -1 715 * @return 0 or -1
704 */ 716 */
705int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb) 717static int if_usb_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb)
706{ 718{
707 int ret = -1; 719 int ret = -1;
708 u32 tmp; 720 u32 tmp;
@@ -733,7 +745,7 @@ int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb
733} 745}
734 746
735/* called with adapter->driver_lock held */ 747/* called with adapter->driver_lock held */
736int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg) 748static int if_usb_get_int_status(wlan_private * priv, u8 * ireg)
737{ 749{
738 struct usb_card_rec *cardp = priv->wlan_dev.card; 750 struct usb_card_rec *cardp = priv->wlan_dev.card;
739 751
@@ -745,7 +757,7 @@ int libertas_sbi_get_int_status(wlan_private * priv, u8 * ireg)
745 return 0; 757 return 0;
746} 758}
747 759
748int libertas_sbi_read_event_cause(wlan_private * priv) 760static int if_usb_read_event_cause(wlan_private * priv)
749{ 761{
750 struct usb_card_rec *cardp = priv->wlan_dev.card; 762 struct usb_card_rec *cardp = priv->wlan_dev.card;
751 priv->adapter->eventcause = cardp->usb_event_cause; 763 priv->adapter->eventcause = cardp->usb_event_cause;
@@ -767,7 +779,7 @@ static int reset_device(wlan_private *priv)
767 return ret; 779 return ret;
768} 780}
769 781
770int libertas_sbi_unregister_dev(wlan_private * priv) 782static int if_usb_unregister_dev(wlan_private * priv)
771{ 783{
772 int ret = 0; 784 int ret = 0;
773 785
@@ -787,7 +799,7 @@ int libertas_sbi_unregister_dev(wlan_private * priv)
787 * @param priv pointer to wlan_private 799 * @param priv pointer to wlan_private
788 * @return 0 or -1 800 * @return 0 or -1
789 */ 801 */
790int libertas_sbi_register_dev(wlan_private * priv) 802static int if_usb_register_dev(wlan_private * priv)
791{ 803{
792 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card; 804 struct usb_card_rec *cardp = (struct usb_card_rec *)priv->wlan_dev.card;
793 805
@@ -809,7 +821,7 @@ int libertas_sbi_register_dev(wlan_private * priv)
809 821
810 822
811 823
812int libertas_sbi_prog_firmware(wlan_private * priv) 824static int if_usb_prog_firmware(wlan_private * priv)
813{ 825{
814 struct usb_card_rec *cardp = priv->wlan_dev.card; 826 struct usb_card_rec *cardp = priv->wlan_dev.card;
815 int i = 0; 827 int i = 0;
@@ -959,7 +971,7 @@ static struct usb_driver if_usb_driver = {
959 * @param arg pointer to call back function parameter 971 * @param arg pointer to call back function parameter
960 * @return dummy success variable 972 * @return dummy success variable
961 */ 973 */
962int libertas_sbi_register(void) 974int if_usb_register(void)
963{ 975{
964 /* 976 /*
965 * API registers the Marvell USB driver 977 * API registers the Marvell USB driver
@@ -975,7 +987,7 @@ int libertas_sbi_register(void)
975 * @brief This function removes usb driver. 987 * @brief This function removes usb driver.
976 * @return N/A 988 * @return N/A
977 */ 989 */
978void libertas_sbi_unregister(void) 990void if_usb_unregister(void)
979{ 991{
980 int i; 992 int i;
981 993
diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c
index 5c58c50b430d..33294dd0eeec 100644
--- a/drivers/net/wireless/libertas/main.c
+++ b/drivers/net/wireless/libertas/main.c
@@ -15,7 +15,6 @@
15#include <net/ieee80211.h> 15#include <net/ieee80211.h>
16 16
17#include "host.h" 17#include "host.h"
18#include "sbi.h"
19#include "decl.h" 18#include "decl.h"
20#include "dev.h" 19#include "dev.h"
21#include "fw.h" 20#include "fw.h"
@@ -661,7 +660,7 @@ static int wlan_service_main_thread(void *data)
661 if (adapter->intcounter) { 660 if (adapter->intcounter) {
662 u8 int_status; 661 u8 int_status;
663 adapter->intcounter = 0; 662 adapter->intcounter = 0;
664 int_status = libertas_sbi_get_int_status(priv, &ireg); 663 int_status = priv->hw_get_int_status(priv, &ireg);
665 664
666 if (int_status) { 665 if (int_status) {
667 lbs_deb_thread( 666 lbs_deb_thread(
@@ -693,9 +692,9 @@ static int wlan_service_main_thread(void *data)
693 692
694 adapter->hisregcpy &= ~his_cardevent; 693 adapter->hisregcpy &= ~his_cardevent;
695 694
696 if (libertas_sbi_read_event_cause(priv)) { 695 if (priv->hw_read_event_cause(priv)) {
697 lbs_pr_alert( 696 lbs_pr_alert(
698 "main-thread: libertas_sbi_read_event_cause failed\n"); 697 "main-thread: hw_read_event_cause failed\n");
699 spin_unlock_irq(&adapter->driver_lock); 698 spin_unlock_irq(&adapter->driver_lock);
700 continue; 699 continue;
701 } 700 }
@@ -850,7 +849,7 @@ int libertas_activate_card(wlan_private *priv)
850 * relevant information from the card and request for the required 849 * relevant information from the card and request for the required
851 * IRQ. 850 * IRQ.
852 */ 851 */
853 if (libertas_sbi_register_dev(priv) < 0) { 852 if (priv->hw_register_dev(priv) < 0) {
854 lbs_pr_err("failed to register WLAN device\n"); 853 lbs_pr_err("failed to register WLAN device\n");
855 goto err_registerdev; 854 goto err_registerdev;
856 } 855 }
@@ -874,7 +873,7 @@ int libertas_activate_card(wlan_private *priv)
874 goto done; 873 goto done;
875 874
876err_init_fw: 875err_init_fw:
877 libertas_sbi_unregister_dev(priv); 876 priv->hw_unregister_dev(priv);
878err_registerdev: 877err_registerdev:
879 destroy_workqueue(priv->assoc_thread); 878 destroy_workqueue(priv->assoc_thread);
880 /* Stop the thread servicing the interrupts */ 879 /* Stop the thread servicing the interrupts */
@@ -1156,7 +1155,7 @@ static int wlan_init_module(void)
1156 1155
1157 libertas_debugfs_init(); 1156 libertas_debugfs_init();
1158 1157
1159 if (libertas_sbi_register()) { 1158 if (if_usb_register()) {
1160 ret = -1; 1159 ret = -1;
1161 libertas_debugfs_remove(); 1160 libertas_debugfs_remove();
1162 } 1161 }
@@ -1169,7 +1168,7 @@ static void wlan_cleanup_module(void)
1169{ 1168{
1170 lbs_deb_enter(LBS_DEB_MAIN); 1169 lbs_deb_enter(LBS_DEB_MAIN);
1171 1170
1172 libertas_sbi_unregister(); 1171 if_usb_unregister();
1173 libertas_debugfs_remove(); 1172 libertas_debugfs_remove();
1174 1173
1175 lbs_deb_leave(LBS_DEB_MAIN); 1174 lbs_deb_leave(LBS_DEB_MAIN);
diff --git a/drivers/net/wireless/libertas/sbi.h b/drivers/net/wireless/libertas/sbi.h
deleted file mode 100644
index d999078c3d1a..000000000000
--- a/drivers/net/wireless/libertas/sbi.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/**
2 * This file contains IF layer definitions.
3 */
4
5#ifndef _SBI_H_
6#define _SBI_H_
7
8#include <linux/interrupt.h>
9
10#include "defs.h"
11
12/** INT status Bit Definition*/
13#define his_cmddnldrdy 0x01
14#define his_cardevent 0x02
15#define his_cmdupldrdy 0x04
16
17#define SBI_EVENT_CAUSE_SHIFT 3
18
19/* Probe and Check if the card is present*/
20int libertas_sbi_register_dev(wlan_private * priv);
21int libertas_sbi_unregister_dev(wlan_private *);
22int libertas_sbi_get_int_status(wlan_private * priv, u8 *);
23int libertas_sbi_register(void);
24void libertas_sbi_unregister(void);
25int libertas_sbi_prog_firmware(wlan_private *);
26
27int libertas_sbi_read_event_cause(wlan_private *);
28int libertas_sbi_host_to_card(wlan_private * priv, u8 type, u8 * payload, u16 nb);
29
30#endif /* _SBI_H */
diff --git a/drivers/net/wireless/libertas/tx.c b/drivers/net/wireless/libertas/tx.c
index e61729f0645a..1993e8e79c45 100644
--- a/drivers/net/wireless/libertas/tx.c
+++ b/drivers/net/wireless/libertas/tx.c
@@ -5,7 +5,6 @@
5 5
6#include "hostcmd.h" 6#include "hostcmd.h"
7#include "radiotap.h" 7#include "radiotap.h"
8#include "sbi.h"
9#include "decl.h" 8#include "decl.h"
10#include "defs.h" 9#include "defs.h"
11#include "dev.h" 10#include "dev.h"
@@ -132,13 +131,13 @@ static int SendSinglePacket(wlan_private * priv, struct sk_buff *skb)
132 131
133 lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length); 132 lbs_dbg_hex("Tx Data", (u8 *) p802x_hdr, plocaltxpd->tx_packet_length);
134 memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length); 133 memcpy(ptr, p802x_hdr, plocaltxpd->tx_packet_length);
135 ret = libertas_sbi_host_to_card(priv, MVMS_DAT, 134 ret = priv->hw_host_to_card(priv, MVMS_DAT,
136 priv->adapter->tmptxbuf, 135 priv->adapter->tmptxbuf,
137 plocaltxpd->tx_packet_length + 136 plocaltxpd->tx_packet_length +
138 sizeof(struct txpd)); 137 sizeof(struct txpd));
139 138
140 if (ret) { 139 if (ret) {
141 lbs_deb_tx("tx err: libertas_sbi_host_to_card returned 0x%X\n", ret); 140 lbs_deb_tx("tx err: hw_host_to_card returned 0x%X\n", ret);
142 goto done; 141 goto done;
143 } 142 }
144 143