[PATCH] atmel: CodingStyle cleanup

Reading this driver I noticed some trailing whitespaces and tabs so I
removed them with some 80th column fitting and a few more similar
things.

Signed-off-by: Carlo Perassi <carlo@linux.it>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Carlo Perassi 2005-11-13 15:02:15 +03:00 committed by John W. Linville
parent c1120b2249
commit 4d791aadf6
1 changed files with 758 additions and 727 deletions

View File

@ -199,7 +199,6 @@ struct rx_desc {
u8 PreambleType;
u16 Duration;
u32 RxTime;
};
#define RX_DESC_FLAG_VALID 0x80
@ -218,7 +217,6 @@ struct rx_desc {
#define RX_DESC_DURATION_OFFSET 14
#define RX_DESC_RX_TIME_OFFSET 16
struct tx_desc {
u32 NextDescriptor;
u16 TxStartOfFrame;
@ -238,10 +236,8 @@ struct tx_desc {
u8 Reserved;
u8 PacketType;
u16 HostTxLength;
};
#define TX_DESC_NEXT_OFFSET 0
#define TX_DESC_POS_OFFSET 4
#define TX_DESC_SIZE_OFFSET 6
@ -255,8 +251,6 @@ struct tx_desc {
#define TX_DESC_PACKET_TYPE_OFFSET 17
#define TX_DESC_HOST_LENGTH_OFFSET 18
///////////////////////////////////////////////////////
// Host-MAC interface
///////////////////////////////////////////////////////
@ -266,7 +260,6 @@ struct tx_desc {
#define TX_FIRM_OWN 0x80
#define TX_DONE 0x40
#define TX_ERROR 0x01
#define TX_PACKET_TYPE_DATA 0x01
@ -282,7 +275,6 @@ struct tx_desc {
#define ISR_IBSS_MERGE 0x40 // (4.1.2.30): IBSS merge
#define ISR_GENERIC_IRQ 0x80
#define Local_Mib_Type 0x01
#define Mac_Address_Mib_Type 0x02
#define Mac_Mib_Type 0x03
@ -317,7 +309,6 @@ struct tx_desc {
#define LOCAL_MIB_PREAMBLE_TYPE 9
#define MAC_ADDR_MIB_MAC_ADDR_POS 0
#define CMD_Set_MIB_Vars 0x01
#define CMD_Get_MIB_Vars 0x02
#define CMD_Scan 0x03
@ -338,7 +329,6 @@ struct tx_desc {
#define CMD_STATUS_HOST_ERROR 0xFF
#define CMD_STATUS_BUSY 0xFE
#define CMD_BLOCK_COMMAND_OFFSET 0
#define CMD_BLOCK_STATUS_OFFSET 1
#define CMD_BLOCK_PARAMETERS_OFFSET 4
@ -398,7 +388,6 @@ struct tx_desc {
#define PROM_MODE_CTRL 0x10
#define PROM_MODE_BAD_PROTOCOL 0x20
#define IFACE_INT_STATUS_OFFSET 0
#define IFACE_INT_MASK_OFFSET 1
#define IFACE_LOCKOUT_HOST_OFFSET 2
@ -590,7 +579,6 @@ struct atmel_private {
u8 SSID[MAX_SSID_LENGTH], new_SSID[MAX_SSID_LENGTH];
u64 last_beacon_timestamp;
u8 rx_buf[MAX_WIRELESS_BODY];
};
static u8 atmel_basic_rates[4] = {0x82,0x84,0x0b,0x16};
@ -610,27 +598,37 @@ static const struct {
static void build_wpa_mib(struct atmel_private *priv);
static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void atmel_copy_to_card(struct net_device *dev, u16 dest, unsigned char *src, u16 len);
static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest, u16 src, u16 len);
static void atmel_copy_to_card(struct net_device *dev, u16 dest,
unsigned char *src, u16 len);
static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest,
u16 src, u16 len);
static void atmel_set_gcr(struct net_device *dev, u16 mask);
static void atmel_clear_gcr(struct net_device *dev, u16 mask);
static int atmel_lock_mac(struct atmel_private *priv);
static void atmel_wmem32(struct atmel_private *priv, u16 pos, u32 data);
static void atmel_command_irq(struct atmel_private *priv);
static int atmel_validate_channel(struct atmel_private *priv, int channel);
static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
static void atmel_management_frame(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header,
u16 frame_len, u8 rssi);
static void atmel_management_timer(u_long a);
static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size);
static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size);
static void atmel_transmit_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
static void atmel_send_command(struct atmel_private *priv, int command,
void *cmd, int cmd_size);
static int atmel_send_command_wait(struct atmel_private *priv, int command,
void *cmd, int cmd_size);
static void atmel_transmit_management_frame(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header,
u8 *body, int body_len);
static u8 atmel_get_mib8(struct atmel_private *priv, u8 type, u8 index);
static void atmel_set_mib8(struct atmel_private *priv, u8 type, u8 index, u8 data);
static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index, u16 data);
static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index, u8 *data, int data_len);
static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index, u8 *data, int data_len);
static void atmel_set_mib8(struct atmel_private *priv, u8 type, u8 index,
u8 data);
static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index,
u16 data);
static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index,
u8 *data, int data_len);
static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index,
u8 *data, int data_len);
static void atmel_scan(struct atmel_private *priv, int specific_ssid);
static void atmel_join_bss(struct atmel_private *priv, int bss_index);
static void atmel_smooth_qual(struct atmel_private *priv);
@ -714,7 +712,6 @@ static void tx_done_irq(struct atmel_private *priv)
atmel_rmem8(priv, atmel_tx(priv, TX_DESC_FLAGS_OFFSET, priv->tx_desc_head)) == TX_DONE &&
i < priv->host_info.tx_desc_count;
i++) {
u8 status = atmel_rmem8(priv, atmel_tx(priv, TX_DESC_STATUS_OFFSET, priv->tx_desc_head));
u16 msdu_size = atmel_rmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, priv->tx_desc_head));
u8 type = atmel_rmem8(priv, atmel_tx(priv, TX_DESC_PACKET_TYPE_OFFSET, priv->tx_desc_head));
@ -762,7 +759,8 @@ static u16 find_tx_buff(struct atmel_private *priv, u16 len)
return 0;
}
static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, u16 len, u16 buff, u8 type)
static void tx_update_descriptor(struct atmel_private *priv, int is_bcast,
u16 len, u16 buff, u8 type)
{
atmel_wmem16(priv, atmel_tx(priv, TX_DESC_POS_OFFSET, priv->tx_desc_tail), buff);
atmel_wmem16(priv, atmel_tx(priv, TX_DESC_SIZE_OFFSET, priv->tx_desc_tail), len);
@ -821,7 +819,6 @@ static void tx_update_descriptor(struct atmel_private *priv, int is_bcast, u16 l
priv->tx_desc_tail = 0;
priv->tx_desc_free--;
priv->tx_free_mem -= len;
}
static int start_tx(struct sk_buff *skb, struct net_device *dev)
@ -852,8 +849,9 @@ static int start_tx (struct sk_buff *skb, struct net_device *dev)
/* nb doing the above in the opposite order will deadlock */
/* The Wireless Header is 30 bytes. In the Ethernet packet we "cut" the
12 first bytes (containing DA/SA) and put them in the appropriate fields of
the Wireless Header. Thus the packet length is then the initial + 18 (+30-12) */
12 first bytes (containing DA/SA) and put them in the appropriate
fields of the Wireless Header. Thus the packet length is then the
initial + 18 (+30-12) */
if (!(buff = find_tx_buff(priv, len + 18))) {
priv->stats.tx_dropped++;
@ -917,7 +915,8 @@ static void atmel_transmit_management_frame(struct atmel_private *priv,
tx_update_descriptor(priv, header->addr1[0] & 0x01, len, buff, TX_PACKET_TYPE_MGMT);
}
static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
static void fast_rx_path(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header,
u16 msdu_size, u16 rx_packet_loc, u32 crc)
{
/* fast path: unfragmented packet copy directly into skbuf */
@ -970,7 +969,8 @@ static void fast_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr
}
/* Test to see if the packet in card memory at packet_loc has a valid CRC
It doesn't matter that this is slow: it is only used to proble the first few packets. */
It doesn't matter that this is slow: it is only used to proble the first few
packets. */
static int probe_crc(struct atmel_private *priv, u16 packet_loc, u16 msdu_size)
{
int i = msdu_size - 4;
@ -990,8 +990,10 @@ static int probe_crc(struct atmel_private *priv, u16 packet_loc, u16 msdu_size)
return (crc ^ 0xffffffff) == netcrc;
}
static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no, u8 frag_no, int more_frags)
static void frag_rx_path(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header,
u16 msdu_size, u16 rx_packet_loc, u32 crc, u16 seq_no,
u8 frag_no, int more_frags)
{
u8 mac4[6];
u8 source[6];
@ -1074,7 +1076,6 @@ static void frag_rx_path(struct atmel_private *priv, struct ieee80211_hdr_4addr
priv->stats.rx_packets++;
}
}
} else
priv->wstats.discard.fragment++;
}
@ -1114,8 +1115,9 @@ static void rx_done_irq(struct atmel_private *priv)
frame_ctl = le16_to_cpu(header.frame_ctl);
seq_control = le16_to_cpu(header.seq_ctl);
/* probe for CRC use here if needed once five packets have arrived with
the same crc status, we assume we know what's happening and stop probing */
/* probe for CRC use here if needed once five packets have
arrived with the same crc status, we assume we know what's
happening and stop probing */
if (priv->probe_crc) {
if (!priv->wep_is_on || !(frame_ctl & IEEE80211_FCTL_PROTECTED)) {
priv->do_rx_crc = probe_crc(priv, rx_packet_loc, msdu_size);
@ -1138,7 +1140,6 @@ static void rx_done_irq(struct atmel_private *priv)
msdu_size -= 24; /* header */
if ((frame_ctl & IEEE80211_FCTL_FTYPE) == IEEE80211_FTYPE_DATA) {
int more_fragments = frame_ctl & IEEE80211_FCTL_MOREFRAGS;
u8 packet_fragment_no = seq_control & IEEE80211_SCTL_FRAG;
u16 packet_sequence_no = (seq_control & IEEE80211_SCTL_SEQ) >> 4;
@ -1200,7 +1201,6 @@ static irqreturn_t service_interrupt(int irq, void *dev_id, struct pt_regs *regs
ISR_GENERIC_IRQ
};
if (priv->card && priv->present_callback &&
!(*priv->present_callback)(priv->card))
return IRQ_HANDLED;
@ -1291,7 +1291,6 @@ static irqreturn_t service_interrupt(int irq, void *dev_id, struct pt_regs *regs
}
}
static struct net_device_stats *atmel_get_stats(struct net_device *dev)
{
struct atmel_private *priv = netdev_priv(dev);
@ -1329,7 +1328,7 @@ static struct iw_statistics *atmel_get_wireless_stats (struct net_device *dev)
priv->wstats.miss.beacon = 0;
}
return (&priv->wstats);
return &priv->wstats;
}
static int atmel_change_mtu(struct net_device *dev, int new_mtu)
@ -1439,10 +1438,12 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
char *p = buf;
char *s, *r, *c;
p += sprintf(p, "Driver version:\t\t%d.%d\n", DRIVER_MAJOR, DRIVER_MINOR);
p += sprintf(p, "Driver version:\t\t%d.%d\n",
DRIVER_MAJOR, DRIVER_MINOR);
if (priv->station_state != STATION_STATE_DOWN) {
p += sprintf(p, "Firmware version:\t%d.%d build %d\nFirmware location:\t",
p += sprintf(p, "Firmware version:\t%d.%d build %d\n"
"Firmware location:\t",
priv->host_info.major_version,
priv->host_info.minor_version,
priv->host_info.build_version);
@ -1450,9 +1451,11 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
if (priv->card_type != CARD_TYPE_EEPROM)
p += sprintf(p, "on card\n");
else if (priv->firmware)
p += sprintf(p, "%s loaded by host\n", priv->firmware_id);
p += sprintf(p, "%s loaded by host\n",
priv->firmware_id);
else
p += sprintf(p, "%s loaded by hotplug\n", priv->firmware_id);
p += sprintf(p, "%s loaded by hotplug\n",
priv->firmware_id);
switch (priv->card_type) {
case CARD_TYPE_PARALLEL_FLASH: c = "Parallel flash"; break;
@ -1461,7 +1464,6 @@ static int atmel_proc_output (char *buf, struct atmel_private *priv)
default: c = "<unknown>";
}
r = "<unknown>";
for (i = 0; i < sizeof(channel_table)/sizeof(channel_table[0]); i++)
if (priv->reg_domain == channel_table[i].reg_domain)
@ -1504,8 +1506,10 @@ static int atmel_read_proc(char *page, char **start, off_t off,
return len;
}
struct net_device *init_atmel_card( unsigned short irq, unsigned long port, const AtmelFWType fw_type,
struct device *sys_dev, int (*card_present)(void *), void *card)
struct net_device *init_atmel_card(unsigned short irq, unsigned long port,
const AtmelFWType fw_type,
struct device *sys_dev,
int (*card_present)(void *), void *card)
{
struct net_device *dev;
struct atmel_private *priv;
@ -1814,7 +1818,6 @@ static int atmel_set_encode(struct net_device *dev,
return -EINPROGRESS; /* Call commit handler */
}
static int atmel_get_encode(struct net_device *dev,
struct iw_request_info *info,
struct iw_point *dwrq,
@ -1989,7 +1992,7 @@ static int atmel_get_retry(struct net_device *dev,
vwrq->disabled = 0; /* Can't be disabled */
/* Note : by default, display the min retry number */
if((vwrq->flags & IW_RETRY_MAX)) {
if (vwrq->flags & IW_RETRY_MAX) {
vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
vwrq->value = priv->long_retry;
} else {
@ -2196,7 +2199,6 @@ static int atmel_get_scan(struct net_device *dev,
iwe.u.data.flags = IW_ENCODE_DISABLED;
iwe.u.data.length = 0;
current_ev = iwe_stream_add_point(current_ev, extra + IW_SCAN_MAX_DATA, &iwe, NULL);
}
/* Length of data */
@ -2375,7 +2377,6 @@ static const iw_handler atmel_handler[] =
(iw_handler) atmel_get_power, /* SIOCGIWPOWER */
};
static const iw_handler atmel_private_handler[] =
{
NULL, /* SIOCIWFIRSTPRIV */
@ -2387,7 +2388,6 @@ typedef struct atmel_priv_ioctl {
unsigned short len;
} atmel_priv_ioctl;
#define ATMELFWL SIOCIWFIRSTPRIV
#define ATMELIDIFC ATMELFWL + 1
#define ATMELRD ATMELFWL + 2
@ -2395,10 +2395,24 @@ typedef struct atmel_priv_ioctl {
#define REGDOMAINSZ 20
static const struct iw_priv_args atmel_private_args[] = {
/*{ cmd, set_args, get_args, name } */
{ ATMELFWL, IW_PRIV_TYPE_BYTE | IW_PRIV_SIZE_FIXED | sizeof (atmel_priv_ioctl), IW_PRIV_TYPE_NONE, "atmelfwl" },
{ ATMELIDIFC, IW_PRIV_TYPE_NONE, IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, "atmelidifc" },
{ ATMELRD, IW_PRIV_TYPE_CHAR | REGDOMAINSZ, IW_PRIV_TYPE_NONE, "regdomain" },
{
.cmd = ATMELFWL,
.set_args = IW_PRIV_TYPE_BYTE
| IW_PRIV_SIZE_FIXED
| sizeof (atmel_priv_ioctl),
.get_args = IW_PRIV_TYPE_NONE,
.name = "atmelfwl"
}, {
.cmd = ATMELIDIFC,
.set_args = IW_PRIV_TYPE_NONE,
.get_args = IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1,
.name = "atmelidifc"
}, {
.cmd = ATMELRD,
.set_args = IW_PRIV_TYPE_CHAR | REGDOMAINSZ,
.get_args = IW_PRIV_TYPE_NONE,
.name = "regdomain"
},
};
static const struct iw_handler_def atmel_handler_def =
@ -2594,7 +2608,6 @@ static void join(struct atmel_private *priv, int type)
atmel_send_command(priv, CMD_Join, &cmd, sizeof(cmd));
}
static void start(struct atmel_private *priv, int type)
{
struct {
@ -2615,7 +2628,8 @@ static void start(struct atmel_private *priv, int type)
atmel_send_command(priv, CMD_Start, &cmd, sizeof(cmd));
}
static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 channel)
static void handle_beacon_probe(struct atmel_private *priv, u16 capability,
u8 channel)
{
int rejoin = 0;
int new = capability & C80211_MGMT_CAPABILITY_ShortPreamble ?
@ -2644,8 +2658,8 @@ static void handle_beacon_probe(struct atmel_private *priv, u16 capability, u8 c
}
}
static void send_authentication_request(struct atmel_private *priv, u16 system, u8 *challenge, int challenge_len)
static void send_authentication_request(struct atmel_private *priv, u16 system,
u8 *challenge, int challenge_len)
{
struct ieee80211_hdr_4addr header;
struct auth_body auth;
@ -2732,7 +2746,8 @@ static void send_association_request(struct atmel_private *priv, int is_reassoc)
atmel_transmit_management_frame(priv, &header, (void *)&body, bodysize);
}
static int is_frame_from_current_bss(struct atmel_private *priv, struct ieee80211_hdr_4addr *header)
static int is_frame_from_current_bss(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header)
{
if (le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_FROMDS)
return memcmp(header->addr3, priv->CurrentBSSID, 6) == 0;
@ -2750,9 +2765,10 @@ static int retrieve_bss(struct atmel_private *priv)
return -1;
if (priv->connect_to_any_BSS) {
/* Select a BSS with the max-RSSI but of the same type and of the same WEP mode
and that it is not marked as 'bad' (i.e. we had previously failed to connect to
this BSS with the settings that we currently use) */
/* Select a BSS with the max-RSSI but of the same type and of
the same WEP mode and that it is not marked as 'bad' (i.e.
we had previously failed to connect to this BSS with the
settings that we currently use) */
priv->current_BSS = 0;
for (i = 0; i < priv->BSS_list_entries; i++) {
if (priv->operating_mode == priv->BSSinfo[i].BSStype &&
@ -2762,7 +2778,6 @@ static int retrieve_bss(struct atmel_private *priv)
max_rssi = priv->BSSinfo[i].RSSI;
priv->current_BSS = max_index = i;
}
}
return max_index;
}
@ -2781,10 +2796,10 @@ static int retrieve_bss(struct atmel_private *priv)
return max_index;
}
static void store_bss_info(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
u16 capability, u16 beacon_period, u8 channel, u8 rssi,
u8 ssid_len, u8 *ssid, int is_beacon)
static void store_bss_info(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header, u16 capability,
u16 beacon_period, u8 channel, u8 rssi, u8 ssid_len,
u8 *ssid, int is_beacon)
{
u8 *bss = capability & C80211_MGMT_CAPABILITY_ESS ? header->addr2 : header->addr3;
int i, index;
@ -2886,7 +2901,6 @@ static void authenticate(struct atmel_private *priv, u16 frame_len)
}
}
priv->AuthenticationRequestRetryCnt = 0;
atmel_enter_state(priv, STATION_STATE_MGMT_ERROR);
priv->station_is_associated = 0;
@ -2916,16 +2930,22 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
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);
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);
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);
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;
@ -2963,7 +2983,6 @@ static void associate(struct atmel_private *priv, u16 frame_len, u16 subtype)
if ((bss_index = retrieve_bss(priv)) != -1)
atmel_join_bss(priv, bss_index);
}
}
@ -2985,8 +3004,10 @@ void atmel_join_bss(struct atmel_private *priv, int bss_index)
priv->power_mode) {
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);
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);
}
priv->operating_mode = bss->BSStype;
@ -2995,7 +3016,8 @@ void atmel_join_bss(struct atmel_private *priv, int bss_index)
if (priv->preamble != bss->preamble) {
priv->preamble = bss->preamble;
atmel_set_mib8(priv, Local_Mib_Type, LOCAL_MIB_PREAMBLE_TYPE, bss->preamble);
atmel_set_mib8(priv, Local_Mib_Type,
LOCAL_MIB_PREAMBLE_TYPE, bss->preamble);
}
if (!priv->wep_is_on && bss->UsingWEP) {
@ -3018,7 +3040,6 @@ void atmel_join_bss(struct atmel_private *priv, int bss_index)
join(priv, BSS_TYPE_AD_HOC);
}
static void restart_search(struct atmel_private *priv)
{
int bss_index;
@ -3032,7 +3053,6 @@ static void restart_search(struct atmel_private *priv)
atmel_join_bss(priv, bss_index);
else
atmel_scan(priv, 0);
}
}
@ -3051,9 +3071,9 @@ static void smooth_rssi(struct atmel_private *priv, u8 rssi)
rssi = rssi * 100 / max_rssi;
if ((rssi + old) % 2)
priv->wstats.qual.level = ((rssi + old)/2) + 1;
priv->wstats.qual.level = (rssi + old) / 2 + 1;
else
priv->wstats.qual.level = ((rssi + old)/2);
priv->wstats.qual.level = (rssi + old) / 2;
priv->wstats.qual.updated |= IW_QUAL_LEVEL_UPDATED;
priv->wstats.qual.updated &= ~IW_QUAL_LEVEL_INVALID;
}
@ -3073,12 +3093,14 @@ static void atmel_smooth_qual(struct atmel_private *priv)
}
/* deals with incoming managment frames. */
static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_hdr_4addr *header,
static void atmel_management_frame(struct atmel_private *priv,
struct ieee80211_hdr_4addr *header,
u16 frame_len, u8 rssi)
{
u16 subtype;
switch (subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE) {
subtype = le16_to_cpu(header->frame_ctl) & IEEE80211_FCTL_STYPE;
switch (subtype) {
case C80211_SUBTYPE_MGMT_BEACON:
case C80211_SUBTYPE_MGMT_ProbeResponse:
@ -3134,8 +3156,10 @@ static void atmel_management_frame(struct atmel_private *priv, struct ieee80211_
}
if (priv->station_state == STATION_STATE_SCANNING)
store_bss_info(priv, header, capability, beacon_interval, channel,
rssi, ssid_length, &beacon->rates_el_id,
store_bss_info(priv, header, capability,
beacon_interval, channel, rssi,
ssid_length,
&beacon->rates_el_id,
subtype == C80211_SUBTYPE_MGMT_BEACON);
}
break;
@ -3210,7 +3234,6 @@ static void atmel_management_timer(u_long a)
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_authentication_request(priv, C80211_MGMT_AAN_OPENSYSTEM, NULL, 0);
}
break;
case STATION_STATE_ASSOCIATING:
@ -3224,7 +3247,6 @@ static void atmel_management_timer(u_long a)
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_association_request(priv, 0);
}
break;
case STATION_STATE_REASSOCIATING:
@ -3238,7 +3260,6 @@ static void atmel_management_timer(u_long a)
mod_timer(&priv->management_timer, jiffies + MGMT_JIFFIES);
send_association_request(priv, 1);
}
break;
default:
@ -3321,7 +3342,6 @@ static void atmel_command_irq(struct atmel_private *priv)
}
atmel_scan(priv, 1);
}
}
@ -3382,7 +3402,8 @@ static int atmel_wakeup_firmware(struct atmel_private *priv)
}
if (i == 0) {
printk(KERN_ALERT "%s: MAC failed to initialise.\n", priv->dev->name);
printk(KERN_ALERT "%s: MAC failed to initialise.\n",
priv->dev->name);
return 0;
}
@ -3490,10 +3511,10 @@ static int probe_atmel_card(struct net_device *dev)
return rc;
}
static void build_wep_mib(struct atmel_private *priv)
/* Move the encyption information on the MIB structure.
This routine is for the pre-WPA firmware: later firmware has
a different format MIB and a different routine. */
static void build_wep_mib(struct atmel_private *priv)
{
struct { /* NB this is matched to the hardware, don't change. */
u8 wep_is_on;
@ -3559,8 +3580,9 @@ static void build_wpa_mib(struct atmel_private *priv)
memset(mib.cipher_default_key_value, 0, sizeof(mib.cipher_default_key_value));
if (priv->wep_is_on) {
/* There's a comment in the Atmel code to the effect that this is only valid
when still using WEP, it may need to be set to something to use WPA */
/* There's a comment in the Atmel code to the effect that this
is only valid when still using WEP, it may need to be set to
something to use WPA */
memset(mib.key_RSC, 0, sizeof(mib.key_RSC));
mib.default_key = mib.group_key = 255;
@ -3770,7 +3792,8 @@ static int reset_atmel_card(struct net_device *dev)
return 1;
}
static void atmel_send_command(struct atmel_private *priv, int command, void *cmd, int cmd_size)
static void atmel_send_command(struct atmel_private *priv, int command,
void *cmd, int cmd_size)
{
if (cmd)
atmel_copy_to_card(priv->dev, atmel_co(priv, CMD_BLOCK_PARAMETERS_OFFSET),
@ -3780,7 +3803,8 @@ static void atmel_send_command(struct atmel_private *priv, int command, void *cm
atmel_wmem8(priv, atmel_co(priv, CMD_BLOCK_STATUS_OFFSET), 0);
}
static int atmel_send_command_wait(struct atmel_private *priv, int command, void *cmd, int cmd_size)
static int atmel_send_command_wait(struct atmel_private *priv, int command,
void *cmd, int cmd_size)
{
int i, status;
@ -3827,7 +3851,8 @@ static void atmel_set_mib8(struct atmel_private *priv, u8 type, u8 index, u8 dat
atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + 1);
}
static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index, u16 data)
static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index,
u16 data)
{
struct get_set_mib m;
m.type = type;
@ -3839,7 +3864,8 @@ static void atmel_set_mib16(struct atmel_private *priv, u8 type, u8 index, u16 d
atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + 2);
}
static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index, u8 *data, int data_len)
static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index,
u8 *data, int data_len)
{
struct get_set_mib m;
m.type = type;
@ -3853,7 +3879,8 @@ static void atmel_set_mib(struct atmel_private *priv, u8 type, u8 index, u8 *dat
atmel_send_command_wait(priv, CMD_Set_MIB_Vars, &m, MIB_HEADER_SIZE + data_len);
}
static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index, u8 *data, int data_len)
static void atmel_get_mib(struct atmel_private *priv, u8 type, u8 index,
u8 *data, int data_len)
{
struct get_set_mib m;
m.type = type;
@ -3877,7 +3904,8 @@ static void atmel_writeAR(struct net_device *dev, u16 data)
outw(data, dev->base_addr + AR);
}
static void atmel_copy_to_card(struct net_device *dev, u16 dest, unsigned char *src, u16 len)
static void atmel_copy_to_card(struct net_device *dev, u16 dest,
unsigned char *src, u16 len)
{
int i;
atmel_writeAR(dev, dest);
@ -3894,7 +3922,8 @@ static void atmel_copy_to_card(struct net_device *dev, u16 dest, unsigned char *
atmel_write8(dev, DR, *src);
}
static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest, u16 src, u16 len)
static void atmel_copy_to_host(struct net_device *dev, unsigned char *dest,
u16 src, u16 len)
{
int i;
atmel_writeAR(dev, src);
@ -3931,12 +3960,14 @@ static int atmel_lock_mac(struct atmel_private *priv)
udelay(20);
}
if (!i) return 0; /* timed out */
if (!i)
return 0; /* timed out */
atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 1);
if (atmel_rmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_HOST_OFFSET))) {
atmel_wmem8(priv, atmel_hi(priv, IFACE_LOCKOUT_MAC_OFFSET), 0);
if (!j--) return 0; /* timed out */
if (!j--)
return 0; /* timed out */
goto retry;
}