Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3422882 authored by Moritz Muehlenhoff's avatar Moritz Muehlenhoff Committed by Greg Kroah-Hartman
Browse files

Staging: wlan-ng: prism2sta.c: Coding style cleanups

parent f4ee0f42
Loading
Loading
Loading
Loading
+562 −560
Original line number Diff line number Diff line
@@ -50,9 +50,6 @@
* --------------------------------------------------------------------
*/

/*================================================================*/
/* System Includes */

#include <linux/version.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
@@ -91,9 +88,6 @@
#include "hfa384x.h"
#include "prism2mgmt.h"

/*================================================================*/
/* Local Macros */

#define wlan_hexchar(x) (((x) < 0x0a) ? ('0' + (x)) : ('a' + ((x) - 0x0a)))

/* Create a string of printable chars from something that might not be */
@@ -117,16 +111,9 @@
	} \
}

/*================================================================*/
/* Local Static Definitions */

static char *dev_info = "prism2_usb";

static wlandevice_t *create_wlan(void);

/*----------------------------------------------------------------*/
/* --Module Parameters */

int prism2_reset_holdtime = 30;	/* Reset hold time in ms */
int prism2_reset_settletime = 100;	/* Reset settle time in ms */

@@ -142,43 +129,37 @@ MODULE_PARM_DESC( prism2_reset_settletime, "reset settle time in ms");

MODULE_LICENSE("Dual MPL/GPL");

/*================================================================*/
/* Local Function Declarations */

static int prism2sta_open(wlandevice_t *wlandev);
static int prism2sta_close(wlandevice_t *wlandev);
static void prism2sta_reset(wlandevice_t *wlandev);
static int      prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
			     p80211_hdr_t *p80211_hdr,
			     p80211_metawep_t *p80211_wep);
static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg);
static int prism2sta_getcardinfo(wlandevice_t *wlandev);
static int prism2sta_globalsetup(wlandevice_t *wlandev);
static int      prism2sta_setmulticast(wlandevice_t *wlandev,
				       netdevice_t *dev);

static void	prism2sta_inf_handover(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_tallies(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void     prism2sta_inf_hostscanresults(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_scanresults(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_chinforesults(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_linkstatus(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_assocstatus(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_authreq(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_authreq_defer(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);
static void	prism2sta_inf_psusercnt(
			wlandevice_t *wlandev, hfa384x_InfFrame_t *inf);

/*================================================================*/
/* Function Definitions */
static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev);

static void prism2sta_inf_handover(wlandevice_t *wlandev,
				   hfa384x_InfFrame_t *inf);
static void prism2sta_inf_tallies(wlandevice_t *wlandev,
				  hfa384x_InfFrame_t *inf);
static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
					  hfa384x_InfFrame_t *inf);
static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
				      hfa384x_InfFrame_t *inf);
static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
					hfa384x_InfFrame_t *inf);
static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
				     hfa384x_InfFrame_t *inf);
static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
				      hfa384x_InfFrame_t *inf);
static void prism2sta_inf_authreq(wlandevice_t *wlandev,
				  hfa384x_InfFrame_t *inf);
static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
					hfa384x_InfFrame_t *inf);
static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
				    hfa384x_InfFrame_t *inf);

/*----------------------------------------------------------------
* prism2sta_open
@@ -214,7 +195,6 @@ static int prism2sta_open(wlandevice_t *wlandev)
	return 0;
}


/*----------------------------------------------------------------
* prism2sta_close
*
@@ -247,7 +227,6 @@ static int prism2sta_close(wlandevice_t *wlandev)
	return 0;
}


/*----------------------------------------------------------------
* prism2sta_reset
*
@@ -270,7 +249,6 @@ static void prism2sta_reset(wlandevice_t *wlandev )
	return;
}


/*----------------------------------------------------------------
* prism2sta_txframe
*
@@ -300,7 +278,8 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
	int result;

	/* If necessary, set the 802.11 WEP bit */
	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) == HOSTWEP_PRIVACYINVOKED) {
	if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
	    HOSTWEP_PRIVACYINVOKED) {
		p80211_hdr->a3.fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
	}

@@ -309,7 +288,6 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
	return result;
}


/*----------------------------------------------------------------
* prism2sta_mlmerequest
*
@@ -340,8 +318,7 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)

	int result = 0;

	switch( msg->msgcode )
	{
	switch (msg->msgcode) {
	case DIDmsg_dot11req_mibget:
		pr_debug("Received mibget request\n");
		result = prism2mgmt_mibset_mibget(wlandev, msg);
@@ -389,13 +366,15 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)
		 * Linux specific messages
		 */
	case DIDmsg_lnxreq_hostwep:
		break;   // ignore me.
		break;		/* ignore me. */
	case DIDmsg_lnxreq_ifstate:
		{
			p80211msg_lnxreq_ifstate_t *ifstatemsg;
			pr_debug("Received mlme ifstate request\n");
			ifstatemsg = (p80211msg_lnxreq_ifstate_t *) msg;
                result = prism2sta_ifstate(wlandev, ifstatemsg->ifstate.data);
			result =
			    prism2sta_ifstate(wlandev,
					      ifstatemsg->ifstate.data);
			ifstatemsg->resultcode.status =
			    P80211ENUM_msgitem_status_data_ok;
			ifstatemsg->resultcode.data = result;
@@ -417,26 +396,31 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, p80211msg_t *msg)

			qualmsg = (p80211msg_lnxreq_commsquality_t *) msg;

		qualmsg->link.status = P80211ENUM_msgitem_status_data_ok;
		qualmsg->level.status = P80211ENUM_msgitem_status_data_ok;
		qualmsg->noise.status = P80211ENUM_msgitem_status_data_ok;

			qualmsg->link.status =
			    P80211ENUM_msgitem_status_data_ok;
			qualmsg->level.status =
			    P80211ENUM_msgitem_status_data_ok;
			qualmsg->noise.status =
			    P80211ENUM_msgitem_status_data_ok;

		qualmsg->link.data = hfa384x2host_16(hw->qual.CQ_currBSS);
		qualmsg->level.data = hfa384x2host_16(hw->qual.ASL_currBSS);
		qualmsg->noise.data = hfa384x2host_16(hw->qual.ANL_currFC);
			qualmsg->link.data =
			    hfa384x2host_16(hw->qual.CQ_currBSS);
			qualmsg->level.data =
			    hfa384x2host_16(hw->qual.ASL_currBSS);
			qualmsg->noise.data =
			    hfa384x2host_16(hw->qual.ANL_currFC);

			break;
		}
	default:
		printk(KERN_WARNING "Unknown mgmt request message 0x%08x", msg->msgcode);
		printk(KERN_WARNING "Unknown mgmt request message 0x%08x",
		       msg->msgcode);
		break;
	}

	return result;
}


/*----------------------------------------------------------------
* prism2sta_ifstate
*
@@ -467,8 +451,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)

	pr_debug("Current MSD state(%d), requesting(%d)\n",
	       wlandev->msdstate, ifstate);
	switch (ifstate)
	{
	switch (ifstate) {
	case P80211ENUM_ifstate_fwload:
		switch (wlandev->msdstate) {
		case WLAN_MSD_HWPRESENT:
@@ -610,7 +593,6 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
	return result;
}


/*----------------------------------------------------------------
* prism2sta_getcardinfo
*
@@ -642,7 +624,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
	/*  Some are critical, some are not */
	/* NIC identity */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICIDENTITY,
			&hw->ident_nic, sizeof(hfa384x_compident_t));
					&hw->ident_nic,
					sizeof(hfa384x_compident_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve NICIDENTITY\n");
		goto failed;
@@ -660,7 +643,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Primary f/w identity */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRIIDENTITY,
			&hw->ident_pri_fw, sizeof(hfa384x_compident_t));
					&hw->ident_pri_fw,
					sizeof(hfa384x_compident_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve PRIIDENTITY\n");
		goto failed;
@@ -678,14 +662,16 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Station (Secondary?) f/w identity */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STAIDENTITY,
			&hw->ident_sta_fw, sizeof(hfa384x_compident_t));
					&hw->ident_sta_fw,
					sizeof(hfa384x_compident_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve STAIDENTITY\n");
		goto failed;
	}

	if (hw->ident_nic.id < 0x8000) {
		printk(KERN_ERR "FATAL: Card is not an Intersil Prism2/2.5/3\n");
		printk(KERN_ERR
		       "FATAL: Card is not an Intersil Prism2/2.5/3\n");
		result = -1;
		goto failed;
	}
@@ -716,7 +702,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, Modem supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_MFISUPRANGE,
			&hw->cap_sup_mfi, sizeof(hfa384x_caplevel_t));
					&hw->cap_sup_mfi,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve MFISUPRANGE\n");
		goto failed;
@@ -738,7 +725,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, Controller supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_CFISUPRANGE,
			&hw->cap_sup_cfi, sizeof(hfa384x_caplevel_t));
					&hw->cap_sup_cfi,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve CFISUPRANGE\n");
		goto failed;
@@ -760,7 +748,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, Primary f/w supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRISUPRANGE,
			&hw->cap_sup_pri, sizeof(hfa384x_caplevel_t));
					&hw->cap_sup_pri,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve PRISUPRANGE\n");
		goto failed;
@@ -782,7 +771,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, Station f/w supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STASUPRANGE,
			&hw->cap_sup_sta, sizeof(hfa384x_caplevel_t));
					&hw->cap_sup_sta,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve STASUPRANGE\n");
		goto failed;
@@ -812,7 +802,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, primary f/w actor, CFI supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_PRI_CFIACTRANGES,
			&hw->cap_act_pri_cfi, sizeof(hfa384x_caplevel_t));
					&hw->cap_act_pri_cfi,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve PRI_CFIACTRANGES\n");
		goto failed;
@@ -822,8 +813,10 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
	   fields in byte order */
	hw->cap_act_pri_cfi.role = hfa384x2host_16(hw->cap_act_pri_cfi.role);
	hw->cap_act_pri_cfi.id = hfa384x2host_16(hw->cap_act_pri_cfi.id);
	hw->cap_act_pri_cfi.variant = hfa384x2host_16(hw->cap_act_pri_cfi.variant);
	hw->cap_act_pri_cfi.bottom = hfa384x2host_16(hw->cap_act_pri_cfi.bottom);
	hw->cap_act_pri_cfi.variant =
	    hfa384x2host_16(hw->cap_act_pri_cfi.variant);
	hw->cap_act_pri_cfi.bottom =
	    hfa384x2host_16(hw->cap_act_pri_cfi.bottom);
	hw->cap_act_pri_cfi.top = hfa384x2host_16(hw->cap_act_pri_cfi.top);

	printk(KERN_INFO
@@ -834,7 +827,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, sta f/w actor, CFI supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_CFIACTRANGES,
			&hw->cap_act_sta_cfi, sizeof(hfa384x_caplevel_t));
					&hw->cap_act_sta_cfi,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve STA_CFIACTRANGES\n");
		goto failed;
@@ -844,8 +838,10 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
	   fields in byte order */
	hw->cap_act_sta_cfi.role = hfa384x2host_16(hw->cap_act_sta_cfi.role);
	hw->cap_act_sta_cfi.id = hfa384x2host_16(hw->cap_act_sta_cfi.id);
	hw->cap_act_sta_cfi.variant = hfa384x2host_16(hw->cap_act_sta_cfi.variant);
	hw->cap_act_sta_cfi.bottom = hfa384x2host_16(hw->cap_act_sta_cfi.bottom);
	hw->cap_act_sta_cfi.variant =
	    hfa384x2host_16(hw->cap_act_sta_cfi.variant);
	hw->cap_act_sta_cfi.bottom =
	    hfa384x2host_16(hw->cap_act_sta_cfi.bottom);
	hw->cap_act_sta_cfi.top = hfa384x2host_16(hw->cap_act_sta_cfi.top);

	printk(KERN_INFO
@@ -856,7 +852,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)

	/* Compatibility range, sta f/w actor, MFI supplier */
	result = hfa384x_drvr_getconfig(hw, HFA384x_RID_STA_MFIACTRANGES,
			&hw->cap_act_sta_mfi, sizeof(hfa384x_caplevel_t));
					&hw->cap_act_sta_mfi,
					sizeof(hfa384x_caplevel_t));
	if (result) {
		printk(KERN_ERR "Failed to retrieve STA_MFIACTRANGES\n");
		goto failed;
@@ -866,8 +863,10 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
	   fields in byte order */
	hw->cap_act_sta_mfi.role = hfa384x2host_16(hw->cap_act_sta_mfi.role);
	hw->cap_act_sta_mfi.id = hfa384x2host_16(hw->cap_act_sta_mfi.id);
	hw->cap_act_sta_mfi.variant = hfa384x2host_16(hw->cap_act_sta_mfi.variant);
	hw->cap_act_sta_mfi.bottom = hfa384x2host_16(hw->cap_act_sta_mfi.bottom);
	hw->cap_act_sta_mfi.variant =
	    hfa384x2host_16(hw->cap_act_sta_mfi.variant);
	hw->cap_act_sta_mfi.bottom =
	    hfa384x2host_16(hw->cap_act_sta_mfi.bottom);
	hw->cap_act_sta_mfi.top = hfa384x2host_16(hw->cap_act_sta_mfi.top);

	printk(KERN_INFO
@@ -925,7 +924,6 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
	return result;
}


/*----------------------------------------------------------------
* prism2sta_globalsetup
*
@@ -969,16 +967,9 @@ static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
	else
		promisc = P80211ENUM_truth_false;

	result = hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE, promisc);

	/* XXX TODO: configure the multicast list */
	// CLEAR_HW_MULTICAST_LIST
	// struct dev_mc_list element = dev->mc_list;
	// while (element != null) {
	//  HW_ADD_MULTICAST_ADDR(element->dmi_addr, dmi_addrlen)
	//  element = element->next;
	// }

	result =
	    hfa384x_drvr_setconfig16_async(hw, HFA384x_RID_PROMISCMODE,
					   promisc);
exit:
	return result;
}
@@ -1001,13 +992,13 @@ static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
* Call context:
*	interrupt
----------------------------------------------------------------*/
static void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
static void prism2sta_inf_handover(wlandevice_t *wlandev,
				   hfa384x_InfFrame_t *inf)
{
	pr_debug("received infoframe:HANDOVER (unhandled)\n");
	return;
}


/*----------------------------------------------------------------
* prism2sta_inf_tallies
*
@@ -1025,7 +1016,8 @@ static void prism2sta_inf_handover(wlandevice_t *wlandev, hfa384x_InfFrame_t *in
* Call context:
*	interrupt
----------------------------------------------------------------*/
static void prism2sta_inf_tallies(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
static void prism2sta_inf_tallies(wlandevice_t *wlandev,
				  hfa384x_InfFrame_t *inf)
{
	hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
	u16 *src16;
@@ -1085,8 +1077,7 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,

	/* Get the number of results, first in bytes, then in results */
	nbss = (inf->framelen * sizeof(u16)) -
		sizeof(inf->infotype) -
		sizeof(inf->info.scanresult.scanreason);
	    sizeof(inf->infotype) - sizeof(inf->info.scanresult.scanreason);
	nbss /= sizeof(hfa384x_ScanResultSub_t);

	/* Print em */
@@ -1096,11 +1087,9 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
		pr_debug("chid=%d anl=%d sl=%d bcnint=%d\n",
		       sr->result[i].chid,
		       sr->result[i].anl,
			sr->result[i].sl,
			sr->result[i].bcnint);
		       sr->result[i].sl, sr->result[i].bcnint);
		pr_debug("  capinfo=0x%04x proberesp_rate=%d\n",
			sr->result[i].capinfo,
			sr->result[i].proberesp_rate);
		       sr->result[i].capinfo, sr->result[i].proberesp_rate);
	}
	/* issue a join request */
	joinreq.channel = sr->result[0].chid;
@@ -1109,7 +1098,8 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
					HFA384x_RID_JOINREQUEST,
					&joinreq, HFA384x_RID_JOINREQUEST_LEN);
	if (result) {
		printk(KERN_ERR "setconfig(joinreq) failed, result=%d\n", result);
		printk(KERN_ERR "setconfig(joinreq) failed, result=%d\n",
		       result);
	}

	return;
@@ -1186,19 +1176,30 @@ static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,

	for (i = 0, n = 0; i < HFA384x_CHINFORESULT_MAX; i++) {
		if (hw->channel_info.results.scanchannels & (1 << i)) {
			int 	channel=hfa384x2host_16(inf->info.chinforesult.result[n].chid)-1;
			hfa384x_ChInfoResultSub_t *chinforesult=&hw->channel_info.results.result[channel];
			int channel =
			    hfa384x2host_16(inf->info.chinforesult.result[n].
					    chid) - 1;
			hfa384x_ChInfoResultSub_t *chinforesult =
			    &hw->channel_info.results.result[channel];
			chinforesult->chid = channel;
			chinforesult->anl    = hfa384x2host_16(inf->info.chinforesult.result[n].anl);
			chinforesult->pnl    = hfa384x2host_16(inf->info.chinforesult.result[n].pnl);
			chinforesult->active = hfa384x2host_16(inf->info.chinforesult.result[n].active);
			pr_debug("chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
			chinforesult->anl =
			    hfa384x2host_16(inf->info.chinforesult.result[n].
					    anl);
			chinforesult->pnl =
			    hfa384x2host_16(inf->info.chinforesult.result[n].
					    pnl);
			chinforesult->active =
			    hfa384x2host_16(inf->info.chinforesult.result[n].
					    active);
			printk(KERN_DEBUG
			       "chinfo: channel %d, %s level (avg/peak)=%d/%d dB, pcf %d\n",
			       channel + 1,
					chinforesult->active &
					HFA384x_CHINFORESULT_BSSACTIVE ? "signal" : "noise",
					chinforesult->anl, chinforesult->pnl,
					chinforesult->active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0
			);
			       chinforesult->
			       active & HFA384x_CHINFORESULT_BSSACTIVE ?
			       "signal" : "noise", chinforesult->anl,
			       chinforesult->pnl,
			       chinforesult->
			       active & HFA384x_CHINFORESULT_PCFACTIVE ? 1 : 0);
			n++;
		}
	}
@@ -1275,9 +1276,10 @@ void prism2sta_processing_defer(struct work_struct *data)

			result = hfa384x_drvr_getconfig(hw,
							HFA384x_RID_CURRENTBSSID,
							wlandev->bssid, WLAN_BSSID_LEN);
							wlandev->bssid,
							WLAN_BSSID_LEN);
			if (result) {
				pr_debug(
				printk(KERN_DEBUG
				       "getconfig(0x%02x) failed, result = %d\n",
				       HFA384x_RID_CURRENTBSSID, result);
				goto failed;
@@ -1287,19 +1289,21 @@ void prism2sta_processing_defer(struct work_struct *data)
							HFA384x_RID_CURRENTSSID,
							&ssid, sizeof(ssid));
			if (result) {
				pr_debug(
				printk(KERN_DEBUG
				       "getconfig(0x%02x) failed, result = %d\n",
				       HFA384x_RID_CURRENTSSID, result);
				goto failed;
			}
			prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
						(p80211pstrd_t *) &wlandev->ssid);
						(p80211pstrd_t *)&wlandev->
						ssid);

			/* Collect the port status */
			result = hfa384x_drvr_getconfig16(hw,
							  HFA384x_RID_PORTSTATUS, &portstatus);
							  HFA384x_RID_PORTSTATUS,
							  &portstatus);
			if (result) {
				pr_debug(
				printk(KERN_DEBUG
				       "getconfig(0x%02x) failed, result = %d\n",
				       HFA384x_RID_PORTSTATUS, result);
				goto failed;
@@ -1323,18 +1327,20 @@ void prism2sta_processing_defer(struct work_struct *data)
		 * Indicate Deauthentication
		 * Block Transmits, Ignore receives of data frames
		 */
		if(hw->join_ap == 2)
		{
		if (hw->join_ap == 2) {
			hfa384x_JoinRequest_data_t joinreq;
			joinreq = hw->joinreq;
			/* Send the join request */
			hfa384x_drvr_setconfig(hw,
					       HFA384x_RID_JOINREQUEST,
				&joinreq, HFA384x_RID_JOINREQUEST_LEN);
			printk(KERN_INFO "linkstatus=DISCONNECTED (re-submitting join)\n");
					       &joinreq,
					       HFA384x_RID_JOINREQUEST_LEN);
			printk(KERN_INFO
			       "linkstatus=DISCONNECTED (re-submitting join)\n");
		} else {
			if (wlandev->netdev->type == ARPHRD_ETHER)
				printk(KERN_INFO "linkstatus=DISCONNECTED (unhandled)\n");
				printk(KERN_INFO
				       "linkstatus=DISCONNECTED (unhandled)\n");
		}
		wlandev->macmode = WLAN_MACMODE_NONE;

@@ -1363,7 +1369,7 @@ void prism2sta_processing_defer(struct work_struct *data)
						HFA384x_RID_CURRENTBSSID,
						wlandev->bssid, WLAN_BSSID_LEN);
		if (result) {
			pr_debug(
			printk(KERN_DEBUG
			       "getconfig(0x%02x) failed, result = %d\n",
			       HFA384x_RID_CURRENTBSSID, result);
			goto failed;
@@ -1373,7 +1379,7 @@ void prism2sta_processing_defer(struct work_struct *data)
						HFA384x_RID_CURRENTSSID,
						&ssid, sizeof(ssid));
		if (result) {
			pr_debug(
			printk(KERN_DEBUG
			       "getconfig(0x%02x) failed, result = %d\n",
			       HFA384x_RID_CURRENTSSID, result);
			goto failed;
@@ -1381,7 +1387,6 @@ void prism2sta_processing_defer(struct work_struct *data)
		prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
					(p80211pstrd_t *)&wlandev->ssid);


		hw->link_status = HFA384x_LINK_CONNECTED;
		netif_carrier_on(wlandev->netdev);

@@ -1428,15 +1433,16 @@ void prism2sta_processing_defer(struct work_struct *data)
		 * Response:
		 * Disable Transmits, Ignore receives of data frames
		 */
		if(hw->join_ap && --hw->join_retries > 0)
		{
		if (hw->join_ap && --hw->join_retries > 0) {
			hfa384x_JoinRequest_data_t joinreq;
			joinreq = hw->joinreq;
			/* Send the join request */
			hfa384x_drvr_setconfig(hw,
					       HFA384x_RID_JOINREQUEST,
				&joinreq, HFA384x_RID_JOINREQUEST_LEN);
			printk(KERN_INFO "linkstatus=ASSOCFAIL (re-submitting join)\n");
					       &joinreq,
					       HFA384x_RID_JOINREQUEST_LEN);
			printk(KERN_INFO
			       "linkstatus=ASSOCFAIL (re-submitting join)\n");
		} else {
			printk(KERN_INFO "linkstatus=ASSOCFAIL (unhandled)\n");
		}
@@ -1537,14 +1543,16 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,

	if (i >= hw->authlist.cnt) {
		if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL)
			printk(KERN_WARNING "assocstatus info frame received for non-authenticated station.\n");
			printk(KERN_WARNING
			       "assocstatus info frame received for non-authenticated station.\n");
	} else {
		hw->authlist.assoc[i] =
		    (rec.assocstatus == HFA384x_ASSOCSTATUS_STAASSOC ||
		     rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC);

		if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL)
			printk(KERN_WARNING "authfail assocstatus info frame received for authenticated station.\n");
			printk(KERN_WARNING
			       "authfail assocstatus info frame received for authenticated station.\n");
	}

	return;
@@ -1703,7 +1711,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,

	if (rec.status == P80211ENUM_status_successful) {
		for (i = 0; i < hw->authlist.cnt; i++)
			if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN) == 0)
			if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
			    == 0)
				break;

		if (i >= hw->authlist.cnt) {
@@ -1730,13 +1739,15 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
	result = hfa384x_drvr_setconfig(hw, HFA384x_RID_AUTHENTICATESTA,
					&rec, sizeof(rec));
	if (result) {
		if (added) hw->authlist.cnt--;
		printk(KERN_ERR "setconfig(authenticatestation) failed, result=%d\n", result);
		if (added)
			hw->authlist.cnt--;
		printk(KERN_ERR
		       "setconfig(authenticatestation) failed, result=%d\n",
		       result);
	}
	return;
}


/*----------------------------------------------------------------
* prism2sta_inf_psusercnt
*
@@ -1831,7 +1842,6 @@ void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf)
	return;
}


/*----------------------------------------------------------------
* prism2sta_ev_txexc
*
@@ -1858,7 +1868,6 @@ void prism2sta_ev_txexc(wlandevice_t *wlandev, u16 status)
	return;
}


/*----------------------------------------------------------------
* prism2sta_ev_tx
*
@@ -1883,7 +1892,6 @@ void prism2sta_ev_tx(wlandevice_t *wlandev, u16 status)
	return;
}


/*----------------------------------------------------------------
* prism2sta_ev_rx
*
@@ -1958,8 +1966,10 @@ static wlandevice_t *create_wlan(void)

	if (!wlandev || !hw) {
		printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info);
		if (wlandev)	kfree(wlandev);
		if (hw)		kfree(hw);
		if (wlandev)
			kfree(wlandev);
		if (hw)
			kfree(hw);
		return NULL;
	}

@@ -1979,8 +1989,7 @@ static wlandevice_t *create_wlan(void)
	wlandev->set_multicast_list = prism2sta_setmulticast;
	wlandev->tx_timeout = hfa384x_tx_timeout;

	wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT |
	                   P80211_NSDCAP_AUTOJOIN;
	wlandev->nsdcaps = P80211_NSDCAP_HWFRAGMENT | P80211_NSDCAP_AUTOJOIN;

	/* Initialize the device private data stucture. */
	hw->dot11_desired_bss_type = 1;
@@ -2015,10 +2024,6 @@ void prism2sta_commsqual_defer(struct work_struct *data)
			goto done;
		}

		// qual.CQ_currBSS; // link
		// ASL_currBSS;  // level
		// qual.ANL_currFC; // noise

		pr_debug("commsqual %d %d %d\n",
		       hfa384x2host_16(hw->qual.CQ_currBSS),
		       hfa384x2host_16(hw->qual.ASL_currBSS),
@@ -2030,7 +2035,7 @@ void prism2sta_commsqual_defer(struct work_struct *data)
					HFA384x_RID_CURRENTBSSID,
					wlandev->bssid, WLAN_BSSID_LEN);
	if (result) {
		pr_debug(
		printk(KERN_DEBUG
		       "getconfig(0x%02x) failed, result = %d\n",
		       HFA384x_RID_CURRENTBSSID, result);
		goto done;
@@ -2040,7 +2045,7 @@ void prism2sta_commsqual_defer(struct work_struct *data)
					HFA384x_RID_CURRENTSSID,
					&ssid, sizeof(ssid));
	if (result) {
		pr_debug(
		printk(KERN_DEBUG
		       "getconfig(0x%02x) failed, result = %d\n",
		       HFA384x_RID_CURRENTSSID, result);
		goto done;
@@ -2048,7 +2053,6 @@ void prism2sta_commsqual_defer(struct work_struct *data)
	prism2mgmt_bytestr2pstr((hfa384x_bytestr_t *)&ssid,
				(p80211pstrd_t *)&wlandev->ssid);


	/* Reschedule timer */
	mod_timer(&hw->commsqual_timer, jiffies + HZ);

@@ -2062,5 +2066,3 @@ void prism2sta_commsqual_timer(unsigned long data)

	schedule_work(&hw->commsqual_bh);
}