memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); 
memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512); /* Skip RID length member */ 
static u16 setup_card(struct airo_info *ai, u8 *mac, int lock){	Cmd cmd;	Resp rsp;	int status;	int i;	SsidRid mySsid;	u16 lastindex;	WepKeyRid wkr;	int rc;	memset( &mySsid, 0, sizeof( mySsid ) );	if (ai->flash) {		kfree (ai->flash);		ai->flash = NULL;	}	/* The NOP is the first step in getting the card going */	cmd.cmd = NOP;	cmd.parm0 = cmd.parm1 = cmd.parm2 = 0;	if (lock && down_interruptible(&ai->sem))		return ERROR;	if ( issuecommand( ai, &cmd, &rsp ) != SUCCESS ) {		if (lock)			up(&ai->sem);		return ERROR;	}	disable_MAC( ai, 0);	// Let's figure out if we need to use the AUX port	if (!test_bit(FLAG_MPI,&ai->flags)) {		cmd.cmd = CMD_ENABLEAUX;		if (issuecommand(ai, &cmd, &rsp) != SUCCESS) {			if (lock)				up(&ai->sem);			printk(KERN_ERR "airo: Error checking for AUX port\n");			return ERROR;		}		if (!aux_bap || rsp.status & 0xff00) {			ai->bap_read = fast_bap_read;			printk(KERN_DEBUG "airo: Doing fast bap_reads\n");		} else {			ai->bap_read = aux_bap_read;			printk(KERN_DEBUG "airo: Doing AUX bap_reads\n");		}	}	if (lock)		up(&ai->sem);	if (ai->config.len == 0) {		tdsRssiRid rssi_rid;		CapabilityRid cap_rid;		if (ai->APList) {			kfree(ai->APList);			ai->APList = NULL;		}		if (ai->SSID) {			kfree(ai->SSID);			ai->SSID = NULL;		}		// general configuration (read/modify/write)		status = readConfigRid(ai, lock);		if ( status != SUCCESS ) return ERROR;		status = readCapabilityRid(ai, &cap_rid, lock);		if ( status != SUCCESS ) return ERROR;		status = PC4500_readrid(ai,RID_RSSI,&rssi_rid,sizeof(rssi_rid),lock);		if ( status == SUCCESS ) {			if (ai->rssi || (ai->rssi = kmalloc(512, GFP_KERNEL)) != NULL)				memcpy(ai->rssi, (u8*)&rssi_rid + 2, 512);		}		else {			if (ai->rssi) {				kfree(ai->rssi);				ai->rssi = NULL;			}			if (cap_rid.softCap & 8)				ai->config.rmode |= RXMODE_NORMALIZED_RSSI;			else				printk(KERN_WARNING "airo: unknown received signal level scale\n");		}		ai->config.opmode = adhoc ? MODE_STA_IBSS : MODE_STA_ESS;		ai->config.authType = AUTH_OPEN;		ai->config.modulation = MOD_CCK;#ifdef MICSUPPORT		if ((cap_rid.len>=sizeof(cap_rid)) && (cap_rid.extSoftCap&1) &&		    (micsetup(ai) == SUCCESS)) {			ai->config.opmode |= MODE_MIC;			set_bit(FLAG_MIC_CAPABLE, &ai->flags);		}#endif		/* Save off the MAC */		for( i = 0; i < ETH_ALEN; i++ ) {			mac[i] = ai->config.macAddr[i];		}		/* Check to see if there are any insmod configured		   rates to add */		if ( rates[0] ) {			int i = 0;			memset(ai->config.rates,0,sizeof(ai->config.rates));			for( i = 0; i < 8 && rates[i]; i++ ) {				ai->config.rates[i] = rates[i];			}		}		if ( basic_rate > 0 ) {			int i;			for( i = 0; i < 8; i++ ) {				if ( ai->config.rates[i] == basic_rate ||				     !ai->config.rates ) {					ai->config.rates[i] = basic_rate | 0x80;					break;				}			}		}		set_bit (FLAG_COMMIT, &ai->flags);	}	/* Setup the SSIDs if present */	if ( ssids[0] ) {		int i;		for( i = 0; i < 3 && ssids[i]; i++ ) {			mySsid.ssids[i].len = strlen(ssids[i]);			if ( mySsid.ssids[i].len > 32 )				mySsid.ssids[i].len = 32;			memcpy(mySsid.ssids[i].ssid, ssids[i],			       mySsid.ssids[i].len);		}		mySsid.len = sizeof(mySsid);	}	status = writeConfigRid(ai, lock);	if ( status != SUCCESS ) return ERROR;	/* Set up the SSID list */	if ( ssids[0] ) {		status = writeSsidRid(ai, &mySsid, lock);		if ( status != SUCCESS ) return ERROR;	}	status = enable_MAC(ai, &rsp, lock);	if ( status != SUCCESS || (rsp.status & 0xFF00) != 0) {		printk( KERN_ERR "airo: Bad MAC enable reason = %x, rid = %x, offset = %d\n", rsp.rsp0, rsp.rsp1, rsp.rsp2 );		return ERROR;	}	/* Grab the initial wep key, we gotta save it for auto_wep */	rc = readWepKeyRid(ai, &wkr, 1, lock);	if (rc == SUCCESS) do {		lastindex = wkr.kindex;		if (wkr.kindex == 0xffff) {			ai->defindex = wkr.mac[0];		}		rc = readWepKeyRid(ai, &wkr, 0, lock);	} while(lastindex != wkr.kindex);	if (auto_wep) {		ai->expires = RUN_AT(3*HZ);		wake_up_interruptible(&ai->thr_wait);	}	return SUCCESS;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/41480af27a85d6008d9e11db8bc2730407c25e1d/airo.c/clean/drivers/net/wireless/airo.c