 if ((bss_index = retrieve_bss(priv)) != -1) 
 if ((bss_index = retrieve_bss(priv)) != -1) 
static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype){	struct ass_resp_format {		u16 capability;		u16 status;		u16 ass_id;		u8 el_id;		u8 length;		u8 rates[4];	} *ass_resp = (struct ass_resp_format *)priv->rx_buf;	       	u16 status = le16_to_cpu(ass_resp->status);	u16 ass_id = le16_to_cpu(ass_resp->ass_id);   	u16 rates_len = ass_resp->length > 4 ? 4 : ass_resp->length;		if (frame_len < 8 + rates_len)		return;		if (status == C80211_MGMT_SC_Success) {		if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE)			priv->AssociationRequestRetryCnt = 0;		else			priv->ReAssociationRequestRetryCnt = 0;				atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_STATION_ID_POS, ass_id & 0x3fff);		atmel_set_mib(priv, Phy_Mib_Type, PHY_MIB_RATE_SET_POS, ass_resp->rates, rates_len);		if (priv->power_mode == 0) {			priv->listen_interval = 1;			atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_PS_MODE_POS,  ACTIVE_MODE);			atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 1);		} else {			priv->listen_interval = 2;			atmel_set_mib8(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_PS_MODE_POS,  PS_MODE);			atmel_set_mib16(priv, Mac_Mgmt_Mib_Type, MAC_MGMT_MIB_LISTEN_INTERVAL_POS, 2);		}				priv->station_is_associated = 1;		priv->station_was_associated = 1;		atmel_enter_state(priv, STATION_STATE_READY);		return;	}		if (subtype == C80211_SUBTYPE_MGMT_ASS_RESPONSE &&	    status != C80211_MGMT_SC_AssDeniedBSSRate &&	    status != C80211_MGMT_SC_SupportCapabilities &&	    priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {		mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);		priv->AssociationRequestRetryCnt++;		send_association_request(priv, 0);		return;	}			if (subtype == C80211_SUBTYPE_MGMT_REASS_RESPONSE &&	    status != C80211_MGMT_SC_AssDeniedBSSRate &&	    status != C80211_MGMT_SC_SupportCapabilities &&	    priv->AssociationRequestRetryCnt < MAX_ASSOCIATION_RETRIES) {		mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);		priv->ReAssociationRequestRetryCnt++;		send_association_request(priv, 1);		return;	}		atmel_enter_state(priv,  STATION_STATE_MGMT_ERROR);	priv->station_is_associated = 0;		if(priv->connect_to_any_BSS) {		int bss_index;		priv->BSSinfo[(int)(priv->current_BSS)].channel |= 0x80;				if ((bss_index = retrieve_bss(priv)) != -1) 			atmel_join_bss(priv, bss_index);			}}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4d791aadf63c9d605bc9a4144e79d5756fc29fb3/atmel.c/clean/drivers/net/wireless/atmel.c