int i, offset = 0;
ar5k_ar5211_setKeyCacheEntry(hal, entry, keyval, mac, xor_notused)	struct ath_hal *hal;	u_int16_t entry;	const HAL_KEYVAL *keyval;	const u_int8_t *mac;	int xor_notused;{	int elements = AR5K_AR5211_KEYCACHE_SIZE - 2;	u_int32_t key_v[elements];	int i, offset = 0;	AR5K_ASSERT_ENTRY(entry, AR5K_AR5211_KEYTABLE_SIZE);	/*	 * Store the key type in the last field	 */	switch (keyval->wk_len) {	case 5:		key_v[elements - 1] = AR5K_AR5211_KEYTABLE_TYPE_40;		break;	case 13:		key_v[elements - 1] = AR5K_AR5211_KEYTABLE_TYPE_104;		break;	case 16:		key_v[elements - 1] = AR5K_AR5211_KEYTABLE_TYPE_128;		break;	default:		/* Unsupported key length (not WEP40/104/128) */		return (AH_FALSE);	}	/*	 * Write key cache entry	 */	for (i = 0; i < elements; i++) {		if (elements < 5) {			if (i % 2) {				key_v[i] = AR5K_LE_READ_2(keyval->wk_key +				    offset) & 0xffff;				offset += 2;			} else {				key_v[i] = AR5K_LE_READ_4(keyval->wk_key +				    offset);				offset += 4;			}			if (i == 4 && keyval->wk_len <= 13)				key_v[i] &= 0xff;		}		/* Write value */		AR5K_REG_WRITE(AR5K_AR5211_KEYTABLE(entry) + (i * 4), key_v[i]);	}	return (ar5k_ar5211_setKeyCacheEntryMac(hal, entry, mac));}