aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Roskin <proski@gnu.org>2007-06-13 21:11:32 -0400
committerGuido Guenther <agx@sigxcpu.org>2007-06-14 10:11:08 +0200
commitad182de778ef8573e22eb929a7974d24a2d176dd (patch)
tree0b316b15ec1a8e5b14c914131454ccec08f89d3e
parent800390e426227305c494ad13fd1a2f2f6014b33c (diff)
[PATCH] Run at76_usb.c throut Lindent
Intervene in some places to make the result readable Signed-off-by: Pavel Roskin <proski@gnu.org>
-rw-r--r--at76_usb.c827
1 files changed, 446 insertions, 381 deletions
diff --git a/at76_usb.c b/at76_usb.c
index f54d99e..6064171 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -47,15 +47,15 @@
static int at76_debug = DBG_DEFAULTS;
static struct fwentry firmwares[] = {
- [0] = { "" },
- [BOARDTYPE_503_INTERSIL_3861] = { "atmel_at76c503-i3861.bin" },
- [BOARDTYPE_503_INTERSIL_3863] = { "atmel_at76c503-i3863.bin" },
- [BOARDTYPE_503_RFMD] = { "atmel_at76c503-rfmd.bin" },
- [BOARDTYPE_503_RFMD_ACC] = { "atmel_at76c503-rfmd-acc.bin" },
- [BOARDTYPE_505_RFMD] = { "atmel_at76c505-rfmd.bin" },
- [BOARDTYPE_505_RFMD_2958] = { "atmel_at76c505-rfmd2958.bin" },
- [BOARDTYPE_505A_RFMD_2958] = { "atmel_at76c505a-rfmd2958.bin" },
- [BOARDTYPE_505AMX_RFMD] = { "atmel_at76c505amx-rfmd.bin" },
+ [0] = {""},
+ [BOARDTYPE_503_INTERSIL_3861] = {"atmel_at76c503-i3861.bin"},
+ [BOARDTYPE_503_INTERSIL_3863] = {"atmel_at76c503-i3863.bin"},
+ [BOARDTYPE_503_RFMD] = {"atmel_at76c503-rfmd.bin"},
+ [BOARDTYPE_503_RFMD_ACC] = {"atmel_at76c503-rfmd-acc.bin"},
+ [BOARDTYPE_505_RFMD] = {"atmel_at76c505-rfmd.bin"},
+ [BOARDTYPE_505_RFMD_2958] = {"atmel_at76c505-rfmd2958.bin"},
+ [BOARDTYPE_505A_RFMD_2958] = {"atmel_at76c505a-rfmd2958.bin"},
+ [BOARDTYPE_505AMX_RFMD] = {"atmel_at76c505amx-rfmd.bin"},
};
static struct usb_device_id dev_table[] = {
@@ -177,11 +177,13 @@ static int scan_max_time = 120;
/* the supported rates of this hardware, bit7 marks a basic rate */
static const u8 hw_rates[] = { 0x82, 0x84, 0x0b, 0x16 };
+
/* The frequency of each channel in MHz */
static const long channel_frequency[] = {
2412, 2417, 2422, 2427, 2432, 2437, 2442,
2447, 2452, 2457, 2462, 2467, 2472, 2484
};
+
#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
/* Firmware download */
@@ -240,13 +242,9 @@ static int at76_dfu_download_block(struct dfu_ctx *ctx, u8 *buffer, int bytes,
memcpy(tmpbuf, buffer, bytes);
- result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- DFU_DNLOAD,
- USB_TYPE_CLASS | USB_DIR_OUT | USB_RECIP_INTERFACE,
- block, /* Value */
- 0, /* Index */
- tmpbuf, /* Buffer */
- bytes, /* Size */
+ result = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), DFU_DNLOAD,
+ USB_TYPE_CLASS | USB_DIR_OUT |
+ USB_RECIP_INTERFACE, block, 0, tmpbuf, bytes,
HZ);
return result;
}
@@ -256,14 +254,10 @@ static int at76_dfu_get_status(struct dfu_ctx *ctx, struct dfu_status *status)
int result;
struct usb_device *udev = ctx->udev;
- result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- DFU_GETSTATUS,
- USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
- 0, /* Value */
- 0, /* Index */
- status, /* Buffer */
- sizeof(struct dfu_status), /* Size */
- HZ);
+ result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATUS,
+ USB_TYPE_CLASS | USB_DIR_IN |
+ USB_RECIP_INTERFACE, 0, 0, status,
+ sizeof(struct dfu_status), HZ);
return result;
}
@@ -271,21 +265,16 @@ static u8 at76_dfu_get_state(struct usb_device *udev, u8 *state)
{
int result;
- result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
- DFU_GETSTATE, /* Request */
- USB_TYPE_CLASS | USB_DIR_IN | USB_RECIP_INTERFACE,
- 0, /* Value */
- 0, /* Index */
- state, /* Buffer */
- 1, /* Size */
- HZ);
+ result = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), DFU_GETSTATE,
+ USB_TYPE_CLASS | USB_DIR_IN |
+ USB_RECIP_INTERFACE, 0, 0, state, 1, HZ);
return result;
}
static inline u32 at76_get_timeout(struct dfu_status *s)
{
u32 ret = (s->poll_timeout[2] << 16) | (s->poll_timeout[1] << 8) |
- (s->poll_timeout[0]);
+ (s->poll_timeout[0]);
return ret;
}
@@ -315,7 +304,9 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
int is_done = 0;
u8 dfu_state = 0;
u32 dfu_timeout = 0;
- int dfu_block_bytes = 0, dfu_bytes_left = dfu_len, dfu_buffer_offset = 0;
+ int dfu_block_bytes = 0;
+ int dfu_bytes_left = dfu_len;
+ int dfu_buffer_offset = 0;
int dfu_block_cnt = 0;
at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __FUNCTION__, dfu_buffer,
@@ -352,7 +343,8 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
dfu_timeout = at76_get_timeout(dfu_stat_buf);
need_dfu_state = 0;
} else
- err("at76_dfu_get_status failed with %d", status);
+ err("at76_dfu_get_status failed with %d",
+ status);
break;
case STATE_DFU_DOWNLOAD_BUSY:
@@ -360,7 +352,8 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
need_dfu_state = 1;
at76_dbg(DBG_DFU, "DFU: Resetting device");
- schedule_timeout_interruptible(msecs_to_jiffies(dfu_timeout));
+ schedule_timeout_interruptible(msecs_to_jiffies
+ (dfu_timeout));
break;
case STATE_DFU_DOWNLOAD_IDLE:
@@ -377,14 +370,15 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
dfu_bytes_left -= dfu_block_bytes;
status = at76_dfu_download_block(ctx,
dfu_buffer +
- dfu_buffer_offset,
+ dfu_buffer_offset,
dfu_block_bytes,
dfu_block_cnt);
dfu_buffer_offset += dfu_block_bytes;
dfu_block_cnt++;
if (!DFU_USB_SUCCESS(status))
- err("dfu_download_block failed with %d", status);
+ err("dfu_download_block failed with %d",
+ status);
need_dfu_state = 1;
break;
@@ -403,8 +397,10 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
if (manifest_sync_timeout > 0)
dfu_timeout = manifest_sync_timeout;
- at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase");
- schedule_timeout_interruptible(msecs_to_jiffies(dfu_timeout));
+ at76_dbg(DBG_DFU,
+ "DFU: Waiting for manifest phase");
+ schedule_timeout_interruptible(msecs_to_jiffies
+ (dfu_timeout));
}
break;
@@ -653,7 +649,8 @@ static int at76_get_hw_config(struct at76_priv *priv)
case BOARDTYPE_503_RFMD:
case BOARDTYPE_503_RFMD_ACC:
- ret = at76_get_hw_cfg_rfmd(priv->udev, hwcfg, sizeof(hwcfg->r3));
+ ret =
+ at76_get_hw_cfg_rfmd(priv->udev, hwcfg, sizeof(hwcfg->r3));
if (ret < 0)
break;
memcpy(priv->mac_addr, hwcfg->r3.mac_addr, ETH_ALEN);
@@ -663,7 +660,8 @@ static int at76_get_hw_config(struct at76_priv *priv)
case BOARDTYPE_505_RFMD:
case BOARDTYPE_505_RFMD_2958:
case BOARDTYPE_505A_RFMD_2958:
- ret = at76_get_hw_cfg_rfmd(priv->udev, hwcfg, sizeof(hwcfg->r5));
+ ret = at76_get_hw_cfg_rfmd(priv->udev, hwcfg,
+ sizeof(hwcfg->r5));
if (ret < 0)
break;
memcpy(priv->mac_addr, hwcfg->r5.mac_addr, ETH_ALEN);
@@ -690,7 +688,7 @@ static struct reg_domain const *at76_get_reg_domain(u16 code)
{0x10, "FCC (USA)", 0x7ff}, /* ch 1-11 */
{0x20, "IC (Canada)", 0x7ff}, /* ch 1-11 */
{0x30, "ETSI (Europe except Spain and France)", 0x1fff}, /* ch 1-13 */
- {0x31, "Spain", 0x600}, /* ch 10-11 */
+ {0x31, "Spain", 0x600}, /* ch 10-11 */
{0x32, "France", 0x1e00}, /* ch 10-13 */
{0x40, "MKK (Japan)", 0x2000}, /* ch 14 */
{0x41, "MKK1 (Japan)", 0x3fff}, /* ch 1-14 */
@@ -832,7 +830,8 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
do {
status = at76_get_cmd_status(priv->udev, cmd);
if (status < 0) {
- err("%s: at76_get_cmd_status failed: %d", netdev->name, status);
+ err("%s: at76_get_cmd_status failed: %d", netdev->name,
+ status);
break;
}
@@ -869,12 +868,14 @@ static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf)
cmd_buf,
sizeof(struct at76_command) +
buf->size + 4, USB_CTRL_GET_TIMEOUT);
- if (ret >= 0)
- if ((ret = at76_wait_completion(priv, CMD_SET_MIB)) !=
- CMD_STATUS_COMPLETE) {
- info("%s: set_mib: at76_wait_completion failed with %d", priv->netdev->name, ret);
+ if (ret >= 0) {
+ ret = at76_wait_completion(priv, CMD_SET_MIB);
+ if (ret != CMD_STATUS_COMPLETE) {
+ info("%s: set_mib: at76_wait_completion failed "
+ "with %d", priv->netdev->name, ret);
ret = -EIO;
}
+ }
kfree(cmd_buf);
return ret;
} else
@@ -891,7 +892,8 @@ static int at76_set_radio(struct at76_priv *priv, int on_off)
if (priv->radio_on != on_off) {
ret = at76_set_card_command(priv->udev, CMD_RADIO, NULL, 0);
if (ret < 0) {
- err("%s: at76_set_card_command(CMD_RADIO) failed: %d", priv->netdev->name, ret);
+ err("%s: at76_set_card_command(CMD_RADIO) failed: %d",
+ priv->netdev->name, ret);
} else
ret = 1;
priv->radio_on = on_off;
@@ -917,7 +919,8 @@ static int at76_set_pm_mode(struct at76_priv *priv)
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (pm_mode) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (pm_mode) failed: %d", priv->netdev->name,
+ ret);
}
return ret;
}
@@ -937,7 +940,8 @@ static int at76_set_associd(struct at76_priv *priv, u16 id)
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (associd) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (associd) failed: %d", priv->netdev->name,
+ ret);
}
return ret;
}
@@ -975,7 +979,8 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type)
priv->mib_buf.data[0] = type;
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (preamble) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (preamble) failed: %d", priv->netdev->name,
+ ret);
}
return ret;
}
@@ -988,10 +993,11 @@ static int at76_set_frag(struct at76_priv *priv, u16 size)
priv->mib_buf.type = MIB_MAC;
priv->mib_buf.size = 2;
priv->mib_buf.index = FRAGMENTATION_OFFSET;
- *(__le16 *) priv->mib_buf.data = cpu_to_le16(size);
+ *(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (frag threshold) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (frag threshold) failed: %d",
+ priv->netdev->name, ret);
}
return ret;
}
@@ -1004,7 +1010,7 @@ static int at76_set_rts(struct at76_priv *priv, u16 size)
priv->mib_buf.type = MIB_MAC;
priv->mib_buf.size = 2;
priv->mib_buf.index = RTS_OFFSET;
- *(__le16 *) priv->mib_buf.data = cpu_to_le16(size);
+ *(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
err("%s: set_mib (rts) failed: %d", priv->netdev->name, ret);
@@ -1023,7 +1029,8 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
priv->mib_buf.data[0] = onoff;
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (autorate fallback) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (autorate fallback) failed: %d",
+ priv->netdev->name, ret);
}
return ret;
}
@@ -1109,17 +1116,17 @@ static int at76_dump_mib_mac_addr(struct at76_priv *priv)
ret = at76_get_mib(priv->udev, MIB_MAC_ADD,
mac_addr, sizeof(struct mib_mac_addr));
if (ret < 0) {
- err("%s: at76_get_mib (MAC_ADDR) failed: %d", priv->netdev->name,
- ret);
+ err("%s: at76_get_mib (MAC_ADDR) failed: %d",
+ priv->netdev->name, ret);
goto err;
}
- dbg("%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x group_addr %s status %d %d %d %d",
- priv->netdev->name, mac2str(mac_addr->mac_addr),
- mac_addr->res[0], mac_addr->res[1],
- hex2str(mac_addr->group_addr, 4 * ETH_ALEN),
- mac_addr->group_addr_status[0], mac_addr->group_addr_status[1],
- mac_addr->group_addr_status[2], mac_addr->group_addr_status[3]);
+ dbg("%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x group_addr %s status "
+ "%d %d %d %d", priv->netdev->name, mac2str(mac_addr->mac_addr),
+ mac_addr->res[0], mac_addr->res[1],
+ hex2str(mac_addr->group_addr, 4 * ETH_ALEN),
+ mac_addr->group_addr_status[0], mac_addr->group_addr_status[1],
+ mac_addr->group_addr_status[2], mac_addr->group_addr_status[3]);
err:
kfree(mac_addr);
@@ -1140,7 +1147,8 @@ static int at76_dump_mib_mac_wep(struct at76_priv *priv)
ret = at76_get_mib(priv->udev, MIB_MAC_WEP, mac_wep,
sizeof(struct mib_mac_wep));
if (ret < 0) {
- err("%s: at76_get_mib (MAC_WEP) failed: %d", priv->netdev->name, ret);
+ err("%s: at76_get_mib (MAC_WEP) failed: %d", priv->netdev->name,
+ ret);
goto err;
}
@@ -1153,9 +1161,9 @@ static int at76_dump_mib_mac_wep(struct at76_priv *priv)
le32_to_cpu(mac_wep->wep_excluded_count),
mac_wep->encryption_level, mac_wep->wep_default_key_id,
mac_wep->wep_default_key_id < 4 ?
- hex2str(mac_wep->wep_default_keyvalue[mac_wep->wep_default_key_id],
- mac_wep->encryption_level == 2 ? 13 : 5) :
- "<invalid key id>");
+ hex2str(mac_wep->wep_default_keyvalue[mac_wep->wep_default_key_id],
+ mac_wep->encryption_level == 2 ? 13 : 5) :
+ "<invalid key id>");
err:
kfree(mac_wep);
@@ -1185,31 +1193,30 @@ static int at76_dump_mib_mac_mgmt(struct at76_priv *priv)
country_string[3] = '\0';
dbg("%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration %d "
- "medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
- "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
- "current_bssid %s current_essid %s current_bss_type %d "
- "pm_mode %d ibss_change %d res %d "
- "multi_domain_capability_implemented %d "
- "international_roaming %d country_string %s",
- priv->netdev->name,
- le16_to_cpu(mac_mgmt->beacon_period),
- le16_to_cpu(mac_mgmt->CFP_max_duration),
- le16_to_cpu(mac_mgmt->medium_occupancy_limit),
- le16_to_cpu(mac_mgmt->station_id),
- le16_to_cpu(mac_mgmt->ATIM_window),
- mac_mgmt->CFP_mode,
- mac_mgmt->privacy_option_implemented,
- mac_mgmt->DTIM_period,
- mac_mgmt->CFP_period,
- mac2str(mac_mgmt->current_bssid),
- hex2str(mac_mgmt->current_essid, IW_ESSID_MAX_SIZE),
- mac_mgmt->current_bss_type,
- mac_mgmt->power_mgmt_mode,
- mac_mgmt->ibss_change,
- mac_mgmt->res,
- mac_mgmt->multi_domain_capability_implemented,
- mac_mgmt->multi_domain_capability_enabled,
- country_string);
+ "medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
+ "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
+ "current_bssid %s current_essid %s current_bss_type %d "
+ "pm_mode %d ibss_change %d res %d "
+ "multi_domain_capability_implemented %d "
+ "international_roaming %d country_string %s",
+ priv->netdev->name,
+ le16_to_cpu(mac_mgmt->beacon_period),
+ le16_to_cpu(mac_mgmt->CFP_max_duration),
+ le16_to_cpu(mac_mgmt->medium_occupancy_limit),
+ le16_to_cpu(mac_mgmt->station_id),
+ le16_to_cpu(mac_mgmt->ATIM_window),
+ mac_mgmt->CFP_mode,
+ mac_mgmt->privacy_option_implemented,
+ mac_mgmt->DTIM_period,
+ mac_mgmt->CFP_period,
+ mac2str(mac_mgmt->current_bssid),
+ hex2str(mac_mgmt->current_essid, IW_ESSID_MAX_SIZE),
+ mac_mgmt->current_bss_type,
+ mac_mgmt->power_mgmt_mode,
+ mac_mgmt->ibss_change,
+ mac_mgmt->res,
+ mac_mgmt->multi_domain_capability_implemented,
+ mac_mgmt->multi_domain_capability_enabled, country_string);
err:
kfree(mac_mgmt);
exit:
@@ -1233,28 +1240,28 @@ static int at76_dump_mib_mac(struct at76_priv *priv)
}
dbg("%s: MIB MAC: max_tx_msdu_lifetime %d max_rx_lifetime %d "
- "frag_threshold %d rts_threshold %d cwmin %d cwmax %d "
- "short_retry_time %d long_retry_time %d scan_type %d "
- "scan_channel %d probe_delay %u min_channel_time %d "
- "max_channel_time %d listen_int %d desired_ssid %s "
- "desired_bssid %s desired_bsstype %d",
- priv->netdev->name,
- le32_to_cpu(mac->max_tx_msdu_lifetime),
- le32_to_cpu(mac->max_rx_lifetime),
- le16_to_cpu(mac->frag_threshold),
- le16_to_cpu(mac->rts_threshold),
- le16_to_cpu(mac->cwmin),
- le16_to_cpu(mac->cwmax),
- mac->short_retry_time,
- mac->long_retry_time,
- mac->scan_type,
- mac->scan_channel,
- le16_to_cpu(mac->probe_delay),
- le16_to_cpu(mac->min_channel_time),
- le16_to_cpu(mac->max_channel_time),
- le16_to_cpu(mac->listen_interval),
- hex2str(mac->desired_ssid, IW_ESSID_MAX_SIZE),
- mac2str(mac->desired_bssid), mac->desired_bsstype);
+ "frag_threshold %d rts_threshold %d cwmin %d cwmax %d "
+ "short_retry_time %d long_retry_time %d scan_type %d "
+ "scan_channel %d probe_delay %u min_channel_time %d "
+ "max_channel_time %d listen_int %d desired_ssid %s "
+ "desired_bssid %s desired_bsstype %d",
+ priv->netdev->name,
+ le32_to_cpu(mac->max_tx_msdu_lifetime),
+ le32_to_cpu(mac->max_rx_lifetime),
+ le16_to_cpu(mac->frag_threshold),
+ le16_to_cpu(mac->rts_threshold),
+ le16_to_cpu(mac->cwmin),
+ le16_to_cpu(mac->cwmax),
+ mac->short_retry_time,
+ mac->long_retry_time,
+ mac->scan_type,
+ mac->scan_channel,
+ le16_to_cpu(mac->probe_delay),
+ le16_to_cpu(mac->min_channel_time),
+ le16_to_cpu(mac->max_channel_time),
+ le16_to_cpu(mac->listen_interval),
+ hex2str(mac->desired_ssid, IW_ESSID_MAX_SIZE),
+ mac2str(mac->desired_bssid), mac->desired_bsstype);
err:
kfree(mac);
exit:
@@ -1278,22 +1285,22 @@ static int at76_dump_mib_phy(struct at76_priv *priv)
}
dbg("%s: MIB PHY: ed_threshold %d slot_time %d sifs_time %d "
- "preamble_length %d plcp_header_length %d mpdu_max_length %d "
- "cca_mode_supported %d operation_rate_set "
- "0x%x 0x%x 0x%x 0x%x channel_id %d current_cca_mode %d "
- "phy_type %d current_reg_domain %d",
- priv->netdev->name,
- le32_to_cpu(phy->ed_threshold),
- le16_to_cpu(phy->slot_time),
- le16_to_cpu(phy->sifs_time),
- le16_to_cpu(phy->preamble_length),
- le16_to_cpu(phy->plcp_header_length),
- le16_to_cpu(phy->mpdu_max_length),
- le16_to_cpu(phy->cca_mode_supported),
- phy->operation_rate_set[0], phy->operation_rate_set[1],
- phy->operation_rate_set[2], phy->operation_rate_set[3],
- phy->channel_id,
- phy->current_cca_mode, phy->phy_type, phy->current_reg_domain);
+ "preamble_length %d plcp_header_length %d mpdu_max_length %d "
+ "cca_mode_supported %d operation_rate_set "
+ "0x%x 0x%x 0x%x 0x%x channel_id %d current_cca_mode %d "
+ "phy_type %d current_reg_domain %d",
+ priv->netdev->name,
+ le32_to_cpu(phy->ed_threshold),
+ le16_to_cpu(phy->slot_time),
+ le16_to_cpu(phy->sifs_time),
+ le16_to_cpu(phy->preamble_length),
+ le16_to_cpu(phy->plcp_header_length),
+ le16_to_cpu(phy->mpdu_max_length),
+ le16_to_cpu(phy->cca_mode_supported),
+ phy->operation_rate_set[0], phy->operation_rate_set[1],
+ phy->operation_rate_set[2], phy->operation_rate_set[3],
+ phy->channel_id,
+ phy->current_cca_mode, phy->phy_type, phy->current_reg_domain);
err:
kfree(phy);
exit:
@@ -1318,11 +1325,11 @@ static int at76_dump_mib_local(struct at76_priv *priv)
}
dbg("%s: MIB PHY: beacon_enable %d txautorate_fallback %d "
- "ssid_size %d promiscuous_mode %d preamble_type %d",
- priv->netdev->name,
- local->beacon_enable,
- local->txautorate_fallback,
- local->ssid_size, local->promiscuous_mode, local->preamble_type);
+ "ssid_size %d promiscuous_mode %d preamble_type %d",
+ priv->netdev->name,
+ local->beacon_enable,
+ local->txautorate_fallback,
+ local->ssid_size, local->promiscuous_mode, local->preamble_type);
err:
kfree(local);
exit:
@@ -1411,7 +1418,8 @@ static int at76_get_current_channel(struct at76_priv *priv)
}
ret = at76_get_mib(priv->udev, MIB_PHY, phy, sizeof(struct mib_phy));
if (ret < 0) {
- err("%s: at76_get_mib(MIB_PHY) failed: %d", priv->netdev->name, ret);
+ err("%s: at76_get_mib(MIB_PHY) failed: %d", priv->netdev->name,
+ ret);
goto err;
}
priv->channel = phy->channel_id;
@@ -1540,7 +1548,8 @@ static int at76_start_ibss(struct at76_priv *priv)
priv->mib_buf.index = IBSS_CHANGE_OK_OFFSET;
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (ibss change ok) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (ibss change ok) failed: %d",
+ priv->netdev->name, ret);
return ret;
}
@@ -1564,9 +1573,10 @@ static int at76_join_bss(struct at76_priv *priv, struct bss_info *ptr)
join.channel = ptr->channel;
join.timeout = cpu_to_le16(2000);
- at76_dbg(DBG_PROGRESS, "%s join addr %s ssid %s type %d ch %d timeout %d",
- priv->netdev->name, mac2str(join.bssid),
- join.essid, join.bss_type, join.channel, le16_to_cpu(join.timeout));
+ at76_dbg(DBG_PROGRESS,
+ "%s join addr %s ssid %s type %d ch %d timeout %d",
+ priv->netdev->name, mac2str(join.bssid), join.essid,
+ join.bss_type, join.channel, le16_to_cpu(join.timeout));
return at76_set_card_command(priv->udev, CMD_JOIN, &join,
sizeof(struct at76_req_join));
}
@@ -1620,7 +1630,7 @@ static void at76_write_bulk_callback(struct urb *urb)
"%s - nonzero write bulk status received: %d",
__FUNCTION__, urb->status);
} else
- return; /* urb has been unlinked */
+ return; /* urb has been unlinked */
stats->tx_errors++;
} else
stats->tx_packets++;
@@ -1642,8 +1652,7 @@ static void at76_write_bulk_callback(struct urb *urb)
priv->bulk_out_buffer,
le16_to_cpu(mgmt_buf->wlength) +
mgmt_buf->padding + AT76_TX_HDRLEN,
- at76_write_bulk_callback,
- priv);
+ at76_write_bulk_callback, priv);
ret = usb_submit_urb(priv->write_urb, GFP_ATOMIC);
if (ret) {
err("%s: %s error in tx submit urb: %d",
@@ -1696,7 +1705,8 @@ static int at76_send_mgmt_bulk(struct at76_priv *priv,
priv->netdev->name, __FUNCTION__, urb_status);
}
- at76_dbg(DBG_TX_MGMT, "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
+ at76_dbg(DBG_TX_MGMT,
+ "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
priv->netdev->name, le16_to_cpu(txbuf->wlength),
txbuf->tx_rate, txbuf->padding,
hex2str(txbuf->packet, le16_to_cpu(txbuf->wlength)));
@@ -1711,8 +1721,7 @@ static int at76_send_mgmt_bulk(struct at76_priv *priv,
le16_to_cpu(txbuf->wlength) +
txbuf->padding +
AT76_TX_HDRLEN,
- at76_write_bulk_callback,
- priv);
+ at76_write_bulk_callback, priv);
ret = usb_submit_urb(priv->write_urb, GFP_ATOMIC);
if (ret) {
err("%s: %s error in tx submit urb: %d",
@@ -1754,8 +1763,9 @@ static int at76_auth_req(struct at76_priv *priv, struct bss_info *bss,
/* make wireless header */
/* first auth msg is not encrypted, only the second (seq_nr == 3) */
- mgmt->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH |
- (seq_nr == 3 ? IEEE80211_FCTL_PROTECTED : 0));
+ mgmt->frame_ctl =
+ cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH |
+ (seq_nr == 3 ? IEEE80211_FCTL_PROTECTED : 0));
mgmt->duration_id = cpu_to_le16(0x8000);
memcpy(mgmt->addr1, bss->bssid, ETH_ALEN);
@@ -1777,8 +1787,7 @@ static int at76_auth_req(struct at76_priv *priv, struct bss_info *bss,
le16_to_cpu(req->algorithm), le16_to_cpu(req->transaction));
if (seq_nr == 3) {
at76_dbg(DBG_TX_MGMT, "%s: AuthReq challenge: %s ...",
- priv->netdev->name,
- hex2str(req->info_element, 18));
+ priv->netdev->name, hex2str(req->info_element, 18));
}
/* either send immediately (if no data tx is pending
@@ -1842,13 +1851,13 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
next_ie(&tlv); /* tlv points behind the supp_rates field */
/* init. at76_priv tx header */
- tx_buffer->wlength = cpu_to_le16((u8 *) tlv - (u8 *) mgmt);
+ tx_buffer->wlength = cpu_to_le16((u8 *)tlv - (u8 *)mgmt);
tlv = req->info_element;
len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
memcpy(essid, tlv->data, len);
essid[len] = '\0';
- next_ie(&tlv); /* points to IE of rates now */
+ next_ie(&tlv); /* points to IE of rates now */
at76_dbg(DBG_TX_MGMT,
"%s: AssocReq bssid %s capa x%04x ssid %s rates %s",
priv->netdev->name, mac2str(mgmt->addr3),
@@ -1930,7 +1939,7 @@ static int at76_reassoc_req(struct at76_priv *priv, struct bss_info *curr_bss,
len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
memcpy(essid, tlv->data, len);
essid[len] = '\0';
- next_ie(&tlv); /* points to IE of rates now */
+ next_ie(&tlv); /* points to IE of rates now */
at76_dbg(DBG_TX_MGMT,
"%s: ReAssocReq curr %s new %s capa x%04x ssid %s rates %s",
priv->netdev->name, mac2str(req->current_ap),
@@ -2079,7 +2088,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
/* the first cmd status after scan start is always a IDLE ->
start the timer to poll again until COMPLETED */
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer for %d ticks",
__FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&priv->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
return;
@@ -2100,12 +2110,13 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
sizeof(mdomain.channel_list)),
hex2str(mdomain.tx_powerlevel,
sizeof(mdomain.tx_powerlevel)));
- }
+ }
if ((ret = at76_start_scan(priv, 0, 1)) < 0) {
err("%s: %s: start_scan (ANY) failed with %d",
priv->netdev->name, __FUNCTION__, ret);
}
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer for %d ticks",
__FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&priv->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
break;
@@ -2115,7 +2126,8 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
err("%s: %s: start_scan (SSID) failed with %d",
priv->netdev->name, __FUNCTION__, ret);
}
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer for %d ticks",
__FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&priv->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
break;
@@ -2141,23 +2153,25 @@ static void at76_handle_mgmt_timeout_scan(struct at76_priv *priv)
static void at76_work_assoc_done(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_assoc_done);
+ work_assoc_done);
mutex_lock(&priv->mtx);
- at76_assert(priv->istate == ASSOCIATING || priv->istate == REASSOCIATING);
+ at76_assert(priv->istate == ASSOCIATING
+ || priv->istate == REASSOCIATING);
if (priv->iw_mode == IW_MODE_INFRA) {
at76_assert(priv->curr_bss != NULL);
if (priv->curr_bss != NULL && priv->pm_mode != AT76_PM_OFF) {
/* calculate the listen interval in units of
beacon intervals of the curr_bss */
u32 pm_period_beacon = (priv->pm_period >> 10) /
- priv->curr_bss->beacon_interval;
+ priv->curr_bss->beacon_interval;
pm_period_beacon = max(pm_period_beacon, 2u);
pm_period_beacon = min(pm_period_beacon, 0xffffu);
- at76_dbg(DBG_PM, "%s: pm_mode %d assoc id x%x listen int %d",
+ at76_dbg(DBG_PM,
+ "%s: pm_mode %d assoc id x%x listen int %d",
priv->netdev->name, priv->pm_mode,
priv->curr_bss->assoc_id, pm_period_beacon);
@@ -2239,8 +2253,9 @@ static void at76_delete_device(struct at76_priv *priv)
dev_kfree_skb(priv->rx_data[i].skb);
priv->rx_data[i].skb = NULL;
}
- at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/netdev", __FUNCTION__);
- free_netdev(priv->netdev); /* priv is in netdev */
+ at76_dbg(DBG_PROC_ENTRY, "%s: before freeing priv/netdev",
+ __FUNCTION__);
+ free_netdev(priv->netdev); /* priv is in netdev */
at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__);
}
@@ -2256,15 +2271,15 @@ static int at76_alloc_urbs(struct at76_priv *priv,
at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __FUNCTION__);
at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __FUNCTION__,
- interface->altsetting[0].desc.bNumEndpoints);
+ interface->altsetting[0].desc.bNumEndpoints);
iface_desc = interface->cur_altsetting;
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
endpoint = &iface_desc->endpoint[i].desc;
at76_dbg(DBG_URB, "%s: %d. endpoint: addr x%x attr x%x",
- __FUNCTION__,
- i, endpoint->bEndpointAddress, endpoint->bmAttributes);
+ __FUNCTION__,
+ i, endpoint->bEndpointAddress, endpoint->bmAttributes);
if ((endpoint->bEndpointAddress & 0x80) &&
((endpoint->bmAttributes & 3) == 0x02)) {
@@ -2288,15 +2303,18 @@ static int at76_alloc_urbs(struct at76_priv *priv,
}
buffer_size = sizeof(struct at76_tx_buffer) +
MAX_PADDING_SIZE;
- priv->bulk_out_endpointAddr = endpoint->bEndpointAddress;
- priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
+ priv->bulk_out_endpointAddr =
+ endpoint->bEndpointAddress;
+ priv->bulk_out_buffer =
+ kmalloc(buffer_size, GFP_KERNEL);
if (!priv->bulk_out_buffer) {
err("couldn't allocate bulk_out_buffer");
return -ENOMEM;
}
usb_fill_bulk_urb(priv->write_urb, udev,
usb_sndbulkpipe(udev,
- endpoint->bEndpointAddress),
+ endpoint->
+ bEndpointAddress),
priv->bulk_out_buffer, buffer_size,
at76_write_bulk_callback, priv);
}
@@ -2410,8 +2428,8 @@ static int at76_iw_handler_set_freq(struct net_device *netdev,
struct at76_priv *priv = netdev_priv(netdev);
int chan = -1;
int ret = -EIWCOMMIT;
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d", netdev->name,
- freq->m, freq->e);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d",
+ netdev->name, freq->m, freq->e);
if ((freq->e == 0) && (freq->m <= 1000)) {
/* Setting by channel number */
@@ -2448,7 +2466,8 @@ static int at76_iw_handler_set_freq(struct net_device *netdev,
if (ret == -EIWCOMMIT) {
priv->channel = chan;
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name, chan);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name,
+ chan);
}
return ret;
@@ -2467,7 +2486,8 @@ static int at76_iw_handler_get_freq(struct net_device *netdev,
at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d",
netdev->name, channel_frequency[priv->channel - 1], 6);
}
- at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name, priv->channel);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name,
+ priv->channel);
return 0;
}
@@ -2486,7 +2506,7 @@ static int at76_iw_handler_set_mode(struct net_device *netdev,
ret = -EINVAL;
} else {
priv->iw_mode = *mode;
- if( priv->iw_mode != IW_MODE_INFRA)
+ if (priv->iw_mode != IW_MODE_INFRA)
priv->pm_mode = AT76_PM_OFF;
}
return ret;
@@ -2494,7 +2514,7 @@ static int at76_iw_handler_set_mode(struct net_device *netdev,
static int at76_iw_handler_get_mode(struct net_device *netdev,
struct iw_request_info *info,
- __u32 * mode, char *extra)
+ __u32 *mode, char *extra)
{
struct at76_priv *priv = netdev_priv(netdev);
@@ -2810,7 +2830,8 @@ static int at76_iw_handler_get_scan(struct net_device *netdev,
iwe->u.data.flags = 1;
curr_pos = iwe_stream_add_point(curr_pos,
- extra + IW_SCAN_MAX_DATA, iwe, curr_bss->ssid);
+ extra + IW_SCAN_MAX_DATA, iwe,
+ curr_bss->ssid);
iwe->cmd = SIOCGIWMODE;
iwe->u.mode = (curr_bss->capa & WLAN_CAPABILITY_IBSS) ?
@@ -2957,7 +2978,8 @@ static int at76_iw_handler_set_rate(struct net_device *netdev,
struct at76_priv *priv = netdev_priv(netdev);
int ret = -EIWCOMMIT;
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWRATE - %d", netdev->name, bitrate->value);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWRATE - %d", netdev->name,
+ bitrate->value);
switch (bitrate->value) {
case -1:
@@ -3067,7 +3089,8 @@ static int at76_iw_handler_set_frag(struct net_device *netdev,
int fthr = frag->value;
at76_dbg(DBG_IOCTL, "%s: SIOCSIWFRAG - value %d, disabled %s",
- netdev->name, frag->value, (frag->disabled) ? "true" : "false");
+ netdev->name, frag->value,
+ (frag->disabled) ? "true" : "false");
if (frag->disabled)
fthr = MAX_FRAG_THRESHOLD;
@@ -3075,7 +3098,7 @@ static int at76_iw_handler_set_frag(struct net_device *netdev,
if ((fthr < MIN_FRAG_THRESHOLD) || (fthr > MAX_FRAG_THRESHOLD)) {
ret = -EINVAL;
} else {
- priv->frag_threshold = fthr & ~0x1; /* get an even value */
+ priv->frag_threshold = fthr & ~0x1; /* get an even value */
}
return ret;
@@ -3092,7 +3115,8 @@ static int at76_iw_handler_get_frag(struct net_device *netdev,
frag->fixed = 1;
at76_dbg(DBG_IOCTL, "%s: SIOCGIWFRAG - value %d, disabled %s",
- netdev->name, frag->value, (frag->disabled) ? "true" : "false");
+ netdev->name, frag->value,
+ (frag->disabled) ? "true" : "false");
return 0;
}
@@ -3155,8 +3179,7 @@ static int at76_iw_handler_get_retry(struct net_device *netdev,
static int at76_iw_handler_set_encode(struct net_device *netdev,
struct iw_request_info *info,
- struct iw_point *encoding,
- char *extra)
+ struct iw_point *encoding, char *extra)
{
struct at76_priv *priv = netdev_priv(netdev);
int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
@@ -3165,11 +3188,12 @@ static int at76_iw_handler_set_encode(struct net_device *netdev,
at76_dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - enc.flags %08x "
"pointer %p len %d", netdev->name, encoding->flags,
encoding->pointer, encoding->length);
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - old wepstate: enabled %s key_id %d "
- "auth_mode %s",
- netdev->name, (priv->wep_enabled) ? "true" : "false",
- priv->wep_key_id,
- (priv->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+ at76_dbg(DBG_IOCTL,
+ "%s: SIOCSIWENCODE - old wepstate: enabled %s key_id %d "
+ "auth_mode %s", netdev->name,
+ (priv->wep_enabled) ? "true" : "false", priv->wep_key_id,
+ (priv->auth_mode ==
+ WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
/* take the old default key if index is invalid */
if ((index < 0) || (index >= WEP_KEYS))
@@ -3194,19 +3218,20 @@ static int at76_iw_handler_set_encode(struct net_device *netdev,
if (encoding->flags & IW_ENCODE_OPEN)
priv->auth_mode = WLAN_AUTH_OPEN;
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - new wepstate: enabled %s key_id %d "
- "key_len %d auth_mode %s",
- netdev->name, (priv->wep_enabled) ? "true" : "false",
- priv->wep_key_id + 1, priv->wep_keys_len[priv->wep_key_id],
- (priv->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+ at76_dbg(DBG_IOCTL,
+ "%s: SIOCSIWENCODE - new wepstate: enabled %s key_id %d "
+ "key_len %d auth_mode %s", netdev->name,
+ (priv->wep_enabled) ? "true" : "false", priv->wep_key_id + 1,
+ priv->wep_keys_len[priv->wep_key_id],
+ (priv->auth_mode ==
+ WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
return -EIWCOMMIT;
}
static int at76_iw_handler_get_encode(struct net_device *netdev,
struct iw_request_info *info,
- struct iw_point *encoding,
- char *extra)
+ struct iw_point *encoding, char *extra)
{
struct at76_priv *priv = netdev_priv(netdev);
int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
@@ -3230,14 +3255,15 @@ static int at76_iw_handler_get_encode(struct net_device *netdev,
}
at76_dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - enc.flags %08x "
- "pointer %p len %d", netdev->name, encoding->flags,
- encoding->pointer, encoding->length);
- at76_dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - wepstate: enabled %s key_id %d "
- "key_len %d auth_mode %s",
- netdev->name, (priv->wep_enabled) ? "true" : "false",
- priv->wep_key_id + 1, priv->wep_keys_len[priv->wep_key_id],
- (priv->auth_mode == WLAN_AUTH_SHARED_KEY) ?
- "restricted" : "open");
+ "pointer %p len %d", netdev->name, encoding->flags,
+ encoding->pointer, encoding->length);
+ at76_dbg(DBG_IOCTL,
+ "%s: SIOCGIWENCODE - wepstate: enabled %s key_id %d "
+ "key_len %d auth_mode %s", netdev->name,
+ (priv->wep_enabled) ? "true" : "false", priv->wep_key_id + 1,
+ priv->wep_keys_len[priv->wep_key_id],
+ (priv->auth_mode ==
+ WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
return 0;
}
@@ -3249,9 +3275,10 @@ static int at76_iw_handler_set_power(struct net_device *netdev,
int err = -EIWCOMMIT;
struct at76_priv *priv = netdev_priv(netdev);
- at76_dbg(DBG_IOCTL, "%s: SIOCSIWPOWER - disabled %s flags x%x value x%x",
- netdev->name, (prq->disabled) ? "true" : "false",
- prq->flags, prq->value);
+ at76_dbg(DBG_IOCTL,
+ "%s: SIOCSIWPOWER - disabled %s flags x%x value x%x",
+ netdev->name, (prq->disabled) ? "true" : "false", prq->flags,
+ prq->value);
if (prq->disabled) {
priv->pm_mode = AT76_PM_OFF;
@@ -3291,7 +3318,8 @@ static int at76_iw_handler_get_power(struct net_device *netdev,
}
power->flags |= IW_POWER_ALL_R;
- at76_dbg(DBG_IOCTL, "%s: SIOCGIWPOWER - disabled %s flags x%x value x%x",
+ at76_dbg(DBG_IOCTL,
+ "%s: SIOCGIWPOWER - disabled %s flags x%x value x%x",
netdev->name, (power->disabled) ? "true" : "false",
power->flags, power->value);
@@ -3338,19 +3366,19 @@ static int at76_iw_set_debug(struct net_device *netdev,
}
dbg("%s: AT76_SET_DEBUG input %d: %s -> x%x",
- netdev->name, data->length, extra, val);
+ netdev->name, data->length, extra, val);
} else {
val = DBG_DEFAULTS;
}
dbg("%s: AT76_SET_DEBUG, old 0x%x new 0x%x",
- netdev->name, at76_debug, val);
+ netdev->name, at76_debug, val);
/* jal: some more output to pin down lockups */
dbg("%s: netif running %d queue_stopped %d carrier_ok %d",
- netdev->name,
- netif_running(netdev),
- netif_queue_stopped(netdev), netif_carrier_ok(netdev));
+ netdev->name,
+ netif_running(netdev),
+ netif_queue_stopped(netdev), netif_carrier_ok(netdev));
at76_debug = val;
@@ -3431,7 +3459,8 @@ static int at76_set_iroaming(struct at76_priv *priv, int onoff)
priv->mib_buf.data[0] = (priv->international_roaming ? 1 : 0);
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0) {
- err("%s: set_mib (intl_roaming_enable) failed: %d", priv->netdev->name, ret);
+ err("%s: set_mib (intl_roaming_enable) failed: %d",
+ priv->netdev->name, ret);
}
return ret;
@@ -3466,8 +3495,7 @@ static int at76_iw_set_intl_roaming(struct net_device *netdev,
/*******************************************************************************
* structure that advertises the iw handlers of this driver
*/
-static const iw_handler at76_handlers[] =
-{
+static const iw_handler at76_handlers[] = {
AT76_SET_HANDLER(SIOCSIWCOMMIT, at76_iw_handler_commit),
AT76_SET_HANDLER(SIOCGIWNAME, at76_iw_handler_get_name),
AT76_SET_HANDLER(SIOCSIWFREQ, at76_iw_handler_set_freq),
@@ -3544,14 +3572,13 @@ static const struct iw_priv_args at76_priv_args[] = {
"intl_roaming"},
};
-static const struct iw_handler_def at76_handler_def =
-{
- .num_standard = ARRAY_SIZE(at76_handlers),
- .num_private = ARRAY_SIZE(at76_priv_handlers),
+static const struct iw_handler_def at76_handler_def = {
+ .num_standard = ARRAY_SIZE(at76_handlers),
+ .num_private = ARRAY_SIZE(at76_priv_handlers),
.num_private_args = ARRAY_SIZE(at76_priv_args),
- .standard = at76_handlers,
- .private = at76_priv_handlers,
- .private_args = at76_priv_args,
+ .standard = at76_handlers,
+ .private = at76_priv_handlers,
+ .private_args = at76_priv_args,
.get_wireless_stats = at76_get_wireless_stats,
};
@@ -3638,14 +3665,14 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
return 0;
}
- at76_ledtrig_tx_activity(); /* tell the ledtrigger we send a packet */
+ at76_ledtrig_tx_activity(); /* tell the ledtrigger we send a packet */
/* we can get rid of memcpy, if we set netdev->hard_header_len
to 8 + sizeof(struct ieee80211_hdr_3addr), because then we have
enough space
at76_dbg(DBG_TX, "skb->data - skb->head = %d", skb->data - skb->head); */
- if (ntohs(*(__be16 *) (skb->data + 2 * ETH_ALEN)) <= 1518) {
+ if (ntohs(*(__be16 *)(skb->data + 2 * ETH_ALEN)) <= 1518) {
/* this is a 802.3 packet */
if (skb->data[2 * ETH_ALEN + 2] == rfc1042sig[0] &&
skb->data[2 * ETH_ALEN + 2 + 1] == rfc1042sig[1]) {
@@ -3653,7 +3680,7 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
memcpy(payload, skb->data + 2 * ETH_ALEN + 2,
skb->len - 2 * ETH_ALEN - 2);
wlen = sizeof(struct ieee80211_hdr_3addr) + skb->len -
- 2 * ETH_ALEN - 2;
+ 2 * ETH_ALEN - 2;
} else {
err("%s: %s: no support for non-SNAP 802.2 packets "
"(DSAP x%02x SSAP x%02x cntrl x%02x)",
@@ -3720,9 +3747,10 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
netdev->trans_start = jiffies;
usb_fill_bulk_urb(priv->write_urb, priv->udev,
- usb_sndbulkpipe(priv->udev, priv->bulk_out_endpointAddr),
- tx_buffer, submit_len,
- at76_write_bulk_callback, priv);
+ usb_sndbulkpipe(priv->udev,
+ priv->bulk_out_endpointAddr),
+ tx_buffer, submit_len, at76_write_bulk_callback,
+ priv);
ret = usb_submit_urb(priv->write_urb, GFP_ATOMIC);
if (ret) {
stats->tx_errors++;
@@ -3730,8 +3758,10 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
if (ret == -EINVAL)
err("-EINVAL: urb %p urb->hcpriv %p urb->complete %p",
priv->write_urb,
- priv->write_urb ? priv->write_urb->hcpriv : (void *)-1,
- priv->write_urb ? priv->write_urb->complete : (void *)-1);
+ priv->write_urb ? priv->write_urb->
+ hcpriv : (void *)-1,
+ priv->write_urb ? priv->write_urb->
+ complete : (void *)-1);
goto err;
}
@@ -3769,7 +3799,8 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
if (skb == NULL) {
skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
if (skb == NULL) {
- err("%s: unable to allocate rx skbuff.", priv->netdev->name);
+ err("%s: unable to allocate rx skbuff.",
+ priv->netdev->name);
ret = -ENOMEM;
goto exit;
}
@@ -3781,15 +3812,18 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
size = skb_tailroom(skb);
usb_fill_bulk_urb(priv->read_urb, priv->udev,
- usb_rcvbulkpipe(priv->udev, priv->bulk_in_endpointAddr),
- skb_put(skb, size), size,
- at76_read_bulk_callback, priv);
+ usb_rcvbulkpipe(priv->udev,
+ priv->bulk_in_endpointAddr),
+ skb_put(skb, size), size, at76_read_bulk_callback,
+ priv);
ret = usb_submit_urb(priv->read_urb, GFP_ATOMIC);
if (ret < 0) {
if (ret == -ENODEV)
- at76_dbg(DBG_DEVSTART, "usb_submit_urb returned -ENODEV");
+ at76_dbg(DBG_DEVSTART,
+ "usb_submit_urb returned -ENODEV");
else
- err("%s: rx, usb_submit_urb failed: %d", priv->netdev->name, ret);
+ err("%s: rx, usb_submit_urb failed: %d",
+ priv->netdev->name, ret);
}
exit:
@@ -3800,8 +3834,9 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
if (--priv->nr_submit_rx_tries > 0)
schedule_work(&priv->work_submit_rx);
else {
- err("%s: giving up to submit rx urb after %d failures -"
- " please unload the driver and/or power cycle the device",
+ err("%s: giving up to submit rx urb after %d "
+ "failures - please unload the driver "
+ "and/or power cycle the device",
priv->netdev->name, NR_SUBMIT_RX_TRIES);
}
}
@@ -3898,7 +3933,7 @@ static int at76_stop(struct net_device *netdev)
}
static void at76_ethtool_get_drvinfo(struct net_device *netdev,
- struct ethtool_drvinfo *info)
+ struct ethtool_drvinfo *info)
{
struct at76_priv *priv = netdev_priv(netdev);
@@ -3961,8 +3996,7 @@ static int at76_init_new_device(struct at76_priv *priv,
if ((req_fw_version.major == 0) &&
(req_fw_version.minor == 0) &&
- (req_fw_version.patch == 0) &&
- (req_fw_version.build == 0)) {
+ (req_fw_version.patch == 0) && (req_fw_version.build == 0)) {
err("firmware version consists of all zeroes");
err("this probably means that the ext. fw was not loaded correctly");
ret = -ENODEV;
@@ -3977,8 +4011,7 @@ static int at76_init_new_device(struct at76_priv *priv,
info("firmware version %d.%d.%d #%d (fcs_len %d)",
req_fw_version.major, req_fw_version.minor,
- req_fw_version.patch, req_fw_version.build,
- priv->rx_data_fcs_len);
+ req_fw_version.patch, req_fw_version.build, priv->rx_data_fcs_len);
/* MAC address */
ret = at76_get_hw_config(priv);
@@ -3991,7 +4024,8 @@ static int at76_init_new_device(struct at76_priv *priv,
/* init. netdev->dev_addr */
memcpy(netdev->dev_addr, priv->mac_addr, ETH_ALEN);
info("device's MAC %s, regulatory domain %s (id %d)",
- mac2str(priv->mac_addr), priv->domain->name, priv->regulatory_domain);
+ mac2str(priv->mac_addr), priv->domain->name,
+ priv->regulatory_domain);
/* initializing */
priv->international_roaming = IR_OFF;
@@ -4010,7 +4044,7 @@ static int at76_init_new_device(struct at76_priv *priv,
priv->scan_max_time = scan_max_time;
priv->scan_mode = SCAN_TYPE_ACTIVE;
- netdev->flags &= ~IFF_MULTICAST; /* not yet or never */
+ netdev->flags &= ~IFF_MULTICAST; /* not yet or never */
netdev->open = at76_open;
netdev->stop = at76_stop;
netdev->get_stats = at76_get_stats;
@@ -4109,15 +4143,17 @@ static int at76_essid_matched(struct at76_priv *priv, struct bss_info *ptr)
/* common criteria for both modi */
int ret = (priv->essid_size == 0 /* ANY ssid */ ||
- (priv->essid_size == ptr->ssid_len &&
- !memcmp(priv->essid, ptr->ssid, ptr->ssid_len)));
+ (priv->essid_size == ptr->ssid_len &&
+ !memcmp(priv->essid, ptr->ssid, ptr->ssid_len)));
if (!ret)
- at76_dbg(DBG_BSS_MATCH, "%s bss table entry %p: essid didn't match",
+ at76_dbg(DBG_BSS_MATCH,
+ "%s bss table entry %p: essid didn't match",
priv->netdev->name, ptr);
return ret;
}
-static inline int at76_mode_matched(struct at76_priv *priv, struct bss_info *ptr)
+static inline int at76_mode_matched(struct at76_priv *priv,
+ struct bss_info *ptr)
{
int ret;
@@ -4126,7 +4162,8 @@ static inline int at76_mode_matched(struct at76_priv *priv, struct bss_info *ptr
else
ret = ptr->capa & WLAN_CAPABILITY_ESS;
if (!ret)
- at76_dbg(DBG_BSS_MATCH, "%s bss table entry %p: mode didn't match",
+ at76_dbg(DBG_BSS_MATCH,
+ "%s bss table entry %p: mode didn't match",
priv->netdev->name, ptr);
return ret;
}
@@ -4153,7 +4190,8 @@ static int at76_rates_matched(struct at76_priv *priv, struct bss_info *ptr)
/* if we use short preamble, the bss must support it */
if (priv->preamble_type == PREAMBLE_TYPE_SHORT &&
!(ptr->capa & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
- at76_dbg(DBG_BSS_MATCH, "%s: %p does not support short preamble",
+ at76_dbg(DBG_BSS_MATCH,
+ "%s: %p does not support short preamble",
priv->netdev->name, ptr);
return 0;
} else
@@ -4164,7 +4202,8 @@ static inline int at76_wep_matched(struct at76_priv *priv, struct bss_info *ptr)
{
if (!priv->wep_enabled && ptr->capa & WLAN_CAPABILITY_PRIVACY) {
/* we have disabled WEP, but the BSS signals privacy */
- at76_dbg(DBG_BSS_MATCH, "%s: bss table entry %p: requires encryption",
+ at76_dbg(DBG_BSS_MATCH,
+ "%s: bss table entry %p: requires encryption",
priv->netdev->name, ptr);
return 0;
}
@@ -4180,9 +4219,11 @@ static inline int at76_bssid_matched(struct at76_priv *priv,
!compare_ether_addr(ptr->bssid, priv->wanted_bssid)) {
return 1;
} else {
- at76_dbg(DBG_BSS_MATCH, "%s: requested bssid - %s does not match",
+ at76_dbg(DBG_BSS_MATCH,
+ "%s: requested bssid - %s does not match",
priv->netdev->name, mac2str(priv->wanted_bssid));
- at76_dbg(DBG_BSS_MATCH, " AP bssid - %s of bss table entry %p",
+ at76_dbg(DBG_BSS_MATCH,
+ " AP bssid - %s of bss table entry %p",
mac2str(ptr->bssid), ptr);
return 0;
}
@@ -4228,7 +4269,7 @@ static struct bss_info *at76_match_bss(struct at76_priv *priv,
static void at76_work_join(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_join);
+ work_join);
int ret;
unsigned long flags;
@@ -4286,7 +4327,8 @@ static void at76_work_join(struct work_struct *work)
/* send auth req */
priv->istate = AUTHENTICATING;
at76_auth_req(priv, priv->curr_bss, 1, NULL);
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
}
@@ -4311,14 +4353,14 @@ static void at76_work_join(struct work_struct *work)
static void at76_work_mgmt_timeout(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_mgmt_timeout);
+ work_mgmt_timeout);
mutex_lock(&priv->mtx);
/* timeouts are normal in SCANNING state, otherwise report */
if ((priv->istate != SCANNING) || (at76_debug & DBG_MGMT_TIMER))
- at76_dbg(DBG_PROGRESS, "%s: timeout, state %d", priv->netdev->name,
- priv->istate);
+ at76_dbg(DBG_PROGRESS, "%s: timeout, state %d",
+ priv->netdev->name, priv->istate);
switch (priv->istate) {
@@ -4349,7 +4391,8 @@ static void at76_work_mgmt_timeout(struct work_struct *work)
case AUTHENTICATING:
if (priv->retries-- >= 0) {
at76_auth_req(priv, priv->curr_bss, 1, NULL);
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
} else {
@@ -4362,7 +4405,8 @@ static void at76_work_mgmt_timeout(struct work_struct *work)
case ASSOCIATING:
if (priv->retries-- >= 0) {
at76_assoc_req(priv, priv->curr_bss);
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
} else {
@@ -4394,7 +4438,8 @@ static void at76_work_mgmt_timeout(struct work_struct *work)
case DISASSOCIATING:
if (priv->retries-- >= 0) {
at76_disassoc_req(priv, priv->curr_bss);
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
} else {
@@ -4416,7 +4461,7 @@ static void at76_work_mgmt_timeout(struct work_struct *work)
static void at76_work_new_bss(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_new_bss);
+ work_new_bss);
int ret;
struct net_device *netdev = priv->netdev;
struct mib_mac_mgmt mac_mgmt;
@@ -4424,7 +4469,7 @@ static void at76_work_new_bss(struct work_struct *work)
mutex_lock(&priv->mtx);
ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, &mac_mgmt,
- sizeof(struct mib_mac_mgmt));
+ sizeof(struct mib_mac_mgmt));
if (ret < 0) {
err("%s: at76_get_mib failed: %d", netdev->name, ret);
goto new_bss_clean;
@@ -4442,7 +4487,8 @@ static void at76_work_new_bss(struct work_struct *work)
priv->mib_buf.index = IBSS_CHANGE_OK_OFFSET;
ret = at76_set_mib(priv, &priv->mib_buf);
if (ret < 0)
- err("%s: set_mib (ibss change ok) failed: %d", netdev->name, ret);
+ err("%s: set_mib (ibss change ok) failed: %d", netdev->name,
+ ret);
new_bss_clean:
mutex_unlock(&priv->mtx);
@@ -4461,34 +4507,30 @@ static int at76_startup_device(struct at76_priv *priv)
memcpy(ossid, priv->essid, priv->essid_size);
ossid[priv->essid_size] = '\0';
- dbg("%s param: ssid %s (%s) mode %s ch %d wep %s key %d keylen %d",
- priv->netdev->name, ossid,
- hex2str(priv->essid, IW_ESSID_MAX_SIZE),
- priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra",
- priv->channel,
- priv->wep_enabled ? "enabled" : "disabled",
- priv->wep_key_id, priv->wep_keys_len[priv->wep_key_id]);
+ dbg("%s param: ssid %s (%s) mode %s ch %d wep %s key %d "
+ "keylen %d", priv->netdev->name, ossid,
+ hex2str(priv->essid, IW_ESSID_MAX_SIZE),
+ priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra",
+ priv->channel, priv->wep_enabled ? "enabled" : "disabled",
+ priv->wep_key_id, priv->wep_keys_len[priv->wep_key_id]);
dbg("%s param: preamble %s rts %d retry %d frag %d "
- "txrate %s auth_mode %d",
- priv->netdev->name,
- priv->preamble_type == PREAMBLE_TYPE_SHORT ? "short" : "long",
- priv->rts_threshold, priv->short_retry_limit,
- priv->frag_threshold,
- priv->txrate == TX_RATE_1MBIT ? "1MBit" :
- priv->txrate == TX_RATE_2MBIT ? "2MBit" :
- priv->txrate == TX_RATE_5_5MBIT ? "5.5MBit" :
- priv->txrate == TX_RATE_11MBIT ? "11MBit" :
- priv->txrate == TX_RATE_AUTO ? "auto" : "<invalid>",
- priv->auth_mode);
+ "txrate %s auth_mode %d", priv->netdev->name,
+ priv->preamble_type ==
+ PREAMBLE_TYPE_SHORT ? "short" : "long", priv->rts_threshold,
+ priv->short_retry_limit, priv->frag_threshold,
+ priv->txrate == TX_RATE_1MBIT ? "1MBit" : priv->txrate ==
+ TX_RATE_2MBIT ? "2MBit" : priv->txrate ==
+ TX_RATE_5_5MBIT ? "5.5MBit" : priv->txrate ==
+ TX_RATE_11MBIT ? "11MBit" : priv->txrate ==
+ TX_RATE_AUTO ? "auto" : "<invalid>", priv->auth_mode);
dbg("%s param: pm_mode %d pm_period %d auth_mode %s "
- "scan_times %d %d scan_mode %s international_roaming %d",
- priv->netdev->name,
- priv->pm_mode, priv->pm_period,
- priv->auth_mode == WLAN_AUTH_OPEN ?
- "open" : "shared_secret",
- priv->scan_min_time, priv->scan_max_time,
- priv->scan_mode == SCAN_TYPE_ACTIVE ? "active" : "passive",
- priv->international_roaming);
+ "scan_times %d %d scan_mode %s international_roaming %d",
+ priv->netdev->name, priv->pm_mode, priv->pm_period,
+ priv->auth_mode ==
+ WLAN_AUTH_OPEN ? "open" : "shared_secret",
+ priv->scan_min_time, priv->scan_max_time,
+ priv->scan_mode == SCAN_TYPE_ACTIVE ? "active" : "passive",
+ priv->international_roaming);
}
memset(ccfg, 0, sizeof(struct at76_card_config));
@@ -4528,7 +4570,8 @@ static int at76_startup_device(struct at76_priv *priv)
ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config,
sizeof(struct at76_card_config));
if (ret < 0) {
- err("%s: at76_set_card_command failed: %d", priv->netdev->name, ret);
+ err("%s: at76_set_card_command failed: %d", priv->netdev->name,
+ ret);
return ret;
}
@@ -4540,22 +4583,29 @@ static int at76_startup_device(struct at76_priv *priv)
if (at76_set_radio(priv, 1) == 1)
at76_wait_completion(priv, CMD_RADIO);
- if ((ret = at76_set_preamble(priv, priv->preamble_type)) < 0)
+ ret = at76_set_preamble(priv, priv->preamble_type);
+ if (ret < 0)
return ret;
- if ((ret = at76_set_frag(priv, priv->frag_threshold)) < 0)
+ ret = at76_set_frag(priv, priv->frag_threshold);
+ if (ret < 0)
return ret;
- if ((ret = at76_set_rts(priv, priv->rts_threshold)) < 0)
+ ret = at76_set_rts(priv, priv->rts_threshold);
+ if (ret < 0)
return ret;
- if ((ret = at76_set_autorate_fallback(priv, priv->txrate == TX_RATE_AUTO ? 1 : 0)) < 0)
+ ret = at76_set_autorate_fallback(priv,
+ priv->txrate == TX_RATE_AUTO ? 1 : 0);
+ if (ret < 0)
return ret;
- if ((ret = at76_set_pm_mode(priv)) < 0)
+ ret = at76_set_pm_mode(priv);
+ if (ret < 0)
return ret;
- if ((ret = at76_set_iroaming(priv, priv->international_roaming)) < 0)
+ ret = at76_set_iroaming(priv, priv->international_roaming);
+ if (ret < 0)
return ret;
at76_set_monitor_mode(priv);
@@ -4576,7 +4626,7 @@ static int at76_startup_device(struct at76_priv *priv)
static void at76_work_restart(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_restart);
+ work_restart);
mutex_lock(&priv->mtx);
@@ -4598,7 +4648,7 @@ static void at76_work_restart(struct work_struct *work)
static void at76_work_scan(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_scan);
+ work_scan);
int ret;
mutex_lock(&priv->mtx);
@@ -4614,7 +4664,8 @@ static void at76_work_scan(struct work_struct *work)
err("%s: %s: start_scan failed with %d",
priv->netdev->name, __FUNCTION__, ret);
} else {
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer for %d ticks",
__FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&priv->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
}
@@ -4625,7 +4676,7 @@ static void at76_work_scan(struct work_struct *work)
static void at76_work_set_promisc(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_set_promisc);
+ work_set_promisc);
int ret = 0;
mutex_lock(&priv->mtx);
@@ -4647,7 +4698,7 @@ static void at76_work_set_promisc(struct work_struct *work)
static void at76_work_submit_rx(struct work_struct *work)
{
struct at76_priv *priv = container_of(work, struct at76_priv,
- work_submit_rx);
+ work_submit_rx);
mutex_lock(&priv->mtx);
at76_submit_rx_urb(priv);
@@ -4664,11 +4715,11 @@ static void at76_rx_mgmt_assoc(struct at76_priv *priv,
u16 assoc_id = le16_to_cpu(resp->aid);
u16 status = le16_to_cpu(resp->status);
u16 capa = le16_to_cpu(resp->capability);
- at76_dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa x%04x status x%04x "
- "assoc_id x%04x rates %s",
- priv->netdev->name, mac2str(mgmt->addr3), capa, status,
- assoc_id, hex2str(resp->info_element->data,
- resp->info_element->len));
+ at76_dbg(DBG_RX_MGMT,
+ "%s: rx AssocResp bssid %s capa x%04x status x%04x "
+ "assoc_id x%04x rates %s", priv->netdev->name,
+ mac2str(mgmt->addr3), capa, status, assoc_id,
+ hex2str(resp->info_element->data, resp->info_element->len));
if (priv->istate == ASSOCIATING) {
at76_assert(priv->curr_bss != NULL);
if (priv->curr_bss == NULL)
@@ -4705,9 +4756,10 @@ static void at76_rx_mgmt_reassoc(struct at76_priv *priv,
u16 status = le16_to_cpu(resp->status);
u16 assoc_id = le16_to_cpu(resp->aid);
- at76_dbg(DBG_RX_MGMT, "%s: rx ReAssocResp bssid %s capa x%04x status x%04x "
- "assoc_id x%04x rates %s",
- priv->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id,
+ at76_dbg(DBG_RX_MGMT,
+ "%s: rx ReAssocResp bssid %s capa x%04x status x%04x "
+ "assoc_id x%04x rates %s", priv->netdev->name,
+ mac2str(mgmt->addr3), capa, status, assoc_id,
hex2str(resp->info_element->data, resp->info_element->len));
if (priv->istate == REASSOCIATING) {
at76_assert(priv->new_bss != NULL);
@@ -4752,10 +4804,10 @@ static void at76_rx_mgmt_disassoc(struct at76_priv *priv,
(struct ieee80211_disassoc *)buf->packet;
struct ieee80211_hdr_3addr *mgmt = &resp->header;
- at76_dbg(DBG_RX_MGMT, "%s: rx DisAssoc bssid %s reason x%04x destination %s",
+ at76_dbg(DBG_RX_MGMT,
+ "%s: rx DisAssoc bssid %s reason x%04x destination %s",
priv->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(resp->reason),
- mac2str(mgmt->addr1));
+ le16_to_cpu(resp->reason), mac2str(mgmt->addr1));
if (priv->istate == SCANNING || priv->istate == INIT)
return;
@@ -4795,7 +4847,8 @@ static void at76_rx_mgmt_disassoc(struct at76_priv *priv,
/* ignore DisAssoc to other STA or from other BSSID */
}
-static void at76_rx_mgmt_auth(struct at76_priv *priv, struct at76_rx_buffer *buf)
+static void at76_rx_mgmt_auth(struct at76_priv *priv,
+ struct at76_rx_buffer *buf)
{
struct ieee80211_auth *resp = (struct ieee80211_auth *)buf->packet;
struct ieee80211_hdr_3addr *mgmt = &resp->header;
@@ -4803,15 +4856,14 @@ static void at76_rx_mgmt_auth(struct at76_priv *priv, struct at76_rx_buffer *buf
int alg = le16_to_cpu(resp->algorithm);
int status = le16_to_cpu(resp->status);
- at76_dbg(DBG_RX_MGMT, "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d "
- "destination %s",
- priv->netdev->name, mac2str(mgmt->addr3),
+ at76_dbg(DBG_RX_MGMT,
+ "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d "
+ "destination %s", priv->netdev->name, mac2str(mgmt->addr3),
alg, seq_nr, status, mac2str(mgmt->addr1));
if (alg == WLAN_AUTH_SHARED_KEY && seq_nr == 2) {
at76_dbg(DBG_RX_MGMT, "%s: AuthFrame challenge %s ...",
- priv->netdev->name,
- hex2str(resp->info_element, 18));
+ priv->netdev->name, hex2str(resp->info_element, 18));
}
if (priv->istate != AUTHENTICATING) {
info("%s: ignored AuthFrame in state %d",
@@ -4844,14 +4896,16 @@ static void at76_rx_mgmt_auth(struct at76_priv *priv, struct at76_rx_buffer *buf
priv->retries = ASSOC_RETRIES;
priv->istate = ASSOCIATING;
at76_assoc_req(priv, priv->curr_bss);
- at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
return;
}
at76_assert(seq_nr == 2);
- at76_auth_req(priv, priv->curr_bss, seq_nr + 1, resp->info_element);
+ at76_auth_req(priv, priv->curr_bss, seq_nr + 1,
+ resp->info_element);
at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
__FUNCTION__, __LINE__);
mod_timer(&priv->mgmt_timer, jiffies + HZ);
@@ -4869,13 +4923,11 @@ static void at76_rx_mgmt_deauth(struct at76_priv *priv,
at76_dbg(DBG_RX_MGMT | DBG_PROGRESS,
"%s: rx DeAuth bssid %s reason x%04x destination %s",
priv->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(resp->reason),
- mac2str(mgmt->addr1));
+ le16_to_cpu(resp->reason), mac2str(mgmt->addr1));
if (priv->istate == DISASSOCIATING ||
priv->istate == AUTHENTICATING ||
priv->istate == ASSOCIATING ||
- priv->istate == REASSOCIATING ||
- priv->istate == CONNECTED) {
+ priv->istate == REASSOCIATING || priv->istate == CONNECTED) {
at76_assert(priv->curr_bss != NULL);
if (priv->curr_bss == NULL)
return;
@@ -5000,14 +5052,16 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
* bytes are useful, hence the have_ssid etc optimizations. */
while (keep_going &&
- ((&tlv->data[tlv->len] - (u8 *)bdata->info_element) <= varpar_len)) {
+ ((&tlv->data[tlv->len] - (u8 *)bdata->info_element) <=
+ varpar_len)) {
switch (tlv->id) {
case MFIE_TYPE_SSID:
len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
if (!have_ssid && ((new_entry) ||
- !at76_is_cloaked_ssid(tlv->data, len))) {
+ !at76_is_cloaked_ssid(tlv->data,
+ len))) {
/* we copy only if this is a new entry,
or the incoming SSID is not a cloaked SSID. This
will protect us from overwriting a real SSID read
@@ -5073,7 +5127,7 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
at76_dbg(DBG_RX_BEACON, "%s: Finished processing beacon data",
priv->netdev->name);
- match->last_rx = jiffies; /* record last rx of beacon */
+ match->last_rx = jiffies; /* record last rx of beacon */
rx_mgmt_beacon_end:
spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
@@ -5083,7 +5137,8 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
static void at76_calc_level(struct at76_priv *priv, struct at76_rx_buffer *buf,
struct iw_quality *qual)
{
- int max_rssi = 42; /* just a guess for now, might be different for other chips */
+ /* just a guess for now, might be different for other chips */
+ int max_rssi = 42;
qual->level = (buf->rssi * 100 / max_rssi);
if (qual->level > 100)
@@ -5093,7 +5148,7 @@ static void at76_calc_level(struct at76_priv *priv, struct at76_rx_buffer *buf,
/* calc the link quality from a given rx_buffer */
static void at76_calc_qual(struct at76_priv *priv, struct at76_rx_buffer *buf,
- struct iw_quality* qual)
+ struct iw_quality *qual)
{
if ((priv->fwe->board_type == BOARDTYPE_503_INTERSIL_3861) ||
(priv->fwe->board_type == BOARDTYPE_503_INTERSIL_3863)) {
@@ -5151,8 +5206,10 @@ static void at76_rx_mgmt(struct at76_priv *priv, struct at76_rx_buffer *buf)
/* update wstats */
if (priv->istate != INIT && priv->istate != SCANNING) {
/* jal: this is a dirty hack needed by Tim in ad-hoc mode */
- if (priv->iw_mode == IW_MODE_ADHOC || (priv->curr_bss != NULL &&
- !compare_ether_addr(mgmt->addr3, priv->curr_bss->bssid))) {
+ if (priv->iw_mode == IW_MODE_ADHOC ||
+ (priv->curr_bss != NULL
+ && !compare_ether_addr(mgmt->addr3,
+ priv->curr_bss->bssid))) {
/* Data packets always seem to have a 0 link level, so we
only read link quality info from management packets.
Atmel driver actually averages the present, and previous
@@ -5253,14 +5310,14 @@ static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
} else if (!memcmp(skb->data, snapsig, sizeof(snapsig))) {
/* SNAP frame - collapse it */
skb_pull(skb, sizeof(rfc1042sig) + 2);
- proto = *(__be16 *) (skb->data - 2);
+ proto = *(__be16 *)(skb->data - 2);
} else {
#ifdef IEEE_STANDARD
/* According to all standards, we should assume the data
* portion contains 802.2 LLC information, so we should give it
* an 802.3 header (which has the same implications) */
proto = htons(skb->len);
-#else /* IEEE_STANDARD */
+#else /* IEEE_STANDARD */
/* Unfortunately, it appears no actual 802.11 implementations
* follow any standards specs. They all appear to put a
* 16-bit ethertype after the 802.11 header instead, so we take
@@ -5273,7 +5330,7 @@ static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
IEEE_STANDARD ... */
proto = *(__be16 *)(skb->data);
skb_pull(skb, 2);
-#endif /* IEEE_STANDARD */
+#endif /* IEEE_STANDARD */
}
skb_set_mac_header(skb, -(int)sizeof(struct ethhdr));
@@ -5337,11 +5394,10 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
struct rx_data_buf *bptr, *optr;
unsigned long oldest = ~0UL;
- at76_dbg(DBG_RX_FRAGS, "%s: rx data frame_ctl %04x addr2 %s seq/frag %d/%d "
- "length %d data %d: %s ...",
- priv->netdev->name, frame_ctl,
- mac2str(i802_11_hdr->addr2),
- seqnr, fragnr, length, data_len,
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: rx data frame_ctl %04x addr2 %s seq/frag %d/%d "
+ "length %d data %d: %s ...", priv->netdev->name, frame_ctl,
+ mac2str(i802_11_hdr->addr2), seqnr, fragnr, length, data_len,
hex2str(data, 32));
at76_dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p "
@@ -5357,7 +5413,8 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
if (fragnr == 0 && !(frame_ctl & IEEE80211_FCTL_MOREFRAGS)) {
/* unfragmented packet received */
- if (length < rx_copybreak && (skb = dev_alloc_skb(length)) != NULL) {
+ if (length < rx_copybreak
+ && (skb = dev_alloc_skb(length)) != NULL) {
memcpy(skb_put(skb, length),
priv->rx_skb->data + AT76_RX_HDRLEN, length);
} else {
@@ -5397,16 +5454,16 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
optr = NULL;
for (i = 0; i < NR_RX_DATA_BUF; i++, bptr++) {
if (bptr->skb != NULL) {
- if (!compare_ether_addr(i802_11_hdr->addr2, bptr->sender))
+ if (!compare_ether_addr(i802_11_hdr->addr2,
+ bptr->sender))
break;
- else
- if (optr == NULL) {
+ else if (optr == NULL) {
+ optr = bptr;
+ oldest = bptr->last_rx;
+ } else {
+ if (bptr->last_rx < oldest)
optr = bptr;
- oldest = bptr->last_rx;
- } else {
- if (bptr->last_rx < oldest)
- optr = bptr;
- }
+ }
} else {
optr = bptr;
oldest = 0UL;
@@ -5426,32 +5483,35 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
if (((bptr->fragnr + 1) & 0xf) == fragnr) {
bptr->last_rx = jiffies;
/* the next following fragment number ->
- add the data at the end */
+ add the data at the end */
/* is & 0xf necessary above ??? */
/* for test only ??? */
left = skb_tailroom(bptr->skb);
if (left < data_len) {
info("%s: only %d byte free (need %d)",
- priv->netdev->name, left, data_len);
+ priv->netdev->name, left,
+ data_len);
} else
memcpy(skb_put(bptr->skb, data_len),
data, data_len);
bptr->fragnr = fragnr;
- if (!(frame_ctl &
- IEEE80211_FCTL_MOREFRAGS)) {
+ if (!(frame_ctl & IEEE80211_FCTL_MOREFRAGS)) {
/* this was the last fragment - send it */
skb = bptr->skb;
- bptr->skb = NULL; /* free the entry */
- at76_dbg(DBG_RX_FRAGS, "%s: last frag of seq %d",
+ bptr->skb = NULL; /* free the entry */
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: last frag of seq %d",
priv->netdev->name, seqnr);
return skb;
} else
return NULL;
} else {
/* wrong fragment number -> ignore it */
- at76_dbg(DBG_RX_FRAGS, "%s: frag nr does not match: %d+1 != %d",
- priv->netdev->name, bptr->fragnr, fragnr);
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: frag nr does not match: %d+1 != %d",
+ priv->netdev->name, bptr->fragnr,
+ fragnr);
return NULL;
}
} else {
@@ -5460,9 +5520,11 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
/* it's the start of a new chain - replace the
old one by this */
/* bptr->sender has the correct value already */
- at76_dbg(DBG_RX_FRAGS, "%s: start of new seq %d, "
- "removing old seq %d", priv->netdev->name,
- seqnr, bptr->seqnr);
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: start of new seq %d, "
+ "removing old seq %d",
+ priv->netdev->name, seqnr,
+ bptr->seqnr);
bptr->seqnr = seqnr;
bptr->fragnr = 0;
bptr->last_rx = jiffies;
@@ -5473,9 +5535,11 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
} else {
/* it from the middle of a new chain ->
delete the old entry and skip the new one */
- at76_dbg(DBG_RX_FRAGS, "%s: middle of new seq %d (%d) "
- "removing old seq %d", priv->netdev->name,
- seqnr, fragnr, bptr->seqnr);
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: middle of new seq %d (%d) "
+ "removing old seq %d",
+ priv->netdev->name, seqnr, fragnr,
+ bptr->seqnr);
dev_kfree_skb(bptr->skb);
bptr->skb = NULL;
}
@@ -5487,7 +5551,8 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
if (fragnr != 0) {
/* this is not the begin of a fragment chain ... */
- at76_dbg(DBG_RX_FRAGS, "%s: no chain for non-first fragment (%d)",
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: no chain for non-first fragment (%d)",
priv->netdev->name, fragnr);
return NULL;
}
@@ -5501,16 +5566,18 @@ static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *priv)
optr->skb = priv->rx_skb;
priv->rx_skb = skb;
- at76_dbg(DBG_RX_FRAGS, "%s: free old contents: sender %s seq/frag %d/%d",
+ at76_dbg(DBG_RX_FRAGS,
+ "%s: free old contents: sender %s seq/frag %d/%d",
priv->netdev->name, mac2str(optr->sender),
optr->seqnr, optr->fragnr);
} else {
/* take the skb from priv->rx_skb */
optr->skb = priv->rx_skb;
- priv->rx_skb = NULL; /* let at76_submit_rx_urb() allocate a new skb */
+ priv->rx_skb = NULL; /* let at76_submit_rx_urb() allocate a new skb */
- at76_dbg(DBG_RX_FRAGS, "%s: use a free entry", priv->netdev->name);
+ at76_dbg(DBG_RX_FRAGS, "%s: use a free entry",
+ priv->netdev->name);
}
memcpy(optr->sender, i802_11_hdr->addr2, ETH_ALEN);
optr->seqnr = seqnr;
@@ -5582,7 +5649,8 @@ static void at76_rx_monitor_mode(struct at76_priv *priv)
if (length < priv->rx_data_fcs_len) {
/* buffer contains no data */
- at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE: rx skb without data",
+ at76_dbg(DBG_MONITOR_MODE,
+ "%s: MONITOR MODE: rx skb without data",
priv->netdev->name);
return;
}
@@ -5628,10 +5696,9 @@ static void at76_rx_monitor_mode(struct at76_priv *priv)
stats->rx_bytes += length;
}
-/**
- * at76_iwspy_update - check if we spy on the sender address of buf and update stats
- */
-static void at76_iwspy_update(struct at76_priv *priv, struct at76_rx_buffer *buf)
+/* check if we spy on the sender address in buf and update stats */
+static void at76_iwspy_update(struct at76_priv *priv,
+ struct at76_rx_buffer *buf)
{
struct ieee80211_hdr_3addr *hdr =
(struct ieee80211_hdr_3addr *)buf->packet;
@@ -5696,11 +5763,10 @@ static void at76_rx_tasklet(unsigned long param)
return;
}
- at76_dbg(DBG_RX_ATMEL_HDR, "%s: rx frame: rate %d rssi %d noise %d link %d %s",
- priv->netdev->name,
- buf->rx_rate, buf->rssi, buf->noise_level,
- buf->link_quality,
- hex2str(i802_11_hdr, 48));
+ at76_dbg(DBG_RX_ATMEL_HDR,
+ "%s: rx frame: rate %d rssi %d noise %d link %d %s",
+ priv->netdev->name, buf->rx_rate, buf->rssi, buf->noise_level,
+ buf->link_quality, hex2str(i802_11_hdr, 48));
if (priv->istate == MONITORING) {
at76_rx_monitor_mode(priv);
goto finish;
@@ -5930,14 +5996,13 @@ static int at76_probe(struct usb_interface *interface,
if ((fwe->fw_version.major > 0 || fwe->fw_version.minor >= 100)
|| (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) {
ret = at76_get_mib(udev, MIB_FW_VERSION,
- &req_fw_version,
- sizeof(req_fw_version));
+ &req_fw_version, sizeof(req_fw_version));
if ((ret < 0)
|| ((req_fw_version.major == 0)
&& (req_fw_version.minor == 0)
&& (req_fw_version.patch == 0)
&& (req_fw_version.build == 0)))
- need_ext_fw = 1;
+ need_ext_fw = 1;
} else {
/* No way to check firmware version, reload to be sure */
need_ext_fw = 1;