unsigned long flags; 
static int orinoco_ioctl_getiwrange(struct net_device *dev, struct iw_point *rrq){	struct orinoco_private *priv = netdev_priv(dev);	int err = 0;	int mode;	struct iw_range range;	int numrates;	int i, k;	unsigned long flags;	TRACE_ENTER(dev->name);	if (!access_ok(VERIFY_WRITE, rrq->pointer, sizeof(range)))		return -EFAULT;	rrq->length = sizeof(range);	if (orinoco_lock(priv, &flags) != 0)		return -EBUSY;	mode = priv->iw_mode;	orinoco_unlock(priv, &flags);	memset(&range, 0, sizeof(range));	/* Much of this shamelessly taken from wvlan_cs.c. No idea	 * what it all means -dgibson */	range.we_version_compiled = WIRELESS_EXT;	range.we_version_source = 11;	range.min_nwid = range.max_nwid = 0; /* We don't use nwids */	/* Set available channels/frequencies */	range.num_channels = NUM_CHANNELS;	k = 0;	for (i = 0; i < NUM_CHANNELS; i++) {		if (priv->channel_mask & (1 << i)) {			range.freq[k].i = i + 1;			range.freq[k].m = channel_frequency[i] * 100000;			range.freq[k].e = 1;			k++;		}				if (k >= IW_MAX_FREQUENCIES)			break;	}	range.num_frequency = k;	range.sensitivity = 3;	if ((mode == IW_MODE_ADHOC) && (priv->spy_number == 0)){		/* Quality stats meaningless in ad-hoc mode */		range.max_qual.qual = 0;		range.max_qual.level = 0;		range.max_qual.noise = 0;		range.avg_qual.qual = 0;		range.avg_qual.level = 0;		range.avg_qual.noise = 0;	} else {		range.max_qual.qual = 0x8b - 0x2f;		range.max_qual.level = 0x2f - 0x95 - 1;		range.max_qual.noise = 0x2f - 0x95 - 1;		/* Need to get better values */		range.avg_qual.qual = 0x24;		range.avg_qual.level = 0xC2;		range.avg_qual.noise = 0x9E;	}	err = orinoco_hw_get_bitratelist(priv, &numrates,					 range.bitrate, IW_MAX_BITRATES);	if (err)		return err;	range.num_bitrates = numrates;		/* Set an indication of the max TCP throughput in bit/s that we can	 * expect using this interface. May be use for QoS stuff...	 * Jean II */	if(numrates > 2)		range.throughput = 5 * 1000 * 1000;	/* ~5 Mb/s */	else		range.throughput = 1.5 * 1000 * 1000;	/* ~1.5 Mb/s */	range.min_rts = 0;	range.max_rts = 2347;	range.min_frag = 256;	range.max_frag = 2346;	if (orinoco_lock(priv, &flags) != 0)		return -EBUSY;	if (priv->has_wep) {		range.max_encoding_tokens = ORINOCO_MAX_KEYS;		range.encoding_size[0] = SMALL_KEY_SIZE;		range.num_encoding_sizes = 1;		if (priv->has_big_wep) {			range.encoding_size[1] = LARGE_KEY_SIZE;			range.num_encoding_sizes = 2;		}	} else {		range.num_encoding_sizes = 0;		range.max_encoding_tokens = 0;	}	orinoco_unlock(priv, &flags);			range.min_pmp = 0;	range.max_pmp = 65535000;	range.min_pmt = 0;	range.max_pmt = 65535 * 1000;	/* ??? */	range.pmp_flags = IW_POWER_PERIOD;	range.pmt_flags = IW_POWER_TIMEOUT;	range.pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_UNICAST_R;	range.num_txpower = 1;	range.txpower[0] = 15; /* 15dBm */	range.txpower_capa = IW_TXPOW_DBM;	range.retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;	range.retry_flags = IW_RETRY_LIMIT;	range.r_time_flags = IW_RETRY_LIFETIME;	range.min_retry = 0;	range.max_retry = 65535;	/* ??? */	range.min_r_time = 0;	range.max_r_time = 65535 * 1000;	/* ??? */	if (copy_to_user(rrq->pointer, &range, sizeof(range)))		return -EFAULT;	TRACE_EXIT(dev->name);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/620554e406e3cc01434c658a1e597162d7e56fd6/orinoco.c/buggy/drivers/net/wireless/orinoco.c