 geo = ieee80211_get_geo(priv->ieee); 
static int ipw_request_scan(struct ipw_priv *priv){	struct ipw_scan_request_ext scan;	int channel_index = 0;	int i, err = 0, scan_type;	const struct ieee80211_geo *geo;#ifdef CONFIG_IPW2200_MONITOR	u8 channel;#endif	down(&priv->sem);	geo = ieee80211_get_geo(priv->ieee);	if (priv->status & STATUS_SCANNING) {		IPW_DEBUG_HC("Concurrent scan requested.  Ignoring.\n");		priv->status |= STATUS_SCAN_PENDING;		goto done;	}	if (priv->status & STATUS_SCAN_ABORTING) {		IPW_DEBUG_HC("Scan request while abort pending.  Queuing.\n");		priv->status |= STATUS_SCAN_PENDING;		goto done;	}	if (priv->status & STATUS_RF_KILL_MASK) {		IPW_DEBUG_HC("Aborting scan due to RF Kill activation\n");		priv->status |= STATUS_SCAN_PENDING;		goto done;	}	memset(&scan, 0, sizeof(scan));	if (priv->config & CFG_SPEED_SCAN)		scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =		    cpu_to_le16(30);	else		scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_SCAN] =		    cpu_to_le16(20);	scan.dwell_time[IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN] =	    cpu_to_le16(20);	scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] = cpu_to_le16(20);	scan.full_scan_index = cpu_to_le32(ieee80211_get_scans(priv->ieee));#ifdef CONFIG_IPW2200_MONITOR	if (priv->ieee->iw_mode == IW_MODE_MONITOR) {		u8 band = 0;		switch (ieee80211_is_valid_channel(priv->ieee, priv->channel)) {		case IEEE80211_52GHZ_BAND:			band = (u8) (IPW_A_MODE << 6) | 1;			channel = priv->channel;			break;		case IEEE80211_24GHZ_BAND:			band = (u8) (IPW_B_MODE << 6) | 1;			channel = priv->channel;			break;		default:			band = (u8) (IPW_B_MODE << 6) | 1;			channel = 9;			break;		}		scan.channels_list[0] = band;		scan.channels_list[1] = channel;		ipw_set_scan_type(&scan, 1, IPW_SCAN_PASSIVE_FULL_DWELL_SCAN);		/* NOTE:  The card will sit on this channel for this time		 * period.  Scan aborts are timing sensitive and frequently		 * result in firmware restarts.  As such, it is best to		 * set a small dwell_time here and just keep re-issuing		 * scans.  Otherwise fast channel hopping will not actually		 * hop channels.		 *		 * TODO: Move SPEED SCAN support to all modes and bands */		scan.dwell_time[IPW_SCAN_PASSIVE_FULL_DWELL_SCAN] =		    cpu_to_le16(2000);	} else {#endif				/* CONFIG_IPW2200_MONITOR */		/* If we are roaming, then make this a directed scan for the		 * current network.  Otherwise, ensure that every other scan		 * is a fast channel hop scan */		if ((priv->status & STATUS_ROAMING)		    || (!(priv->status & STATUS_ASSOCIATED)			&& (priv->config & CFG_STATIC_ESSID)			&& (le32_to_cpu(scan.full_scan_index) % 2))) {			err = ipw_send_ssid(priv, priv->essid, priv->essid_len);			if (err) {				IPW_DEBUG_HC("Attempt to send SSID command "					     "failed.\n");				goto done;			}			scan_type = IPW_SCAN_ACTIVE_BROADCAST_AND_DIRECT_SCAN;		} else {			scan_type = IPW_SCAN_ACTIVE_BROADCAST_SCAN;		}		/* Add channels to the scan list */		if (priv->ieee->freq_band & IEEE80211_52GHZ_BAND) {			int start = channel_index;			for (i = 0; i < geo->a_channels; i++) {				if ((priv->status & STATUS_ASSOCIATED) &&				    geo->a[i].channel == priv->channel)					continue;				channel_index++;				scan.channels_list[channel_index] =				    geo->a[i].channel;				ipw_set_scan_type(&scan, channel_index,						  scan_type);			}			if (start != channel_index) {				scan.channels_list[start] =				    (u8) (IPW_A_MODE << 6) | (channel_index -							      start);				channel_index++;			}		}		if (priv->ieee->freq_band & IEEE80211_24GHZ_BAND) {			int start = channel_index;			if (priv->config & CFG_SPEED_SCAN) {				u8 channels[IEEE80211_24GHZ_CHANNELS] = {					/* nop out the list */					[0] = 0				};				u8 channel;				while (channel_index < IPW_SCAN_CHANNELS) {					channel =					    priv->speed_scan[priv->							     speed_scan_pos];					if (channel == 0) {						priv->speed_scan_pos = 0;						channel = priv->speed_scan[0];					}					if ((priv->status & STATUS_ASSOCIATED)					    && channel == priv->channel) {						priv->speed_scan_pos++;						continue;					}					/* If this channel has already been					 * added in scan, break from loop					 * and this will be the first channel					 * in the next scan.					 */					if (channels[channel - 1] != 0)						break;					channels[channel - 1] = 1;					priv->speed_scan_pos++;					channel_index++;					scan.channels_list[channel_index] =					    channel;					ipw_set_scan_type(&scan, channel_index,							  scan_type);				}			} else {				for (i = 0; i < geo->bg_channels; i++) {					if ((priv->status & STATUS_ASSOCIATED)					    && geo->bg[i].channel ==					    priv->channel)						continue;					channel_index++;					scan.channels_list[channel_index] =					    geo->bg[i].channel;					ipw_set_scan_type(&scan, channel_index,							  scan_type);				}			}			if (start != channel_index) {				scan.channels_list[start] =				    (u8) (IPW_B_MODE << 6) | (channel_index -							      start);			}		}#ifdef CONFIG_IPW2200_MONITOR	}#endif	err = ipw_send_scan_request_ext(priv, &scan);	if (err) {		IPW_DEBUG_HC("Sending scan command failed: %08X\n", err);		goto done;	}	priv->status |= STATUS_SCANNING;	priv->status &= ~STATUS_SCAN_PENDING;      done:	up(&priv->sem);	return err;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/afbf30a2b78cac38e6ddae10a73063943b4783ee/ipw2200.c/clean/drivers/net/wireless/ipw2200.c