staging: add driver for KS7010 based SDIO WLAN cards
v2 cover staging: add driver for KS7010 based SDIO WLAN cards
This driver can be used with later Spectec SDW-821 and all SDW-823 cards. See patch 1 and TODO for more details about its origin. The series can also be found here:
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git staging/ks7010
It worked out of the box with a Renesas Salvator-X (H3).
Note: I needed this driver to verify SDIO capabilities for the new Renesas H3 SoC. The fact that the original KS7010 driver also comes from Renesas is a coincidence. It does not mean official support for this driver. Parts of this work were backed by the above mentioned SDIO verification task while other parts were my personal interest. Future patches and reviews will also done by me as a private person (unless something very surprising happens ;))
Changes since V1:
* rebased to v4.7-rc1. That means the needed fix for the mmc-core (88ea46bcbfd677b779897bbada32ec0709a6c92f) and the netdev trans_start helper (ba162f8eed61a7e71e26455ce1cff5b5898a3579) are now both upstream.
* squashed the README->TODO rename into patch 1
* included the trans_start fixup which was sent seperately before
* last 3 patches are new, even more cleanups
Please comment, review, apply...
Thanks,
Wolfram
Wolfram Sang (31):
staging: ks7010: add driver from Nanonote extra-repository
staging: ks7010: remove non-SDIO code and #ifdefs
staging: ks7010: remove custom firmware loader
staging: ks7010: remove checks for WIRELESS_EXT version
staging: ks7010: remove code for old kernel versions
staging: ks7010: avoid workqueue races
staging: ks7010: use long preamble as default
staging: ks7010: use kernel helper to print buffer
staging: ks7010: delete seperate debug header
staging: ks7010: really iterate over multicast addresses
staging: ks7010: make loading config file optional
staging: ks7010: fix printk format warnings
staging: ks7010: add example cfg file as a reference
staging: ks7010: remove unecessary typedef
staging: ks7010: indent eap_packet.h
staging: ks7010: indent ks7010_config.c
staging: ks7010: indent ks7010_sdio.h
staging: ks7010: indent ks_hostif.c
staging: ks7010: indent ks_hostif.h
staging: ks7010: indent ks_wlan.h
staging: ks7010: indent ks_wlan_ioctl.h
staging: ks7010: indent ks_wlan_net.c
staging: ks7010: indent michael_mic.c
staging: ks7010: indent michael_mic.h
staging: ks7010: indent ks7010_sdio.c
staging: ks7010: remove supported card table with one element
staging: ks7010: fix module annotations
staging: ks7010: adapt to new trans_start handling
staging: ks7010: simplify module_init/exit
staging: ks7010: drop counting sd errors
staging: ks7010: cleanup file headers
drivers/staging/Kconfig | 2 + drivers/staging/Makefile | 1 + drivers/staging/ks7010/Kconfig | 10 + drivers/staging/ks7010/Makefile | 5 + drivers/staging/ks7010/TODO | 37 + drivers/staging/ks7010/eap_packet.h | 129 ++ drivers/staging/ks7010/ks7010_config.c | 500 +++++ drivers/staging/ks7010/ks7010_sdio.c | 1234 +++++++++++ drivers/staging/ks7010/ks7010_sdio.h | 148 ++ drivers/staging/ks7010/ks79xx.cfg | 116 ++ drivers/staging/ks7010/ks_hostif.c | 2760 +++++++++++++++++++++++++ drivers/staging/ks7010/ks_hostif.h | 644 ++++++ drivers/staging/ks7010/ks_wlan.h | 503 +++++ drivers/staging/ks7010/ks_wlan_ioctl.h | 67 + drivers/staging/ks7010/ks_wlan_net.c | 3544 ++++++++++++++++++++++++++++++++ drivers/staging/ks7010/michael_mic.c | 139 ++ drivers/staging/ks7010/michael_mic.h | 26 + 17 files changed, 9865 insertions(+) create mode 100644 drivers/staging/ks7010/Kconfig create mode 100644 drivers/staging/ks7010/Makefile create mode 100644 drivers/staging/ks7010/TODO create mode 100644 drivers/staging/ks7010/eap_packet.h create mode 100644 drivers/staging/ks7010/ks7010_config.c create mode 100644 drivers/staging/ks7010/ks7010_sdio.c create mode 100644 drivers/staging/ks7010/ks7010_sdio.h create mode 100644 drivers/staging/ks7010/ks79xx.cfg create mode 100644 drivers/staging/ks7010/ks_hostif.c create mode 100644 drivers/staging/ks7010/ks_hostif.h create mode 100644 drivers/staging/ks7010/ks_wlan.h create mode 100644 drivers/staging/ks7010/ks_wlan_ioctl.h create mode 100644 drivers/staging/ks7010/ks_wlan_net.c create mode 100644 drivers/staging/ks7010/michael_mic.c create mode 100644 drivers/staging/ks7010/michael_mic.h
Signature · 1 line
2.8.1
PATCH v2 2/31 staging: ks7010: remove non-SDIO code and #ifdefs
From: Wolfram Sang <[email protected]>
I couldn't find any trace of code or even products using ks7010 with something else than SDIO. So, remove the conditionals.
--- drivers/staging/ks7010/Makefile | 2 +- drivers/staging/ks7010/ks7010_config.c | 6 --- drivers/staging/ks7010/ks_hostif.c | 70 ---------------------------------- drivers/staging/ks7010/ks_wlan.h | 10 ----- 4 files changed, 1 insertion(+), 87 deletions(-)
drivers/staging/ks7010/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_KS7010) += ks7010.o -ccflags-y += -D_SDIO_ -DKS_WLAN_DEBUG=0 +ccflags-y += -DKS_WLAN_DEBUG=0 ks7010-y := michael_mic.o ks_hostif.o ks_wlan_net.o ks_debug.o \ ks7010_sdio.o ks7010_config.o
drivers/staging/ks7010/ks7010_config.c +0 -6
@@ -268,13 +268,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv) priv->reg.rate_set.size =12 ;#ifndef NO_FIRMWARE_CLASS -#if (defined _PCMCIA_) - dev = &priv->ks_wlan_hw.pcmcia_dev->dev; -#elif (defined _PCI_) - dev = &priv->ks_wlan_hw.pci_dev->dev; -#elif (defined _SDIO_) dev = &priv->ks_wlan_hw.sdio_card->func->dev; -#endif if ((retval =request_firmware (&fw_entry, cfg_file, dev)) !=0 ){DPRINTK (1 ,"error request_firmware() file=%s ret=%d\n" , cfg_file, retval);return 1 ;
drivers/staging/ks7010/ks_hostif.c +0 -70
135 lines not on this page · raw message
drivers/staging/ks7010/ks_wlan.h +0 -10
@@ -62,17 +62,7 @@ typedef void irqreturn_t;#define pci_name (x) x->slot_name#endif -#if (defined _PCMCIA_) -#include "pcmcia/ks7010_pcmcia.h" -#elif (defined _PCI_) -#include "pci/ks7010_pci.h" -#elif (defined _SDIO_)#include "ks7010_sdio.h" -#elif (defined _SPI_) -#include "spi/ks7010_spi.h" -#else -#error not defined bus type ! -#endif struct ks_wlan_parameter {uint8_t operation_mode;/* Operation Mode */
Signature · 1 line
2.8.1
PATCH v2 3/31 staging: ks7010: remove custom firmware loader
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
FW_LOADER works fine, no need for a open coded fallback.
--- drivers/staging/ks7010/Kconfig | 1 + drivers/staging/ks7010/ks7010_config.c | 62 ---------------------------------- drivers/staging/ks7010/ks7010_sdio.c | 56 ------------------------------ drivers/staging/ks7010/ks7010_sdio.h | 5 --- 4 files changed, 1 insertion(+), 123 deletions(-)
drivers/staging/ks7010/Kconfig +1 -0
@@ -3,6 +3,7 @@ config KS7010 depends on MMC && WIRELESS select WIRELESS_EXT select WEXT_PRIV + select FW_LOADER help This is a driver for KeyStream KS7010 based SDIO WIFI cards. It is found on at least later Spectec SDW-821 (FCC-ID "S2Y-WLAN-11G-K" only,
drivers/staging/ks7010/ks7010_config.c +0 -62
97 lines not on this page · raw message
drivers/staging/ks7010/ks7010_sdio.c +0 -56
107 lines not on this page · raw message
drivers/staging/ks7010/ks7010_sdio.h +0 -5
@@ -153,13 +153,8 @@ struct rx_device{unsigned int qtail;/* rx buffer queue last pointer */ spinlock_t rx_dev_lock; }; -#ifndef NO_FIRMWARE_CLASS #define ROM_FILE "ks7010sd.rom"#define CFG_FILE "ks79xx.cfg" -#else -#define ROM_FILE "/lib/firmware/ks7010sd.rom" -#define CFG_FILE "/lib/firmware/ks79xx.cfg" -#endif #define KS_WLAN_DRIVER_VERSION_INFO "ks7010 sdio linux 007"#endif /* _KS7010_SDIO_H */
Signature · 1 line
2.8.1
PATCH v2 4/31 staging: ks7010: remove checks for WIRELESS_EXT version
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
We are by far newer than that anyhow.
--- drivers/staging/ks7010/ks_hostif.c | 23 ----------------------- drivers/staging/ks7010/ks_wlan_net.c | 14 -------------- 2 files changed, 37 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -23
@@ -22,12 +22,7 @@#include <linux/if_arp.h> /* Include Wireless Extension definition and check version */ -#ifndef WIRELESS_EXT -#include <linux/wireless.h> -#endif /* WIRELESS_EXT */ -#if WIRELESS_EXT >12 #include <net/iw_handler.h> /* New driver API */ -#endif /* WIRELESS_EXT > 12 */ extern int ks_wlan_hw_tx(ks_wlan_private *priv, void *p, unsigned long size, void (*complete_handler)(void *arg1, void *arg2),
@@ -121,10 +116,8 @@ staticint get_current_ap (ks_wlan_private *priv,struct link_ap_info_t *ap_info) {struct local_ap_t *ap; -#if WIRELESS_EXT >13 union iwreq_data wrqu;struct net_device *netdev=priv->net_dev; -#endif /* WIRELESS_EXT > 13 */ int rc=0 ;DPRINTK (3 ,"\n" );
@@ -190,7 +183,6 @@ int get_current_ap(ks_wlan_private *priv, struct link_ap_info_t *ap_info) ap->wpa_ie.size =0 ; } -#if WIRELESS_EXT >13 wrqu.data.length =0 ; wrqu.data.flags =0 ; wrqu.ap_addr.sa_family =ARPHRD_ETHER ;
@@ -203,7 +195,6 @@ int get_current_ap(ks_wlan_private *priv, struct link_ap_info_t *ap_info) (unsigned char)wrqu.ap_addr.sa_data[4],(unsigned char)wrqu.ap_addr.sa_data[5]);wireless_send_event (netdev,SIOCGIWAP , &wrqu,NULL ); } -#endif DPRINTK (4 ,"\n Link AP\n" ); DPRINTK(4," bssid=%02X:%02X:%02X:%02X:%02X:%02X\n \ essid=%s\n rate_set=%02X,%02X,%02X,%02X,%02X,%02X,%02X,%02X\n channel=%d\n \
@@ -338,9 +329,7 @@ void hostif_data_indication(ks_wlan_private *priv)struct ieee802_1x_hdr *aa1x_hdr;struct wpa_eapol_key *eap_key;struct michel_mic_t michel_mic; -#if WIRELESS_EXT >14 union iwreq_data wrqu; -#endif /* WIRELESS_EXT > 14 */ DPRINTK (3 ,"\n" );
@@ -412,7 +401,6 @@ void hostif_data_indication(ks_wlan_private *priv) mic_failure->counter =1 ; } priv->wpa.mic_failure.last_failure_time = now; -#if WIRELESS_EXT >14 /* needed parameters: count, keyid, key type, TSC */ sprintf(buf, "MLME-MICHAELMICFAILURE.indication(keyid=%d %scast addr=" "%02x:%02x:%02x:%02x:%02x:%02x)",
@@ -424,7 +412,6 @@ void hostif_data_indication(ks_wlan_private *priv) wrqu.data.length =strlen (buf);DPRINTK (4 ,"IWEVENT:MICHAELMICFAILURE\n" );wireless_send_event (priv->net_dev,IWEVCUSTOM , &wrqu, buf); -#endif /* WIRELESS_EXT > 14 */ return ; } }
@@ -754,9 +741,7 @@ void hostif_connect_indication(ks_wlan_private *priv)unsigned int tmp=0 ;unsigned int old_status=priv->connect_status;struct net_device *netdev=priv->net_dev; -#if WIRELESS_EXT >13 union iwreq_data wrqu0; -#endif /* WIRELESS_EXT > 13 */ connect_code =get_WORD (priv);switch (connect_code){
@@ -791,7 +776,6 @@ void hostif_connect_indication(ks_wlan_private *priv) }ks_wlan_do_power_save (priv); -#if WIRELESS_EXT >13 wrqu0.data.length =0 ; wrqu0.data.flags =0 ; wrqu0.ap_addr.sa_family =ARPHRD_ETHER ;
@@ -802,7 +786,6 @@ void hostif_connect_indication(ks_wlan_private *priv)DPRINTK (3 ,"disconnect :: scan_ind_count=%d\n" ,priv->scan_ind_count);wireless_send_event (netdev,SIOCGIWAP , &wrqu0,NULL ); } -#endif /* WIRELESS_EXT > 13 */ priv->scan_ind_count=0 ; }
@@ -904,7 +887,6 @@ void hostif_adhoc_set_confirm(ks_wlan_private *priv)static void hostif_associate_indication (ks_wlan_private *priv) { -#if WIRELESS_EXT >14 struct association_request_t *assoc_req;struct association_response_t *assoc_resp;unsigned char *pb;
@@ -944,29 +926,24 @@ void hostif_associate_indication(ks_wlan_private *priv)DPRINTK (3 ,"IWEVENT:ASSOCINFO\n" );wireless_send_event (priv->net_dev,IWEVCUSTOM , &wrqu, buf); -#endif /* WIRELESS_EXT > 14 */ }static void hostif_bss_scan_confirm (ks_wlan_private *priv) {unsigned int result_code; -#if WIRELESS_EXT >13 struct net_device *dev = priv->net_dev;union iwreq_data wrqu; -#endif /* WIRELESS_EXT > 13 */ result_code =get_DWORD (priv);DPRINTK (2 ,"result=%d :: scan_ind_count=%d\n" , result_code, priv->scan_ind_count); priv->sme_i.sme_flag &= ~SME_AP_SCAN ;hostif_sme_enqueue (priv,SME_BSS_SCAN_CONFIRM ); -#if WIRELESS_EXT >13 wrqu.data.length =0 ; wrqu.data.flags =0 ;DPRINTK (3 ,"IWEVENT: SCAN CONFIRM\n" );wireless_send_event (dev,SIOCGIWSCAN , &wrqu,NULL ); -#endif /* WIRELESS_EXT > 13 */ priv->scan_ind_count=0 ; }
drivers/staging/ks7010/ks_wlan_net.c +0 -14
@@ -50,7 +50,6 @@ static int wep_on_off;#define WIRELESS_SPY /* enable iwspy support */ #include <net/iw_handler.h> /* New driver API */ -#ifdef WIRELESS_EXT /* Frequency list (map channels to frequencies) */ static const long frequency_list[] = {2412 ,2417 ,2422 ,2427 ,2432 ,2437 ,2442 ,2447 ,2452 ,2457 ,2462 ,2467 ,2472 ,2484 };
@@ -74,7 +73,6 @@ static const struct iw_handler_def ks_wlan_handler_def;#define KSC_OPNOTSUPP /* Operation Not Support*/ -#endif /* WIRELESS_EXT */ /* * function prototypes
@@ -174,7 +172,6 @@ int ks_wlan_setup_parameter(ks_wlan_private *priv, unsigned int commit_flag)return 0 ; } -#ifdef WIRELESS_EXT /* * Initial Wireless Extension code for Ks_Wlannet driver by : * Jean Tourrilhes <[email protected]> - HPL - 17 November 00
@@ -1090,7 +1087,6 @@ static int ks_wlan_get_range(struct net_device *dev, struct iw_request_info *inf range->avg_qual.level =186 ;/* -70 dBm */ range->avg_qual.noise =0 ; -#if defined(WIRELESS_EXT )/* Event capability (kernel + driver) */ range->event_capa[0] = (IW_EVENT_CAPA_K_0 | IW_EVENT_CAPA_MASK(SIOCGIWAP) |
@@ -1104,7 +1100,6 @@ static int ks_wlan_get_range(struct net_device *dev, struct iw_request_info *infIW_ENC_CAPA_WPA2 |IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP); -#endif return 0 ; }
@@ -1229,7 +1224,6 @@ static int ks_wlan_get_aplist(struct net_device *dev, struct iw_request_info *inreturn 0 ; } -#if defined(WIRELESS_EXT )/*------------------------------------------------------------------*/ /* Wireless Handler : Initiate Scan */ static int ks_wlan_set_scan(struct net_device *dev, struct iw_request_info *info,
@@ -1452,7 +1446,6 @@ DPRINTK(2,"aplist 0\n");return 0 ; } -#endif /* WIRELESS_EXT */ /*------------------------------------------------------------------*/ /* Commit handler : called after a bunch of SET operations */
@@ -1469,7 +1462,6 @@ static int ks_wlan_config_commit(struct net_device *dev, struct iw_request_inforeturn 0 ; } -#ifdef WIRELESS_EXT /*------------------------------------------------------------------*/ /* Wireless handler : set association ie params */ static int ks_wlan_set_genie(struct net_device *dev, struct iw_request_info *info,
@@ -1951,7 +1943,6 @@ static int ks_wlan_set_mlme(struct net_device *dev, struct iw_request_info *inforeturn -EOPNOTSUPP ;/* Not Support */ } } -#endif /* WIRELESS_EXT */ /*------------------------------------------------------------------*/ /* Private handler : get driver version */
@@ -2915,20 +2906,15 @@ static const struct iw_handler_def ks_wlan_handler_def = .get_wireless_stats = ks_get_wireless_stats, }; -#endif /* WIRELESS_EXT */ static int ks_wlan_netdev_ioctl (struct net_device *dev,struct ifreq *rq,int cmd) {int rc =0 ; -#if defined(WIRELESS_EXT )struct iwreq *wrq = (struct iwreq *) rq; -#endif /* WIRELESS_EXT */ switch (cmd) { -#if defined(WIRELESS_EXT )case SIOCIWFIRSTPRIV +20 :/* KS_WLAN_SET_STOP_REQ */ rc =ks_wlan_set_stop_request (dev,NULL , &(wrq->u.mode),NULL );break ; -#endif /* WIRELESS_EXT >17 */ // All other calls are currently unsupported default : rc = -EOPNOTSUPP ;
Signature · 1 line
2.8.1
PATCH v2 5/31 staging: ks7010: remove code for old kernel versions
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
No need to be backwards compatible.
--- drivers/staging/ks7010/ks_hostif.c | 9 --------- drivers/staging/ks7010/ks_wlan.h | 28 +--------------------------- drivers/staging/ks7010/ks_wlan_net.c | 3 --- 3 files changed, 1 insertion(+), 39 deletions(-)
drivers/staging/ks7010/ks_hostif.c +0 -9
@@ -2103,11 +2103,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)struct net_device *dev = priv->net_dev;int mc_count; -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,35 )struct netdev_hw_addr *ha; -#else -struct dev_mc_list *mclist; -#endif char set_address[NIC_MAX_MCAST_LIST *ETH_ALEN ];unsigned long filter_type;int i;
@@ -2131,14 +2127,9 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)else {if (priv->sme_i.sme_flag &SME_MULTICAST ){ mc_count =netdev_mc_count (dev); -#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,6 ,35 )netdev_for_each_mc_addr (ha, dev) {memcpy (&set_address[i*ETH_ALEN ], ha->addr,ETH_ALEN ); } -#else -for (i =0 , mclist = dev->mc_list; mclist && i < mc_count; i++, mclist = mclist->next) -memcpy (&set_address[i*ETH_ALEN ], mclist->dmi_addr,ETH_ALEN ); -#endif priv->sme_i.sme_flag &= ~SME_MULTICAST ;hostif_mib_set_request (priv,LOCAL_MULTICAST_ADDRESS , (ETH_ALEN *mc_count),MIB_VALUE_TYPE_OSTRING , &set_address[0 ]);
drivers/staging/ks7010/ks_wlan.h +1 -27
@@ -18,9 +18,6 @@#define WPS #include <linux/version.h> -#if (LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,24 )) -#include <linux/config.h> -#endif #include <linux/interrupt.h> #include <linux/kernel.h> #include <linux/module.h>
@@ -35,32 +32,9 @@#include <linux/timer.h> /* struct timer_list */ #include <linux/string.h> #include <linux/completion.h> /* struct completion */ - -#include <asm/io.h> - -/* Workqueue / task queue backwards compatibility stuff */ -#if ((LINUX_VERSION_CODE >KERNEL_VERSION (2 ,5 ,41 )) || (defined _MVL31_) || (defined _CELF3_))#include <linux/workqueue.h> -#else -#include <linux/tqueue.h> -#define work_struct tq_struct -#define INIT_WORK INIT_TQUEUE -#define schedule_work schedule_task -#endif -/* Interrupt handler backwards compatibility stuff */ -/* -#ifndef IRQ_NONE -#define IRQ_NONE -#define IRQ_HANDLED -typedef void irqreturn_t; -#endif -*/ - -#if LINUX_VERSION_CODE <KERNEL_VERSION (2 ,4 ,23 ) -#define free_netdev (x) kfree(x) -#define pci_name (x) x->slot_name -#endif +#include <asm/io.h> #include "ks7010_sdio.h"
drivers/staging/ks7010/ks_wlan_net.c +0 -3
@@ -13,9 +13,6 @@*/ #include <linux/version.h> -#if (LINUX_VERSION_CODE <KERNEL_VERSION (2 ,6 ,24 )) -#include <linux/config.h> -#endif #include <linux/module.h> #include <linux/kernel.h> #include <linux/compiler.h>
Signature · 1 line
2.8.1
PATCH v2 6/31 staging: ks7010: avoid workqueue races
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
My Spectec SDW823 card oopsed when it was already inserted during boot. When debugging this, I noticed that the card init was done in a seperate workqueue which was only activated once in probe. After removing the workqueue and calling the card init directly from probe, the OOPS went away. It turned out this is the same OOPS which happened when removing the card, so this seems possible now. Note: There is still a not-understood card-removed event during boot, but at least it doesn't crash anymore and the card will be re-probed right away.
--- drivers/staging/ks7010/TODO | 1 - drivers/staging/ks7010/ks7010_sdio.c | 28 ++-------------------------- drivers/staging/ks7010/ks7010_sdio.h | 2 -- 3 files changed, 2 insertions(+), 29 deletions(-)
drivers/staging/ks7010/TODO +0 -1
@@ -28,7 +28,6 @@ Now the TODOs: should understand the change you submit. - drop using a config file and use an upstream technique for configuration - fix the 'card removal' event when card is inserted when booting -- driver crashes when removing the card - check what other upstream wireless mechanisms can be used instead of the custom ones here
drivers/staging/ks7010/ks7010_sdio.c +2 -26
@@ -817,14 +817,8 @@ static int ks79xx_upload_firmware(ks_wlan_private *priv, struct ks_sdio_card *careturn rc; } -static void card_init_task (struct work_struct *work) +static void ks7010_card_init (struct ks_wlan_private *priv) { -struct hw_info_t *hw; -struct ks_wlan_private *priv; - - hw = container_of(work, struct hw_info_t, init_task); - priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw); -DPRINTK (5 ,"\ncard_init_task()\n" );/* init_waitqueue_head(&priv->confirm_wait); */
@@ -1052,23 +1046,11 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_id goto error_free_read_buf; } - priv->ks_wlan_hw.ks7010sdio_init =create_singlethread_workqueue ("ks7010sdio_init" ); -if (!priv->ks_wlan_hw.ks7010sdio_init){ -DPRINTK (1 ,"create_workqueue failed !!\n" ); - goto error_free_sdio_wq; - } - -INIT_WORK (&priv->ks_wlan_hw.init_task, card_init_task);INIT_DELAYED_WORK (&priv->ks_wlan_hw.rw_wq, ks7010_rw_function); - -queue_work (priv->ks_wlan_hw.ks7010sdio_init, &priv->ks_wlan_hw.init_task); +ks7010_card_init (priv);return 0 ; -error_free_sdio_wq: -flush_workqueue (priv->ks_wlan_hw.ks7010sdio_wq); -destroy_workqueue (priv->ks_wlan_hw.ks7010sdio_wq); - priv->ks_wlan_hw.ks7010sdio_wq =NULL ; error_free_read_buf:kfree (priv->ks_wlan_hw.read_buf); priv->ks_wlan_hw.read_buf =NULL ;
@@ -1139,12 +1121,6 @@ static void ks7910_sdio_remove(struct sdio_func *func) }DPRINTK (1 ,"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);\n" ); -if (priv->ks_wlan_hw.ks7010sdio_init){ -flush_workqueue (priv->ks_wlan_hw.ks7010sdio_init); -destroy_workqueue (priv->ks_wlan_hw.ks7010sdio_init); - } -DPRINTK (1 ,"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_init);\n" ); -hostif_exit (priv);DPRINTK (1 ,"hostif_exit\n" );
drivers/staging/ks7010/ks7010_sdio.h +0 -2
@@ -96,8 +96,6 @@ struct hw_info_t {struct ks_sdio_card *sdio_card;struct completion ks7010_sdio_wait;struct workqueue_struct *ks7010sdio_wq; -struct workqueue_struct *ks7010sdio_init; -struct work_struct init_task;struct delayed_work rw_wq;unsigned char *read_buf;struct tasklet_struct rx_bh_task;
Signature · 1 line
2.8.1
PATCH v2 7/31 staging: ks7010: use long preamble as default
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
I had a problem connecting to a network with a short preamble, so let's make the safer option the default.
--- drivers/staging/ks7010/ks7010_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/ks7010/ks7010_config.c +2 -2
@@ -193,7 +193,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv) {8,"WepIndex","1"}, /* 13 */ {7,"WepType","STRING"}, /* 14 */ {3,"Wep","OFF"}, /* 15 */ - {13,"PREAMBLE_TYPE","SHORT"}, /* 16 */ + {13,"PREAMBLE_TYPE","LONG"}, /* 16 */ {8,"ScanType","ACTIVE_SCAN"}, /* 17 */ {8,"ROM_FILE", ROM_FILE}, /* 18 */ {7,"PhyType", "BG_MODE"}, /* 19 */
@@ -216,7 +216,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv) priv->reg.ssid.body[0 ] ='\0' ;/* SSID */ priv->reg.ssid.size =0 ;/* SSID size */ priv->reg.tx_rate =TX_RATE_AUTO ;/* TxRate Fully Auto */ - priv->reg.preamble =SHORT_PREAMBLE ;/* Preamble = SHORT */ + priv->reg.preamble =LONG_PREAMBLE ;/* Preamble = LONG */ priv->reg.powermgt =POWMGT_ACTIVE_MODE ;/* POWMGT_ACTIVE_MODE */ priv->reg.scan_type =ACTIVE_SCAN ;/* Active */ priv->reg.beacon_lost_count =20 ;/* Beacon Lost Count */
Signature · 1 line
2.8.1
PATCH v2 8/31 staging: ks7010: use kernel helper to print buffer
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
No need for an open coded one.
--- drivers/staging/ks7010/Makefile | 2 +- drivers/staging/ks7010/ks7010_sdio.c | 9 +++++---- drivers/staging/ks7010/ks_debug.c | 30 ------------------------------ drivers/staging/ks7010/ks_debug.h | 2 -- 4 files changed, 6 insertions(+), 37 deletions(-) delete mode 100644 drivers/staging/ks7010/ks_debug.c
drivers/staging/ks7010/Makefile +1 -1
@@ -1,5 +1,5 @@ obj-$(CONFIG_KS7010) += ks7010.o ccflags-y += -DKS_WLAN_DEBUG=0 -ks7010-y := michael_mic.o ks_hostif.o ks_wlan_net.o ks_debug.o \ +ks7010-y := michael_mic.o ks_hostif.o ks_wlan_net.o \ ks7010_sdio.o ks7010_config.o
drivers/staging/ks7010/ks7010_sdio.c +5 -4
@@ -441,10 +441,11 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)/* length check */ if (size >2046 || size ==0 ){ - -DPRINTK (5 ,"-INVAILED DATA dump\n" ); -print_buffer (&rx_buffer->data[0 ],32 ); - +#ifdef KS_WLAN_DEBUG +if (KS_WLAN_DEBUG >5 ) +print_hex_dump_bytes ("INVALID DATA dump: " ,DUMP_PREFIX_OFFSET , + rx_buffer->data,32 ); +#endif /* rx_status update */ read_status =READ_STATUS_IDLE ; retval =ks7010_sdio_write (priv,READ_STATUS , &read_status,sizeof (read_status));
drivers/staging/ks7010/ks_debug.c deleted +0 -30
@@ -1,30 +0,0 @@ -/* -* Driver for KeyStream 11b/g wireless LAN cards. -* -* ks_debug.c -* $Id: ks_debug.c 991 2009-09-14 01:38:58Z sekine $ -* -* Copyright (C) 2005-2008 KeyStream Corp. -* Copyright (C) 2009 Renesas Technology Corp. -* -* This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. -*/ -#include "ks_wlan.h" -#include "ks_debug.h" - -void print_buffer (unsigned char *p,int length) -{ -#ifdef KS_WLAN_DEBUG -int i; -#define HEX_OFFSET "\ - +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +A +B +C +D +E +F" -printk (HEX_OFFSET ); -for (i=0 ; i<length; i++) { -if (i %16 ==0 )printk ("\n%04X-%04X:" , i, i+15 ); -printk (" %02X" , *(p+i)); - } -printk ("\n" ); -#endif -}
drivers/staging/ks7010/ks_debug.h +0 -2
@@ -25,6 +25,4 @@ #define DPRINTK(n, fmt, args...)#endif -extern void print_buffer (unsigned char *p,int size); -#endif /* _KS_DEBUG_H */
Signature · 1 line
2.8.1
PATCH v2 9/31 staging: ks7010: delete seperate debug header
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Move the one debug macro to the generic wlan header.
--- drivers/staging/ks7010/ks7010_config.c | 1 - drivers/staging/ks7010/ks7010_sdio.c | 1 - drivers/staging/ks7010/ks_debug.h | 28 ---------------------------- drivers/staging/ks7010/ks_hostif.c | 1 - drivers/staging/ks7010/ks_wlan.h | 7 +++++++ drivers/staging/ks7010/ks_wlan_net.c | 1 - 6 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 drivers/staging/ks7010/ks_debug.h
drivers/staging/ks7010/ks7010_config.c +0 -1
@@ -4,7 +4,6 @@#include "ks_wlan.h" #include "ks_hostif.h" #include "ks_wlan_ioctl.h" -#include "ks_debug.h" static int wep_on_off;#define WEP_OFF 0
drivers/staging/ks7010/ks7010_sdio.c +0 -1
@@ -19,7 +19,6 @@#include "ks_wlan.h" #include "ks_wlan_ioctl.h" -#include "ks_debug.h" #include "ks_hostif.h" #include "ks7010_sdio.h"
drivers/staging/ks7010/ks_debug.h deleted +0 -28
@@ -1,28 +0,0 @@ -/* -* Driver for KeyStream 11b/g wireless LAN cards. -* -* ks_debug.h -* $Id: ks_debug.h 991 2009-09-14 01:38:58Z sekine $ -* -* Copyright (C) 2005-2008 KeyStream Corp. -* Copyright (C) 2009 Renesas Technology Corp. -* -* This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. -*/ - -#ifndef _KS_DEBUG_H -#define _KS_DEBUG_H - -#include <linux/kernel.h> - - -#ifdef KS_WLAN_DEBUG -#define DPRINTK(n, fmt, args...) \ - if (KS_WLAN_DEBUG>(n)) printk(KERN_NOTICE "%s: "fmt, __FUNCTION__, ## args) -#else -#define DPRINTK(n, fmt, args...) -#endif - -#endif /* _KS_DEBUG_H */
drivers/staging/ks7010/ks_hostif.c +0 -1
@@ -13,7 +13,6 @@*/ #include "ks_wlan.h" -#include "ks_debug.h" #include "ks_hostif.h" #include "eap_packet.h" #include "michael_mic.h"
drivers/staging/ks7010/ks_wlan.h +7 -0
@@ -38,6 +38,13 @@#include "ks7010_sdio.h" +#ifdef KS_WLAN_DEBUG +#define DPRINTK(n, fmt, args...) \ + if (KS_WLAN_DEBUG>(n)) printk(KERN_NOTICE "%s: "fmt, __FUNCTION__, ## args) +#else +#define DPRINTK(n, fmt, args...) +#endif +struct ks_wlan_parameter {uint8_t operation_mode;/* Operation Mode */ uint8_t channel;/* Channel */
drivers/staging/ks7010/ks_wlan_net.c +0 -1
@@ -40,7 +40,6 @@ static int wep_on_off;#include "ks_wlan.h" #include "ks_hostif.h" #include "ks_wlan_ioctl.h" -#include "ks_debug.h" /* Include Wireless Extension definition and check version */ #include <linux/wireless.h>
Signature · 1 line
2.8.1
PATCH v2 10/31 staging: ks7010: really iterate over multicast addresses
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
The loop variable was defined but not really used. Fix this.
--- drivers/staging/ks7010/ks_hostif.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/ks7010/ks_hostif.c +2 -1
@@ -2105,7 +2105,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv)struct netdev_hw_addr *ha;char set_address[NIC_MAX_MCAST_LIST *ETH_ALEN ];unsigned long filter_type; -int i; +int i =0 ;DPRINTK (3 ,"\n" );
@@ -2128,6 +2128,7 @@ void hostif_sme_multicast_set(ks_wlan_private *priv) mc_count =netdev_mc_count (dev);netdev_for_each_mc_addr (ha, dev) {memcpy (&set_address[i*ETH_ALEN ], ha->addr,ETH_ALEN ); + i++; } priv->sme_i.sme_flag &= ~SME_MULTICAST ; hostif_mib_set_request(priv, LOCAL_MULTICAST_ADDRESS,
Signature · 1 line
2.8.1
PATCH v2 11/31 staging: ks7010: make loading config file optional
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
We have sane defaults, so we don't need to bail out if there is no config file. Note that the config file should go away completely in favour of configuration mechanisms already upstream.
--- drivers/staging/ks7010/ks7010_config.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/staging/ks7010/ks7010_config.c +3 -5
@@ -203,7 +203,6 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)const struct firmware *fw_entry;struct device *dev =NULL ; -int retval;char cfg_file[]=CFG_FILE ;char *cur_p, *end_p;char wk_buff[256 ], *wk_p;
@@ -254,10 +253,9 @@ int ks_wlan_read_config_file(ks_wlan_private *priv) priv->reg.rate_set.size =12 ; dev = &priv->ks_wlan_hw.sdio_card->func->dev; -if ((retval =request_firmware (&fw_entry, cfg_file, dev)) !=0 ){ -DPRINTK (1 ,"error request_firmware() file=%s ret=%d\n" , cfg_file, retval); -return 1 ; - } +/* If no cfg file, stay with the defaults */ +if (request_firmware_direct (&fw_entry, cfg_file, dev)) +return 0 ;DPRINTK (4 ,"success request_firmware() file=%s size=%d\n" , cfg_file, fw_entry->size); cur_p = fw_entry->data;
Signature · 1 line
2.8.1
PATCH v2 12/31 staging: ks7010: fix printk format warnings
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Use proper type for size_t.
--- drivers/staging/ks7010/ks7010_config.c | 2 +- drivers/staging/ks7010/ks7010_sdio.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/ks7010/ks7010_config.c +1 -1
@@ -257,7 +257,7 @@ int ks_wlan_read_config_file(ks_wlan_private *priv)if (request_firmware_direct (&fw_entry, cfg_file, dev))return 0 ; -DPRINTK (4 ,"success request_firmware() file=%s size=%d\n" , cfg_file, fw_entry->size); +DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , cfg_file, fw_entry->size); cur_p = fw_entry->data; end_p = cur_p + fw_entry->size; *end_p ='\0' ;
drivers/staging/ks7010/ks7010_sdio.c +1 -1
@@ -750,7 +750,7 @@ static int ks79xx_upload_firmware(ks_wlan_private *priv, struct ks_sdio_card *caDPRINTK (1 ,"error request_firmware() file=%s\n" , priv->reg.rom_file);return 1 ; } -DPRINTK (4 ,"success request_firmware() file=%s size=%d\n" , priv->reg.rom_file, fw_entry->size); +DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , priv->reg.rom_file, fw_entry->size); length = fw_entry->size;/* Load Program */
Signature · 1 line
2.8.1
PATCH v2 13/31 staging: ks7010: add example cfg file as a reference
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
We want to remove it, but to do so properly, it is good to have a working example. Needs to be copied to /lib/firmware in order to be used.
--- drivers/staging/ks7010/ks79xx.cfg | 116 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 drivers/staging/ks7010/ks79xx.cfg
drivers/staging/ks7010/ks79xx.cfg new file +116 -0
@@ -0,0 +1,116 @@ +#ks79xx.cfg +#KS79xx configuration file +# + +# +#BeaconLostCount default 20 +BeaconLostCount=20 +# + +# +#Ap List Scan Type default ACTIVE_SCAN ACTIVE_SCAN or PASSIVE_SCAN +ScanType=ACTIVE_SCAN +# + +# +#Channel default 10 min 1 max 14 +Channel=10 +# + +# +#FragmentThreshold default 2346 min 256 max 2346 +FragmentThreshold=2346 +# + +# +#OperationMode default Infrastructure Pseudo-Ad-Hoc or 802.11-Ad-Hoc or Infrastructure +OperationMode=Infrastructure +# + +# +#PowerManagementMode default ACTIVE ACTIVE or SAVE1 or SAVE2 +PowerManagementMode=ACTIVE +# + +# +#RTSThreshold default 2347 min 0 max 2347 +RTSThreshold=2347 +# + +# +#SSID default "" max 32 character +SSID="default" +# + +# +#TxRate default Auto 1, 2, 5.5, 11 ex. TxRate=1,2 TxRate=11 TxRate=Auto ... +TxRate=Auto +# + +# +#Wep default OFF OFF or 64bit or 128bit +Wep=OFF +# + +# +#WepType default STRING STRING or HEX +WepType=STRING +# + +# +#WepIndex=1 +# + +# +#WepKeyValue1 +# character_wep_key:64bit key_length = 5; 128bit key_length = 13 +# hex_wep_key:64bit key_length = 10; 128bit key_length = 26 +# + +# +#WepKeyValue2 +# character_wep_key:64bit key_length = 5; 128bit key_length = 13 +# hex_wep_key:64bit key_length = 10; 128bit key_length = 26 +# + +# +#WepKeyValue3 +# character_wep_key:64bit key_length = 5; 128bit key_length = 13 +# hex_wep_key:64bit key_length = 10; 128bit key_length = 26 +# + +# +#WepKeyValue4 +# character_wep_key:64bit key_length = 5; 128bit key_length = 13 +# hex_wep_key:64bit key_length = 10; 128bit key_length = 26 +# + +# +#AuthenticationAlgorithm default OPEN_SYSTEM OPEN_SYSTEM or SHARED_KEY +AuthenticationAlgorithm=OPEN_SYSTEM +# + +# +#PREAMBLE_TYPE default LONG LONG or SHORT +PREAMBLE_TYPE=SHORT +# + +# +# PhyType default BG_MODE B_MODE, G_MODE or BG_MODE +PhyType=BG_MODE +# + +# +# CtsMode defalut FALSE TURE or FALSE +CtsMode=FALSE +# + +# +# PhyInformationTimer defalut 0 uint 100msec +PhyInformationTimer=0 +# + +# +#ROM_FILE default "ks7010sd.rom" +ROM_FILE="ks7010sd.rom" +#
Signature · 1 line
2.8.1
PATCH v2 14/31 staging: ks7010: remove unecessary typedef
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Let's simply specify the struct to keep in sync with kernel coding style.
--- drivers/staging/ks7010/ks7010_config.c | 4 +- drivers/staging/ks7010/ks7010_sdio.c | 44 ++++----- drivers/staging/ks7010/ks7010_sdio.h | 2 +- drivers/staging/ks7010/ks_hostif.c | 114 +++++++++++----------- drivers/staging/ks7010/ks_hostif.h | 10 +- drivers/staging/ks7010/ks_wlan.h | 4 +- drivers/staging/ks7010/ks_wlan_ioctl.h | 4 +- drivers/staging/ks7010/ks_wlan_net.c | 168 ++++++++++++++++----------------- 8 files changed, 175 insertions(+), 175 deletions(-)
drivers/staging/ks7010/ks7010_config.c +2 -2
@@ -87,7 +87,7 @@ void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index, cha }static -int rate_set_configuration (ks_wlan_private *priv,char *value) +int rate_set_configuration (struct ks_wlan_private *priv,char *value) {int rc=0 ;
@@ -169,7 +169,7 @@ int rate_set_configuration(ks_wlan_private *priv, char *value) }#include <linux/firmware.h> -int ks_wlan_read_config_file (ks_wlan_private *priv) +int ks_wlan_read_config_file (struct ks_wlan_private *priv) {struct {const int key_len;
drivers/staging/ks7010/ks7010_sdio.c +22 -22
170 lines not on this page · raw message
drivers/staging/ks7010/ks7010_sdio.h +1 -1
@@ -110,7 +110,7 @@ struct ks_sdio_packet {struct ks_sdio_card {struct sdio_func *func; -struct ks_wlan_private *priv; +struct ks_wlan_private *priv;int model;const char *firmware;spinlock_t lock;
drivers/staging/ks7010/ks_hostif.c +57 -57
448 lines not on this page · raw message
drivers/staging/ks7010/ks_hostif.h +5 -5
@@ -623,11 +623,11 @@ enum {#include "ks_wlan.h" /* function prototype */ -extern int hostif_data_request (ks_wlan_private *priv,struct sk_buff *packet ); -extern void hostif_receive (ks_wlan_private *priv,unsigned char *p,unsigned int size ); -extern void hostif_sme_enqueue (ks_wlan_private *priv,uint16_t event); -extern int hostif_init (ks_wlan_private *priv ); -extern void hostif_exit (ks_wlan_private *priv ); +extern int hostif_data_request (struct ks_wlan_private *priv,struct sk_buff *packet ); +extern void hostif_receive (struct ks_wlan_private *priv,unsigned char *p,unsigned int size ); +extern void hostif_sme_enqueue (struct ks_wlan_private *priv,uint16_t event); +extern int hostif_init (struct ks_wlan_private *priv ); +extern void hostif_exit (struct ks_wlan_private *priv );static inline int hif_align_size (int size)
drivers/staging/ks7010/ks_wlan.h +2 -2
@@ -414,7 +414,7 @@ struct wps_status_t { };#endif /* WPS */ -typedef struct ks_wlan_private{ +struct ks_wlan_private {struct hw_info_t ks_wlan_hw;/* hardware information */
@@ -505,7 +505,7 @@ typedef struct ks_wlan_private{uint sdio_error_count;/* SDIO error */ uint wakeup_count;/* for detect wakeup loop */ -} ks_wlan_private; +};
drivers/staging/ks7010/ks_wlan_ioctl.h +2 -2
@@ -61,8 +61,8 @@#include "ks_wlan.h" #include <linux/netdevice.h> -extern int ks_wlan_read_config_file (ks_wlan_private *priv); -extern int ks_wlan_setup_parameter (ks_wlan_private *priv,unsigned int commit_flag); +extern int ks_wlan_read_config_file (struct ks_wlan_private *priv); +extern int ks_wlan_setup_parameter (struct ks_wlan_private *priv,unsigned int commit_flag);#endif /* __KERNEL__ */
drivers/staging/ks7010/ks_wlan_net.c +84 -84
670 lines not on this page · raw message
Signature · 1 line
2.8.1
PATCH v2 15/31 staging: ks7010: indent eap_packet.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/eap_packet.h | 49 ++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 25 deletions(-)
drivers/staging/ks7010/eap_packet.h +24 -25
@@ -14,13 +14,13 @@#endif struct ether_hdr { -unsigned char h_dest[ETH_ALEN ];/* destination eth addr */ -unsigned char h_source[ETH_ALEN ];/* source ether addr */ -unsigned char h_dest_snap; -unsigned char h_source_snap; -unsigned char h_command; -unsigned char h_vendor_id[3 ]; -unsigned short h_proto;/* packet type ID field */ +unsigned char h_dest[ETH_ALEN ];/* destination eth addr */ +unsigned char h_source[ETH_ALEN ];/* source ether addr */ +unsigned char h_dest_snap; +unsigned char h_source_snap; +unsigned char h_command; +unsigned char h_vendor_id[3 ]; +unsigned short h_proto;/* packet type ID field */ #define ETHER_PROTOCOL_TYPE_EAP 0x888e#define ETHER_PROTOCOL_TYPE_IP 0x0800#define ETHER_PROTOCOL_TYPE_ARP 0x0806
@@ -37,15 +37,15 @@ struct ieee802_1x_hdr {#define EAPOL_VERSION 2enum {IEEE802_1X_TYPE_EAP_PACKET =0 , -IEEE802_1X_TYPE_EAPOL_START =1 , -IEEE802_1X_TYPE_EAPOL_LOGOFF =2 , -IEEE802_1X_TYPE_EAPOL_KEY =3 , -IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT =4 +IEEE802_1X_TYPE_EAPOL_START =1 , +IEEE802_1X_TYPE_EAPOL_LOGOFF =2 , +IEEE802_1X_TYPE_EAPOL_KEY =3 , +IEEE802_1X_TYPE_EAPOL_ENCAPSULATED_ASF_ALERT =4 };enum {EAPOL_KEY_TYPE_RC4 =1 ,EAPOL_KEY_TYPE_RSN =2 , -EAPOL_KEY_TYPE_WPA =254 }; - +EAPOL_KEY_TYPE_WPA =254 +};#define IEEE8021X_REPLAY_COUNTER_LEN 8#define IEEE8021X_KEY_SIGN_LEN 16
@@ -60,11 +60,11 @@ struct ieee802_1x_eapol_key {/* does not repeat within the life of the keying material used to * encrypt the Key field; 64-bit NTP timestamp MAY be used here */ unsigned char replay_counter[IEEE8021X_REPLAY_COUNTER_LEN ]; -unsigned char key_iv[IEEE8021X_KEY_IV_LEN ];/* cryptographically random number */ -unsigned char key_index;/* key flag in the most significant bit: -* 0 = broadcast (default key), -* 1 = unicast (key mapping key); key index is in the -* 7 least significant bits */ +unsigned char key_iv[IEEE8021X_KEY_IV_LEN ];/* cryptographically random number */ +unsigned char key_index;/* key flag in the most significant bit: +* 0 = broadcast (default key), +* 1 = unicast (key mapping key); key index is in the +* 7 least significant bits */ /* HMAC-MD5 message integrity check computed with MS-MPPE-Send-Key as * the key */ unsigned char key_signature[IEEE8021X_KEY_SIGN_LEN ];
@@ -77,19 +77,18 @@ struct ieee802_1x_eapol_key {* RC4 key used in encryption = Key-IV + MS-MPPE-Recv-Key */ } __attribute__ ((packed)); -#define WPA_NONCE_LEN 32#define WPA_REPLAY_COUNTER_LEN 8struct wpa_eapol_key {unsigned char type; -unsigned short key_info; +unsigned short key_info;unsigned short key_length;unsigned char replay_counter[WPA_REPLAY_COUNTER_LEN ];unsigned char key_nonce[WPA_NONCE_LEN ];unsigned char key_iv[16 ];unsigned char key_rsc[8 ]; -unsigned char key_id[8 ];/* Reserved in IEEE 802.11i/RSN */ +unsigned char key_id[8 ];/* Reserved in IEEE 802.11i/RSN */ unsigned char key_mic[16 ];unsigned short key_data_length;/* followed by key_data_length bytes of key_data */
@@ -98,18 +97,18 @@ struct wpa_eapol_key {#define WPA_KEY_INFO_TYPE_MASK (WBIT(0) | WBIT(1) | WBIT(2))#define WPA_KEY_INFO_TYPE_HMAC_MD5_RC4 WBIT(0)#define WPA_KEY_INFO_TYPE_HMAC_SHA1_AES WBIT(1) -#define WPA_KEY_INFO_KEY_TYPE WBIT(3)/* 1 = Pairwise, 0 = Group key */ +#define WPA_KEY_INFO_KEY_TYPE WBIT(3)/* 1 = Pairwise, 0 = Group key */ /* bit4..5 is used in WPA, but is reserved in IEEE 802.11i/RSN */ #define WPA_KEY_INFO_KEY_INDEX_MASK (WBIT(4) | WBIT(5))#define WPA_KEY_INFO_KEY_INDEX_SHIFT 4 -#define WPA_KEY_INFO_INSTALL WBIT(6)/* pairwise */ -#define WPA_KEY_INFO_TXRX WBIT(6)/* group */ +#define WPA_KEY_INFO_INSTALL WBIT(6)/* pairwise */ +#define WPA_KEY_INFO_TXRX WBIT(6)/* group */ #define WPA_KEY_INFO_ACK WBIT(7)#define WPA_KEY_INFO_MIC WBIT(8)#define WPA_KEY_INFO_SECURE WBIT(9)#define WPA_KEY_INFO_ERROR WBIT(10)#define WPA_KEY_INFO_REQUEST WBIT(11) -#define WPA_KEY_INFO_ENCR_KEY_DATA WBIT(12)/* IEEE 802.11i/RSN only */ +#define WPA_KEY_INFO_ENCR_KEY_DATA WBIT(12)/* IEEE 802.11i/RSN only */ #define WPA_CAPABILITY_PREAUTH WBIT(0)
Signature · 1 line
2.8.1
PATCH v2 16/31 staging: ks7010: indent ks7010_config.c
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/ks7010_config.c | 353 +++++++++++++++++---------------- 1 file changed, 184 insertions(+), 169 deletions(-)
drivers/staging/ks7010/ks7010_config.c +184 -169
@@ -15,7 +15,8 @@ static int wep_type;#define WEP_KEY_HEX 1static -void analyze_character_wep_key (struct ks_wlan_parameter *param,int wep_key_index,char *value) +void analyze_character_wep_key (struct ks_wlan_parameter *param, +int wep_key_index,char *value) {int i;unsigned char wep_key[26 ], key_length;
@@ -23,64 +24,69 @@ void analyze_character_wep_key(struct ks_wlan_parameter *param, int wep_key_inde key_length = (wep_on_off ==WEP_ON_64BIT ) ?5 :13 ;/* 64bit key_length = 5; 128bit key_length = 13; */ -for (i=0 ; i<key_length; i++) { +for (i =0 ; i < key_length; i++) { wep_key[i] = value[i]; } -if (wep_key_index <0 || wep_key_index >3 ) +if (wep_key_index <0 || wep_key_index >3 )return ; param->wep_key[wep_key_index].size = key_length; -for (i=0 ; i<(param->wep_key[wep_key_index].size); i++) { +for (i =0 ; i < (param->wep_key[wep_key_index].size); i++) { param->wep_key[wep_key_index].val[i] = wep_key[i]; } }static -void analyze_hex_wep_key (struct ks_wlan_parameter *param,int wep_key_index,char *value) +void analyze_hex_wep_key (struct ks_wlan_parameter *param,int wep_key_index, +char *value) {unsigned char wep_end[26 ], i, j, key_length; key_length = (wep_on_off ==WEP_ON_64BIT ) ?10 :26 ;/* 64bit key_length = 10; 128bit key_length = 26; */ -for (i=0 ; i<key_length; i++) { +for (i =0 ; i < key_length; i++) { wep_end[i] = value[i];if (i %2 ) {/* Odd */ -for (j=0x00 ; j<0x10 ; j++) { -if (j<0x0a ) { -if (wep_end[i] == j+0x30 ) +for (j =0x00 ; j <0x10 ; j++) { +if (j <0x0a ) { +if (wep_end[i] == j +0x30 ) wep_end[i] = j; }else { -if ((wep_end[i] == j+0x37 ) | (wep_end[i] == j+0x57 )) +if ((wep_end[i] == + j +0x37 ) | (wep_end[i] == + j +0x57 )) wep_end[i] = j; } } }else {/* Even */ -for (j=0x00 ; j<0x10 ; j++) { -if (j<0x0a ) { -if (wep_end[i] == j+0x30 ) { - wep_end[i] = j*16 ; +for (j =0x00 ; j <0x10 ; j++) { +if (j <0x0a ) { +if (wep_end[i] == j +0x30 ) { + wep_end[i] = j *16 ; } }else { -if ((wep_end[i] == j+0x37 ) | (wep_end[i] == j+0x57 )) - wep_end[i] = j*16 ; +if ((wep_end[i] == + j +0x37 ) | (wep_end[i] == + j +0x57 )) + wep_end[i] = j *16 ; } } } } -for (i=0 ; i<key_length/2 ; i++) { - wep_end[i] = wep_end[i*2 ] + wep_end[(i*2 )+1 ]; +for (i =0 ; i < key_length /2 ; i++) { + wep_end[i] = wep_end[i *2 ] + wep_end[(i *2 ) +1 ]; } -if (wep_key_index <0 || wep_key_index >3 ) -return ; +if (wep_key_index <0 || wep_key_index >3 ) +return ; - param->wep_key[wep_key_index].size = key_length/2 ; -for (i=0 ; i<(param->wep_key[wep_key_index].size); i++) { + param->wep_key[wep_key_index].size = key_length /2 ; +for (i =0 ; i < (param->wep_key[wep_key_index].size); i++) { param->wep_key[wep_key_index].val[i] = wep_end[i]; }
@@ -89,62 +95,57 @@ void analyze_hex_wep_key(struct ks_wlan_parameter *param, int wep_key_index, chastatic int rate_set_configuration (struct ks_wlan_private *priv,char *value) { -int rc=0 ; +int rc =0 ; priv->reg.tx_rate =TX_RATE_FIXED ; priv->reg.rate_set.size =1 ; -switch (*value){ -case '1' :/* 1M 11M 12M 18M */ -if (*(value+1 ) =='8' ){ +switch (*value) { +case '1' :/* 1M 11M 12M 18M */ +if (*(value +1 ) =='8' ) { priv->reg.rate_set.body[0 ] =TX_RATE_18M ; - } -else if (*(value+1 ) =='2' ){ - priv->reg.rate_set.body[0 ] =TX_RATE_12M |BASIC_RATE ; - } -else if (*(value+1 ) =='1' ){ - priv->reg.rate_set.body[0 ] =TX_RATE_11M |BASIC_RATE ; - } -else { - priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; + }else if (*(value +1 ) =='2' ) { + priv->reg.rate_set.body[0 ] =TX_RATE_12M |BASIC_RATE ; + }else if (*(value +1 ) =='1' ) { + priv->reg.rate_set.body[0 ] =TX_RATE_11M |BASIC_RATE ; + }else { + priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; }break ; -case '2' :/* 2M 24M */ -if (*(value+1 ) =='4' ){ - priv->reg.rate_set.body[0 ] =TX_RATE_24M |BASIC_RATE ; - } -else { - priv->reg.rate_set.body[0 ] =TX_RATE_2M |BASIC_RATE ; +case '2' :/* 2M 24M */ +if (*(value +1 ) =='4' ) { + priv->reg.rate_set.body[0 ] =TX_RATE_24M |BASIC_RATE ; + }else { + priv->reg.rate_set.body[0 ] =TX_RATE_2M |BASIC_RATE ; }break ; -case '3' :/* 36M */ +case '3' :/* 36M */ priv->reg.rate_set.body[0 ] =TX_RATE_36M ;break ; -case '4' :/* 48M */ +case '4' :/* 48M */ priv->reg.rate_set.body[0 ] =TX_RATE_48M ;break ; -case '5' :/* 5.5M 54M */ -if (*(value+1 ) =='4' ){ +case '5' :/* 5.5M 54M */ +if (*(value +1 ) =='4' ) { priv->reg.rate_set.body[0 ] =TX_RATE_54M ; - } -else { - priv->reg.rate_set.body[0 ] =TX_RATE_5M |BASIC_RATE ; + }else { + priv->reg.rate_set.body[0 ] =TX_RATE_5M |BASIC_RATE ; }break ; -case '6' :/* 6M */ - priv->reg.rate_set.body[0 ] =TX_RATE_6M |BASIC_RATE ; +case '6' :/* 6M */ + priv->reg.rate_set.body[0 ] =TX_RATE_6M |BASIC_RATE ;break ; -case '9' :/* 9M */ +case '9' :/* 9M */ priv->reg.rate_set.body[0 ] =TX_RATE_9M ;break ;case 'K' : priv->reg.rate_set.body[6 ] =TX_RATE_36M ; priv->reg.rate_set.body[5 ] =TX_RATE_18M ; - priv->reg.rate_set.body[4 ] =TX_RATE_24M |BASIC_RATE ; - priv->reg.rate_set.body[3 ] =TX_RATE_12M |BASIC_RATE ; - priv->reg.rate_set.body[2 ] =TX_RATE_6M |BASIC_RATE ; - priv->reg.rate_set.body[1 ] =TX_RATE_11M |BASIC_RATE ; - priv->reg.rate_set.body[0 ] =TX_RATE_2M |BASIC_RATE ; + priv->reg.rate_set.body[4 ] =TX_RATE_24M |BASIC_RATE ; + priv->reg.rate_set.body[3 ] =TX_RATE_12M |BASIC_RATE ; + priv->reg.rate_set.body[2 ] =TX_RATE_6M |BASIC_RATE ; + priv->reg.rate_set.body[1 ] =TX_RATE_11M |BASIC_RATE ; + priv->reg.rate_set.body[0 ] =TX_RATE_2M |BASIC_RATE ; priv->reg.tx_rate =TX_RATE_FULL_AUTO ; priv->reg.rate_set.size =7 ;break ;
@@ -154,13 +155,13 @@ int rate_set_configuration(struct ks_wlan_private *priv, char *value) priv->reg.rate_set.body[9 ] =TX_RATE_36M ; priv->reg.rate_set.body[8 ] =TX_RATE_18M ; priv->reg.rate_set.body[7 ] =TX_RATE_9M ; - priv->reg.rate_set.body[6 ] =TX_RATE_24M |BASIC_RATE ; - priv->reg.rate_set.body[5 ] =TX_RATE_12M |BASIC_RATE ; - priv->reg.rate_set.body[4 ] =TX_RATE_6M |BASIC_RATE ; - priv->reg.rate_set.body[3 ] =TX_RATE_11M |BASIC_RATE ; - priv->reg.rate_set.body[2 ] =TX_RATE_5M |BASIC_RATE ; - priv->reg.rate_set.body[1 ] =TX_RATE_2M |BASIC_RATE ; - priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; + priv->reg.rate_set.body[6 ] =TX_RATE_24M |BASIC_RATE ; + priv->reg.rate_set.body[5 ] =TX_RATE_12M |BASIC_RATE ; + priv->reg.rate_set.body[4 ] =TX_RATE_6M |BASIC_RATE ; + priv->reg.rate_set.body[3 ] =TX_RATE_11M |BASIC_RATE ; + priv->reg.rate_set.body[2 ] =TX_RATE_5M |BASIC_RATE ; + priv->reg.rate_set.body[1 ] =TX_RATE_2M |BASIC_RATE ; + priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; priv->reg.tx_rate =TX_RATE_FULL_AUTO ; priv->reg.rate_set.size =12 ;break ;
@@ -176,63 +177,63 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv)const char *key;const char *val; } cfg_tbl[] = { - {15,"BeaconLostCount", "20"}, /* 0 */ - {7,"Channel", "1"}, /* 1 */ - {17,"FragmentThreshold","2346"}, /* 2 */ - {13,"OperationMode","Infrastructure"}, /* 3 */ - {19,"PowerManagementMode","ACTIVE"}, /* 4 */ - {12,"RTSThreshold","2347"}, /* 5 */ - {4,"SSID","default"}, /* 6 */ - {6,"TxRate","Auto"}, /* 7 */ - {23,"AuthenticationAlgorithm",""}, /* 8 */ - {12,"WepKeyValue1",""}, /* 9 */ - {12,"WepKeyValue2",""}, /* 10 */ - {12,"WepKeyValue3",""}, /* 11 */ - {12,"WepKeyValue4",""}, /* 12 */ - {8,"WepIndex","1"}, /* 13 */ - {7,"WepType","STRING"}, /* 14 */ - {3,"Wep","OFF"}, /* 15 */ - {13,"PREAMBLE_TYPE","LONG"}, /* 16 */ - {8,"ScanType","ACTIVE_SCAN"}, /* 17 */ - {8,"ROM_FILE", ROM_FILE}, /* 18 */ - {7,"PhyType", "BG_MODE"}, /* 19 */ - {7,"CtsMode", "FALSE"}, /* 20 */ - {19,"PhyInformationTimer", "0"}, /* 21 */ - {0,"",""}, + {15, "BeaconLostCount", "20"}, /* 0 */ + {7, "Channel", "1"}, /* 1 */ + {17, "FragmentThreshold", "2346"}, /* 2 */ + {13, "OperationMode", "Infrastructure"}, /* 3 */ + {19, "PowerManagementMode", "ACTIVE"}, /* 4 */ + {12, "RTSThreshold", "2347"}, /* 5 */ + {4, "SSID", "default"}, /* 6 */ + {6, "TxRate", "Auto"}, /* 7 */ + {23, "AuthenticationAlgorithm", ""}, /* 8 */ + {12, "WepKeyValue1", ""}, /* 9 */ + {12, "WepKeyValue2", ""}, /* 10 */ + {12, "WepKeyValue3", ""}, /* 11 */ + {12, "WepKeyValue4", ""}, /* 12 */ + {8, "WepIndex", "1"}, /* 13 */ + {7, "WepType", "STRING"}, /* 14 */ + {3, "Wep", "OFF"}, /* 15 */ + {13, "PREAMBLE_TYPE", "LONG"}, /* 16 */ + {8, "ScanType", "ACTIVE_SCAN"}, /* 17 */ + {8, "ROM_FILE", ROM_FILE}, /* 18 */ + {7, "PhyType", "BG_MODE"}, /* 19 */ + {7, "CtsMode", "FALSE"}, /* 20 */ + {19, "PhyInformationTimer", "0"}, /* 21 */ + {0, "", ""}, }; const struct firmware *fw_entry; struct device *dev = NULL; - char cfg_file[]=CFG_FILE; + char cfg_file[] = CFG_FILE; char *cur_p, *end_p; char wk_buff[256], *wk_p; /* Initialize Variable */ priv->reg.operation_mode = MODE_INFRASTRUCTURE; /* Infrastructure */ - priv->reg.channel = 10; /* 10 */ - memset(priv->reg.bssid, 0x0, ETH_ALEN); /* BSSID */ - priv->reg.ssid.body[0] = '\0'; /* SSID */ - priv->reg.ssid.size = 0; /* SSID size */ - priv->reg.tx_rate = TX_RATE_AUTO; /* TxRate Fully Auto */ - priv->reg.preamble = LONG_PREAMBLE; /* Preamble = LONG */ - priv->reg.powermgt = POWMGT_ACTIVE_MODE; /* POWMGT_ACTIVE_MODE */ - priv->reg.scan_type = ACTIVE_SCAN; /* Active */ - priv->reg.beacon_lost_count = 20; /* Beacon Lost Count */ - priv->reg.rts = 2347UL; /* RTS Threashold */ - priv->reg.fragment = 2346UL; /* Fragmentation Threashold */ + priv->reg.channel = 10; /* 10 */ + memset(priv->reg.bssid, 0x0, ETH_ALEN); /* BSSID */ + priv->reg.ssid.body[0] = '\0'; /* SSID */ + priv->reg.ssid.size = 0; /* SSID size */ + priv->reg.tx_rate = TX_RATE_AUTO; /* TxRate Fully Auto */ + priv->reg.preamble = LONG_PREAMBLE; /* Preamble = LONG */ + priv->reg.powermgt = POWMGT_ACTIVE_MODE; /* POWMGT_ACTIVE_MODE */ + priv->reg.scan_type = ACTIVE_SCAN; /* Active */ + priv->reg.beacon_lost_count = 20; /* Beacon Lost Count */ + priv->reg.rts = 2347UL; /* RTS Threashold */ + priv->reg.fragment = 2346UL; /* Fragmentation Threashold */ strcpy(&priv->reg.rom_file[0], ROM_FILE); priv->skb = NULL; - priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM; /* AuthenticationAlgorithm */ + priv->reg.authenticate_type = AUTH_TYPE_OPEN_SYSTEM; /* AuthenticationAlgorithm */ - priv->reg.privacy_invoked = 0x00; /* WEP */ - priv->reg.wep_index=0; - memset(&priv->reg.wep_key[0],0,sizeof(priv->reg.wep_key[0])); - memset(&priv->reg.wep_key[1],0,sizeof(priv->reg.wep_key[0])); - memset(&priv->reg.wep_key[2],0,sizeof(priv->reg.wep_key[0])); - memset(&priv->reg.wep_key[3],0,sizeof(priv->reg.wep_key[0])); + priv->reg.privacy_invoked = 0x00; /* WEP */ + priv->reg.wep_index = 0; + memset(&priv->reg.wep_key[0], 0, sizeof(priv->reg.wep_key[0])); + memset(&priv->reg.wep_key[1], 0, sizeof(priv->reg.wep_key[0])); + memset(&priv->reg.wep_key[2], 0, sizeof(priv->reg.wep_key[0])); + memset(&priv->reg.wep_key[3], 0, sizeof(priv->reg.wep_key[0])); priv->reg.phy_type = D_11BG_COMPATIBLE_MODE; priv->reg.cts_mode = CTS_MODE_FALSE;
@@ -242,13 +243,13 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) priv->reg.rate_set.body[9 ] =TX_RATE_36M ; priv->reg.rate_set.body[8 ] =TX_RATE_18M ; priv->reg.rate_set.body[7 ] =TX_RATE_9M ; - priv->reg.rate_set.body[6 ] =TX_RATE_24M |BASIC_RATE ; - priv->reg.rate_set.body[5 ] =TX_RATE_12M |BASIC_RATE ; - priv->reg.rate_set.body[4 ] =TX_RATE_6M |BASIC_RATE ; - priv->reg.rate_set.body[3 ] =TX_RATE_11M |BASIC_RATE ; - priv->reg.rate_set.body[2 ] =TX_RATE_5M |BASIC_RATE ; - priv->reg.rate_set.body[1 ] =TX_RATE_2M |BASIC_RATE ; - priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; + priv->reg.rate_set.body[6 ] =TX_RATE_24M |BASIC_RATE ; + priv->reg.rate_set.body[5 ] =TX_RATE_12M |BASIC_RATE ; + priv->reg.rate_set.body[4 ] =TX_RATE_6M |BASIC_RATE ; + priv->reg.rate_set.body[3 ] =TX_RATE_11M |BASIC_RATE ; + priv->reg.rate_set.body[2 ] =TX_RATE_5M |BASIC_RATE ; + priv->reg.rate_set.body[1 ] =TX_RATE_2M |BASIC_RATE ; + priv->reg.rate_set.body[0 ] =TX_RATE_1M |BASIC_RATE ; priv->reg.tx_rate =TX_RATE_FULL_AUTO ; priv->reg.rate_set.size =12 ;
@@ -257,7 +258,8 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv)if (request_firmware_direct (&fw_entry, cfg_file, dev))return 0 ; -DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , cfg_file, fw_entry->size); +DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , cfg_file, + fw_entry->size); cur_p = fw_entry->data; end_p = cur_p + fw_entry->size; *end_p ='\0' ;
@@ -266,7 +268,7 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv)int i, j, len; len = end_p - cur_p; -for (i=0 ; cfg_tbl[i].key_len !=0 ; i++) { +for (i =0 ; cfg_tbl[i].key_len !=0 ; i++) {if (*cur_p =='#' ) {break ; }
@@ -298,58 +300,64 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) } cur_p++; -for (j=0 ,wk_p=cur_p; *wk_p !='\n' && wk_p < end_p; j++,wk_p++) { +for (j =0 , wk_p = cur_p; *wk_p !='\n' && wk_p < end_p; + j++, wk_p++) { wk_buff[j] = *wk_p; } wk_buff[j] ='\0' ; cur_p = wk_p; -DPRINTK (4 ,"%s=%s\n" ,cfg_tbl[i].key, wk_buff); +DPRINTK (4 ,"%s=%s\n" , cfg_tbl[i].key, wk_buff); wk_p = wk_buff;switch (i) { -case 0 :/* "BeaconLostCount", "10" */ - priv->reg.beacon_lost_count =simple_strtol (wk_buff,NULL ,10 ); +case 0 :/* "BeaconLostCount", "10" */ + priv->reg.beacon_lost_count = +simple_strtol (wk_buff,NULL ,10 );break ; -case 1 :/* "Channel", "1" */ - priv->reg.channel =simple_strtol (wk_buff,NULL ,10 ); +case 1 :/* "Channel", "1" */ + priv->reg.channel = +simple_strtol (wk_buff,NULL ,10 );break ; -case 2 :/* "FragmentThreshold","2346" */ +case 2 :/* "FragmentThreshold","2346" */ j =simple_strtol (wk_buff,NULL ,10 ); priv->reg.fragment = (unsigned long )j;break ; -case 3 :/* "OperationMode","Infrastructure" */ +case 3 :/* "OperationMode","Infrastructure" */ switch (*wk_buff) {case 'P' : - priv->reg.operation_mode =MODE_PSEUDO_ADHOC ; + priv->reg.operation_mode = +MODE_PSEUDO_ADHOC ;break ;case 'I' : - priv->reg.operation_mode =MODE_INFRASTRUCTURE ; + priv->reg.operation_mode = +MODE_INFRASTRUCTURE ;break ;case '8' : priv->reg.operation_mode =MODE_ADHOC ;break ;default : - priv->reg.operation_mode =MODE_INFRASTRUCTURE ; + priv->reg.operation_mode = +MODE_INFRASTRUCTURE ; }break ; -case 4 :/* "PowerManagementMode","POWER_ACTIVE" */ +case 4 :/* "PowerManagementMode","POWER_ACTIVE" */ if (!strncmp (wk_buff,"SAVE1" ,5 )) { priv->reg.powermgt =POWMGT_SAVE1_MODE ; - }else if (!strncmp (wk_buff,"SAVE2" ,5 )){ + }else if (!strncmp (wk_buff,"SAVE2" ,5 )) { priv->reg.powermgt =POWMGT_SAVE2_MODE ; }else { priv->reg.powermgt =POWMGT_ACTIVE_MODE ; }break ; -case 5 :/* "RTSThreshold","2347" */ +case 5 :/* "RTSThreshold","2347" */ j =simple_strtol (wk_buff,NULL ,10 ); priv->reg.rts = (unsigned long )j;break ; -case 6 :/* "SSID","" */ +case 6 :/* "SSID","" */ if (*wk_p !='"' )break ; wk_p++; -for (j=0 ; *wk_p !='"' ; j++) { +for (j =0 ; *wk_p !='"' ; j++) {if (wk_p =='\0' ) {break ; }
@@ -359,45 +367,51 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) priv->reg.ssid.size = j; wk_p++;break ; -case 7 :/* "TxRate","Auto" */ +case 7 :/* "TxRate","Auto" */ rate_set_configuration (priv, wk_p);break ; -case 8 :/* "AuthenticationAlgorithm","OPEN_SYSTEM" */ +case 8 :/* "AuthenticationAlgorithm","OPEN_SYSTEM" */ switch (*wk_p) { -case 'O' :/* Authenticate System : Open System */ - priv->reg.authenticate_type =AUTH_TYPE_OPEN_SYSTEM ; +case 'O' :/* Authenticate System : Open System */ + priv->reg.authenticate_type = +AUTH_TYPE_OPEN_SYSTEM ;break ; -case 'S' :/* Authenticate System : Shared Key */ - priv->reg.authenticate_type =AUTH_TYPE_SHARED_KEY ; +case 'S' :/* Authenticate System : Shared Key */ + priv->reg.authenticate_type = +AUTH_TYPE_SHARED_KEY ;break ; }break ; -case 9 :/* "WepKeyValue1","" */ -case 10 :/* "WepKeyValue2","" */ -case 11 :/* "WepKeyValue3","" */ -case 12 :/* "WepKeyValue4","" */ +case 9 :/* "WepKeyValue1","" */ +case 10 :/* "WepKeyValue2","" */ +case 11 :/* "WepKeyValue3","" */ +case 12 :/* "WepKeyValue4","" */ if (wep_on_off !=WEP_OFF ) {switch (wep_type) {case WEP_KEY_CHARACTER : -analyze_character_wep_key (&priv->reg, (i-9 ), wk_p); +analyze_character_wep_key + (&priv->reg, (i -9 ), wk_p);break ;case WEP_KEY_HEX : -analyze_hex_wep_key (&priv->reg, (i-9 ), wk_p); +analyze_hex_wep_key (&priv->reg, + (i -9 ), + wk_p);break ; } }break ; -case 13 :/* "WepIndex","1"->0 (So, Zero Origin) */ - priv->reg.wep_index =simple_strtol (wk_buff,NULL ,10 ) -1 ; +case 13 :/* "WepIndex","1"->0 (So, Zero Origin) */ + priv->reg.wep_index = +simple_strtol (wk_buff,NULL ,10 ) -1 ;break ; -case 14 :/* "WepType","STRING" */ +case 14 :/* "WepType","STRING" */ if (!strncmp (wk_buff,"STRING" ,6 )) { wep_type =WEP_KEY_CHARACTER ; }else { wep_type =WEP_KEY_HEX ; }break ; -case 15 :/* "Wep","OFF" */ +case 15 :/* "Wep","OFF" */ if (!strncmp (wk_buff,"OFF" ,3 )) { priv->reg.privacy_invoked =0x00 ; wep_on_off =WEP_OFF ;
@@ -405,30 +419,30 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) priv->reg.privacy_invoked =0x01 ;if (*wk_buff =='6' ) {/* 64bit */ wep_on_off =WEP_ON_64BIT ; - }else {/* 128bit */ + }else {/* 128bit */ wep_on_off =WEP_ON_128BIT ; } }break ; -case 16 :/* "PREAMBLE_TYPE","LONG" */ +case 16 :/* "PREAMBLE_TYPE","LONG" */ if (!strncmp (wk_buff,"SHORT" ,5 )) { priv->reg.preamble =SHORT_PREAMBLE ; - }else {/* "LONG" */ + }else {/* "LONG" */ priv->reg.preamble =LONG_PREAMBLE ; }break ; -case 17 :/* "ScanType","ACTIVE_SCAN" */ +case 17 :/* "ScanType","ACTIVE_SCAN" */ if (!strncmp (wk_buff,"PASSIVE_SCAN" ,12 )) { priv->reg.scan_type =PASSIVE_SCAN ; - }else {/* "ACTIVE_SCAN" */ + }else {/* "ACTIVE_SCAN" */ priv->reg.scan_type =ACTIVE_SCAN ; }break ; -case 18 :// "ROM_FILE",ROMFILE +case 18 :// "ROM_FILE",ROMFILE if (*wk_p !='"' )break ; wk_p++; -for (j=0 ; *wk_p !='"' ; j++) { +for (j =0 ; *wk_p !='"' ; j++) {if (wk_p =='\0' ) {break ; }
@@ -437,25 +451,26 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) priv->reg.rom_file[j] ='\0' ; wk_p++;break ; -case 19 :/*"PhyType", "BG_MODE" */ +case 19 :/*"PhyType", "BG_MODE" */ if (!strncmp (wk_buff,"B_MODE" ,6 )) { priv->reg.phy_type =D_11B_ONLY_MODE ; }else if (!strncmp (wk_buff,"G_MODE" ,6 )) { priv->reg.phy_type =D_11G_ONLY_MODE ; }else { - priv->reg.phy_type =D_11BG_COMPATIBLE_MODE ; + priv->reg.phy_type = +D_11BG_COMPATIBLE_MODE ; }break ; -case 20 :/* "CtsMode", "FALSE" */ +case 20 :/* "CtsMode", "FALSE" */ if (!strncmp (wk_buff,"TRUE" ,4 )) { priv->reg.cts_mode =CTS_MODE_TRUE ; }else { priv->reg.cts_mode =CTS_MODE_FALSE ; }break ; -case 21 :/* "PhyInformationTimer", "0" */ +case 21 :/* "PhyInformationTimer", "0" */ j =simple_strtol (wk_buff,NULL ,10 ); - priv->reg.phy_info_timer = (uint16_t )j; + priv->reg.phy_info_timer = (uint16_t ) j;break ;default :break ;
@@ -469,17 +484,17 @@ int ks_wlan_read_config_file(struct ks_wlan_private *priv) }release_firmware (fw_entry); -DPRINTK (3 ,"\n operation_mode = %d\n channel = %d\n ssid = %s\n tx_rate = %d\n \ +DPRINTK (3 , +"\n operation_mode = %d\n channel = %d\n ssid = %s\n tx_rate = %d\n \ preamble = %d\n powermgt = %d\n scan_type = %d\n beacon_lost_count = %d\n rts = %d\n \ fragment = %d\n privacy_invoked = %d\n wep_type = %d\n wep_on_off = %d\n wep_index = %d\n romfile = %s\n" , - priv->reg.operation_mode,priv->reg.channel,&priv->reg.ssid.body[0 ],priv->reg.tx_rate, - priv->reg.preamble,priv->reg.powermgt,priv->reg.scan_type,priv->reg.beacon_lost_count, - priv->reg.rts,priv->reg.fragment,priv->reg.privacy_invoked,wep_type,wep_on_off,priv->reg.wep_index, - &priv->reg.rom_file[0 ] - ); -DPRINTK (3 ,"\n phy_type = %d\n cts_mode = %d\n tx_rate = %d\n phy_info_timer = %d\n" , - priv->reg.phy_type,priv->reg.cts_mode,priv->reg.tx_rate,priv->reg.phy_info_timer ); - -return (0 ); + priv->reg.operation_mode, priv->reg.channel, &priv->reg.ssid.body[0 ], priv->reg.tx_rate, priv->reg.preamble, priv->reg.powermgt, priv->reg.scan_type, priv->reg.beacon_lost_count, priv->reg.rts, priv->reg.fragment, priv->reg.privacy_invoked, wep_type, wep_on_off, + priv->reg.wep_index, &priv->reg.rom_file[0 ] + ); +DPRINTK (3 , +"\n phy_type = %d\n cts_mode = %d\n tx_rate = %d\n phy_info_timer = %d\n" , + priv->reg.phy_type, priv->reg.cts_mode, priv->reg.tx_rate, + priv->reg.phy_info_timer); + +return (0 ); } -
Signature · 1 line
2.8.1
PATCH v2 17/31 staging: ks7010: indent ks7010_sdio.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/ks7010_sdio.h | 64 +++++++++++++++++------------------- 1 file changed, 30 insertions(+), 34 deletions(-)
drivers/staging/ks7010/ks7010_sdio.h +30 -34
@@ -21,7 +21,7 @@#define DEVICE_ALIGNMENT 32/* SDIO KeyStream vendor and device */ -#define SDIO_VENDOR_ID_KS_CODE_A 0x005b +#define SDIO_VENDOR_ID_KS_CODE_A 0x005b#define SDIO_VENDOR_ID_KS_CODE_B 0x0023#define SDIO_DEVICE_ID_KS_7010 0x7910
@@ -48,8 +48,8 @@* for network packet (less than 2048 bytes data) */ #define WSTATUS_RSIZE 0x000014 -#define WSTATUS_MASK 0x80/* Write Status Register value */ -#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] */ +#define WSTATUS_MASK 0x80/* Write Status Register value */ +#define RSIZE_MASK 0x7F/* Read Data Size Register value [10:4] */ /* ARM to SD interrupt Enable */ #define INT_ENABLE 0x000020
@@ -88,52 +88,48 @@#define KS7010_IRAM_ADDRESS 0x06000000 -/* * struct define */ struct hw_info_t { -struct ks_sdio_card *sdio_card; +struct ks_sdio_card *sdio_card;struct completion ks7010_sdio_wait;struct workqueue_struct *ks7010sdio_wq;struct delayed_work rw_wq; -unsigned char *read_buf; +unsigned char *read_buf;struct tasklet_struct rx_bh_task; };struct ks_sdio_packet { -struct ks_sdio_packet *next; -u16 nb; -u8 buffer[0 ] __attribute__((aligned (4 ))); +struct ks_sdio_packet *next; +u16 nb; +u8 buffer[0 ] __attribute__ ((aligned (4 ))); }; -struct ks_sdio_card { -struct sdio_func *func; +struct sdio_func *func;struct ks_wlan_private *priv; -int model; -const char *firmware; -spinlock_t lock; +int model; +const char *firmware; +spinlock_t lock; }; - -/* Tx Device struct */ -#define TX_DEVICE_BUFF_SIZE 1024 +#define TX_DEVICE_BUFF_SIZE 1024struct tx_device_buffer { -unsigned char *sendp;/* pointer of send req data */ -unsigned int size; -void (*complete_handler)(void *arg1,void *arg2); -void *arg1; -void *arg2; +unsigned char *sendp;/* pointer of send req data */ +unsigned int size; +void (*complete_handler) (void *arg1,void *arg2); +void *arg1; +void *arg2; }; -struct tx_device { -struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE ]; -unsigned int qhead;/* tx buffer queue first pointer */ -unsigned int qtail;/* tx buffer queue last pointer */ -spinlock_t tx_dev_lock; +struct tx_device { +struct tx_device_buffer tx_dev_buff[TX_DEVICE_BUFF_SIZE ]; +unsigned int qhead;/* tx buffer queue first pointer */ +unsigned int qtail;/* tx buffer queue last pointer */ +spinlock_t tx_dev_lock; };/* Rx Device struct */
@@ -141,15 +137,15 @@ struct tx_device{#define RX_DEVICE_BUFF_SIZE 32struct rx_device_buffer { -unsigned char data[RX_DATA_SIZE ]; -unsigned int size; +unsigned char data[RX_DATA_SIZE ]; +unsigned int size; }; -struct rx_device { -struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE ]; -unsigned int qhead;/* rx buffer queue first pointer */ -unsigned int qtail;/* rx buffer queue last pointer */ -spinlock_t rx_dev_lock; +struct rx_device { +struct rx_device_buffer rx_dev_buff[RX_DEVICE_BUFF_SIZE ]; +unsigned int qhead;/* rx buffer queue first pointer */ +unsigned int qtail;/* rx buffer queue last pointer */ +spinlock_t rx_dev_lock; };#define ROM_FILE "ks7010sd.rom"#define CFG_FILE "ks79xx.cfg"
Signature · 1 line
2.8.1
PATCH v2 19/31 staging: ks7010: indent ks_hostif.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/ks_hostif.h | 525 ++++++++++++++++++------------------- 1 file changed, 262 insertions(+), 263 deletions(-)
drivers/staging/ks7010/ks_hostif.h +262 -263
@@ -62,141 +62,140 @@*/ struct hostif_hdr { -uint16_t size; -uint16_t event; -} __attribute__((packed)); +uint16_t size; +uint16_t event; +} __attribute__ ((packed));struct hostif_data_request_t {struct hostif_hdr header; -uint16_t auth_type; +uint16_t auth_type;#define TYPE_DATA 0x0000#define TYPE_AUTH 0x0001 -uint16_t reserved; -uint8_t data[0 ]; -} __attribute__((packed)); +uint16_t reserved; +uint8_t data[0 ]; +} __attribute__ ((packed));struct hostif_data_indication_t {struct hostif_hdr header; -uint16_t auth_type; +uint16_t auth_type;/* #define TYPE_DATA 0x0000 */ #define TYPE_PMK1 0x0001#define TYPE_GMK1 0x0002#define TYPE_GMK2 0x0003 -uint16_t reserved; -uint8_t data[0 ]; -} __attribute__((packed)); +uint16_t reserved; +uint8_t data[0 ]; +} __attribute__ ((packed));#define CHANNEL_LIST_MAX_SIZE 14struct channel_list_t { -uint8_t size; -uint8_t body[CHANNEL_LIST_MAX_SIZE ]; -uint8_t pad; -} __attribute__((packed)); +uint8_t size; +uint8_t body[CHANNEL_LIST_MAX_SIZE ]; +uint8_t pad; +} __attribute__ ((packed));/* MIB Attribute */ -#define DOT11_MAC_ADDRESS 0x21010100/* MAC Address (R) */ -#define DOT11_PRODUCT_VERSION 0x31024100/* FirmWare Version (R)*/ -#define DOT11_RTS_THRESHOLD 0x21020100/* RTS Threshold (R/W) */ -#define DOT11_FRAGMENTATION_THRESHOLD 0x21050100/* Fragment Threshold (R/W) */ -#define DOT11_PRIVACY_INVOKED 0x15010100/* WEP ON/OFF (W) */ -#define DOT11_WEP_DEFAULT_KEY_ID 0x15020100/* WEP Index (W) */ -#define DOT11_WEP_DEFAULT_KEY_VALUE1 0x13020101/* WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) */ -#define DOT11_WEP_DEFAULT_KEY_VALUE2 0x13020102/* WEP Key#2(TKIP AES: GroupKey1) (W) */ -#define DOT11_WEP_DEFAULT_KEY_VALUE3 0x13020103/* WEP Key#3(TKIP AES: GroupKey2) (W) */ -#define DOT11_WEP_DEFAULT_KEY_VALUE4 0x13020104/* WEP Key#4 (W) */ -#define DOT11_WEP_LIST 0x13020100/* WEP LIST */ -#define DOT11_DESIRED_SSID 0x11090100/* SSID */ -#define DOT11_CURRENT_CHANNEL 0x45010100/* channel set */ -#define DOT11_OPERATION_RATE_SET 0x11110100/* rate set */ - -#define LOCAL_AP_SEARCH_INTEAVAL 0xF1010100/* AP search interval (R/W) */ -#define LOCAL_CURRENTADDRESS 0xF1050100/* MAC Adress change (W) */ -#define LOCAL_MULTICAST_ADDRESS 0xF1060100/* Multicast Adress (W) */ -#define LOCAL_MULTICAST_FILTER 0xF1060200/* Multicast Adress Filter enable/disable (W) */ -#define LOCAL_SEARCHED_AP_LIST 0xF1030100/* AP list (R) */ -#define LOCAL_LINK_AP_STATUS 0xF1040100/* Link AP status (R) */ -#define LOCAL_PACKET_STATISTICS 0xF1020100/* tx,rx packets statistics */ -#define LOCAL_AP_SCAN_LIST_TYPE_SET 0xF1030200/* AP_SCAN_LIST_TYPE */ - -#define DOT11_RSN_ENABLED 0x15070100/* WPA enable/disable (W) */ -#define LOCAL_RSN_MODE 0x56010100/* RSN mode WPA/WPA2 (W) */ -#define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100/* GroupKeyCipherSuite (W) */ -#define DOT11_RSN_CONFIG_UNICAST_CIPHER 0x52020100/* PairwiseKeyCipherSuite (W) */ -#define DOT11_RSN_CONFIG_AUTH_SUITE 0x53020100/* AuthenticationKeyManagementSuite (W) */ -#define DOT11_RSN_CONFIG_VERSION 0x51020100/* RSN version (W) */ -#define LOCAL_RSN_CONFIG_ALL 0x5F010100/* RSN CONFIG ALL (W) */ -#define DOT11_PMK_TSC 0x55010100/* PMK_TSC (W) */ -#define DOT11_GMK1_TSC 0x55010101/* GMK1_TSC (W) */ -#define DOT11_GMK2_TSC 0x55010102/* GMK2_TSC (W) */ -#define DOT11_GMK3_TSC 0x55010103/* GMK3_TSC */ -#define LOCAL_PMK 0x58010100/* Pairwise Master Key cache (W) */ - -#define LOCAL_REGION 0xF10A0100/* Region setting */ +#define DOT11_MAC_ADDRESS 0x21010100/* MAC Address (R) */ +#define DOT11_PRODUCT_VERSION 0x31024100/* FirmWare Version (R) */ +#define DOT11_RTS_THRESHOLD 0x21020100/* RTS Threshold (R/W) */ +#define DOT11_FRAGMENTATION_THRESHOLD 0x21050100/* Fragment Threshold (R/W) */ +#define DOT11_PRIVACY_INVOKED 0x15010100/* WEP ON/OFF (W) */ +#define DOT11_WEP_DEFAULT_KEY_ID 0x15020100/* WEP Index (W) */ +#define DOT11_WEP_DEFAULT_KEY_VALUE1 0x13020101/* WEP Key#1(TKIP AES: PairwiseTemporalKey) (W) */ +#define DOT11_WEP_DEFAULT_KEY_VALUE2 0x13020102/* WEP Key#2(TKIP AES: GroupKey1) (W) */ +#define DOT11_WEP_DEFAULT_KEY_VALUE3 0x13020103/* WEP Key#3(TKIP AES: GroupKey2) (W) */ +#define DOT11_WEP_DEFAULT_KEY_VALUE4 0x13020104/* WEP Key#4 (W) */ +#define DOT11_WEP_LIST 0x13020100/* WEP LIST */ +#define DOT11_DESIRED_SSID 0x11090100/* SSID */ +#define DOT11_CURRENT_CHANNEL 0x45010100/* channel set */ +#define DOT11_OPERATION_RATE_SET 0x11110100/* rate set */ + +#define LOCAL_AP_SEARCH_INTEAVAL 0xF1010100/* AP search interval (R/W) */ +#define LOCAL_CURRENTADDRESS 0xF1050100/* MAC Adress change (W) */ +#define LOCAL_MULTICAST_ADDRESS 0xF1060100/* Multicast Adress (W) */ +#define LOCAL_MULTICAST_FILTER 0xF1060200/* Multicast Adress Filter enable/disable (W) */ +#define LOCAL_SEARCHED_AP_LIST 0xF1030100/* AP list (R) */ +#define LOCAL_LINK_AP_STATUS 0xF1040100/* Link AP status (R) */ +#define LOCAL_PACKET_STATISTICS 0xF1020100/* tx,rx packets statistics */ +#define LOCAL_AP_SCAN_LIST_TYPE_SET 0xF1030200/* AP_SCAN_LIST_TYPE */ + +#define DOT11_RSN_ENABLED 0x15070100/* WPA enable/disable (W) */ +#define LOCAL_RSN_MODE 0x56010100/* RSN mode WPA/WPA2 (W) */ +#define DOT11_RSN_CONFIG_MULTICAST_CIPHER 0x51040100/* GroupKeyCipherSuite (W) */ +#define DOT11_RSN_CONFIG_UNICAST_CIPHER 0x52020100/* PairwiseKeyCipherSuite (W) */ +#define DOT11_RSN_CONFIG_AUTH_SUITE 0x53020100/* AuthenticationKeyManagementSuite (W) */ +#define DOT11_RSN_CONFIG_VERSION 0x51020100/* RSN version (W) */ +#define LOCAL_RSN_CONFIG_ALL 0x5F010100/* RSN CONFIG ALL (W) */ +#define DOT11_PMK_TSC 0x55010100/* PMK_TSC (W) */ +#define DOT11_GMK1_TSC 0x55010101/* GMK1_TSC (W) */ +#define DOT11_GMK2_TSC 0x55010102/* GMK2_TSC (W) */ +#define DOT11_GMK3_TSC 0x55010103/* GMK3_TSC */ +#define LOCAL_PMK 0x58010100/* Pairwise Master Key cache (W) */ + +#define LOCAL_REGION 0xF10A0100/* Region setting */ #ifdef WPS -#define LOCAL_WPS_ENABLE 0xF10B0100/* WiFi Protected Setup */ -#define LOCAL_WPS_PROBE_REQ 0xF10C0100/* WPS Probe Request */ +#define LOCAL_WPS_ENABLE 0xF10B0100/* WiFi Protected Setup */ +#define LOCAL_WPS_PROBE_REQ 0xF10C0100/* WPS Probe Request */ #endif /* WPS */ -#define LOCAL_GAIN 0xF10D0100/* Carrer sense threshold for demo ato show */ -#define LOCAL_EEPROM_SUM 0xF10E0100/* EEPROM checksum information */ +#define LOCAL_GAIN 0xF10D0100/* Carrer sense threshold for demo ato show */ +#define LOCAL_EEPROM_SUM 0xF10E0100/* EEPROM checksum information */ struct hostif_mib_get_request_t {struct hostif_hdr header; -uint32_t mib_attribute; -} __attribute__((packed)); - +uint32_t mib_attribute; +} __attribute__ ((packed));struct hostif_mib_value_t { -uint16_t size; -uint16_t type; +uint16_t size; +uint16_t type;#define MIB_VALUE_TYPE_NULL 0#define MIB_VALUE_TYPE_INT 1#define MIB_VALUE_TYPE_BOOL 2#define MIB_VALUE_TYPE_COUNT32 3#define MIB_VALUE_TYPE_OSTRING 4 -uint8_t body[0 ]; -} __attribute__((packed)); +uint8_t body[0 ]; +} __attribute__ ((packed));struct hostif_mib_get_confirm_t {struct hostif_hdr header; -uint32_t mib_status; +uint32_t mib_status;#define MIB_SUCCESS 0#define MIB_INVALID 1#define MIB_READ_ONLY 2#define MIB_WRITE_ONLY 3 -uint32_t mib_attribute; +uint32_t mib_attribute;struct hostif_mib_value_t mib_value; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_mib_set_request_t {struct hostif_hdr header; -uint32_t mib_attribute; +uint32_t mib_attribute;struct hostif_mib_value_t mib_value; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_mib_set_confirm_t {struct hostif_hdr header; -uint32_t mib_status; -uint32_t mib_attribute; -} __attribute__((packed)); +uint32_t mib_status; +uint32_t mib_attribute; +} __attribute__ ((packed));struct hostif_power_mngmt_request_t {struct hostif_hdr header; -uint32_t mode; +uint32_t mode;#define POWER_ACTIVE 1#define POWER_SAVE 2 -uint32_t wake_up; +uint32_t wake_up;#define SLEEP_FALSE 0 -#define SLEEP_TRUE 1/* not used */ -uint32_t receiveDTIMs; +#define SLEEP_TRUE 1/* not used */ +uint32_t receiveDTIMs;#define DTIM_FALSE 0#define DTIM_TRUE 1 -} __attribute__((packed)); +} __attribute__ ((packed));/* power management mode */ enum { -POWMGT_ACTIVE_MODE =0 , +POWMGT_ACTIVE_MODE =0 ,POWMGT_SAVE1_MODE ,POWMGT_SAVE2_MODE };
@@ -209,84 +208,83 @@ enum {struct hostif_power_mngmt_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));struct hostif_start_request_t {struct hostif_hdr header; -uint16_t mode; +uint16_t mode;#define MODE_PSEUDO_ADHOC 0#define MODE_INFRASTRUCTURE 1 -#define MODE_AP 2/* not used */ +#define MODE_AP 2/* not used */ #define MODE_ADHOC 3 -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_start_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));#define SSID_MAX_SIZE 32struct ssid_t { -uint8_t size; -uint8_t body[SSID_MAX_SIZE ]; -uint8_t ssid_pad; -} __attribute__((packed)); +uint8_t size; +uint8_t body[SSID_MAX_SIZE ]; +uint8_t ssid_pad; +} __attribute__ ((packed));#define RATE_SET_MAX_SIZE 16struct rate_set8_t { -uint8_t size; -uint8_t body[8 ]; -uint8_t rate_pad; -} __attribute__((packed)); +uint8_t size; +uint8_t body[8 ]; +uint8_t rate_pad; +} __attribute__ ((packed));struct FhParms_t { -uint16_t dwellTime; -uint8_t hopSet; -uint8_t hopPattern; -uint8_t hopIndex; -} __attribute__((packed)); +uint16_t dwellTime; +uint8_t hopSet; +uint8_t hopPattern; +uint8_t hopIndex; +} __attribute__ ((packed));struct DsParms_t { -uint8_t channel; -} __attribute__((packed)); +uint8_t channel; +} __attribute__ ((packed));struct CfParms_t { -uint8_t count; -uint8_t period; -uint16_t maxDuration; -uint16_t durRemaining; -} __attribute__((packed)); +uint8_t count; +uint8_t period; +uint16_t maxDuration; +uint16_t durRemaining; +} __attribute__ ((packed));struct IbssParms_t { -uint16_t atimWindow; -} __attribute__((packed)); - +uint16_t atimWindow; +} __attribute__ ((packed));struct rsn_t { -uint8_t size; +uint8_t size;#define RSN_BODY_SIZE 64 -uint8_t body[RSN_BODY_SIZE ]; -} __attribute__((packed)); +uint8_t body[RSN_BODY_SIZE ]; +} __attribute__ ((packed));struct ErpParams_t {uint8_t erp_info; -} __attribute__((packed)); - -struct rate_set16_t { -uint8_t size; -uint8_t body[16 ]; -uint8_t rate_pad; -} __attribute__((packed)); - -struct ap_info_t { -uint8_t bssid[6 ];/* +00 */ -uint8_t rssi;/* +06 */ -uint8_t sq;/* +07 */ -uint8_t noise;/* +08 */ -uint8_t pad0;/* +09 */ -uint16_t beacon_period;/* +10 */ -uint16_t capability;/* +12 */ +} __attribute__ ((packed)); + +struct rate_set16_t { +uint8_t size; +uint8_t body[16 ]; +uint8_t rate_pad; +} __attribute__ ((packed)); + +struct ap_info_t { +uint8_t bssid[6 ];/* +00 */ +uint8_t rssi;/* +06 */ +uint8_t sq;/* +07 */ +uint8_t noise;/* +08 */ +uint8_t pad0;/* +09 */ +uint16_t beacon_period;/* +10 */ +uint16_t capability;/* +12 */ #define BSS_CAP_ESS (1<<0)#define BSS_CAP_IBSS (1<<1)#define BSS_CAP_CF_POLABLE (1<<2)
@@ -297,178 +295,176 @@ struct ap_info_t{#define BSS_CAP_CHANNEL_AGILITY (1<<7)#define BSS_CAP_SHORT_SLOT_TIME (1<<10)#define BSS_CAP_DSSS_OFDM (1<<13) -uint8_t frame_type;/* +14 */ -uint8_t ch_info;/* +15 */ +uint8_t frame_type;/* +14 */ +uint8_t ch_info;/* +15 */ #define FRAME_TYPE_BEACON 0x80#define FRAME_TYPE_PROBE_RESP 0x50 -uint16_t body_size;/* +16 */ -uint8_t body[1024 ];/* +18 */ -/* +1032 */ -} __attribute__((packed)); - -struct link_ap_info_t { -uint8_t bssid[6 ];/* +00 */ -uint8_t rssi;/* +06 */ -uint8_t sq;/* +07 */ -uint8_t noise;/* +08 */ -uint8_t pad0;/* +09 */ -uint16_t beacon_period;/* +10 */ -uint16_t capability;/* +12 */ -struct rate_set8_t rate_set;/* +14 */ -struct FhParms_t fh_parameter;/* +24 */ -struct DsParms_t ds_parameter;/* +29 */ -struct CfParms_t cf_parameter;/* +30 */ +uint16_t body_size;/* +16 */ +uint8_t body[1024 ];/* +18 */ +/* +1032 */ +} __attribute__ ((packed)); + +struct link_ap_info_t { +uint8_t bssid[6 ];/* +00 */ +uint8_t rssi;/* +06 */ +uint8_t sq;/* +07 */ +uint8_t noise;/* +08 */ +uint8_t pad0;/* +09 */ +uint16_t beacon_period;/* +10 */ +uint16_t capability;/* +12 */ +struct rate_set8_t rate_set;/* +14 */ +struct FhParms_t fh_parameter;/* +24 */ +struct DsParms_t ds_parameter;/* +29 */ +struct CfParms_t cf_parameter;/* +30 */ struct IbssParms_t ibss_parameter;/* +36 */ struct ErpParams_t erp_parameter;/* +38 */ -uint8_t pad1;/* +39 */ -struct rate_set8_t ext_rate_set;/* +40 */ -uint8_t DTIM_period;/* +50 */ -uint8_t rsn_mode;/* +51 */ +uint8_t pad1;/* +39 */ +struct rate_set8_t ext_rate_set;/* +40 */ +uint8_t DTIM_period;/* +50 */ +uint8_t rsn_mode;/* +51 */ #define RSN_MODE_NONE 0#define RSN_MODE_WPA 1#define RSN_MODE_WPA2 2struct { -uint8_t size;/* +52 */ -uint8_t body[128 ];/* +53 */ - } __attribute__((packed)) rsn; -} __attribute__((packed)); +uint8_t size;/* +52 */ +uint8_t body[128 ];/* +53 */ + } __attribute__ ((packed)) rsn; +} __attribute__ ((packed));struct hostif_connect_indication_t {struct hostif_hdr header; -uint16_t connect_code; +uint16_t connect_code;#define RESULT_CONNECT 0#define RESULT_DISCONNECT 1struct link_ap_info_t link_ap_info; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_stop_request_t {struct hostif_hdr header; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_stop_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));struct hostif_ps_adhoc_set_request_t {struct hostif_hdr header; -uint16_t phy_type; +uint16_t phy_type;#define D_11B_ONLY_MODE 0#define D_11G_ONLY_MODE 1#define D_11BG_COMPATIBLE_MODE 2#define D_11A_ONLY_MODE 3 -uint16_t cts_mode; +uint16_t cts_mode;#define CTS_MODE_FALSE 0#define CTS_MODE_TRUE 1 -uint16_t channel; +uint16_t channel;struct rate_set16_t rate_set; -uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 -* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ -uint16_t scan_type; -} __attribute__((packed)); +uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 +* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ +uint16_t scan_type; +} __attribute__ ((packed));struct hostif_ps_adhoc_set_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));struct hostif_infrastructure_set_request_t {struct hostif_hdr header; -uint16_t phy_type; -uint16_t cts_mode; +uint16_t phy_type; +uint16_t cts_mode;struct rate_set16_t rate_set;struct ssid_t ssid; -uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 -* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ -uint16_t beacon_lost_count; -uint16_t auth_type; +uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 +* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ +uint16_t beacon_lost_count; +uint16_t auth_type;#define AUTH_TYPE_OPEN_SYSTEM 0#define AUTH_TYPE_SHARED_KEY 1struct channel_list_t channel_list; -uint16_t scan_type; -} __attribute__((packed)); +uint16_t scan_type; +} __attribute__ ((packed));struct hostif_infrastructure_set2_request_t {struct hostif_hdr header; -uint16_t phy_type; -uint16_t cts_mode; +uint16_t phy_type; +uint16_t cts_mode;struct rate_set16_t rate_set;struct ssid_t ssid; -uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 -* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ -uint16_t beacon_lost_count; -uint16_t auth_type; +uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 +* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ +uint16_t beacon_lost_count; +uint16_t auth_type;#define AUTH_TYPE_OPEN_SYSTEM 0#define AUTH_TYPE_SHARED_KEY 1struct channel_list_t channel_list; -uint16_t scan_type; -uint8_t bssid[ETH_ALEN ]; -} __attribute__((packed)); - +uint16_t scan_type; +uint8_t bssid[ETH_ALEN ]; +} __attribute__ ((packed));struct hostif_infrastructure_set_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));struct hostif_adhoc_set_request_t {struct hostif_hdr header; -uint16_t phy_type; -uint16_t cts_mode; -uint16_t channel; +uint16_t phy_type; +uint16_t cts_mode; +uint16_t channel;struct rate_set16_t rate_set;struct ssid_t ssid; -uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 -* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ -uint16_t scan_type; -} __attribute__((packed)); +uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 +* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ +uint16_t scan_type; +} __attribute__ ((packed));struct hostif_adhoc_set2_request_t {struct hostif_hdr header; -uint16_t phy_type; -uint16_t cts_mode; -uint16_t reserved; +uint16_t phy_type; +uint16_t cts_mode; +uint16_t reserved;struct rate_set16_t rate_set;struct ssid_t ssid; -uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 -* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ -uint16_t scan_type; +uint16_t capability;/* bit5:preamble bit6:pbcc pbcc not supported always 0 +* bit10:ShortSlotTime bit13:DSSS-OFDM DSSS-OFDM not supported always 0 */ +uint16_t scan_type;struct channel_list_t channel_list; -uint8_t bssid[ETH_ALEN ]; -} __attribute__((packed)); +uint8_t bssid[ETH_ALEN ]; +} __attribute__ ((packed));struct hostif_adhoc_set_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); - +uint16_t result_code; +} __attribute__ ((packed));struct last_associate_t { -uint8_t type; -uint8_t status; -} __attribute__((packed)); +uint8_t type; +uint8_t status; +} __attribute__ ((packed));struct association_request_t { -uint8_t type; +uint8_t type;#define FRAME_TYPE_ASSOC_REQ 0x00#define FRAME_TYPE_REASSOC_REQ 0x20 -uint8_t pad; -uint16_t capability; -uint16_t listen_interval; -uint8_t ap_address[6 ]; -uint16_t reqIEs_size; -} __attribute__((packed)); +uint8_t pad; +uint16_t capability; +uint16_t listen_interval; +uint8_t ap_address[6 ]; +uint16_t reqIEs_size; +} __attribute__ ((packed));struct association_response_t { -uint8_t type; +uint8_t type;#define FRAME_TYPE_ASSOC_RESP 0x10#define FRAME_TYPE_REASSOC_RESP 0x30 -uint8_t pad; -uint16_t capability; -uint16_t status; -uint16_t association_id; -uint16_t respIEs_size; -} __attribute__((packed)); +uint8_t pad; +uint16_t capability; +uint16_t status; +uint16_t association_id; +uint16_t respIEs_size; +} __attribute__ ((packed));struct hostif_associate_indication_t {struct hostif_hdr header;
@@ -476,68 +472,68 @@ struct hostif_associate_indication_t {struct association_response_t assoc_resp;/* followed by (reqIEs_size + respIEs_size) octets of data */ /* reqIEs data *//* respIEs data */ -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_bss_scan_request_t {struct hostif_hdr header; -uint8_t scan_type; +uint8_t scan_type;#define ACTIVE_SCAN 0#define PASSIVE_SCAN 1 -uint8_t pad[3 ]; +uint8_t pad[3 ];uint32_t ch_time_min;uint32_t ch_time_max;struct channel_list_t channel_list;struct ssid_t ssid; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_bss_scan_confirm_t {struct hostif_hdr header; -uint16_t result_code; -uint16_t reserved; -} __attribute__((packed)); +uint16_t result_code; +uint16_t reserved; +} __attribute__ ((packed));struct hostif_phy_information_request_t {struct hostif_hdr header; -uint16_t type; +uint16_t type;#define NORMAL_TYPE 0#define TIME_TYPE 1 -uint16_t time;/* unit 100ms */ -} __attribute__((packed)); +uint16_t time;/* unit 100ms */ +} __attribute__ ((packed));struct hostif_phy_information_confirm_t {struct hostif_hdr header; -uint8_t rssi; -uint8_t sq; -uint8_t noise; -uint8_t link_speed; -uint32_t tx_frame; -uint32_t rx_frame; -uint32_t tx_error; -uint32_t rx_error; -} __attribute__((packed)); +uint8_t rssi; +uint8_t sq; +uint8_t noise; +uint8_t link_speed; +uint32_t tx_frame; +uint32_t rx_frame; +uint32_t tx_error; +uint32_t rx_error; +} __attribute__ ((packed));/* sleep mode */ #define SLP_ACTIVE 0#define SLP_SLEEP 1struct hostif_sleep_request_t {struct hostif_hdr header; -} __attribute__((packed)); +} __attribute__ ((packed));struct hostif_sleep_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));struct hostif_mic_failure_request_t {struct hostif_hdr header; -uint16_t failure_count; -uint16_t timer; -} __attribute__((packed)); +uint16_t failure_count; +uint16_t timer; +} __attribute__ ((packed));struct hostif_mic_failure_confirm_t {struct hostif_hdr header; -uint16_t result_code; -} __attribute__((packed)); +uint16_t result_code; +} __attribute__ ((packed));#define BASIC_RATE 0x80#define RATE_MASK 0x7F
@@ -557,13 +553,13 @@ struct hostif_mic_failure_confirm_t {#define TX_RATE_FIXED 5/* 11b rate */ -#define TX_RATE_1M (uint8_t)(10/5)/* 11b 11g basic rate */ -#define TX_RATE_2M (uint8_t)(20/5)/* 11b 11g basic rate */ -#define TX_RATE_5M (uint8_t)(55/5)/* 11g basic rate */ +#define TX_RATE_1M (uint8_t)(10/5)/* 11b 11g basic rate */ +#define TX_RATE_2M (uint8_t)(20/5)/* 11b 11g basic rate */ +#define TX_RATE_5M (uint8_t)(55/5)/* 11g basic rate */ #define TX_RATE_11M (uint8_t)(110/5)/* 11g basic rate */ /* 11g rate */ -#define TX_RATE_6M (uint8_t)(60/5)/* 11g basic rate */ +#define TX_RATE_6M (uint8_t)(60/5)/* 11g basic rate */ #define TX_RATE_12M (uint8_t)(120/5)/* 11g basic rate */ #define TX_RATE_24M (uint8_t)(240/5)/* 11g basic rate */ #define TX_RATE_9M (uint8_t)(90/5)
@@ -587,13 +583,13 @@ struct hostif_mic_failure_confirm_t { ((A&RATE_MASK)==TX_RATE_54M))enum { -CONNECT_STATUS =0 , +CONNECT_STATUS =0 ,DISCONNECT_STATUS };/* preamble type */ enum { -LONG_PREAMBLE =0 , +LONG_PREAMBLE =0 ,SHORT_PREAMBLE };
@@ -623,26 +619,29 @@ enum {#include "ks_wlan.h" /* function prototype */ -extern int hostif_data_request (struct ks_wlan_private *priv,struct sk_buff *packet ); -extern void hostif_receive (struct ks_wlan_private *priv,unsigned char *p,unsigned int size ); +extern int hostif_data_request (struct ks_wlan_private *priv, +struct sk_buff *packet); +extern void hostif_receive (struct ks_wlan_private *priv,unsigned char *p, +unsigned int size);extern void hostif_sme_enqueue (struct ks_wlan_private *priv,uint16_t event); -extern int hostif_init (struct ks_wlan_private *priv ); -extern void hostif_exit (struct ks_wlan_private *priv ); +extern int hostif_init (struct ks_wlan_private *priv); +extern void hostif_exit (struct ks_wlan_private *priv);static inline int hif_align_size (int size) {#ifdef KS_ATOM -if ( size <1024 ) +if (size <1024 ) size =1024 ;#endif #ifdef DEVICE_ALIGNMENT -return (size%DEVICE_ALIGNMENT ) ? size +DEVICE_ALIGNMENT - (size %DEVICE_ALIGNMENT ) : size; +return (size %DEVICE_ALIGNMENT ) ? size +DEVICE_ALIGNMENT - + (size %DEVICE_ALIGNMENT ) : size;#else return size;#endif } -#endif /* __KERNEL__ */ +#endif /* __KERNEL__ */ #endif /* _KS_HOSTIF_H_ */
Signature · 1 line
2.8.1
PATCH v2 20/31 staging: ks7010: indent ks_wlan.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/ks_wlan.h | 246 +++++++++++++++++++-------------------- 1 file changed, 121 insertions(+), 125 deletions(-)
drivers/staging/ks7010/ks_wlan.h +121 -125
@@ -22,16 +22,16 @@#include <linux/kernel.h> #include <linux/module.h> -#include <linux/spinlock.h> /* spinlock_t */ -#include <linux/sched.h> /* wait_queue_head_t */ -#include <linux/types.h> /* pid_t */ -#include <linux/netdevice.h> /* struct net_device_stats, struct sk_buff */ +#include <linux/spinlock.h> /* spinlock_t */ +#include <linux/sched.h> /* wait_queue_head_t */ +#include <linux/types.h> /* pid_t */ +#include <linux/netdevice.h> /* struct net_device_stats, struct sk_buff */ #include <linux/etherdevice.h> #include <linux/wireless.h> -#include <asm/atomic.h> /* struct atmic_t */ +#include <asm/atomic.h> /* struct atmic_t */ #include <linux/timer.h> /* struct timer_list */ #include <linux/string.h> -#include <linux/completion.h> /* struct completion */ +#include <linux/completion.h> /* struct completion */ #include <linux/workqueue.h> #include <asm/io.h>
@@ -46,37 +46,37 @@#endif struct ks_wlan_parameter { -uint8_t operation_mode;/* Operation Mode */ -uint8_t channel;/* Channel */ -uint8_t tx_rate;/* Transmit Rate */ +uint8_t operation_mode;/* Operation Mode */ +uint8_t channel;/* Channel */ +uint8_t tx_rate;/* Transmit Rate */ struct {uint8_t size;uint8_t body[16 ]; } rate_set; -uint8_t bssid[ETH_ALEN ];/* BSSID */ +uint8_t bssid[ETH_ALEN ];/* BSSID */ struct {uint8_t size; -uint8_t body[32 +1 ]; - } ssid;/* SSID */ -uint8_t preamble;/* Preamble */ -uint8_t powermgt;/* PowerManagementMode */ -uint32_t scan_type;/* AP List Scan Type */ +uint8_t body[32 +1 ]; + } ssid;/* SSID */ +uint8_t preamble;/* Preamble */ +uint8_t powermgt;/* PowerManagementMode */ +uint32_t scan_type;/* AP List Scan Type */ #define BEACON_LOST_COUNT_MIN 0#define BEACON_LOST_COUNT_MAX 65535 -uint32_t beacon_lost_count;/* Beacon Lost Count */ -uint32_t rts;/* RTS Threashold */ -uint32_t fragment;/* Fragmentation Threashold */ -uint32_t privacy_invoked; -uint32_t wep_index; +uint32_t beacon_lost_count;/* Beacon Lost Count */ +uint32_t rts;/* RTS Threashold */ +uint32_t fragment;/* Fragmentation Threashold */ +uint32_t privacy_invoked; +uint32_t wep_index;struct {uint8_t size; -uint8_t val[13 *2 +1 ]; +uint8_t val[13 *2 +1 ]; } wep_key[4 ]; -uint16_t authenticate_type; -uint16_t phy_type;/* 11b/11g/11bg mode type*/ -uint16_t cts_mode;/* for 11g/11bg mode cts mode */ -uint16_t phy_info_timer;/* phy information timer */ -char rom_file[256 ]; +uint16_t authenticate_type; +uint16_t phy_type;/* 11b/11g/11bg mode type */ +uint16_t cts_mode;/* for 11g/11bg mode cts mode */ +uint16_t phy_info_timer;/* phy information timer */ +char rom_file[256 ]; };enum {
@@ -157,7 +157,6 @@ enum {SME_START_REQUEST ,SME_GET_EEPROM_CKSUM , -SME_MIC_FAILURE_CONFIRM , SME_START_CONFIRM,
@@ -187,7 +186,7 @@ enum {SME_WEP_SET_CONFIRM ,SME_TERMINATE , - SME_EVENT_SIZE /* end */ + SME_EVENT_SIZE /* end */ };/* SME Status */
@@ -200,58 +199,58 @@ enum {#define SME_EVENT_BUFF_SIZE 128 -struct sme_info { -int sme_status; -int event_buff[SME_EVENT_BUFF_SIZE ]; -unsigned int qhead; -unsigned int qtail; +struct sme_info { +int sme_status; +int event_buff[SME_EVENT_BUFF_SIZE ]; +unsigned int qhead; +unsigned int qtail;#ifdef KS_WLAN_DEBUG -/* for debug */ +/* for debug */ unsigned int max_event_count;#endif -spinlock_t sme_spin; +spinlock_t sme_spin;unsigned long sme_flag; }; -struct hostt_t { -int buff[SME_EVENT_BUFF_SIZE ]; -unsigned int qhead; -unsigned int qtail; +struct hostt_t { +int buff[SME_EVENT_BUFF_SIZE ]; +unsigned int qhead; +unsigned int qtail; };#define RSN_IE_BODY_MAX 64struct rsn_ie_t { -uint8_t id;/* 0xdd = WPA or 0x30 = RSN */ -uint8_t size;/* max ? 255 ? */ -uint8_t body[RSN_IE_BODY_MAX ]; -} __attribute__((packed)); +uint8_t id;/* 0xdd = WPA or 0x30 = RSN */ +uint8_t size;/* max ? 255 ? */ +uint8_t body[RSN_IE_BODY_MAX ]; +} __attribute__ ((packed));#ifdef WPS #define WPS_IE_BODY_MAX 255struct wps_ie_t { -uint8_t id;/* 221 'dd <len> 00 50 F2 04' */ -uint8_t size;/* max ? 255 ? */ +uint8_t id;/* 221 'dd <len> 00 50 F2 04' */ +uint8_t size;/* max ? 255 ? */ uint8_t body[WPS_IE_BODY_MAX ]; -} __attribute__((packed)); +} __attribute__ ((packed));#endif /* WPS */ struct local_ap_t { -uint8_t bssid[6 ]; -uint8_t rssi; -uint8_t sq; +uint8_t bssid[6 ]; +uint8_t rssi; +uint8_t sq;struct { -uint8_t size; -uint8_t body[32 ]; -uint8_t ssid_pad; +uint8_t size; +uint8_t body[32 ]; +uint8_t ssid_pad; } ssid;struct { -uint8_t size; -uint8_t body[16 ]; -uint8_t rate_pad; +uint8_t size; +uint8_t body[16 ]; +uint8_t rate_pad; } rate_set; -uint16_t capability; -uint8_t channel; -uint8_t noise; +uint16_t capability; +uint8_t channel; +uint8_t noise;struct rsn_ie_t wpa_ie;struct rsn_ie_t rsn_ie;#ifdef WPS
@@ -263,19 +262,19 @@ struct local_ap_t {#define LOCAL_CURRENT_AP LOCAL_APLIST_MAXstruct local_aplist_t {int size; -struct local_ap_t ap[LOCAL_APLIST_MAX +1 ]; +struct local_ap_t ap[LOCAL_APLIST_MAX +1 ]; }; -struct local_gain_t { -uint8_t TxMode; -uint8_t RxMode; -uint8_t TxGain; -uint8_t RxGain; +struct local_gain_t { +uint8_t TxMode; +uint8_t RxMode; +uint8_t TxGain; +uint8_t RxGain; }; -struct local_eeprom_sum_t { -uint8_t type; -uint8_t result; +struct local_eeprom_sum_t { +uint8_t type; +uint8_t result; };enum {
@@ -285,7 +284,6 @@ enum { EEPROM_NG, }; -/* Power Save Status */ enum {PS_NONE ,
@@ -297,22 +295,22 @@ enum { };struct power_save_status_t { -atomic_t status;/* initialvalue 0 */ +atomic_t status;/* initialvalue 0 */ struct completion wakeup_wait; -atomic_t confirm_wait; -atomic_t snooze_guard; +atomic_t confirm_wait; +atomic_t snooze_guard; };struct sleep_status_t { -atomic_t status;/* initialvalue 0 */ -atomic_t doze_request; -atomic_t wakeup_request; +atomic_t status;/* initialvalue 0 */ +atomic_t doze_request; +atomic_t wakeup_request; };/* WPA */ struct scan_ext_t {unsigned int flag; -char ssid[IW_ESSID_MAX_SIZE +1 ]; +char ssid[IW_ESSID_MAX_SIZE +1 ]; };enum {
@@ -337,7 +335,7 @@ enum {#define CIPHER_ID_LEN 4 -enum { +enum {KEY_MGMT_802_1X ,KEY_MGMT_PSK ,KEY_MGMT_WPANONE ,
@@ -358,26 +356,26 @@ enum {#define MIC_KEY_SIZE 8struct wpa_key_t { -uint32_t ext_flags;/* IW_ENCODE_EXT_xxx */ -uint8_t tx_seq[IW_ENCODE_SEQ_MAX_SIZE ];/* LSB first */ -uint8_t rx_seq[IW_ENCODE_SEQ_MAX_SIZE ];/* LSB first */ -struct sockaddr addr;/* ff:ff:ff:ff:ff:ff for broadcast/multicast -* (group) keys or unicast address for -* individual keys */ -uint16_t alg; -uint16_t key_len;/* WEP: 5 or 13, TKIP: 32, CCMP: 16 */ -uint8_t key_val[IW_ENCODING_TOKEN_MAX ]; -uint8_t tx_mic_key[MIC_KEY_SIZE ]; -uint8_t rx_mic_key[MIC_KEY_SIZE ]; +uint32_t ext_flags;/* IW_ENCODE_EXT_xxx */ +uint8_t tx_seq[IW_ENCODE_SEQ_MAX_SIZE ];/* LSB first */ +uint8_t rx_seq[IW_ENCODE_SEQ_MAX_SIZE ];/* LSB first */ +struct sockaddr addr;/* ff:ff:ff:ff:ff:ff for broadcast/multicast +* (group) keys or unicast address for +* individual keys */ +uint16_t alg; +uint16_t key_len;/* WEP: 5 or 13, TKIP: 32, CCMP: 16 */ +uint8_t key_val[IW_ENCODING_TOKEN_MAX ]; +uint8_t tx_mic_key[MIC_KEY_SIZE ]; +uint8_t rx_mic_key[MIC_KEY_SIZE ]; };#define WPA_KEY_INDEX_MAX 4#define WPA_RX_SEQ_LEN 6struct mic_failure_t { -uint16_t failure;/* MIC Failure counter 0 or 1 or 2 */ -uint16_t counter;/* 1sec counter 0-60 */ -uint32_t last_failure_time; -int stop;/* stop flag */ +uint16_t failure;/* MIC Failure counter 0 or 1 or 2 */ +uint16_t counter;/* 1sec counter 0-60 */ +uint32_t last_failure_time; +int stop;/* stop flag */ };struct wpa_status_t {
@@ -401,36 +399,36 @@ struct pmk_list_t {struct list_head head;struct pmk_t {struct list_head list; -uint8_t bssid[ETH_ALEN ]; -uint8_t pmkid[IW_PMKID_LEN ]; +uint8_t bssid[ETH_ALEN ]; +uint8_t pmkid[IW_PMKID_LEN ]; } pmk[PMK_LIST_MAX ]; };#ifdef WPS struct wps_status_t { -int wps_enabled; -int ielen; -uint8_t ie[255 ]; +int wps_enabled; +int ielen; +uint8_t ie[255 ]; };#endif /* WPS */ struct ks_wlan_private { -struct hw_info_t ks_wlan_hw;/* hardware information */ +struct hw_info_t ks_wlan_hw;/* hardware information */ struct net_device *net_dev; -int reg_net;/* register_netdev */ +int reg_net;/* register_netdev */ struct net_device_stats nstats;struct iw_statistics wstats;struct completion confirm_wait; -/* trx device & sme */ +/* trx device & sme */ struct tx_device tx_dev;struct rx_device rx_dev; -struct sme_info sme_i; +struct sme_info sme_i;u8 *rxp; -unsigned int rx_size; +unsigned int rx_size;struct tasklet_struct sme_task;struct work_struct ks_wlan_wakeup_task;int scan_ind_count;
@@ -443,33 +441,33 @@ struct ks_wlan_private {struct sleep_status_t sleepstatus;struct wpa_status_t wpa;struct pmk_list_t pmklist; -/* wireless parameter */ +/* wireless parameter */ struct ks_wlan_parameter reg;uint8_t current_rate; -char nick[IW_ESSID_MAX_SIZE +1 ]; - -spinlock_t multicast_spin; +char nick[IW_ESSID_MAX_SIZE +1 ]; + +spinlock_t multicast_spin;spinlock_t dev_read_lock; -wait_queue_head_t devread_wait; +wait_queue_head_t devread_wait; -unsigned int need_commit;/* for ioctl */ +unsigned int need_commit;/* for ioctl */ -/* DeviceIoControl */ +/* DeviceIoControl */ int device_open_status;atomic_t event_count; -atomic_t rec_count; -int dev_count; +atomic_t rec_count; +int dev_count;#define DEVICE_STOCK_COUNT 20unsigned char *dev_data[DEVICE_STOCK_COUNT ];int dev_size[DEVICE_STOCK_COUNT ]; -/* ioctl : IOCTL_FIRMWARE_VERSION */ -unsigned char firmware_version[128 +1 ]; +/* ioctl : IOCTL_FIRMWARE_VERSION */ +unsigned char firmware_version[128 +1 ];int version_size; -int mac_address_valid;/* Mac Address Status */ +int mac_address_valid;/* Mac Address Status */ int dev_state;
@@ -478,35 +476,33 @@ struct ks_wlan_private {/* spinlock_t lock; */ #define FORCE_DISCONNECT 0x80000000#define CONNECT_STATUS_MASK 0x7FFFFFFF -uint32_t connect_status;/* connect status */ -int infra_status;/* Infractructure status */ +uint32_t connect_status;/* connect status */ +int infra_status;/* Infractructure status */ -uint8_t data_buff[0x1000 ]; +uint8_t data_buff[0x1000 ];uint8_t scan_ssid_len; -uint8_t scan_ssid[IW_ESSID_MAX_SIZE +1 ]; +uint8_t scan_ssid[IW_ESSID_MAX_SIZE +1 ];struct local_gain_t gain;#ifdef WPS struct net_device *l2_dev; -int l2_fd; +int l2_fd;struct wps_status_t wps;#endif /* WPS */ -uint8_t sleep_mode; +uint8_t sleep_mode;uint8_t region;struct local_eeprom_sum_t eeprom_sum;uint8_t eeprom_checksum; -struct hostt_t hostt; +struct hostt_t hostt;unsigned long last_doze;unsigned long last_wakeup; -uint sdio_error_count;/* SDIO error */ - uint wakeup_count; /* for detect wakeup loop */ - -}; - +uint sdio_error_count;/* SDIO error */ + uint wakeup_count; /* for detect wakeup loop */ +};#endif /* _KS_WLAN_H */
Signature · 1 line
2.8.1
PATCH v2 21/31 staging: ks7010: indent ks_wlan_ioctl.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/ks_wlan_ioctl.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/ks7010/ks_wlan_ioctl.h +6 -5
@@ -36,8 +36,8 @@#define KS_WLAN_GET_SCAN_TYPE SIOCIWFIRSTPRIV+13#define KS_WLAN_SET_RX_GAIN SIOCIWFIRSTPRIV+14#define KS_WLAN_GET_RX_GAIN SIOCIWFIRSTPRIV+15 -#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV+16/* unused */ -//#define KS_WLAN_SET_REGION SIOCIWFIRSTPRIV+17 +#define KS_WLAN_HOSTT SIOCIWFIRSTPRIV+16/* unused */ +//#define KS_WLAN_SET_REGION SIOCIWFIRSTPRIV+17 #define KS_WLAN_SET_BEACON_LOST SIOCIWFIRSTPRIV+18#define KS_WLAN_GET_BEACON_LOST SIOCIWFIRSTPRIV+19
@@ -51,8 +51,8 @@#define KS_WLAN_GET_CTS_MODE SIOCIWFIRSTPRIV+25/* SIOCIWFIRSTPRIV+26 */ /* SIOCIWFIRSTPRIV+27 */ -#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV+28/* sleep mode */ -#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV+29/* sleep mode */ +#define KS_WLAN_SET_SLEEP_MODE SIOCIWFIRSTPRIV+28/* sleep mode */ +#define KS_WLAN_GET_SLEEP_MODE SIOCIWFIRSTPRIV+29/* sleep mode */ /* SIOCIWFIRSTPRIV+30 */ /* SIOCIWFIRSTPRIV+31 */
@@ -62,7 +62,8 @@#include <linux/netdevice.h> extern int ks_wlan_read_config_file (struct ks_wlan_private *priv); -extern int ks_wlan_setup_parameter (struct ks_wlan_private *priv,unsigned int commit_flag); +extern int ks_wlan_setup_parameter (struct ks_wlan_private *priv, +unsigned int commit_flag);#endif /* __KERNEL__ */
Signature · 1 line
2.8.1
PATCH v2 23/31 staging: ks7010: indent michael_mic.c
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/michael_mic.c | 43 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 22 deletions(-)
drivers/staging/ks7010/michael_mic.c +21 -22
@@ -34,11 +34,11 @@A ->nBytesInM =0 ;static -void MichaelInitializeFunction (struct michel_mic_t *Mic,uint8_t *key ) +void MichaelInitializeFunction (struct michel_mic_t *Mic,uint8_t * key) {// Set the key - Mic->K0 =getUInt32 ( key ,0 ); - Mic->K1 =getUInt32 ( key ,4 ); + Mic->K0 =getUInt32 (key,0 ); + Mic->K1 =getUInt32 (key,4 );//clear(); MichaelClear (Mic);
@@ -56,11 +56,10 @@ do{ \L +=R ; \ }while (0 ) - static -void MichaelAppend (struct michel_mic_t *Mic,uint8_t *src,int nBytes ) +void MichaelAppend (struct michel_mic_t *Mic,uint8_t * src,int nBytes) { -int addlen ; +int addlen;if (Mic->nBytesInM) { addlen =4 - Mic->nBytesInM;if (addlen > nBytes)
@@ -73,13 +72,13 @@ void MichaelAppend( struct michel_mic_t *Mic, uint8_t *src, int nBytes )if (Mic->nBytesInM <4 )return ; - Mic->L ^=getUInt32 (Mic->M,0 ); + Mic->L ^=getUInt32 (Mic->M,0 );MichaelBlockFunction (Mic->L, Mic->R); Mic->nBytesInM =0 ; } -while (nBytes >=4 ){ - Mic->L ^=getUInt32 (src,0 ); +while (nBytes >=4 ) { + Mic->L ^=getUInt32 (src,0 );MichaelBlockFunction (Mic->L, Mic->R); src +=4 ; nBytes -=4 ;
@@ -92,7 +91,7 @@ void MichaelAppend( struct michel_mic_t *Mic, uint8_t *src, int nBytes ) }static -void MichaelGetMIC (struct michel_mic_t *Mic,uint8_t *dst ) +void MichaelGetMIC (struct michel_mic_t *Mic,uint8_t * dst) {uint8_t *data = Mic->M;switch (Mic->nBytesInM) {
@@ -107,24 +106,24 @@ void MichaelGetMIC( struct michel_mic_t *Mic, uint8_t *dst )break ;case 3 : Mic->L ^= data[0 ] | (data[1 ] <<8 ) | (data[2 ] <<16 ) | -0x5a000000 ; +0x5a000000 ;break ; }MichaelBlockFunction (Mic->L, Mic->R);MichaelBlockFunction (Mic->L, Mic->R);// The appendByte function has already computed the result. -putUInt32 ( dst,0 , Mic->L ); -putUInt32 ( dst,4 , Mic->R ); +putUInt32 (dst,0 , Mic->L); +putUInt32 (dst,4 , Mic->R);// Reset to the empty message. MichaelClear (Mic); } -void MichaelMICFunction (struct michel_mic_t *Mic,uint8_t *Key, -uint8_t *Data,int Len,uint8_t priority, -uint8_t *Result ) +void MichaelMICFunction (struct michel_mic_t *Mic,uint8_t * Key, +uint8_t * Data,int Len,uint8_t priority, +uint8_t * Result) { -uint8_t pad_data[4 ] = {priority,0 ,0 ,0 }; +uint8_t pad_data[4 ] = { priority,0 ,0 ,0 };// Compute the MIC value /* * IEEE802.11i page 47
@@ -135,9 +134,9 @@ void MichaelMICFunction( struct michel_mic_t *Mic, uint8_t *Key,* |DA|SA|Priority|0 |Data|M0|M1|M2|M3|M4|M5|M6|M7| * +--+--+--------+--+----+--+--+--+--+--+--+--+--+ */ -MichaelInitializeFunction ( Mic, Key ) ; -MichaelAppend ( Mic, (uint8_t *)Data,12 );/* |DA|SA| */ -MichaelAppend ( Mic, pad_data,4 );/* |Priority|0|0|0| */ -MichaelAppend ( Mic, (uint8_t *)(Data+12 ), Len -12 );/* |Data| */ -MichaelGetMIC ( Mic, Result ) ; +MichaelInitializeFunction (Mic, Key); +MichaelAppend (Mic, (uint8_t *) Data,12 );/* |DA|SA| */ +MichaelAppend (Mic, pad_data,4 );/* |Priority|0|0|0| */ +MichaelAppend (Mic, (uint8_t *) (Data +12 ), Len -12 );/* |Data| */ +MichaelGetMIC (Mic, Result); }
Signature · 1 line
2.8.1
PATCH v2 24/31 staging: ks7010: indent michael_mic.h
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
--- drivers/staging/ks7010/michael_mic.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/staging/ks7010/michael_mic.h +8 -8
@@ -16,14 +16,14 @@struct michel_mic_t {uint32_t K0;// Key uint32_t K1;// Key -uint32_t L;// Current state -uint32_t R;// Current state -uint8_t M[4 ];// Message accumulator (single word) -int nBytesInM;// # bytes in M -uint8_t Result[8 ]; +uint32_t L;// Current state +uint32_t R;// Current state +uint8_t M[4 ];// Message accumulator (single word) +int nBytesInM;// # bytes in M +uint8_t Result[8 ]; };extern -void MichaelMICFunction (struct michel_mic_t *Mic,uint8_t *Key, -uint8_t *Data,int Len,uint8_t priority, -uint8_t *Result ); +void MichaelMICFunction (struct michel_mic_t *Mic,uint8_t * Key, +uint8_t * Data,int Len,uint8_t priority, +uint8_t * Result);
Signature · 1 line
2.8.1
PATCH v2 25/31 staging: ks7010: indent ks7010_sdio.c
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Unlike the previous patches which are plain indent outcomes, this has some manual fixups to be not overly strict with the 80 char limit.
--- drivers/staging/ks7010/ks7010_sdio.c | 807 ++++++++++++++++++++--------------- 1 file changed, 460 insertions(+), 347 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +460 -347
@@ -30,31 +30,32 @@static int reg_net =0 ;static const struct sdio_device_id if_sdio_ids[] = { - {SDIO_DEVICE (SDIO_VENDOR_ID_KS_CODE_A ,SDIO_DEVICE_ID_KS_7010 ) }, - {SDIO_DEVICE (SDIO_VENDOR_ID_KS_CODE_B ,SDIO_DEVICE_ID_KS_7010 ) }, + {SDIO_DEVICE (SDIO_VENDOR_ID_KS_CODE_A ,SDIO_DEVICE_ID_KS_7010 )}, + {SDIO_DEVICE (SDIO_VENDOR_ID_KS_CODE_B ,SDIO_DEVICE_ID_KS_7010 )}, {/* all zero */ } };struct ks_sdio_model { -int model; -const char *firmware; +int model; +const char *firmware; };static struct ks_sdio_model ks_sdio_models[] = { - { -/* ks7010 */ - .model =0x10 , - .firmware ="ks7010sd.rom" , - }, + { +/* ks7010 */ + .model =0x10 , + .firmware ="ks7010sd.rom" , + }, }; -static int ks7910_sdio_probe (struct sdio_func *function,const struct sdio_device_id *device); +static int ks7910_sdio_probe (struct sdio_func *function, +const struct sdio_device_id *device);static void ks7910_sdio_remove (struct sdio_func *function);static void ks7010_rw_function (struct work_struct *work); -static int ks7010_sdio_read (struct ks_wlan_private *priv,unsigned int address, -unsigned char *buffer,int length ); -static int ks7010_sdio_write (struct ks_wlan_private *priv,unsigned int address, -unsigned char *buffer,int length ); +static int ks7010_sdio_read (struct ks_wlan_private *priv,unsigned int address, +unsigned char *buffer,int length); +static int ks7010_sdio_write (struct ks_wlan_private *priv,unsigned int address, +unsigned char *buffer,int length);/* macro */ #define inc_txqhead (priv) \
@@ -79,25 +80,25 @@ void ks_wlan_hw_sleep_doze_request(struct ks_wlan_private *priv)DPRINTK (4 ,"\n" );/* clear request */ -atomic_set (&priv->sleepstatus.doze_request,0 ); +atomic_set (&priv->sleepstatus.doze_request,0 ); -if (atomic_read (&priv->sleepstatus.status) ==0 ){ +if (atomic_read (&priv->sleepstatus.status) ==0 ) { rw_data =GCR_B_DOZE ; - retval =ks7010_sdio_write (priv,GCR_B , &rw_data,sizeof (rw_data)); -if (retval){ + retval = +ks7010_sdio_write (priv,GCR_B , &rw_data,sizeof (rw_data)); +if (retval) {DPRINTK (1 ," error : GCR_B=%02X\n" , rw_data); goto out; }DPRINTK (4 ,"PMG SET!! : GCR_B=%02X\n" , rw_data); -DPRINTK (3 ,"sleep_mode=SLP_SLEEP\n" ); +DPRINTK (3 ,"sleep_mode=SLP_SLEEP\n" );atomic_set (&priv->sleepstatus.status,1 ); - priv->last_doze = jiffies; - } -else { -DPRINTK (1 ,"sleep_mode=%d\n" ,priv->sleep_mode); + priv->last_doze = jiffies; + }else { +DPRINTK (1 ,"sleep_mode=%d\n" , priv->sleep_mode); } -out: + out: priv->sleep_mode =atomic_read (&priv->sleepstatus.status);return ; }
@@ -110,110 +111,126 @@ void ks_wlan_hw_sleep_wakeup_request(struct ks_wlan_private *priv)DPRINTK (4 ,"\n" );/* clear request */ -atomic_set (&priv->sleepstatus.wakeup_request,0 ); +atomic_set (&priv->sleepstatus.wakeup_request,0 ); -if (atomic_read (&priv->sleepstatus.status) ==1 ){ +if (atomic_read (&priv->sleepstatus.status) ==1 ) { rw_data =WAKEUP_REQ ; - retval =ks7010_sdio_write (priv,WAKEUP , &rw_data,sizeof (rw_data)); -if (retval){ + retval = +ks7010_sdio_write (priv,WAKEUP , &rw_data,sizeof (rw_data)); +if (retval) {DPRINTK (1 ," error : WAKEUP=%02X\n" , rw_data); goto out; }DPRINTK (4 ,"wake up : WAKEUP=%02X\n" , rw_data);atomic_set (&priv->sleepstatus.status,0 ); - priv->last_wakeup = jiffies; + priv->last_wakeup = jiffies; ++priv->wakeup_count; - } -else { -DPRINTK (1 ,"sleep_mode=%d\n" ,priv->sleep_mode); + }else { +DPRINTK (1 ,"sleep_mode=%d\n" , priv->sleep_mode); } -out: + out: priv->sleep_mode =atomic_read (&priv->sleepstatus.status);return ; } -void ks_wlan_hw_wakeup_request (struct ks_wlan_private *priv) {unsigned char rw_data;int retval;DPRINTK (4 ,"\n" ); -if (atomic_read (&priv->psstatus.status)==PS_SNOOZE ){ +if (atomic_read (&priv->psstatus.status) ==PS_SNOOZE ) { rw_data =WAKEUP_REQ ; - retval =ks7010_sdio_write (priv,WAKEUP , &rw_data,sizeof (rw_data)); -if (retval){ + retval = +ks7010_sdio_write (priv,WAKEUP , &rw_data,sizeof (rw_data)); +if (retval) {DPRINTK (1 ," error : WAKEUP=%02X\n" , rw_data); }DPRINTK (4 ,"wake up : WAKEUP=%02X\n" , rw_data); - priv->last_wakeup = jiffies; + priv->last_wakeup = jiffies; ++priv->wakeup_count; - } -else { -DPRINTK (1 ,"psstatus=%d\n" ,atomic_read (&priv->psstatus.status)); + }else { +DPRINTK (1 ,"psstatus=%d\n" , +atomic_read (&priv->psstatus.status)); } }int _ks_wlan_hw_power_save (struct ks_wlan_private *priv) { -int rc=0 ; +int rc =0 ;unsigned char rw_data;int retval; -if (priv->reg.powermgt ==POWMGT_ACTIVE_MODE ) +if (priv->reg.powermgt ==POWMGT_ACTIVE_MODE )return rc; -if (priv->reg.operation_mode ==MODE_INFRASTRUCTURE && - (priv->connect_status &CONNECT_STATUS_MASK )==CONNECT_STATUS ){ +if (priv->reg.operation_mode ==MODE_INFRASTRUCTURE && + (priv->connect_status &CONNECT_STATUS_MASK ) ==CONNECT_STATUS ) {//DPRINTK(1,"psstatus.status=%d\n",atomic_read(&priv->psstatus.status)); -if (priv->dev_state ==DEVICE_STATE_SLEEP ) { -switch (atomic_read (&priv->psstatus.status)){ -case PS_SNOOZE :/* 4 */ -break ; -default : -DPRINTK (5 ,"\n\ -psstatus.status=%d\n\ -psstatus.confirm_wait=%d\n\ -psstatus.snooze_guard=%d\n\ -cnt_txqbody=%d\n" , -atomic_read (&priv->psstatus.status), -atomic_read (&priv->psstatus.confirm_wait), -atomic_read (&priv->psstatus.snooze_guard), -cnt_txqbody (priv)); - -if (!atomic_read (&priv->psstatus.confirm_wait)&& - !atomic_read (&priv->psstatus.snooze_guard)&& - !cnt_txqbody (priv)){ - retval =ks7010_sdio_read (priv,INT_PENDING , &rw_data,sizeof (rw_data)); -if (retval){ -DPRINTK (1 ," error : INT_PENDING=%02X\n" , rw_data); -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); -break ; - } -if (!rw_data){ - rw_data =GCR_B_DOZE ; - retval =ks7010_sdio_write (priv,GCR_B , &rw_data,sizeof (rw_data)); -if (retval){ -DPRINTK (1 ," error : GCR_B=%02X\n" , rw_data); -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +if (priv->dev_state ==DEVICE_STATE_SLEEP ) { +switch (atomic_read (&priv->psstatus.status)) { +case PS_SNOOZE :/* 4 */ +break ; +default : +DPRINTK (5 ,"\npsstatus.status=%d\npsstatus.confirm_wait=%d\npsstatus.snooze_guard=%d\ncnt_txqbody=%d\n" , +atomic_read (&priv->psstatus.status), +atomic_read (&priv->psstatus.confirm_wait), +atomic_read (&priv->psstatus.snooze_guard), +cnt_txqbody (priv)); + +if (!atomic_read (&priv->psstatus.confirm_wait) + && !atomic_read (&priv->psstatus.snooze_guard) + && !cnt_txqbody (priv)) { + retval = +ks7010_sdio_read (priv,INT_PENDING , + &rw_data, +sizeof (rw_data)); +if (retval) { +DPRINTK (1 , +" error : INT_PENDING=%02X\n" , + rw_data); +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 );break ; } -DPRINTK (4 ,"PMG SET!! : GCR_B=%02X\n" , rw_data); -atomic_set (&priv->psstatus.status,PS_SNOOZE ); -DPRINTK (3 ,"psstatus.status=PS_SNOOZE\n" ); - } -else { -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +if (!rw_data) { + rw_data =GCR_B_DOZE ; + retval = +ks7010_sdio_write (priv, +GCR_B , + &rw_data, +sizeof (rw_data)); +if (retval) { +DPRINTK (1 , +" error : GCR_B=%02X\n" , + rw_data); +queue_delayed_work + (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 ); +break ; + } +DPRINTK (4 , +"PMG SET!! : GCR_B=%02X\n" , + rw_data); +atomic_set (&priv->psstatus. + status,PS_SNOOZE ); +DPRINTK (3 , +"psstatus.status=PS_SNOOZE\n" ); + }else { +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 ); + } + }else { +queue_delayed_work (priv->ks_wlan_hw. + ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq, +0 ); } +break ; } -else { -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,0 ); - } -break ; } - } }
@@ -222,7 +239,8 @@ int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)int ks_wlan_hw_power_save (struct ks_wlan_private *priv) { -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 );return 0 ; }
@@ -234,16 +252,16 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address, card = priv->ks_wlan_hw.sdio_card; -if (length ==1 )/* CMD52 */ +if (length ==1 )/* CMD52 */ *buffer =sdio_readb (card->func, address, &rc); -else /* CMD53 multi-block transfer */ +else /* CMD53 multi-block transfer */ rc =sdio_memcpy_fromio (card->func, buffer, address, length); -if (rc !=0 ){ +if (rc !=0 ) {printk ("sdio error erorr=%d size=%d\n" , rc, length); ++priv->sdio_error_count; - }else { - priv->sdio_error_count=0 ; + }else { + priv->sdio_error_count =0 ; }return rc;
@@ -257,40 +275,42 @@ static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int address, card = priv->ks_wlan_hw.sdio_card; -if (length ==1 )/* CMD52 */ -sdio_writeb (card->func, *buffer, (unsigned int ) address, &rc); -else /* CMD53 */ - rc =sdio_memcpy_toio (card->func, (unsigned int ) address, buffer, length); +if (length ==1 )/* CMD52 */ +sdio_writeb (card->func, *buffer, (unsigned int )address, &rc); +else /* CMD53 */ + rc =sdio_memcpy_toio (card->func, (unsigned int )address, buffer, + length); -if (rc !=0 ){ +if (rc !=0 ) {printk ("sdio error erorr=%d size=%d\n" , rc, length); ++priv->sdio_error_count; - }else { - priv->sdio_error_count=0 ; + }else { + priv->sdio_error_count =0 ; }return rc; } -static int enqueue_txdev (struct ks_wlan_private *priv,unsigned char *p,unsigned long size, -void (*complete_handler)(void *arg1,void *arg2), -void *arg1,void *arg2 ) +static int enqueue_txdev (struct ks_wlan_private *priv,unsigned char *p, +unsigned long size, +void (*complete_handler) (void *arg1,void *arg2), +void *arg1,void *arg2) {struct tx_device_buffer *sp;if (priv->dev_state <DEVICE_STATE_BOOT ) {kfree (p);if (complete_handler !=NULL ) - (*complete_handler)(arg1, arg2); + (*complete_handler) (arg1, arg2);return 1 ; } -if ((TX_DEVICE_BUFF_SIZE -1 ) <=cnt_txqbody (priv)) { +if ((TX_DEVICE_BUFF_SIZE -1 ) <=cnt_txqbody (priv)) {/* in case of buffer overflow */ -DPRINTK (1 ,"tx buffer overflow\n" ); +DPRINTK (1 ,"tx buffer overflow\n" );kfree (p);if (complete_handler !=NULL ) - (*complete_handler)(arg1, arg2); + (*complete_handler) (arg1, arg2);return 1 ; }
@@ -306,29 +326,31 @@ static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p, unsigne }/* write data */ -static int write_to_device (struct ks_wlan_private *priv,unsigned char *buffer,unsigned long size ) +static int write_to_device (struct ks_wlan_private *priv,unsigned char *buffer, +unsigned long size) { -int rc,retval; +int rc, retval;unsigned char rw_data;struct hostif_hdr *hdr; hdr = (struct hostif_hdr *)buffer; - rc=0 ; + rc =0 ; -DPRINTK (4 ,"size=%d\n" , hdr->size); -if (hdr->event <HIF_DATA_REQ ||HIF_REQ_MAX < hdr->event){ -DPRINTK (1 ,"unknown event=%04X\n" ,hdr->event); +DPRINTK (4 ,"size=%d\n" , hdr->size); +if (hdr->event <HIF_DATA_REQ ||HIF_REQ_MAX < hdr->event) { +DPRINTK (1 ,"unknown event=%04X\n" , hdr->event);return 0 ; } retval =ks7010_sdio_write (priv,DATA_WINDOW , buffer, size); -if (retval){ +if (retval) {DPRINTK (1 ," write error : retval=%d\n" , retval);return -4 ; } rw_data =WRITE_STATUS_BUSY ; - retval =ks7010_sdio_write (priv,WRITE_STATUS , &rw_data,sizeof (rw_data)); -if (retval){ + retval = +ks7010_sdio_write (priv,WRITE_STATUS , &rw_data,sizeof (rw_data)); +if (retval) {DPRINTK (1 ," error : WRITE_STATUS=%02X\n" , rw_data);return -3 ; }
@@ -339,74 +361,80 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,static void tx_device_task (void *dev) {struct ks_wlan_private *priv = (struct ks_wlan_private *)dev; -struct tx_device_buffer *sp; +struct tx_device_buffer *sp;int rc =0 ;DPRINTK (4 ,"\n" ); -if (cnt_txqbody (priv)>0 &&atomic_read (&priv->psstatus.status) !=PS_SNOOZE ){ +if (cnt_txqbody (priv) >0 + &&atomic_read (&priv->psstatus.status) !=PS_SNOOZE ) { sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; -if (priv->dev_state >=DEVICE_STATE_BOOT ){ +if (priv->dev_state >=DEVICE_STATE_BOOT ) { rc =write_to_device (priv, sp->sendp, sp->size); -if (rc){ -DPRINTK (1 ,"write_to_device error !!(%d)\n" , rc); -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +if (rc) { +DPRINTK (1 ,"write_to_device error !!(%d)\n" , + rc); +queue_delayed_work (priv->ks_wlan_hw. + ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 );return ; } } -kfree (sp->sendp);/* allocated memory free */ -if (sp->complete_handler !=NULL )/* TX Complete */ - (*sp->complete_handler)(sp->arg1, sp->arg2); +kfree (sp->sendp);/* allocated memory free */ +if (sp->complete_handler !=NULL )/* TX Complete */ + (*sp->complete_handler) (sp->arg1, sp->arg2);inc_txqhead (priv); -if (cnt_txqbody (priv)>0 ){ -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,0 ); +if (cnt_txqbody (priv) >0 ) { +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,0 ); } }return ; } -int ks_wlan_hw_tx (struct ks_wlan_private *priv,void *p,unsigned long size, -void (*complete_handler)(void *arg1,void *arg2), -void *arg1,void *arg2 ) +int ks_wlan_hw_tx (struct ks_wlan_private *priv,void *p,unsigned long size, +void (*complete_handler) (void *arg1,void *arg2), +void *arg1,void *arg2) { -int result=0 ; +int result =0 ;struct hostif_hdr *hdr; hdr = (struct hostif_hdr *)p; -if (hdr->event <HIF_DATA_REQ ||HIF_REQ_MAX < hdr->event){ -DPRINTK (1 ,"unknown event=%04X\n" ,hdr->event); +if (hdr->event <HIF_DATA_REQ ||HIF_REQ_MAX < hdr->event) { +DPRINTK (1 ,"unknown event=%04X\n" , hdr->event);return 0 ; }/* add event to hostt buffer */ priv->hostt.buff[priv->hostt.qtail] = hdr->event; - priv->hostt.qtail = (priv->hostt.qtail +1 ) %SME_EVENT_BUFF_SIZE ; + priv->hostt.qtail = (priv->hostt.qtail +1 ) %SME_EVENT_BUFF_SIZE ; -DPRINTK (4 ,"event=%04X\n" ,hdr->event); +DPRINTK (4 ,"event=%04X\n" , hdr->event);spin_lock (&priv->tx_dev.tx_dev_lock); result =enqueue_txdev (priv, p, size, complete_handler, arg1, arg2);spin_unlock (&priv->tx_dev.tx_dev_lock); -if (cnt_txqbody (priv)>0 ){ -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,0 ); +if (cnt_txqbody (priv) >0 ) { +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,0 ); }return result; }static void rx_event_task (unsigned long dev) { -struct ks_wlan_private *priv = (struct ks_wlan_private *)dev; -struct rx_device_buffer *rp; +struct ks_wlan_private *priv = (struct ks_wlan_private *)dev; +struct rx_device_buffer *rp; -DPRINTK (4 ,"\n" ); +DPRINTK (4 ,"\n" ); -if (cnt_rxqbody (priv) >0 && priv->dev_state >=DEVICE_STATE_BOOT ){ +if (cnt_rxqbody (priv) >0 && priv->dev_state >=DEVICE_STATE_BOOT ) { rp = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qhead];hostif_receive (priv, rp->data, rp->size);inc_rxqhead (priv); -if (cnt_rxqbody (priv) >0 ){ +if (cnt_rxqbody (priv) >0 ) {tasklet_schedule (&priv->ks_wlan_hw.rx_bh_task); } }
@@ -420,35 +448,40 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)int retval;struct rx_device_buffer *rx_buffer;struct hostif_hdr *hdr; -unsigned char read_status; -unsigned short event=0 ; +unsigned char read_status; +unsigned short event =0 ; -DPRINTK (4 ,"\n" ); +DPRINTK (4 ,"\n" );/* receive data */ -if (cnt_rxqbody (priv) >= (RX_DEVICE_BUFF_SIZE -1 )) { +if (cnt_rxqbody (priv) >= (RX_DEVICE_BUFF_SIZE -1 )) {/* in case of buffer overflow */ -DPRINTK (1 ,"rx buffer overflow \n" ); +DPRINTK (1 ,"rx buffer overflow \n" ); goto error_out; } rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail]; - retval =ks7010_sdio_read (priv,DATA_WINDOW , &rx_buffer->data[0 ],hif_align_size (size)); -if (retval){ + retval = +ks7010_sdio_read (priv,DATA_WINDOW , &rx_buffer->data[0 ], +hif_align_size (size)); +if (retval) { goto error_out; }/* length check */ -if (size >2046 || size ==0 ){ +if (size >2046 || size ==0 ) {#ifdef KS_WLAN_DEBUG if (KS_WLAN_DEBUG >5 ) -print_hex_dump_bytes ("INVALID DATA dump: " ,DUMP_PREFIX_OFFSET , +print_hex_dump_bytes ("INVALID DATA dump: " , +DUMP_PREFIX_OFFSET , rx_buffer->data,32 );#endif /* rx_status update */ read_status =READ_STATUS_IDLE ; - retval =ks7010_sdio_write (priv,READ_STATUS , &read_status,sizeof (read_status)); -if (retval){ + retval = +ks7010_sdio_write (priv,READ_STATUS , &read_status, +sizeof (read_status)); +if (retval) {DPRINTK (1 ," error : READ_STATUS=%02X\n" , read_status); } goto error_out;
@@ -461,14 +494,16 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)/* read status update */ read_status =READ_STATUS_IDLE ; - retval =ks7010_sdio_write (priv,READ_STATUS , &read_status,sizeof (read_status)); -if (retval){ + retval = +ks7010_sdio_write (priv,READ_STATUS , &read_status, +sizeof (read_status)); +if (retval) {DPRINTK (1 ," error : READ_STATUS=%02X\n" , read_status); }DPRINTK (4 ,"READ_STATUS=%02X\n" , read_status); -if (atomic_read (&priv->psstatus.confirm_wait)){ -if (IS_HIF_CONF (event)){ +if (atomic_read (&priv->psstatus.confirm_wait)) { +if (IS_HIF_CONF (event)) {DPRINTK (4 ,"IS_HIF_CONF true !!\n" );atomic_dec (&priv->psstatus.confirm_wait); }
@@ -477,7 +512,7 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)/* rx_event_task((void *)priv); */ tasklet_schedule (&priv->ks_wlan_hw.rx_bh_task); -error_out: + error_out:return ; }
@@ -491,71 +526,74 @@ static void ks7010_rw_function(struct work_struct *work) hw = container_of(work, struct hw_info_t, rw_wq.work); priv = container_of(hw, struct ks_wlan_private, ks_wlan_hw); -DPRINTK (4 ,"\n" ); - +DPRINTK (4 ,"\n" ); -/* wiat after DOZE */ -if (time_after (priv->last_doze + ((30 *HZ )/1000 ), jiffies )){ -DPRINTK (4 ,"wait after DOZE \n" ); -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +/* wiat after DOZE */ +if (time_after (priv->last_doze + ((30 *HZ ) /1000 ), jiffies)) { +DPRINTK (4 ,"wait after DOZE \n" ); +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 );return ; }/* wiat after WAKEUP */ -while (time_after (priv->last_wakeup + ((30 *HZ )/1000 ), jiffies )){ +while (time_after (priv->last_wakeup + ((30 *HZ ) /1000 ), jiffies)) {DPRINTK (4 ,"wait after WAKEUP \n" );/* queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, (priv->last_wakeup + ((30*HZ)/1000) - jiffies));*/ -printk ("wake: %lu %lu\n" , priv->last_wakeup + (30 *HZ )/1000 , jiffies); +printk ("wake: %lu %lu\n" , priv->last_wakeup + (30 *HZ ) /1000 , + jiffies);msleep (30 ); }sdio_claim_host (priv->ks_wlan_hw.sdio_card->func);/* power save wakeup */ -if (atomic_read (&priv->psstatus.status)==PS_SNOOZE ){ -if (cnt_txqbody (priv)>0 ){ +if (atomic_read (&priv->psstatus.status) ==PS_SNOOZE ) { +if (cnt_txqbody (priv) >0 ) {ks_wlan_hw_wakeup_request (priv); -queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,1 ); +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,1 ); } goto err_out; }/* sleep mode doze */ -if (atomic_read (&priv->sleepstatus.doze_request)==1 ){ +if (atomic_read (&priv->sleepstatus.doze_request) ==1 ) {ks_wlan_hw_sleep_doze_request (priv); goto err_out; }/* sleep mode wakeup */ -if (atomic_read (&priv->sleepstatus.wakeup_request)==1 ){ +if (atomic_read (&priv->sleepstatus.wakeup_request) ==1 ) {ks_wlan_hw_sleep_wakeup_request (priv); goto err_out; }/* read (WriteStatus/ReadDataSize FN1:00_0014) */ - retval =ks7010_sdio_read (priv,WSTATUS_RSIZE , &rw_data,sizeof (rw_data)); -if (retval){ -DPRINTK (1 ," error : WSTATUS_RSIZE=%02X psstatus=%d\n" , rw_data,atomic_read (&priv->psstatus.status)); + retval = +ks7010_sdio_read (priv,WSTATUS_RSIZE , &rw_data,sizeof (rw_data)); +if (retval) { +DPRINTK (1 ," error : WSTATUS_RSIZE=%02X psstatus=%d\n" , rw_data, +atomic_read (&priv->psstatus.status)); goto err_out; }DPRINTK (4 ,"WSTATUS_RSIZE=%02X\n" , rw_data); -if (rw_data&RSIZE_MASK ){/* Read schedule */ -ks_wlan_hw_rx ((void *)priv, (uint16_t )(((rw_data&RSIZE_MASK )<<4 ))); +if (rw_data &RSIZE_MASK ) {/* Read schedule */ +ks_wlan_hw_rx ((void *)priv, + (uint16_t ) (((rw_data &RSIZE_MASK ) <<4 ))); } -if ((rw_data&WSTATUS_MASK )){ +if ((rw_data &WSTATUS_MASK )) {tx_device_task ((void *)priv); }_ks_wlan_hw_power_save (priv); -err_out: + err_out:sdio_release_host (priv->ks_wlan_hw.sdio_card->func);return ; } - -static void ks_sdio_interrupt (struct sdio_func *func) {int retval;
@@ -567,10 +605,12 @@ static void ks_sdio_interrupt(struct sdio_func *func) priv = card->priv;DPRINTK (4 ,"\n" ); -if (priv->dev_state >=DEVICE_STATE_BOOT ){ - retval =ks7010_sdio_read (priv,INT_PENDING , &status,sizeof (status)); -if (retval){ -DPRINTK (1 ,"read INT_PENDING Failed!!(%d)\n" ,retval); +if (priv->dev_state >=DEVICE_STATE_BOOT ) { + retval = +ks7010_sdio_read (priv,INT_PENDING , &status, +sizeof (status)); +if (retval) { +DPRINTK (1 ,"read INT_PENDING Failed!!(%d)\n" , retval); goto intr_out; }DPRINTK (4 ,"INT_PENDING=%02X\n" , rw_data);
@@ -580,70 +620,89 @@ static void ks_sdio_interrupt(struct sdio_func *func)/* read (General Communication B register) */ /* bit5 -> Write Status Idle */ /* bit2 -> Read Status Busy */ -if (status&INT_GCR_B ||atomic_read (&priv->psstatus.status)==PS_SNOOZE ){ - retval =ks7010_sdio_read (priv,GCR_B , &rw_data,sizeof (rw_data)); -if (retval){ +if (status &INT_GCR_B + ||atomic_read (&priv->psstatus.status) ==PS_SNOOZE ) { + retval = +ks7010_sdio_read (priv,GCR_B , &rw_data, +sizeof (rw_data)); +if (retval) {DPRINTK (1 ," error : GCR_B=%02X\n" , rw_data); goto intr_out; }/* DPRINTK(1, "GCR_B=%02X\n", rw_data); */ -if (rw_data ==GCR_B_ACTIVE ){ -if (atomic_read (&priv->psstatus.status)==PS_SNOOZE ){ -atomic_set (&priv->psstatus.status,PS_WAKEUP ); - priv->wakeup_count=0 ; +if (rw_data ==GCR_B_ACTIVE ) { +if (atomic_read (&priv->psstatus.status) == +PS_SNOOZE ) { +atomic_set (&priv->psstatus.status, +PS_WAKEUP ); + priv->wakeup_count =0 ; }complete (&priv->psstatus.wakeup_wait); } - } - do{ +do {/* read (WriteStatus/ReadDataSize FN1:00_0014) */ - retval = ks7010_sdio_read(priv, WSTATUS_RSIZE, &rw_data, sizeof(rw_data)); - if(retval){ - DPRINTK(1, " error : WSTATUS_RSIZE=%02X\n", rw_data); + retval = +ks7010_sdio_read (priv,WSTATUS_RSIZE , &rw_data, +sizeof (rw_data)); +if (retval) { +DPRINTK (1 ," error : WSTATUS_RSIZE=%02X\n" , + rw_data); goto intr_out; }DPRINTK (4 ,"WSTATUS_RSIZE=%02X\n" , rw_data); - rsize=rw_data&RSIZE_MASK; - if(rsize){ /* Read schedule */ - ks_wlan_hw_rx((void *)priv, (uint16_t)(((rsize)<<4))); + rsize = rw_data &RSIZE_MASK ; +if (rsize) {/* Read schedule */ +ks_wlan_hw_rx ((void *)priv, + (uint16_t ) (((rsize) <<4 ))); } - if(rw_data&WSTATUS_MASK){ +if (rw_data &WSTATUS_MASK ) {#if 0 - if(status&INT_WRITE_STATUS && !cnt_txqbody(priv)){ +if (status &INT_WRITE_STATUS + && !cnt_txqbody (priv)) {/* dummy write for interrupt clear */ - rw_data =0; - retval = ks7010_sdio_write(priv, DATA_WINDOW, &rw_data, sizeof(rw_data)); + rw_data =0 ; + retval = +ks7010_sdio_write (priv,DATA_WINDOW , + &rw_data, +sizeof (rw_data));if (retval) { - DPRINTK(1, "write DATA_WINDOW Failed!!(%d)\n",retval); +DPRINTK (1 , +"write DATA_WINDOW Failed!!(%d)\n" , + retval); } status &= ~INT_WRITE_STATUS ; - } - else{ + }else {#endif - if(atomic_read(&priv->psstatus.status)==PS_SNOOZE){ - if(cnt_txqbody(priv)){ +if (atomic_read (&priv->psstatus.status) ==PS_SNOOZE ) { +if (cnt_txqbody (priv)) {ks_wlan_hw_wakeup_request (priv); - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq, &priv->ks_wlan_hw.rw_wq, 1); +queue_delayed_work + (priv->ks_wlan_hw. + ks7010sdio_wq, + &priv->ks_wlan_hw. + rw_wq,1 );return ; } - } - else{ + }else {tx_device_task ((void *)priv); } -// } +#if 0 + } +#endif } - }while(rsize); + }while (rsize); } -intr_out: - queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq, 0); + intr_out: +queue_delayed_work (priv->ks_wlan_hw.ks7010sdio_wq, + &priv->ks_wlan_hw.rw_wq,0 );return ; } -static int trx_device_init (struct ks_wlan_private *priv ) +static int trx_device_init (struct ks_wlan_private *priv) {/* initialize values (tx) */ priv->tx_dev.qtail = priv->tx_dev.qhead =0 ;
@@ -655,21 +714,22 @@ static int trx_device_init( struct ks_wlan_private *priv )spin_lock_init (&priv->tx_dev.tx_dev_lock);spin_lock_init (&priv->rx_dev.rx_dev_lock); -tasklet_init (&priv->ks_wlan_hw.rx_bh_task, rx_event_task, (unsigned long )priv); +tasklet_init (&priv->ks_wlan_hw.rx_bh_task, rx_event_task, + (unsigned long )priv);return 0 ; } -static void trx_device_exit (struct ks_wlan_private *priv ) +static void trx_device_exit (struct ks_wlan_private *priv) { -struct tx_device_buffer *sp; +struct tx_device_buffer *sp;/* tx buffer clear */ -while (cnt_txqbody (priv)>0 ) { +while (cnt_txqbody (priv) >0 ) { sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead]; -kfree (sp->sendp);/* allocated memory free */ -if (sp->complete_handler !=NULL )/* TX Complete */ - (*sp->complete_handler)(sp->arg1, sp->arg2); +kfree (sp->sendp);/* allocated memory free */ +if (sp->complete_handler !=NULL )/* TX Complete */ + (*sp->complete_handler) (sp->arg1, sp->arg2);inc_txqhead (priv); }
@@ -677,24 +737,35 @@ static void trx_device_exit( struct ks_wlan_private *priv )return ; } +static int ks7010_sdio_update_index (struct ks_wlan_private *priv,u32 index) { -int rc=0 ; +int rc =0 ;int retval;unsigned char *data_buf; data_buf =NULL ; data_buf =kmalloc (sizeof (u32),GFP_KERNEL ); -if (!data_buf){ rc =1 ; goto error_out; } +if (!data_buf) { + rc =1 ; + goto error_out; + }memcpy (data_buf, &index,sizeof (index)); retval =ks7010_sdio_write (priv,WRITE_INDEX , data_buf,sizeof (index)); -if (retval){ rc =2 ; goto error_out; } +if (retval) { + rc =2 ; + goto error_out; + } retval =ks7010_sdio_write (priv,READ_INDEX , data_buf,sizeof (index)); -if (retval){ rc =3 ; goto error_out; } -error_out: -if (data_buf)kfree (data_buf); +if (retval) { + rc =3 ; + goto error_out; + } + error_out: +if (data_buf) +kfree (data_buf);return rc; }
@@ -702,30 +773,41 @@ error_out:static int ks7010_sdio_data_compare (struct ks_wlan_private *priv,u32 address,unsigned char *data,unsigned int size) { -int rc=0 ; +int rc =0 ;int retval;unsigned char *read_buf; read_buf =NULL ; read_buf =kmalloc (ROM_BUFF_SIZE ,GFP_KERNEL ); -if (!read_buf){ rc =1 ; goto error_out; } +if (!read_buf) { + rc =1 ; + goto error_out; + } retval =ks7010_sdio_read (priv, address, read_buf, size); -if (retval){ rc =2 ; goto error_out; } +if (retval) { + rc =2 ; + goto error_out; + } retval =memcmp (data, read_buf, size); -if (retval){ -DPRINTK (0 ,"data compare error (%d) \n" ,retval); rc =3 ; goto error_out; +if (retval) { +DPRINTK (0 ,"data compare error (%d) \n" , retval); + rc =3 ; + goto error_out; } -error_out: -if (read_buf)kfree (read_buf); + error_out: +if (read_buf) +kfree (read_buf);return rc; } +#include <linux/firmware.h> -static int ks79xx_upload_firmware (struct ks_wlan_private *priv,struct ks_sdio_card *card) +static int ks79xx_upload_firmware (struct ks_wlan_private *priv, +struct ks_sdio_card *card) { -unsigned int size, offset, n =0 ; -unsigned char *rom_buf; -unsigned char rw_data =0 ; -int retval, rc=0 ; +unsigned int size, offset, n =0 ; +unsigned char *rom_buf; +unsigned char rw_data =0 ; +int retval, rc =0 ;int length;const struct firmware *fw_entry =NULL ;
@@ -733,76 +815,99 @@ static int ks79xx_upload_firmware(struct ks_wlan_private *priv, struct ks_sdio_c/* buffer allocate */ rom_buf =kmalloc (ROM_BUFF_SIZE ,GFP_KERNEL ); -if (!rom_buf){ rc =3 ; goto error_out0; } - +if (!rom_buf) { + rc =3 ; + goto error_out0; + }sdio_claim_host (card->func);/* Firmware running ? */ retval =ks7010_sdio_read (priv,GCR_A , &rw_data,sizeof (rw_data)); -if (rw_data ==GCR_A_RUN ){ -DPRINTK (0 ,"MAC firmware running ...\n" ); +if (rw_data ==GCR_A_RUN ) { +DPRINTK (0 ,"MAC firmware running ...\n" ); rc =0 ; goto error_out0; } -if (request_firmware (&fw_entry, priv->reg.rom_file, &priv->ks_wlan_hw.sdio_card->func->dev)!=0 ){ -DPRINTK (1 ,"error request_firmware() file=%s\n" , priv->reg.rom_file); +if (request_firmware + (&fw_entry, priv->reg.rom_file, + &priv->ks_wlan_hw.sdio_card->func->dev) !=0 ) { +DPRINTK (1 ,"error request_firmware() file=%s\n" , + priv->reg.rom_file);return 1 ; } -DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , priv->reg.rom_file, fw_entry->size); +DPRINTK (4 ,"success request_firmware() file=%s size=%zu\n" , + priv->reg.rom_file, fw_entry->size); length = fw_entry->size;/* Load Program */ n =0 ; -do { -if (length >=ROM_BUFF_SIZE ){ +do { +if (length >=ROM_BUFF_SIZE ) { size =ROM_BUFF_SIZE ; length = length -ROM_BUFF_SIZE ; + }else { + size = length; + length =0 ; } -else { - size=length; - length=0 ; - } -DPRINTK (4 ,"size = %d\n" ,size); -if (size ==0 )break ; -memcpy (rom_buf,fw_entry->data+n,size); +DPRINTK (4 ,"size = %d\n" , size); +if (size ==0 ) +break ; +memcpy (rom_buf, fw_entry->data + n, size);/* Update write index */ offset = n; - retval =ks7010_sdio_update_index (priv,KS7010_IRAM_ADDRESS +offset); -if (retval){ rc =6 ; goto error_out1; } + retval = +ks7010_sdio_update_index (priv, +KS7010_IRAM_ADDRESS + offset); +if (retval) { + rc =6 ; + goto error_out1; + }/* Write data */ retval =ks7010_sdio_write (priv,DATA_WINDOW , rom_buf, size); -if (retval){ rc =8 ; goto error_out1; } +if (retval) { + rc =8 ; + goto error_out1; + }/* compare */ - retval =ks7010_sdio_data_compare (priv,DATA_WINDOW , rom_buf, size); -if (retval){ rc =9 ; goto error_out1; } + retval = +ks7010_sdio_data_compare (priv,DATA_WINDOW , rom_buf, size); +if (retval) { + rc =9 ; + goto error_out1; + } n += size; - }while (size); + }while (size);/* Remap request */ rw_data =GCR_A_REMAP ; retval =ks7010_sdio_write (priv,GCR_A , &rw_data,sizeof (rw_data)); -if (retval){ +if (retval) { rc =11 ; goto error_out1; } -DPRINTK (4 ," REMAP Request : GCR_A=%02X\n" , rw_data); +DPRINTK (4 ," REMAP Request : GCR_A=%02X\n" , rw_data);/* Firmware running check */ for (n =0 ; n <50 ; ++n) { -mdelay (10 );/* wait_ms(10); */ - retval =ks7010_sdio_read (priv,GCR_A , &rw_data,sizeof (rw_data)); -if (retval){ rc =11 ; goto error_out1; } -if (rw_data ==GCR_A_RUN )break ; +mdelay (10 );/* wait_ms(10); */ + retval = +ks7010_sdio_read (priv,GCR_A , &rw_data,sizeof (rw_data)); +if (retval) { + rc =11 ; + goto error_out1; + } +if (rw_data ==GCR_A_RUN ) +break ; } -DPRINTK (4 ,"firmware wakeup (%d)!!!!\n" ,n); +DPRINTK (4 ,"firmware wakeup (%d)!!!!\n" , n);if ((50 ) <= n) {DPRINTK (1 ,"firmware can't start\n" ); - rc =12 ; + rc =12 ; goto error_out1; }
@@ -812,30 +917,31 @@ static int ks79xx_upload_firmware(struct ks_wlan_private *priv, struct ks_sdio_crelease_firmware (fw_entry); error_out0:sdio_release_host (card->func); -if (rom_buf) +if (rom_buf)kfree (rom_buf);return rc; }static void ks7010_card_init (struct ks_wlan_private *priv) { -DPRINTK (5 ,"\ncard_init_task()\n" ); +DPRINTK (5 ,"\ncard_init_task()\n" );/* init_waitqueue_head(&priv->confirm_wait); */ init_completion (&priv->confirm_wait); -DPRINTK (5 ,"init_completion()\n" ); +DPRINTK (5 ,"init_completion()\n" );/* get mac address & firmware version */ hostif_sme_enqueue (priv,SME_START ); -DPRINTK (5 ,"hostif_sme_enqueu()\n" ); +DPRINTK (5 ,"hostif_sme_enqueu()\n" ); -if (!wait_for_completion_interruptible_timeout (&priv->confirm_wait,5 *HZ )){ -DPRINTK (1 ,"wait time out!! SME_START\n" ); +if (!wait_for_completion_interruptible_timeout + (&priv->confirm_wait,5 *HZ )) { +DPRINTK (1 ,"wait time out!! SME_START\n" ); } -if (priv->mac_address_valid && priv->version_size){ +if (priv->mac_address_valid && priv->version_size) { priv->dev_state =DEVICE_STATE_PREINIT ; }
@@ -858,57 +964,56 @@ static void ks7010_card_init(struct ks_wlan_private *priv)hostif_sme_enqueue (priv,SME_MODE_SET_REQUEST );hostif_sme_enqueue (priv,SME_START_REQUEST ); -if (!wait_for_completion_interruptible_timeout (&priv->confirm_wait,5 *HZ )){ -DPRINTK (1 ,"wait time out!! wireless parameter set\n" ); +if (!wait_for_completion_interruptible_timeout + (&priv->confirm_wait,5 *HZ )) { +DPRINTK (1 ,"wait time out!! wireless parameter set\n" ); } -if (priv->dev_state >=DEVICE_STATE_PREINIT ){ +if (priv->dev_state >=DEVICE_STATE_PREINIT ) {DPRINTK (1 ,"DEVICE READY!!\n" ); priv->dev_state =DEVICE_STATE_READY ; - reg_net =register_netdev (priv->net_dev); -DPRINTK (3 ,"register_netdev=%d\n" ,reg_net); - } -else { -DPRINTK (1 ,"dev_state=%d\n" ,priv->dev_state); + reg_net =register_netdev (priv->net_dev); +DPRINTK (3 ,"register_netdev=%d\n" , reg_net); + }else { +DPRINTK (1 ,"dev_state=%d\n" , priv->dev_state); } }static struct sdio_driver ks7010_sdio_driver = { - .name ="ks7910_sdio" , - .id_table = if_sdio_ids, - .probe = ks7910_sdio_probe, - .remove = ks7910_sdio_remove, + .name ="ks7910_sdio" , + .id_table = if_sdio_ids, + .probe = ks7910_sdio_probe, + .remove = ks7910_sdio_remove, }; -extern int ks_wlan_net_start (struct net_device *dev);extern int ks_wlan_net_stop (struct net_device *dev); -static int ks7910_sdio_probe (struct sdio_func *func,const struct sdio_device_id *device) +static int ks7910_sdio_probe (struct sdio_func *func, +const struct sdio_device_id *device) {struct ks_wlan_private *priv;struct ks_sdio_card *card;struct net_device *netdev;unsigned char rw_data; -int i=0 , ret; +int i =0 , ret;DPRINTK (5 ,"ks7910_sdio_probe()\n" ); priv =NULL ; - netdev=NULL ; - + netdev =NULL ;/* initilize ks_sdio_card */ card =kzalloc (sizeof (struct ks_sdio_card ),GFP_KERNEL );if (!card)return -ENOMEM ; - card->func = func; + card->func = func; card->model =0x10 ;spin_lock_init (&card->lock);/* select model */ -for (i =0 ;i <ARRAY_SIZE (ks_sdio_models);i++) { +for (i =0 ; i <ARRAY_SIZE (ks_sdio_models); i++) {if (card->model == ks_sdio_models[i].model)break ; }
@@ -920,7 +1025,6 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_id card->firmware = ks_sdio_models[i].firmware; -/*** Initialize SDIO ***/ sdio_claim_host (func);
@@ -929,7 +1033,8 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_id/* function blocksize set */ ret =sdio_set_block_size (func,KS7010_IO_BLOCK_SIZE ); -DPRINTK (5 ,"multi_block=%d sdio_set_block_size()=%d %d\n" , func->card->cccr.multi_block, func->cur_blksize, ret); +DPRINTK (5 ,"multi_block=%d sdio_set_block_size()=%d %d\n" , + func->card->cccr.multi_block, func->cur_blksize, ret);/* Allocate the slot current */
@@ -940,10 +1045,10 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_id goto error_free_card;/* interrupt disable */ -sdio_writeb (func,0 ,INT_ENABLE , &ret); +sdio_writeb (func,0 ,INT_ENABLE , &ret);if (ret) goto error_free_card; -sdio_writeb (func,0xff ,INT_PENDING , &ret); +sdio_writeb (func,0xff ,INT_PENDING , &ret);if (ret) goto error_disable_func;
@@ -957,18 +1062,16 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_idsdio_set_drvdata (func, card);DPRINTK (5 ,"class = 0x%X, vendor = 0x%X, " -"device = 0x%X\n" , - func->class, func->vendor, func->device); - +"device = 0x%X\n" , func->class, func->vendor, func->device);/* private memory allocate */ netdev =alloc_etherdev (sizeof (*priv));if (netdev ==NULL ) { -printk (KERN_ERR "ks79xx : Unable to alloc new net device\n" ); +printk (KERN_ERR "ks79xx : Unable to alloc new net device\n" ); goto error_release_irq; }if (dev_alloc_name (netdev, netdev->name) <0 ) { -printk (KERN_ERR "ks79xx : Couldn't get name!\n" ); +printk (KERN_ERR "ks79xx : Couldn't get name!\n" ); goto error_free_netdev; }
@@ -982,7 +1085,7 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_idinit_completion (&priv->ks_wlan_hw.ks7010_sdio_wait); priv->ks_wlan_hw.read_buf =NULL ; priv->ks_wlan_hw.read_buf =kmalloc (RX_DATA_SIZE ,GFP_KERNEL ); -if (!priv->ks_wlan_hw.read_buf){ +if (!priv->ks_wlan_hw.read_buf) { goto error_free_netdev; } priv->dev_state =DEVICE_STATE_PREBOOT ;
@@ -995,25 +1098,29 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_idmemset (&priv->wstats,0 ,sizeof (priv->wstats));/* sleep mode */ -atomic_set (&priv->sleepstatus.doze_request,0 ); -atomic_set (&priv->sleepstatus.wakeup_request,0 ); -atomic_set (&priv->sleepstatus.wakeup_request,0 ); +atomic_set (&priv->sleepstatus.doze_request,0 ); +atomic_set (&priv->sleepstatus.wakeup_request,0 ); +atomic_set (&priv->sleepstatus.wakeup_request,0 );trx_device_init (priv);hostif_init (priv); -ks_wlan_net_start (netdev); +ks_wlan_net_start (netdev);/* Read config file */ ret =ks_wlan_read_config_file (priv);if (ret) { -printk (KERN_ERR "ks79xx: read configuration file failed !! retern code = %d\n" , ret); +printk (KERN_ERR +"ks79xx: read configuration file failed !! retern code = %d\n" , + ret); goto error_free_read_buf; }/* Upload firmware */ - ret =ks79xx_upload_firmware (priv, card);/* firmware load */ -if (ret){ -printk (KERN_ERR "ks79xx: firmware load failed !! retern code = %d\n" , ret); + ret =ks79xx_upload_firmware (priv, card);/* firmware load */ +if (ret) { +printk (KERN_ERR +"ks79xx: firmware load failed !! retern code = %d\n" , + ret); goto error_free_read_buf; }
@@ -1023,25 +1130,24 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_idsdio_claim_host (func); ret =ks7010_sdio_write (priv,INT_PENDING , &rw_data,sizeof (rw_data));sdio_release_host (func); -if (ret){ +if (ret) {DPRINTK (1 ," error : INT_PENDING=%02X\n" , rw_data); }DPRINTK (4 ," clear Interrupt : INT_PENDING=%02X\n" , rw_data); -/* enable ks7010sdio interrupt (INT_GCR_B|INT_READ_STATUS|INT_WRITE_STATUS) */ - rw_data = (INT_GCR_B |INT_READ_STATUS |INT_WRITE_STATUS ); + rw_data = (INT_GCR_B |INT_READ_STATUS |INT_WRITE_STATUS );sdio_claim_host (func); ret =ks7010_sdio_write (priv,INT_ENABLE , &rw_data,sizeof (rw_data));sdio_release_host (func); -if (ret){ +if (ret) {DPRINTK (1 ," error : INT_ENABLE=%02X\n" , rw_data); }DPRINTK (4 ," enable Interrupt : INT_ENABLE=%02X\n" , rw_data); priv->dev_state =DEVICE_STATE_BOOT ; priv->ks_wlan_hw.ks7010sdio_wq =create_workqueue ("ks7010sdio_wq" ); -if (!priv->ks_wlan_hw.ks7010sdio_wq){ +if (!priv->ks_wlan_hw.ks7010sdio_wq) {DPRINTK (1 ,"create_workqueue failed !!\n" ); goto error_free_read_buf; }
@@ -1051,22 +1157,22 @@ static int ks7910_sdio_probe(struct sdio_func *func, const struct sdio_device_idreturn 0 ; -error_free_read_buf: + error_free_read_buf:kfree (priv->ks_wlan_hw.read_buf); priv->ks_wlan_hw.read_buf =NULL ; -error_free_netdev: + error_free_netdev:free_netdev (priv->net_dev); card->priv =NULL ; -error_release_irq: + error_release_irq:sdio_claim_host (func);sdio_release_irq (func); -error_disable_func: + error_disable_func:sdio_disable_func (func); -error_free_card: + error_free_card:sdio_release_host (func);sdio_set_drvdata (func,NULL );kfree (card); -error: + error:return -ENODEV ; }
@@ -1080,56 +1186,62 @@ static void ks7910_sdio_remove(struct sdio_func *func) card =sdio_get_drvdata (func); -if (card ==NULL ) +if (card ==NULL )return ;DPRINTK (1 ,"priv = card->priv\n" ); priv = card->priv; netdev = priv->net_dev; -if (priv){ +if (priv) {ks_wlan_net_stop (netdev);DPRINTK (1 ,"ks_wlan_net_stop\n" );/* interrupt disable */ sdio_claim_host (func); -sdio_writeb (func,0 ,INT_ENABLE , &ret); -sdio_writeb (func,0xff ,INT_PENDING , &ret); +sdio_writeb (func,0 ,INT_ENABLE , &ret); +sdio_writeb (func,0xff ,INT_PENDING , &ret);sdio_release_host (func);DPRINTK (1 ,"interrupt disable\n" );/* send stop request to MAC */ {struct hostif_stop_request_t *pp; - pp = (struct hostif_stop_request_t *)kzalloc (hif_align_size (sizeof (*pp)),GFP_KERNEL ); -if (pp==NULL ) { -DPRINTK (3 ,"allocate memory failed..\n" ); -return ;/* to do goto ni suru*/ + pp = (struct hostif_stop_request_t *) +kzalloc (hif_align_size (sizeof (*pp)),GFP_KERNEL ); +if (pp ==NULL ) { +DPRINTK (3 ,"allocate memory failed..\n" ); +return ;/* to do goto ni suru */ } - pp->header.size =cpu_to_le16 ((uint16_t )(sizeof (*pp)-sizeof (pp->header.size))); - pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ ); + pp->header.size = +cpu_to_le16 ((uint16_t ) + (sizeof (*pp) - +sizeof (pp->header.size))); + pp->header.event =cpu_to_le16 ((uint16_t )HIF_STOP_REQ );sdio_claim_host (func); -write_to_device (priv, (unsigned char *) pp,hif_align_size (sizeof (*pp))); +write_to_device (priv, (unsigned char *)pp, +hif_align_size (sizeof (*pp)));sdio_release_host (func);kfree (pp); }DPRINTK (1 ,"STOP Req\n" ); -if (priv->ks_wlan_hw.ks7010sdio_wq){ +if (priv->ks_wlan_hw.ks7010sdio_wq) {flush_workqueue (priv->ks_wlan_hw.ks7010sdio_wq);destroy_workqueue (priv->ks_wlan_hw.ks7010sdio_wq); } -DPRINTK (1 ,"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);\n" ); +DPRINTK (1 , +"destroy_workqueue(priv->ks_wlan_hw.ks7010sdio_wq);\n" );hostif_exit (priv);DPRINTK (1 ,"hostif_exit\n" ); -if (!reg_net) +if (!reg_net)unregister_netdev (netdev);DPRINTK (1 ,"unregister_netdev\n" );trx_device_exit (priv); -if (priv->ks_wlan_hw.read_buf){ +if (priv->ks_wlan_hw.read_buf) {kfree (priv->ks_wlan_hw.read_buf); }free_netdev (priv->net_dev);
@@ -1148,26 +1260,27 @@ static void ks7910_sdio_remove(struct sdio_func *func)kfree (card);DPRINTK (1 ,"kfree()\n" ); - -DPRINTK (5 ," Bye !!\n" ); +DPRINTK (5 ," Bye !!\n" );return ; } -static int __init ks7010_sdio_init (void ) +static int __init ks7010_sdio_init (void ) {int status;/* register with bus driver core */ status =sdio_register_driver (&ks7010_sdio_driver); -if (status !=0 ){ -DPRINTK (1 ,"ks79xx_sdio : failed to register with bus driver, %d\n" , status ); +if (status !=0 ) { +DPRINTK (1 , +"ks79xx_sdio : failed to register with bus driver, %d\n" , + status); }return status; } -static void __exit ks7010_sdio_exit( void ) +static void __exit ks7010_sdio_exit(void) { -DPRINTK (5 ," \n" ); +DPRINTK (5 ," \n" );sdio_unregister_driver (&ks7010_sdio_driver);return ; }
Signature · 1 line
2.8.1
PATCH v2 26/31 staging: ks7010: remove supported card table with one element
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
There is only this card supported, no need to iterate over the table. The resulting firmware filename wasn't used anyway, but came from the config file or hardcoded default.
--- drivers/staging/ks7010/ks7010_sdio.c | 31 ++----------------------------- drivers/staging/ks7010/ks7010_sdio.h | 2 -- 2 files changed, 2 insertions(+), 31 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +2 -29
@@ -35,19 +35,6 @@ static const struct sdio_device_id if_sdio_ids[] = { {/* all zero */ } }; -struct ks_sdio_model { -int model; -const char *firmware; -}; - -static struct ks_sdio_model ks_sdio_models[] = { - { -/* ks7010 */ - .model =0x10 , - .firmware ="ks7010sd.rom" , - }, -}; -static int ks7910_sdio_probe (struct sdio_func *function,const struct sdio_device_id *device);static void ks7910_sdio_remove (struct sdio_func *function);
@@ -996,7 +983,7 @@ static int ks7910_sdio_probe(struct sdio_func *func,struct ks_sdio_card *card;struct net_device *netdev;unsigned char rw_data; -int i =0 , ret; +int ret;DPRINTK (5 ,"ks7910_sdio_probe()\n" );
@@ -1009,22 +996,8 @@ static int ks7910_sdio_probe(struct sdio_func *func,return -ENOMEM ; card->func = func; - card->model =0x10 ;spin_lock_init (&card->lock); -/* select model */ -for (i =0 ; i <ARRAY_SIZE (ks_sdio_models); i++) { -if (card->model == ks_sdio_models[i].model) -break ; - } - -if (i ==ARRAY_SIZE (ks_sdio_models)) { -DPRINTK (5 ,"unkown card model 0x%x\n" , card->model); - goto error; - } - - card->firmware = ks_sdio_models[i].firmware; -/*** Initialize SDIO ***/ sdio_claim_host (func);
@@ -1172,7 +1145,7 @@ static int ks7910_sdio_probe(struct sdio_func *func,sdio_release_host (func);sdio_set_drvdata (func,NULL );kfree (card); - error: +return -ENODEV ; }
drivers/staging/ks7010/ks7010_sdio.h +0 -2
@@ -109,8 +109,6 @@ struct ks_sdio_packet {struct ks_sdio_card {struct sdio_func *func;struct ks_wlan_private *priv; -int model; -const char *firmware;spinlock_t lock; };
Signature · 1 line
2.8.1
PATCH v2 27/31 staging: ks7010: fix module annotations
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
List all authors, beautify description, match license to what is stated in file headers, add firmware information.
--- drivers/staging/ks7010/ks7010_sdio.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +4 -6
@@ -1261,9 +1261,7 @@ static void __exit ks7010_sdio_exit(void)module_init (ks7010_sdio_init);module_exit (ks7010_sdio_exit); -MODULE_AUTHOR ("Qi-Hardware based on KeyStream driver" ); -MODULE_DESCRIPTION ("Driver for KeyStream, KS7010 based SDIO cards. " ); -#ifdef MODULE_LICENSE -MODULE_LICENSE ("GPL" ); -#endif -MODULE_SUPPORTED_DEVICE ("KS7910" ); +MODULE_AUTHOR ("Sang Engineering, Qi-Hardware, KeyStream" ); +MODULE_DESCRIPTION ("Driver for KeyStream KS7010 based SDIO cards" ); +MODULE_LICENSE ("GPL v2" ); +MODULE_FIRMWARE (ROM_FILE );
Signature · 1 line
2.8.1
PATCH v2 28/31 staging: ks7010: adapt to new trans_start handling
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
trans_start is gone from netdevice, so use the new helper function to set the mark.
--- drivers/staging/ks7010/ks_wlan_net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/ks7010/ks_wlan_net.c +1 -1
@@ -3398,7 +3398,7 @@ int ks_wlan_start_xmit(struct sk_buff *skb, struct net_device *dev)netif_stop_queue (dev); rc =hostif_data_request (priv, skb); - dev->trans_start = jiffies; +netif_trans_update (dev);DPRINTK (4 ,"rc=%d\n" , rc);if (rc) {
Signature · 1 line
2.8.1
PATCH v2 29/31 staging: ks7010: simplify module_init/exit
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
The printouts are not needed, the driver core has enough debug output for this if wanted. So, use a helper to save boilerplate code.
--- drivers/staging/ks7010/ks7010_sdio.c | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +1 -24
@@ -1237,30 +1237,7 @@ static void ks7910_sdio_remove(struct sdio_func *func)return ; } -static int __init ks7010_sdio_init (void ) -{ -int status; - -/* register with bus driver core */ - status =sdio_register_driver (&ks7010_sdio_driver); -if (status !=0 ) { -DPRINTK (1 , -"ks79xx_sdio : failed to register with bus driver, %d\n" , - status); - } -return status; -} - -static void __exit ks7010_sdio_exit(void) -{ -DPRINTK (5 ," \n" ); -sdio_unregister_driver (&ks7010_sdio_driver); -return ; -} - -module_init (ks7010_sdio_init); -module_exit (ks7010_sdio_exit); - +module_driver (ks7010_sdio_driver, sdio_register_driver, sdio_unregister_driver);MODULE_AUTHOR ("Sang Engineering, Qi-Hardware, KeyStream" );MODULE_DESCRIPTION ("Driver for KeyStream KS7010 based SDIO cards" );MODULE_LICENSE ("GPL v2" );
Signature · 1 line
2.8.1
PATCH v2 30/31 staging: ks7010: drop counting sd errors
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
They were counted but never really used anywhere. Also change the printk to a debug print, since it mostly shows on the expected -ENOMEDIUM on card removal.
--- drivers/staging/ks7010/ks7010_sdio.c | 20 ++++++-------------- drivers/staging/ks7010/ks_wlan.h | 2 -- 2 files changed, 6 insertions(+), 16 deletions(-)
drivers/staging/ks7010/ks7010_sdio.c +6 -14
@@ -234,8 +234,8 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv)static int ks7010_sdio_read (struct ks_wlan_private *priv,unsigned int address,unsigned char *buffer,int length) { -int rc =-1 ;struct ks_sdio_card *card; +int rc; card = priv->ks_wlan_hw.sdio_card;
@@ -244,12 +244,8 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address, else /* CMD53 multi-block transfer */ rc =sdio_memcpy_fromio (card->func, buffer, address, length); -if (rc !=0 ) { -printk ("sdio error erorr=%d size=%d\n" , rc, length); - ++priv->sdio_error_count; - }else { - priv->sdio_error_count =0 ; - } +if (rc !=0 ) +DPRINTK (1 ,"sdio error=%d size=%d\n" , rc, length);return rc; }
@@ -257,8 +253,8 @@ static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,static int ks7010_sdio_write (struct ks_wlan_private *priv,unsigned int address,unsigned char *buffer,int length) { -int rc =-1 ;struct ks_sdio_card *card; +int rc; card = priv->ks_wlan_hw.sdio_card;
@@ -268,12 +264,8 @@ static int ks7010_sdio_write(struct ks_wlan_private *priv, unsigned int address, rc =sdio_memcpy_toio (card->func, (unsigned int )address, buffer, length); -if (rc !=0 ) { -printk ("sdio error erorr=%d size=%d\n" , rc, length); - ++priv->sdio_error_count; - }else { - priv->sdio_error_count =0 ; - } +if (rc !=0 ) +DPRINTK (1 ,"sdio error=%d size=%d\n" , rc, length);return rc; }
drivers/staging/ks7010/ks_wlan.h +0 -2
@@ -500,9 +500,7 @@ struct ks_wlan_private {unsigned long last_doze;unsigned long last_wakeup; -uint sdio_error_count;/* SDIO error */ uint wakeup_count; /* for detect wakeup loop */ - };#endif /* _KS_WLAN_H */
Signature · 1 line
2.8.1
PATCH v2 31/31 staging: ks7010: cleanup file headers
In reply to Wolfram SangFrom: Wolfram Sang <[email protected]>
Remove svn-ids and fix typos in the licence declaration. Add my copyright to the sdio code which I worked on mainly.
--- drivers/staging/ks7010/eap_packet.h | 6 ------ drivers/staging/ks7010/ks7010_sdio.c | 8 +++----- drivers/staging/ks7010/ks7010_sdio.h | 8 ++------ drivers/staging/ks7010/ks_hostif.c | 7 ++----- drivers/staging/ks7010/ks_hostif.h | 7 ++----- drivers/staging/ks7010/ks_wlan.h | 7 ++----- drivers/staging/ks7010/ks_wlan_ioctl.h | 7 ++----- drivers/staging/ks7010/ks_wlan_net.c | 7 ++----- drivers/staging/ks7010/michael_mic.c | 7 ++----- drivers/staging/ks7010/michael_mic.h | 7 ++----- 10 files changed, 19 insertions(+), 52 deletions(-)
drivers/staging/ks7010/eap_packet.h +0 -6
@@ -1,9 +1,3 @@ -/* -* -* eap_packet.h -* $Id: eap_packet.h 991 2009-09-14 01:38:58Z sekine $ -* -*/ #ifndef EAP_PACKET_H #define EAP_PACKET_H
drivers/staging/ks7010/ks7010_sdio.c +3 -5
@@ -1,15 +1,13 @@/* * Driver for KeyStream, KS7010 based SDIO cards. * -* ks7010_sdio.c -* $Id: ks7010_sdio.c 996 2009-09-14 02:54:21Z sekine $ -* * Copyright (C) 2006-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. +* Copyright (C) 2016 Sang Engineering, Wolfram Sang * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #include <linux/workqueue.h>
drivers/staging/ks7010/ks7010_sdio.h +2 -6
@@ -1,16 +1,12 @@/* -* * Driver for KeyStream, KS7010 based SDIO cards. -* -* ks7010_sdio.h -* $Id: ks7010_sdio.h 1019 2009-09-28 05:41:07Z sekine $ * * Copyright (C) 2006-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _KS7010_SDIO_H#define _KS7010_SDIO_H
drivers/staging/ks7010/ks_hostif.c +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream wireless LAN cards. * -* ks_hostif.c -* $Id: ks_hostif.c 996 2009-09-14 02:54:21Z sekine $ -* * Copyright (C) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #include "ks_wlan.h"
drivers/staging/ks7010/ks_hostif.h +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream wireless LAN * -* ks_hostif.h -* $Id: ks_hostif.h 994 2009-09-14 01:51:16Z sekine $ -* * Copyright (c) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _KS_HOSTIF_H_
drivers/staging/ks7010/ks_wlan.h +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream IEEE802.11 b/g wireless LAN cards. -* -* ks_wlan.h -* $Id: ks_wlan.h 994 2009-09-14 01:51:16Z sekine $ * * Copyright (C) 2006-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _KS_WLAN_H
drivers/staging/ks7010/ks_wlan_ioctl.h +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream 11b/g wireless LAN * -* ks_wlan_ioctl.h -* $Id: ks_wlan_ioctl.h 996 2009-09-14 02:54:21Z sekine $ -* * Copyright (c) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #ifndef _KS_WLAN_IOCTL_H
drivers/staging/ks7010/ks_wlan_net.c +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream 11b/g wireless LAN * -* ks_wlan_net.c -* $Id: ks_wlan_net.c 1020 2009-09-28 05:48:31Z sekine $ -* * Copyright (C) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #include <linux/version.h>
drivers/staging/ks7010/michael_mic.c +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream wireless LAN * -* michael_mic.c -* $Id: michael_mic.c 991 2009-09-14 01:38:58Z sekine $ -* * Copyright (C) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ #include <linux/types.h>
drivers/staging/ks7010/michael_mic.h +2 -5
@@ -1,15 +1,12 @@/* * Driver for KeyStream wireless LAN -* -* michael_mic.h -* $Id: michael_mic.h 991 2009-09-14 01:38:58Z sekine $ * * Copyright (C) 2005-2008 KeyStream Corp. * Copyright (C) 2009 Renesas Technology Corp. * * This program is free software; you can redistribute it and/or modify -* it undr the terms of the GNU General Public License version 2 as -* published by the Free Sotware Foundation. +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. */ /* MichelMIC routine define */
Signature · 1 line
2.8.1