aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Guenther <agx@sigxcpu.org>2007-04-02 14:59:05 +0200
committerGuido Guenther <agx@bogon.sigxcpu.org>2007-04-02 14:59:05 +0200
commit9227b6f5b2aba1f5a918b7846d086169c49e9d0c (patch)
tree3ebea937a642f5a3f3d1dcecd226f1dad336e8c7
parent59e1db7537dc8468be91daad596a045213725286 (diff)
parent9a46b53872af78757d51f1b25205eda46575a336 (diff)
Merge branch 'locals/naming-cleanups'
-rw-r--r--at76_usb.c2119
-rw-r--r--at76_usb.h49
2 files changed, 1075 insertions, 1093 deletions
diff --git a/at76_usb.c b/at76_usb.c
index 67e00af..080961b 100644
--- a/at76_usb.c
+++ b/at76_usb.c
@@ -186,25 +186,24 @@ static int monitor_scan_min_time = 50;
static int monitor_scan_max_time = 600;
/* Function prototypes */
-static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf);
-static void at76c503_read_bulk_callback(struct urb *urb);
-static void at76c503_write_bulk_callback(struct urb *urb);
-static void at76_defer_event(struct at76c503 *dev, int flag);
-static struct bss_info *find_matching_bss(struct at76c503 *dev,
- struct bss_info *curr);
-static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr,
- struct ieee80211_info_element *challenge);
-static int disassoc_req(struct at76c503 *dev, struct bss_info *bss);
-static int assoc_req(struct at76c503 *dev, struct bss_info *bss);
-static int reassoc_req(struct at76c503 *dev, struct bss_info *curr,
- struct bss_info *new);
-static void dump_bss_table(struct at76c503 *dev);
-static int submit_rx_urb(struct at76c503 *dev);
-static int startup_device(struct at76c503 *dev);
-static int set_iroaming(struct at76c503 *dev, int onoff);
-static void set_monitor_mode(struct at76c503 *dev, int use_prism);
-/* second step of initialization (after fw download) */
-static int init_new_device(struct at76c503 *dev);
+static void at76_iwspy_update(struct at76_priv *dev, struct at76_rx_buffer *buf);
+static void at76_read_bulk_callback(struct urb *urb);
+static void at76_write_bulk_callback(struct urb *urb);
+static void at76_defer_event(struct at76_priv *dev, int flag);
+static struct bss_info *at76_match_bss(struct at76_priv *dev,
+ struct bss_info *curr);
+static int at76_auth_req(struct at76_priv *dev, struct bss_info *bss, int seq_nr,
+ struct ieee80211_info_element *challenge);
+static int at76_disassoc_req(struct at76_priv *dev, struct bss_info *bss);
+static int at76_assoc_req(struct at76_priv *dev, struct bss_info *bss);
+static int at76_reassoc_req(struct at76_priv *dev, struct bss_info *curr,
+ struct bss_info *new);
+static void at76_dump_bss_table(struct at76_priv *dev);
+static int at76_submit_rx_urb(struct at76_priv *dev);
+static int at76_startup_device(struct at76_priv *dev);
+static int at76_set_iroaming(struct at76_priv *dev, int onoff);
+static void at76_set_monitor_mode(struct at76_priv *dev, int use_prism);
+static int at76_init_new_device(struct at76_priv *dev);
/* Firmware download */
/* DFU states */
@@ -254,8 +253,8 @@ int dfu_download_block(struct dfu_ctx *ctx, u8 * buffer, int bytes, int block)
u8 *tmpbuf = ctx->buf;
struct usb_device *udev = ctx->udev;
- dbg(DBG_DFU, "dfu_download_block(): buffer=%p, bytes=%d, block=%d",
- buffer, bytes, block);
+ at76_dbg(DBG_DFU, "dfu_download_block(): buffer=%p, bytes=%d, block=%d",
+ buffer, bytes, block);
if (tmpbuf == NULL)
return -ENOMEM;
@@ -306,7 +305,7 @@ u8 dfu_get_state(struct usb_device *udev, u8 * state)
return result;
}
-static inline u32 __get_timeout(struct dfu_status *s)
+static inline u32 __at76_get_timeout(struct dfu_status *s)
{
unsigned long ret;
@@ -331,8 +330,8 @@ struct dfu_ctx *dfu_alloc_ctx(struct usb_device *udev)
/* if manifest_sync_timeout > 0 use this timeout (in msec) instead of the
one reported by the device in state MANIFEST_SYNC */
-static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
- u32 dfu_len, int manifest_sync_timeout)
+static int at76_usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
+ u32 dfu_len, int manifest_sync_timeout)
{
struct dfu_ctx *ctx;
struct dfu_status *dfu_stat_buf;
@@ -344,8 +343,8 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
int dfu_block_bytes = 0, dfu_bytes_left = dfu_len, dfu_buffer_offset = 0;
int dfu_block_cnt = 0;
- dbg(DBG_DFU, "%s( %p, %u, %d)", __FUNCTION__, dfu_buffer,
- dfu_len, manifest_sync_timeout);
+ at76_dbg(DBG_DFU, "%s( %p, %u, %d)", __FUNCTION__, dfu_buffer,
+ dfu_len, manifest_sync_timeout);
if (dfu_len == 0) {
err("FW Buffer length invalid!");
@@ -371,34 +370,34 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
switch (dfu_state) {
case STATE_DFU_DOWNLOAD_SYNC:
- dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC");
+ at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_SYNC");
status = dfu_get_status(ctx, dfu_stat_buf);
if (DFU_USB_SUCCESS(status)) {
dfu_state = dfu_stat_buf->bState;
- dfu_timeout = __get_timeout(dfu_stat_buf);
+ dfu_timeout = __at76_get_timeout(dfu_stat_buf);
need_dfu_state = 0;
} else
err("dfu_get_status failed with %d", status);
break;
case STATE_DFU_DOWNLOAD_BUSY:
- dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_BUSY");
+ at76_dbg(DBG_DFU, "STATE_DFU_DOWNLOAD_BUSY");
need_dfu_state = 1;
if (dfu_timeout >= 0) {
- dbg(DBG_DFU, "DFU: Resetting device");
+ at76_dbg(DBG_DFU, "DFU: Resetting device");
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1 + dfu_timeout * HZ / 1000);
} else
- dbg(DBG_DFU, "DFU: In progress");
+ at76_dbg(DBG_DFU, "DFU: In progress");
break;
case STATE_DFU_DOWNLOAD_IDLE:
- dbg(DBG_DFU, "DOWNLOAD...");
+ at76_dbg(DBG_DFU, "DOWNLOAD...");
/* fall through */
case STATE_DFU_IDLE:
- dbg(DBG_DFU, "DFU IDLE");
+ at76_dbg(DBG_DFU, "DFU IDLE");
if (dfu_bytes_left <= DFU_PACKETSIZE)
dfu_block_bytes = dfu_bytes_left;
@@ -420,13 +419,13 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
break;
case STATE_DFU_MANIFEST_SYNC:
- dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC");
+ at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_SYNC");
status = dfu_get_status(ctx, dfu_stat_buf);
if (DFU_USB_SUCCESS(status)) {
dfu_state = dfu_stat_buf->bState;
- dfu_timeout = __get_timeout(dfu_stat_buf);
+ dfu_timeout = __at76_get_timeout(dfu_stat_buf);
need_dfu_state = 0;
/* override the timeout from the status response,
@@ -435,36 +434,36 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
dfu_timeout = manifest_sync_timeout;
if (dfu_timeout >= 0) {
- dbg(DBG_DFU, "DFU: Waiting for manifest phase");
+ at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase");
set_current_state( TASK_INTERRUPTIBLE );
schedule_timeout((dfu_timeout*HZ+999)/1000);
} else
- dbg(DBG_DFU, "DFU: In progress");
+ at76_dbg(DBG_DFU, "DFU: In progress");
}
break;
case STATE_DFU_MANIFEST:
- dbg(DBG_DFU, "STATE_DFU_MANIFEST");
+ at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST");
is_done = 1;
break;
case STATE_DFU_MANIFEST_WAIT_RESET:
- dbg(DBG_DFU, "STATE_DFU_MANIFEST_WAIT_RESET");
+ at76_dbg(DBG_DFU, "STATE_DFU_MANIFEST_WAIT_RESET");
is_done = 1;
break;
case STATE_DFU_UPLOAD_IDLE:
- dbg(DBG_DFU, "STATE_DFU_UPLOAD_IDLE");
+ at76_dbg(DBG_DFU, "STATE_DFU_UPLOAD_IDLE");
break;
case STATE_DFU_ERROR:
- dbg(DBG_DFU, "STATE_DFU_ERROR");
+ at76_dbg(DBG_DFU, "STATE_DFU_ERROR");
status = -EPIPE;
break;
default:
- dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", dfu_state);
+ at76_dbg(DBG_DFU, "DFU UNKNOWN STATE (%d)", dfu_state);
status = -EINVAL;
break;
}
@@ -479,16 +478,16 @@ static int usbdfu_download(struct usb_device *udev, u8 *dfu_buffer,
}
/* some abbrev. for wireless events */
-static inline void iwevent_scan_complete(struct net_device *dev)
+static inline void at76_iwevent_scan_complete(struct net_device *dev)
{
union iwreq_data wrqu;
wrqu.data.length = 0;
wrqu.data.flags = 0;
wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
- dbg(DBG_WE_EVENTS, "%s: SIOCGIWSCAN sent", dev->name);
+ at76_dbg(DBG_WE_EVENTS, "%s: SIOCGIWSCAN sent", dev->name);
}
-static inline void iwevent_bss_connect(struct net_device *dev, u8 *bssid)
+static inline void at76_iwevent_bss_connect(struct net_device *dev, u8 *bssid)
{
union iwreq_data wrqu;
wrqu.data.length = 0;
@@ -496,10 +495,10 @@ static inline void iwevent_bss_connect(struct net_device *dev, u8 *bssid)
memcpy(wrqu.ap_addr.sa_data, bssid, ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
- dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", dev->name, __FUNCTION__);
+ at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", dev->name, __FUNCTION__);
}
-static inline void iwevent_bss_disconnect(struct net_device *dev)
+static inline void at76_iwevent_bss_disconnect(struct net_device *dev)
{
union iwreq_data wrqu;
wrqu.data.length = 0;
@@ -507,7 +506,7 @@ static inline void iwevent_bss_disconnect(struct net_device *dev)
memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
wrqu.ap_addr.sa_family = ARPHRD_ETHER;
wireless_send_event(dev, SIOCGIWAP, &wrqu, NULL);
- dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", dev->name, __FUNCTION__);
+ at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", dev->name, __FUNCTION__);
}
@@ -532,8 +531,8 @@ static char *hex2str(char *obuf, u8 *buf, int len, char delim)
return ret;
}
-/* check if the given sisd is cloaked */
-static inline int is_cloaked_ssid(u8 *ssid, int length)
+/* check if the given ssid is cloaked */
+static inline int at76_is_cloaked_ssid(u8 *ssid, int length)
{
static const u8 zeros[32];
@@ -542,7 +541,7 @@ static inline int is_cloaked_ssid(u8 *ssid, int length)
(length > 0 && !memcmp(ssid, zeros, length));
}
-static inline void free_bss_list(struct at76c503 *dev)
+static inline void at76_free_bss_list(struct at76_priv *dev)
{
struct list_head *next, *ptr;
unsigned long flags;
@@ -569,20 +568,20 @@ static inline char *mac2str(u8 *mac)
}
/* led trigger */
-static void ledtrig_tx_timerfunc(unsigned long data);
+static void at76_ledtrig_tx_timerfunc(unsigned long data);
DEFINE_LED_TRIGGER(ledtrig_tx);
-static DEFINE_TIMER(ledtrig_tx_timer, ledtrig_tx_timerfunc, 0, 0);
+static DEFINE_TIMER(ledtrig_tx_timer, at76_ledtrig_tx_timerfunc, 0, 0);
static int tx_activity;
static int tx_lastactivity;
-static void ledtrig_tx_activity(void)
+static void at76_ledtrig_tx_activity(void)
{
tx_activity++;
if (!timer_pending(&ledtrig_tx_timer))
mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250));
}
-static void ledtrig_tx_timerfunc(unsigned long data)
+static void at76_ledtrig_tx_timerfunc(unsigned long data)
{
if (tx_lastactivity != tx_activity) {
tx_lastactivity = tx_activity;
@@ -594,7 +593,7 @@ static void ledtrig_tx_timerfunc(unsigned long data)
}
-static int at76c503_remap(struct usb_device *udev)
+static int at76_remap(struct usb_device *udev)
{
int ret;
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
@@ -606,7 +605,7 @@ static int at76c503_remap(struct usb_device *udev)
}
-static int get_op_mode(struct usb_device *udev)
+static int at76_get_op_mode(struct usb_device *udev)
{
int ret;
u8 op_mode;
@@ -620,15 +619,15 @@ static int get_op_mode(struct usb_device *udev)
}
/* this loads a block of the second part of the firmware */
-static inline int load_ext_fw_block(struct usb_device *udev,
- int i, unsigned char *buf, int bsize)
+static inline int at76_load_ext_fw_block(struct usb_device *udev,
+ int i, unsigned char *buf, int bsize)
{
return usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
0x0e, DEVICE_VENDOR_REQUEST_OUT,
0x0802, i, buf, bsize, USB_CTRL_GET_TIMEOUT);
}
-static inline int get_hw_cfg_rfmd(struct usb_device *udev,
+static inline int at76_get_hw_cfg_rfmd(struct usb_device *udev,
unsigned char *buf, int buf_size)
{
return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -652,7 +651,7 @@ int get_hw_cfg_intersil(struct usb_device *udev,
* data in the appropriate fields of 'dev' (the GetHWConfig request and
* interpretation of the result depends on the type of board we're dealing
* with) */
-static int get_hw_config(struct at76c503 *dev)
+static int at76_get_hw_config(struct at76_priv *dev)
{
int ret;
union {
@@ -680,7 +679,7 @@ static int get_hw_config(struct at76c503 *dev)
case BOARDTYPE_503_RFMD:
case BOARDTYPE_503_RFMD_ACC:
- ret = get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r3, sizeof(hwcfg->r3));
+ ret = at76_get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r3, sizeof(hwcfg->r3));
if (ret < 0)
break;
memcpy(dev->cr20_values, hwcfg->r3.cr20_values, 14);
@@ -696,7 +695,7 @@ static int get_hw_config(struct at76c503 *dev)
case BOARDTYPE_505_RFMD:
case BOARDTYPE_505_RFMD_2958:
case BOARDTYPE_505A_RFMD_2958:
- ret = get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r5, sizeof(hwcfg->r5));
+ ret = at76_get_hw_cfg_rfmd(dev->udev, (unsigned char *)&hwcfg->r5, sizeof(hwcfg->r5));
if (ret < 0)
break;
memcpy(dev->cr39_values, hwcfg->r5.cr39_values, 14);
@@ -721,7 +720,7 @@ static int get_hw_config(struct at76c503 *dev)
return ret;
}
-static struct reg_domain const *getRegDomain(u16 code)
+static struct reg_domain const *at76_get_reg_domain(u16 code)
{
static struct reg_domain const fd_tab[] = {
{0x10, "FCC (U.S)", 0x7ff}, /* ch 1-11 */
@@ -747,7 +746,7 @@ static struct reg_domain const *getRegDomain(u16 code)
return (i >= tab_len) ? &unknown : &fd_tab[i];
}
-static inline int get_mib(struct usb_device *udev,
+static inline int at76_get_mib(struct usb_device *udev,
u16 mib, u8 *buf, int buf_size)
{
return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
@@ -757,7 +756,7 @@ static inline int get_mib(struct usb_device *udev,
}
/* Return positive number for status, negative for an error */
-static inline int get_cmd_status(struct usb_device *udev, u8 cmd)
+static inline int at76_get_cmd_status(struct usb_device *udev, u8 cmd)
{
u8 stat_buf[40];
int ret;
@@ -772,7 +771,7 @@ static inline int get_cmd_status(struct usb_device *udev, u8 cmd)
}
#define EXT_FW_BLOCK_SIZE 1024
-static int download_external_fw(struct usb_device *udev, u8 *buf, int size)
+static int at76_download_external_fw(struct usb_device *udev, u8 *buf, int size)
{
int i = 0, ret = 0;
u8 *block;
@@ -786,16 +785,17 @@ static int download_external_fw(struct usb_device *udev, u8 *buf, int size)
if (block == NULL)
return -ENOMEM;
- dbg(DBG_DEVSTART, "downloading external firmware");
+ at76_dbg(DBG_DEVSTART, "downloading external firmware");
while (size > 0) {
int bsize = size > EXT_FW_BLOCK_SIZE ? EXT_FW_BLOCK_SIZE : size;
memcpy(block, buf, bsize);
- dbg(DBG_DEVSTART,
- "ext fw, size left = %5d, bsize = %4d, i = %2d", size, bsize, i);
- if ((ret = load_ext_fw_block(udev, i, block, bsize)) < 0) {
- err("load_ext_fw_block failed: %d, i = %d", ret, i);
+ at76_dbg(DBG_DEVSTART,
+ "ext fw, size left = %5d, bsize = %4d, i = %2d",
+ size, bsize, i);
+ if ((ret = at76_load_ext_fw_block(udev, i, block, bsize)) < 0) {
+ err("loading %dth firmware block failed: %d", i, ret);
goto exit;
}
buf += bsize;
@@ -805,8 +805,8 @@ static int download_external_fw(struct usb_device *udev, u8 *buf, int size)
/* for fw >= 0.100, the device needs
an extra empty block: */
- if ((ret = load_ext_fw_block(udev, i, block, 0)) < 0) {
- err("load_ext_fw_block failed: %d, i = %d", ret, i);
+ if ((ret = at76_load_ext_fw_block(udev, i, block, 0)) < 0) {
+ err("loading %dth firmware block failed: %d", ret, i);
goto exit;
}
@@ -815,12 +815,12 @@ static int download_external_fw(struct usb_device *udev, u8 *buf, int size)
return ret;
}
-static int set_card_command(struct usb_device *udev, int cmd,
- unsigned char *buf, int buf_size)
+static int at76_set_card_command(struct usb_device *udev, int cmd,
+ unsigned char *buf, int buf_size)
{
int ret;
- struct at76c503_command *cmd_buf =
- (struct at76c503_command *)kmalloc(sizeof(struct at76c503_command) +
+ struct at76_command *cmd_buf =
+ (struct at76_command *)kmalloc(sizeof(struct at76_command) +
buf_size,
GFP_KERNEL);
@@ -834,7 +834,7 @@ static int set_card_command(struct usb_device *udev, int cmd,
0x0e, DEVICE_VENDOR_REQUEST_OUT,
0, 0,
cmd_buf,
- sizeof(struct at76c503_command) +
+ sizeof(struct at76_command) +
buf_size, USB_CTRL_GET_TIMEOUT);
kfree(cmd_buf);
return ret;
@@ -845,7 +845,7 @@ static int set_card_command(struct usb_device *udev, int cmd,
#define MAKE_CMD_STATUS_CASE(c) case (c): return #c
-static const char *get_cmd_status_string(u8 cmd_status)
+static const char *at76_get_cmd_status_string(u8 cmd_status)
{
switch (cmd_status) {
MAKE_CMD_STATUS_CASE(CMD_STATUS_IDLE);
@@ -863,22 +863,22 @@ static const char *get_cmd_status_string(u8 cmd_status)
}
/* TODO: should timeout */
-static int at76_wait_completion(struct at76c503 *dev, int cmd)
+static int at76_wait_completion(struct at76_priv *dev, int cmd)
{
struct net_device *netdev = dev->netdev;
int status = 0;
do {
- status = get_cmd_status(dev->udev, cmd);
+ status = at76_get_cmd_status(dev->udev, cmd);
if (status < 0) {
- err("%s: get_cmd_status failed: %d", netdev->name, status);
+ err("%s: at76_get_cmd_status failed: %d", netdev->name, status);
break;
}
- dbg(DBG_WAIT_COMPLETE,
- "%s: Waiting on cmd %d, status = %d (%s)",
- dev->netdev->name, cmd, status,
- get_cmd_status_string(status));
+ at76_dbg(DBG_WAIT_COMPLETE,
+ "%s: Waiting on cmd %d, status = %d (%s)",
+ dev->netdev->name, cmd, status,
+ at76_get_cmd_status_string(status));
if (status == CMD_STATUS_IN_PROGRESS ||
status == CMD_STATUS_IDLE) {
@@ -891,12 +891,12 @@ static int at76_wait_completion(struct at76c503 *dev, int cmd)
return status;
}
-static int set_mib(struct at76c503 *dev, struct set_mib_buffer *buf)
+static int at76_set_mib(struct at76_priv *dev, struct set_mib_buffer *buf)
{
struct usb_device *udev = dev->udev;
int ret;
- struct at76c503_command *cmd_buf =
- (struct at76c503_command *)kmalloc(sizeof(struct at76c503_command) +
+ struct at76_command *cmd_buf =
+ (struct at76_command *)kmalloc(sizeof(struct at76_command) +
buf->size + 4,
GFP_KERNEL);
@@ -909,7 +909,7 @@ static int set_mib(struct at76c503 *dev, struct set_mib_buffer *buf)
0x0e, DEVICE_VENDOR_REQUEST_OUT,
0, 0,
cmd_buf,
- sizeof(struct at76c503_command) +
+ sizeof(struct at76_command) +
buf->size + 4, USB_CTRL_GET_TIMEOUT);
if (ret >= 0)
if ((ret = at76_wait_completion(dev, CMD_SET_MIB)) !=
@@ -926,14 +926,14 @@ static int set_mib(struct at76c503 *dev, struct set_mib_buffer *buf)
}
/* return < 0 on error, == 0 if no command sent, == 1 if cmd sent */
-static int set_radio(struct at76c503 *dev, int on_off)
+static int at76_set_radio(struct at76_priv *dev, int on_off)
{
int ret;
if (dev->radio_on != on_off) {
- ret = set_card_command(dev->udev, CMD_RADIO, NULL, 0);
+ ret = at76_set_card_command(dev->udev, CMD_RADIO, NULL, 0);
if (ret < 0) {
- err("%s: set_card_command(CMD_RADIO) failed: %d", dev->netdev->name, ret);
+ err("%s: at76_set_card_command(CMD_RADIO) failed: %d", dev->netdev->name, ret);
} else
ret = 1;
dev->radio_on = on_off;
@@ -946,7 +946,7 @@ static int set_radio(struct at76c503 *dev, int on_off)
* set_pm_mode - set current power save mode
* (AT76_PM_OFF/AT76_PM_ON/AT76_PM_SMART)
*/
-static int set_pm_mode(struct at76c503 *dev)
+static int at76_set_pm_mode(struct at76_priv *dev)
{
int ret = 0;
@@ -957,7 +957,7 @@ static int set_pm_mode(struct at76c503 *dev)
dev->mib_buf.data[0] = dev->pm_mode;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (pm_mode) failed: %d", dev->netdev->name, ret);
}
@@ -965,7 +965,7 @@ static int set_pm_mode(struct at76c503 *dev)
}
/* sets the assoc id for power save mode */
-static int set_associd(struct at76c503 *dev, u16 id)
+static int at76_set_associd(struct at76_priv *dev, u16 id)
{
int ret = 0;
@@ -977,7 +977,7 @@ static int set_associd(struct at76c503 *dev, u16 id)
dev->mib_buf.data[0] = id & 0xff;
dev->mib_buf.data[1] = id >> 8;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (associd) failed: %d", dev->netdev->name, ret);
}
@@ -986,7 +986,7 @@ static int set_associd(struct at76c503 *dev, u16 id)
/* sets the listen interval for power save mode.
really needed, as we have a similar parameter in the assocreq ??? */
-static int set_listen_interval(struct at76c503 *dev, u16 interval)
+static int at76_set_listen_interval(struct at76_priv *dev, u16 interval)
{
int ret = 0;
@@ -998,7 +998,7 @@ static int set_listen_interval(struct at76c503 *dev, u16 interval)
dev->mib_buf.data[0] = interval & 0xff;
dev->mib_buf.data[1] = interval >> 8;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (listen_interval) failed: %d",
dev->netdev->name, ret);
@@ -1006,7 +1006,7 @@ static int set_listen_interval(struct at76c503 *dev, u16 interval)
return ret;
}
-static int set_preamble(struct at76c503 *dev, u8 type)
+static int at76_set_preamble(struct at76_priv *dev, u8 type)
{
int ret = 0;
@@ -1015,14 +1015,14 @@ static int set_preamble(struct at76c503 *dev, u8 type)
dev->mib_buf.size = 1;
dev->mib_buf.index = PREAMBLE_TYPE_OFFSET;
dev->mib_buf.data[0] = type;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (preamble) failed: %d", dev->netdev->name, ret);
}
return ret;
}
-static int set_frag(struct at76c503 *dev, u16 size)
+static int at76_set_frag(struct at76_priv *dev, u16 size)
{
int ret = 0;
@@ -1031,14 +1031,14 @@ static int set_frag(struct at76c503 *dev, u16 size)
dev->mib_buf.size = 2;
dev->mib_buf.index = FRAGMENTATION_OFFSET;
*(__le16 *) dev->mib_buf.data = cpu_to_le16(size);
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (frag threshold) failed: %d", dev->netdev->name, ret);
}
return ret;
}
-static int set_rts(struct at76c503 *dev, u16 size)
+static int at76_set_rts(struct at76_priv *dev, u16 size)
{
int ret = 0;
@@ -1047,14 +1047,14 @@ static int set_rts(struct at76c503 *dev, u16 size)
dev->mib_buf.size = 2;
dev->mib_buf.index = RTS_OFFSET;
*(__le16 *) dev->mib_buf.data = cpu_to_le16(size);
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (rts) failed: %d", dev->netdev->name, ret);
}
return ret;
}
-static int set_autorate_fallback(struct at76c503 *dev, int onoff)
+static int at76_set_autorate_fallback(struct at76_priv *dev, int onoff)
{
int ret = 0;
@@ -1063,14 +1063,14 @@ static int set_autorate_fallback(struct at76c503 *dev, int onoff)
dev->mib_buf.size = 1;
dev->mib_buf.index = TX_AUTORATE_FALLBACK_OFFSET;
dev->mib_buf.data[0] = onoff;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (autorate fallback) failed: %d", dev->netdev->name, ret);
}
return ret;
}
-static int set_mac_address(struct at76c503 *dev, void *addr)
+static int at76_add_mac_address(struct at76_priv *dev, void *addr)
{
int ret = 0;
@@ -1079,7 +1079,7 @@ static int set_mac_address(struct at76c503 *dev, void *addr)
dev->mib_buf.size = ETH_ALEN;
dev->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr);
memcpy(dev->mib_buf.data, addr, ETH_ALEN);
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d",
dev->netdev->name, ret);
@@ -1090,7 +1090,7 @@ static int set_mac_address(struct at76c503 *dev, void *addr)
#if 0
/* implemented to get promisc. mode working, but does not help.
May still be useful for multicast eventually. */
-static int set_group_address(struct at76c503 *dev, u8 *addr, int n)
+static int set_group_address(struct at76_priv *dev, u8 *addr, int n)
{
int ret = 0;
@@ -1100,7 +1100,7 @@ static int set_group_address(struct at76c503 *dev, u8 *addr, int n)
dev->mib_buf.index =
offsetof(struct mib_mac_addr, group_addr) + n * ETH_ALEN;
memcpy(dev->mib_buf.data, addr, ETH_ALEN);
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (MIB_MAC_ADD, group_addr) failed: %d",
dev->netdev->name, ret);
@@ -1113,7 +1113,7 @@ static int set_group_address(struct at76c503 *dev, u8 *addr, int n)
dev->mib_buf.index =
offsetof(struct mib_mac_addr, group_addr_status) + n;
dev->mib_buf.data[0] = 1;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (MIB_MAC_ADD, group_addr_status) failed: %d",
dev->netdev->name, ret);
@@ -1123,7 +1123,7 @@ static int set_group_address(struct at76c503 *dev, u8 *addr, int n)
}
#endif
-static int set_promisc(struct at76c503 *dev, int onoff)
+static int set_promisc(struct at76_priv *dev, int onoff)
{
int ret = 0;
@@ -1132,14 +1132,14 @@ static int set_promisc(struct at76c503 *dev, int onoff)
dev->mib_buf.size = 1;
dev->mib_buf.index = offsetof(struct mib_local, promiscuous_mode);
dev->mib_buf.data[0] = onoff ? 1 : 0;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (promiscuous_mode) failed: %d", dev->netdev->name, ret);
}
return ret;
}
-static int dump_mib_mac_addr(struct at76c503 *dev)
+static int at76_dump_mib_mac_addr(struct at76_priv *dev)
{
int ret = 0;
struct mib_mac_addr *mac_addr =
@@ -1150,15 +1150,15 @@ static int dump_mib_mac_addr(struct at76c503 *dev)
goto exit;
}
- ret = get_mib(dev->udev, MIB_MAC_ADD,
+ ret = at76_get_mib(dev->udev, MIB_MAC_ADD,
(u8 *) mac_addr, sizeof(struct mib_mac_addr));
if (ret < 0) {
- err("%s: get_mib (MAC_ADDR) failed: %d", dev->netdev->name,
+ err("%s: at76_get_mib (MAC_ADDR) failed: %d", dev->netdev->name,
ret);
goto err;
}
- dbg_uc("%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x group_addr %s status %d %d %d %d",
+ dbg("%s: MIB MAC_ADDR: mac_addr %s res 0x%x 0x%x group_addr %s status %d %d %d %d",
dev->netdev->name, mac2str(mac_addr->mac_addr),
mac_addr->res[0], mac_addr->res[1],
hex2str(dev->obuf, (u8 *)mac_addr->group_addr,
@@ -1172,7 +1172,7 @@ static int dump_mib_mac_addr(struct at76c503 *dev)
return ret;
}
-static int dump_mib_mac_wep(struct at76c503 *dev)
+static int at76_dump_mib_mac_wep(struct at76_priv *dev)
{
int ret = 0;
struct mib_mac_wep *mac_wep =
@@ -1182,14 +1182,14 @@ static int dump_mib_mac_wep(struct at76c503 *dev)
ret = -ENOMEM;
goto exit;
}
- ret = get_mib(dev->udev, MIB_MAC_WEP,
+ ret = at76_get_mib(dev->udev, MIB_MAC_WEP,
(u8*)mac_wep, sizeof(struct mib_mac_wep));
if (ret < 0) {
- err("%s: get_mib (MAC_WEP) failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib (MAC_WEP) failed: %d", dev->netdev->name, ret);
goto err;
}
- dbg_uc("%s: MIB MAC_WEP: priv_invoked %u def_key_id %u key_len %u "
+ dbg("%s: MIB MAC_WEP: priv_invoked %u def_key_id %u key_len %u "
"excl_unencr %u wep_icv_err %u wep_excluded %u encr_level %u key %d: %s",
dev->netdev->name, mac_wep->privacy_invoked,
mac_wep->wep_default_key_id, mac_wep->wep_key_mapping_len,
@@ -1217,7 +1217,7 @@ static int dump_mib_mac_wep(struct at76c503 *dev)
return ret;
}
-static int dump_mib_mac_mgmt(struct at76c503 *dev)
+static int at76_dump_mib_mac_mgmt(struct at76_priv *dev)
{
int ret = 0;
struct mib_mac_mgmt *mac_mgmt =
@@ -1228,17 +1228,17 @@ static int dump_mib_mac_mgmt(struct at76c503 *dev)
ret = -ENOMEM;
goto exit;
}
- ret = get_mib(dev->udev, MIB_MAC_MGMT,
+ ret = at76_get_mib(dev->udev, MIB_MAC_MGMT,
(u8*)mac_mgmt, sizeof(struct mib_mac_mgmt));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
memcpy(&country_string, mac_mgmt->country_string, 3);
country_string[3] = '\0';
- dbg_uc("%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration %d "
+ 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 "
@@ -1272,7 +1272,7 @@ static int dump_mib_mac_mgmt(struct at76c503 *dev)
return ret;
}
-static int dump_mib_mac(struct at76c503 *dev)
+static int at76_dump_mib_mac(struct at76_priv *dev)
{
int ret = 0;
struct mib_mac *mac = kmalloc(sizeof(struct mib_mac), GFP_KERNEL);
@@ -1282,14 +1282,14 @@ static int dump_mib_mac(struct at76c503 *dev)
goto exit;
}
- ret = get_mib(dev->udev, MIB_MAC,
+ ret = at76_get_mib(dev->udev, MIB_MAC,
(u8*)mac, sizeof(struct mib_mac));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
- dbg_uc("%s: MIB MAC: max_tx_msdu_lifetime %d max_rx_lifetime %d "
+ 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 "
@@ -1320,7 +1320,7 @@ static int dump_mib_mac(struct at76c503 *dev)
return ret;
}
-static int dump_mib_phy(struct at76c503 *dev)
+static int at76_dump_mib_phy(struct at76_priv *dev)
{
int ret = 0;
struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
@@ -1330,13 +1330,13 @@ static int dump_mib_phy(struct at76c503 *dev)
goto exit;
}
- ret = get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy));
+ ret = at76_get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
- dbg_uc("%s: MIB PHY: ed_threshold %d slot_time %d sifs_time %d "
+ 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 "
@@ -1359,7 +1359,7 @@ static int dump_mib_phy(struct at76c503 *dev)
return ret;
}
-static int dump_mib_local(struct at76c503 *dev)
+static int at76_dump_mib_local(struct at76_priv *dev)
{
int ret = 0;
struct mib_local *local = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
@@ -1369,14 +1369,14 @@ static int dump_mib_local(struct at76c503 *dev)
goto exit;
}
- ret = get_mib(dev->udev, MIB_LOCAL,
+ ret = at76_get_mib(dev->udev, MIB_LOCAL,
(u8*)local, sizeof(struct mib_local));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
- dbg_uc("%s: MIB PHY: beacon_enable %d txautorate_fallback %d "
+ dbg("%s: MIB PHY: beacon_enable %d txautorate_fallback %d "
"ssid_size %d promiscuous_mode %d preamble_type %d",
dev->netdev->name,
local->beacon_enable,
@@ -1388,7 +1388,7 @@ static int dump_mib_local(struct at76c503 *dev)
return ret;
}
-static int get_mib_mdomain(struct at76c503 *dev, struct mib_mdomain *val)
+static int at76_at76_get_mib_mdomain(struct at76_priv *dev, struct mib_mdomain *val)
{
int ret = 0;
struct mib_mdomain *mdomain =
@@ -1399,10 +1399,10 @@ static int get_mib_mdomain(struct at76c503 *dev, struct mib_mdomain *val)
goto exit;
}
- ret = get_mib(dev->udev, MIB_MDOMAIN,
+ ret = at76_get_mib(dev->udev, MIB_MDOMAIN,
(u8*)mdomain, sizeof(struct mib_mdomain));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
@@ -1414,28 +1414,28 @@ static int get_mib_mdomain(struct at76c503 *dev, struct mib_mdomain *val)
return ret;
}
-static void dump_mib_mdomain(struct at76c503 *dev)
+static void at76_dump_mib_mdomain(struct at76_priv *dev)
{
char obuf1[2*14+1], obuf2[2*14+1]; /* to hexdump tx_powerlevel,
channel_list */
int ret;
struct mib_mdomain mdomain;
- if ((ret=get_mib_mdomain(dev, &mdomain)) < 0) {
- err("%s: get_mib_mdomain returned %d", __FUNCTION__, ret);
+ if ((ret=at76_at76_get_mib_mdomain(dev, &mdomain)) < 0) {
+ err("%s: at76_get_mib_mdomain returned %d", __FUNCTION__, ret);
return;
}
- dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s tx_powerlevel %s",
- dev->netdev->name,
- hex2str(obuf1, mdomain.channel_list,
- (sizeof(obuf1) - 1) / 2, '\0'),
- hex2str(obuf2, mdomain.tx_powerlevel,
- (sizeof(obuf2) - 1) / 2, '\0'));
+ at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s tx_powerlevel %s",
+ dev->netdev->name,
+ hex2str(obuf1, mdomain.channel_list,
+ (sizeof(obuf1) - 1) / 2, '\0'),
+ hex2str(obuf2, mdomain.tx_powerlevel,
+ (sizeof(obuf2) - 1) / 2, '\0'));
}
static
-int get_current_bssid(struct at76c503 *dev)
+int at76_get_current_bssid(struct at76_priv *dev)
{
int ret = 0;
struct mib_mac_mgmt *mac_mgmt =
@@ -1446,10 +1446,10 @@ int get_current_bssid(struct at76c503 *dev)
goto exit;
}
- ret = get_mib(dev->udev, MIB_MAC_MGMT,
+ ret = at76_get_mib(dev->udev, MIB_MAC_MGMT,
(u8*)mac_mgmt, sizeof(struct mib_mac_mgmt));
if (ret < 0) {
- err("%s: get_mib failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", dev->netdev->name, ret);
goto err;
}
memcpy(dev->bssid, mac_mgmt->current_bssid, ETH_ALEN);
@@ -1460,7 +1460,7 @@ int get_current_bssid(struct at76c503 *dev)
return ret;
}
-static int get_current_channel(struct at76c503 *dev)
+static int at76_get_current_channel(struct at76_priv *dev)
{
int ret = 0;
struct mib_phy *phy = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
@@ -1469,9 +1469,9 @@ static int get_current_channel(struct at76c503 *dev)
ret = -ENOMEM;
goto exit;
}
- ret = get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy));
+ ret = at76_get_mib(dev->udev, MIB_PHY, (u8*) phy, sizeof(struct mib_phy));
if (ret < 0) {
- err("%s: get_mib(MIB_PHY) failed: %d", dev->netdev->name, ret);
+ err("%s: at76_get_mib(MIB_PHY) failed: %d", dev->netdev->name, ret);
goto err;
}
dev->channel = phy->channel_id;
@@ -1487,11 +1487,11 @@ static int get_current_channel(struct at76c503 *dev)
* @use_essid - use the configured ESSID in non passive mode
* @ir_step - international roaming step (0, 1)
*/
-static int start_scan(struct at76c503 *dev, int use_essid, int ir_step)
+static int at76_start_scan(struct at76_priv *dev, int use_essid, int ir_step)
{
- struct at76c503_start_scan scan;
+ struct at76_start_scan scan;
- memset(&scan, 0, sizeof(struct at76c503_start_scan));
+ memset(&scan, 0, sizeof(struct at76_start_scan));
memset(scan.bssid, 0xff, ETH_ALEN);
if (use_essid) {
@@ -1531,42 +1531,42 @@ static int start_scan(struct at76c503 *dev, int use_essid, int ir_step)
/* other values are set to 0 for type 0 */
- dbg(DBG_PROGRESS, "%s: start_scan (use_essid = %d, intl = %d, "
- "channel = %d, probe_delay = %d, scan_min_time = %d, "
- "scan_max_time = %d)",
- dev->netdev->name, use_essid,
- scan.international_scan, scan.channel,
- le16_to_cpu(scan.probe_delay),
- le16_to_cpu(scan.min_channel_time),
- le16_to_cpu(scan.max_channel_time));
+ at76_dbg(DBG_PROGRESS, "%s: start_scan (use_essid = %d, intl = %d, "
+ "channel = %d, probe_delay = %d, scan_min_time = %d, "
+ "scan_max_time = %d)",
+ dev->netdev->name, use_essid,
+ scan.international_scan, scan.channel,
+ le16_to_cpu(scan.probe_delay),
+ le16_to_cpu(scan.min_channel_time),
+ le16_to_cpu(scan.max_channel_time));
- return set_card_command(dev->udev, CMD_SCAN,
- (unsigned char *)&scan, sizeof(scan));
+ return at76_set_card_command(dev->udev, CMD_SCAN,
+ (unsigned char *)&scan, sizeof(scan));
}
-static int start_ibss(struct at76c503 *dev)
+static int at76_start_ibss(struct at76_priv *dev)
{
- struct at76c503_start_bss bss;
+ struct at76_start_bss bss;
- memset(&bss, 0, sizeof(struct at76c503_start_bss));
+ memset(&bss, 0, sizeof(struct at76_start_bss));
memset(bss.bssid, 0xff, ETH_ALEN);
memcpy(bss.essid, dev->essid, IW_ESSID_MAX_SIZE);
bss.essid_size = dev->essid_size;
bss.bss_type = ADHOC_MODE;
bss.channel = dev->channel;
- return set_card_command(dev->udev, CMD_START_IBSS,
- (unsigned char*)&bss, sizeof(struct at76c503_start_bss));
+ return at76_set_card_command(dev->udev, CMD_START_IBSS,
+ (unsigned char*)&bss, sizeof(struct at76_start_bss));
}
/* idx points into dev->bss */
-static int join_bss(struct at76c503 *dev, struct bss_info *ptr)
+static int at76_join_bss(struct at76_priv *dev, struct bss_info *ptr)
{
- struct at76c503_join join;
+ struct at76_join join;
- assert(ptr != NULL);
+ at76_assert(ptr != NULL);
- memset(&join, 0, sizeof(struct at76c503_join));
+ memset(&join, 0, sizeof(struct at76_join));
memcpy(join.bssid, ptr->bssid, ETH_ALEN);
memcpy(join.essid, ptr->ssid, ptr->ssid_len);
join.essid_size = ptr->ssid_len;
@@ -1574,32 +1574,32 @@ static int join_bss(struct at76c503 *dev, struct bss_info *ptr)
join.channel = ptr->channel;
join.timeout = cpu_to_le16(2000);
- dbg(DBG_PROGRESS, "%s join addr %s ssid %s type %d ch %d timeout %d",
- dev->netdev->name, mac2str(join.bssid),
- join.essid, join.bss_type, join.channel, le16_to_cpu(join.timeout));
- return set_card_command(dev->udev, CMD_JOIN,
- (unsigned char*)&join,
- sizeof(struct at76c503_join));
+ at76_dbg(DBG_PROGRESS, "%s join addr %s ssid %s type %d ch %d timeout %d",
+ dev->netdev->name, mac2str(join.bssid),
+ join.essid, join.bss_type, join.channel, le16_to_cpu(join.timeout));
+ return at76_set_card_command(dev->udev, CMD_JOIN,
+ (unsigned char*)&join,
+ sizeof(struct at76_join));
}
/* the firmware download timeout (after remap) */
-static void fw_dl_timeout(unsigned long par)
+static void at76_fw_dl_timeout(unsigned long par)
{
- struct at76c503 *dev = (struct at76c503 *)par;
+ struct at76_priv *dev = (struct at76_priv *)par;
at76_defer_event(dev, AT76_DEVENT_RESET_DEVICE);
}
/* the restart timer timed out */
-static void restart_timeout(unsigned long par)
+static void at76_restart_timeout(unsigned long par)
{
- struct at76c503 *dev = (struct at76c503 *)par;
+ struct at76_priv *dev = (struct at76_priv *)par;
at76_defer_event(dev, AT76_DEVENT_RESTART);
}
/* we got to check the bss_list for old entries */
-static void bss_list_timeout(unsigned long par)
+static void at76_bss_list_timeout(unsigned long par)
{
- struct at76c503 *dev = (struct at76c503 *)par;
+ struct at76_priv *dev = (struct at76_priv *)par;
unsigned long flags;
struct list_head *lptr, *nptr;
struct bss_info *ptr;
@@ -1612,10 +1612,10 @@ static void bss_list_timeout(unsigned long par)
if (ptr != dev->curr_bss && ptr != dev->new_bss &&
time_after(jiffies, ptr->last_rx + BSS_LIST_TIMEOUT)) {
- dbg(DBG_BSS_TABLE_RM,
- "%s: bss_list: removing old BSS %s ch %d",
- dev->netdev->name, mac2str(ptr->bssid),
- ptr->channel);
+ at76_dbg(DBG_BSS_TABLE_RM,
+ "%s: bss_list: removing old BSS %s ch %d",
+ dev->netdev->name, mac2str(ptr->bssid),
+ ptr->channel);
list_del(&ptr->list);
kfree(ptr);
}
@@ -1627,75 +1627,75 @@ static void bss_list_timeout(unsigned long par)
}
/* we got a timeout for a infrastructure mgmt packet */
-static void mgmt_timeout(unsigned long par)
+static void at76_mgmt_timeout(unsigned long par)
{
- struct at76c503 *dev = (struct at76c503 *)par;
+ struct at76_priv *dev = (struct at76_priv *)par;
at76_defer_event(dev, AT76_DEVENT_MGMT_TIMEOUT);
}
-/**
- * handle_mgmt_timeout_scan - expiry of management timer in istate SCANNING
+/*
+ * at76_handle_mgmt_timeout_scan - expiry of management timer in istate SCANNING
*/
-static void handle_mgmt_timeout_scan(struct at76c503 *dev)
+static void at76_handle_mgmt_timeout_scan(struct at76_priv *dev)
{
int status, ret;
struct mib_mdomain mdomain;
- if ((status = get_cmd_status(dev->udev, CMD_SCAN)) < 0) {
- err("%s: %s: get_cmd_status failed with %d",
+ if ((status = at76_get_cmd_status(dev->udev, CMD_SCAN)) < 0) {
+ err("%s: %s: at76_get_cmd_status failed with %d",
dev->netdev->name, __FUNCTION__, status);
status = CMD_STATUS_IN_PROGRESS;
/* INFO: Hope it was a one off error - if not, scanning
further down the line and stop this cycle */
}
- dbg(DBG_PROGRESS, "%s %s:%d got cmd_status %d (istate %d, "
- "scan_runs %d)",
- dev->netdev->name, __FUNCTION__, __LINE__, status,
- dev->istate, dev->scan_runs);
+ at76_dbg(DBG_PROGRESS, "%s %s:%d got cmd_status %d (istate %d, "
+ "scan_runs %d)",
+ dev->netdev->name, __FUNCTION__, __LINE__, status,
+ dev->istate, dev->scan_runs);
if (status == CMD_STATUS_COMPLETE) {
if (dev->istate == SCANNING) {
if (at76_debug & DBG_BSS_TABLE)
- dump_bss_table(dev);
+ at76_dump_bss_table(dev);
switch (dev->scan_runs) {
case 1:
- assert(dev->international_roaming);
- if ((ret=get_mib_mdomain(dev, &mdomain)) < 0) {
- err("get_mib_mdomain returned %d", ret);
+ at76_assert(dev->international_roaming);
+ if ((ret=at76_at76_get_mib_mdomain(dev, &mdomain)) < 0) {
+ err("at76_get_mib_mdomain returned %d", ret);
} else {
char obuf1[2*14+1], obuf2[2*14+1];
- dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s "
- "tx_powerlevel %s",
- dev->netdev->name,
- hex2str(obuf1, mdomain.channel_list,
- (sizeof(obuf1)-1)/2,'\0'),
- hex2str(obuf2, mdomain.tx_powerlevel,
+ at76_dbg(DBG_MIB, "%s: MIB MDOMAIN: channel_list %s "
+ "tx_powerlevel %s",
+ dev->netdev->name,
+ hex2str(obuf1, mdomain.channel_list,
+ (sizeof(obuf1)-1)/2,'\0'),
+ hex2str(obuf2, mdomain.tx_powerlevel,
(sizeof(obuf2)-1)/2,'\0'));
}
- if ((ret = start_scan(dev, 0, 1)) < 0) {
+ if ((ret = at76_start_scan(dev, 0, 1)) < 0) {
err("%s: %s: start_scan (ANY) failed with %d",
dev->netdev->name, __FUNCTION__, ret);
}
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
break;
case 2:
- if ((ret = start_scan(dev, 1, 1)) < 0) {
+ if ((ret = at76_start_scan(dev, 1, 1)) < 0) {
err("%s: %s: start_scan (SSID) failed with %d",
dev->netdev->name, __FUNCTION__, ret);
}
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
break;
case 3:
dev->site_survey_state = SITE_SURVEY_COMPLETED;
/* report the end of scan to user space */
- iwevent_scan_complete(dev->netdev);
+ at76_iwevent_scan_complete(dev->netdev);
dev->istate = JOINING;
/* call join_bss immediately after
re-run of all other threads in at76_devent */
@@ -1708,12 +1708,12 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev)
dev->scan_runs++;
} else {
- assert(dev->istate == MONITORING);
- dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE: restart scan",
- dev->netdev->name);
- start_scan(dev, 0, 0);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_assert(dev->istate == MONITORING);
+ at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE: restart scan",
+ dev->netdev->name);
+ at76_start_scan(dev, 0, 0);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
}
@@ -1722,34 +1722,34 @@ static void handle_mgmt_timeout_scan(struct at76c503 *dev)
(status != CMD_STATUS_IDLE))
err("%s: %s: Bad scan status: %s",
dev->netdev->name, __FUNCTION__,
- get_cmd_status_string(status));
+ at76_get_cmd_status_string(status));
/* the first cmd status after scan start is always a IDLE ->
start the timer to poll again until COMPLETED */
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
}
}
/* the deferred procedure called from at76_devent() */
-static void handle_mgmt_timeout(struct at76c503 *dev)
+static void at76_handle_mgmt_timeout(struct at76_priv *dev)
{
if ((dev->istate != SCANNING && dev->istate != MONITORING) ||
(at76_debug & DBG_MGMT_TIMER))
/* this is normal behavior in states MONITORING, SCANNING ... */
- dbg(DBG_PROGRESS, "%s: timeout, state %d", dev->netdev->name,
- dev->istate);
+ at76_dbg(DBG_PROGRESS, "%s: timeout, state %d", dev->netdev->name,
+ dev->istate);
switch (dev->istate) {
case MONITORING:
case SCANNING:
- handle_mgmt_timeout_scan(dev);
+ at76_handle_mgmt_timeout_scan(dev);
break;
case JOINING:
- assert(0);
+ at76_assert(0);
break;
case CONNECTED: /* we haven't received the beacon of this BSS for
@@ -1761,7 +1761,7 @@ static void handle_mgmt_timeout(struct at76c503 *dev)
if (dev->iw_mode != IW_MODE_ADHOC) {
netif_carrier_off(dev->netdev);
netif_stop_queue(dev->netdev);
- iwevent_bss_disconnect(dev->netdev);
+ at76_iwevent_bss_disconnect(dev->netdev);
dev->istate = SCANNING;
at76_defer_event(dev, AT76_DEVENT_SCAN);
}
@@ -1769,9 +1769,9 @@ static void handle_mgmt_timeout(struct at76c503 *dev)
case AUTHENTICATING:
if (dev->retries-- >= 0) {
- auth_req(dev, dev->curr_bss, 1, NULL);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_auth_req(dev, dev->curr_bss, 1, NULL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
} else {
/* try to get next matching BSS */
@@ -1782,9 +1782,9 @@ static void handle_mgmt_timeout(struct at76c503 *dev)
case ASSOCIATING:
if (dev->retries-- >= 0) {
- assoc_req(dev, dev->curr_bss);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_assoc_req(dev, dev->curr_bss);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
} else {
/* jal: TODO: we may be authenticated to several
@@ -1799,24 +1799,24 @@ static void handle_mgmt_timeout(struct at76c503 *dev)
case REASSOCIATING:
if (dev->retries-- >= 0)
- reassoc_req(dev, dev->curr_bss, dev->new_bss);
+ at76_reassoc_req(dev, dev->curr_bss, dev->new_bss);
else {
/* we disassociate from the curr_bss and
scan again ... */
dev->istate = DISASSOCIATING;
dev->retries = DISASSOC_RETRIES;
- disassoc_req(dev, dev->curr_bss);
+ at76_disassoc_req(dev, dev->curr_bss);
}
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
break;
case DISASSOCIATING:
if (dev->retries-- >= 0) {
- disassoc_req(dev, dev->curr_bss);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_disassoc_req(dev, dev->curr_bss);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
} else {
/* we scan again ... */
@@ -1829,17 +1829,17 @@ static void handle_mgmt_timeout(struct at76c503 *dev)
break;
default:
- assert(0);
+ at76_assert(0);
} /* switch (dev->istate) */
}
/* calc. the padding from txbuf->wlength (which excludes the USB TX header)
guess this is needed to compensate a flaw in the AT76C503A USB part ... */
-static inline int calc_padding(int wlen)
+static inline int at76_calc_padding(int wlen)
{
/* add the USB TX header */
- wlen += AT76C503_TX_HDRLEN;
+ wlen += AT76_TX_HDRLEN;
wlen = wlen % 64;
@@ -1854,8 +1854,8 @@ static inline int calc_padding(int wlen)
/* send a management frame on bulk-out.
txbuf->wlength must be set (in LE format !) */
-static int send_mgmt_bulk(struct at76c503 *dev,
- struct at76c503_tx_buffer *txbuf)
+static int at76_send_mgmt_bulk(struct at76_priv *dev,
+ struct at76_tx_buffer *txbuf)
{
unsigned long flags;
int ret = 0;
@@ -1888,31 +1888,31 @@ static int send_mgmt_bulk(struct at76c503 *dev,
if (txbuf) {
txbuf->tx_rate = 0;
- txbuf->padding = calc_padding(le16_to_cpu(txbuf->wlength));
+ txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
if (dev->next_mgmt_bulk) {
err("%s: %s URB status %d, but mgmt is pending",
dev->netdev->name, __FUNCTION__, urb_status);
}
- dbg(DBG_TX_MGMT, "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
- dev->netdev->name, le16_to_cpu(txbuf->wlength),
- txbuf->tx_rate, txbuf->padding,
- hex2str(dev->obuf, txbuf->packet,
+ at76_dbg(DBG_TX_MGMT, "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
+ dev->netdev->name, le16_to_cpu(txbuf->wlength),
+ txbuf->tx_rate, txbuf->padding,
+ hex2str(dev->obuf, txbuf->packet,
min((sizeof(dev->obuf) - 1) / 2,
(size_t) le16_to_cpu(txbuf->wlength)), '\0'));
/* txbuf was not consumed above -> send mgmt msg immediately */
memcpy(dev->bulk_out_buffer, txbuf,
- le16_to_cpu(txbuf->wlength) + AT76C503_TX_HDRLEN);
+ le16_to_cpu(txbuf->wlength) + AT76_TX_HDRLEN);
usb_fill_bulk_urb(dev->write_urb, dev->udev,
usb_sndbulkpipe(dev->udev,
dev->bulk_out_endpointAddr),
dev->bulk_out_buffer,
le16_to_cpu(txbuf->wlength) +
txbuf->padding +
- AT76C503_TX_HDRLEN,
- (usb_complete_t) at76c503_write_bulk_callback,
+ AT76_TX_HDRLEN,
+ (usb_complete_t) at76_write_bulk_callback,
dev);
ret = usb_submit_urb(dev->write_urb, GFP_ATOMIC);
if (ret) {
@@ -1932,13 +1932,13 @@ static inline void next_ie(struct ieee80211_info_element **ie)
*ie = (struct ieee80211_info_element *)(&(*ie)->data[(*ie)->len]);
}
-static int disassoc_req(struct at76c503 *dev, struct bss_info *bss)
+static int at76_disassoc_req(struct at76_priv *dev, struct bss_info *bss)
{
- struct at76c503_tx_buffer *tx_buffer;
+ struct at76_tx_buffer *tx_buffer;
struct ieee80211_hdr_3addr *mgmt;
struct ieee80211_disassoc *req;
- assert(bss != NULL);
+ at76_assert(bss != NULL);
if (bss == NULL)
return -EFAULT;
@@ -1959,16 +1959,15 @@ static int disassoc_req(struct at76c503 *dev, struct bss_info *bss)
req->reason = 0;
- /* init. at76c503 tx header */
- tx_buffer->wlength = cpu_to_le16(DISASSOC_FRAME_SIZE -
- AT76C503_TX_HDRLEN);
+ /* init. at76_priv tx header */
+ tx_buffer->wlength = cpu_to_le16(DISASSOC_FRAME_SIZE - AT76_TX_HDRLEN);
- dbg(DBG_TX_MGMT, "%s: DisAssocReq bssid %s",
- dev->netdev->name, mac2str(mgmt->addr3));
+ at76_dbg(DBG_TX_MGMT, "%s: DisAssocReq bssid %s",
+ dev->netdev->name, mac2str(mgmt->addr3));
/* either send immediately (if no data tx is pending
or put it in pending list */
- return send_mgmt_bulk(dev, tx_buffer);
+ return at76_send_mgmt_bulk(dev, tx_buffer);
}
@@ -1976,17 +1975,17 @@ static int disassoc_req(struct at76c503 *dev, struct bss_info *bss)
we got with seq_nr 2 for shared secret authentication only and
send in seq_nr 3 WEP encrypted to prove we have the correct WEP key;
otherwise it is NULL */
-static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr,
+static int at76_auth_req(struct at76_priv *dev, struct bss_info *bss, int seq_nr,
struct ieee80211_info_element *challenge)
{
- struct at76c503_tx_buffer *tx_buffer;
+ struct at76_tx_buffer *tx_buffer;
struct ieee80211_hdr_3addr *mgmt;
struct ieee80211_auth *req;
int buf_len = (seq_nr != 3 ? AUTH_FRAME_SIZE :
AUTH_FRAME_SIZE + 1 + 1 + challenge->len);
- assert(bss != NULL);
- assert(seq_nr != 3 || challenge != NULL);
+ at76_assert(bss != NULL);
+ at76_assert(seq_nr != 3 || challenge != NULL);
tx_buffer = kmalloc(buf_len + MAX_PADDING_SIZE, GFP_ATOMIC);
if (!tx_buffer)
return -ENOMEM;
@@ -2012,32 +2011,32 @@ static int auth_req(struct at76c503 *dev, struct bss_info *bss, int seq_nr,
if (seq_nr == 3)
memcpy(req->info_element, challenge, 1 + 1 + challenge->len);
- /* init. at76c503 tx header */
- tx_buffer->wlength = cpu_to_le16(buf_len - AT76C503_TX_HDRLEN);
- dbg(DBG_TX_MGMT, "%s: AuthReq bssid %s alg %d seq_nr %d",
- dev->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(req->algorithm), le16_to_cpu(req->transaction));
+ /* init. at76_priv tx header */
+ tx_buffer->wlength = cpu_to_le16(buf_len - AT76_TX_HDRLEN);
+ at76_dbg(DBG_TX_MGMT, "%s: AuthReq bssid %s alg %d seq_nr %d",
+ dev->netdev->name, mac2str(mgmt->addr3),
+ le16_to_cpu(req->algorithm), le16_to_cpu(req->transaction));
if (seq_nr == 3) {
- dbg(DBG_TX_MGMT, "%s: AuthReq challenge: %s ...",
- dev->netdev->name,
- hex2str(dev->obuf, (u8 *) req->info_element,
- min((int)sizeof(dev->obuf) / 3, 18), ' '));
+ at76_dbg(DBG_TX_MGMT, "%s: AuthReq challenge: %s ...",
+ dev->netdev->name,
+ hex2str(dev->obuf, (u8 *) req->info_element,
+ min((int)sizeof(dev->obuf) / 3, 18), ' '));
}
/* either send immediately (if no data tx is pending
or put it in pending list */
- return send_mgmt_bulk(dev, tx_buffer);
+ return at76_send_mgmt_bulk(dev, tx_buffer);
}
-static int assoc_req(struct at76c503 *dev, struct bss_info *bss)
+static int at76_assoc_req(struct at76_priv *dev, struct bss_info *bss)
{
- struct at76c503_tx_buffer *tx_buffer;
+ struct at76_tx_buffer *tx_buffer;
struct ieee80211_hdr_3addr *mgmt;
struct ieee80211_assoc_request *req;
struct ieee80211_info_element *tlv;
- assert(bss != NULL);
+ at76_assert(bss != NULL);
tx_buffer = kmalloc(ASSOCREQ_MAX_SIZE + MAX_PADDING_SIZE, GFP_ATOMIC);
if (!tx_buffer)
@@ -2079,7 +2078,7 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss)
memcpy(tlv->data, hw_rates, sizeof(hw_rates));
next_ie(&tlv); /* tlv points behind the supp_rates field */
- /* init. at76c503 tx header */
+ /* init. at76_priv tx header */
tx_buffer->wlength = cpu_to_le16((u8 *) tlv - (u8 *) mgmt);
{
@@ -2092,31 +2091,31 @@ static int assoc_req(struct at76c503 *dev, struct bss_info *bss)
memcpy(dev->obuf, tlv->data, len);
dev->obuf[len] = '\0';
next_ie(&tlv); /* points to IE of rates now */
- dbg(DBG_TX_MGMT, "%s: AssocReq bssid %s capa x%04x ssid %s rates %s",
- dev->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(req->capability), dev->obuf,
- hex2str(orates,tlv->data,min((sizeof(orates)-1)/2,(size_t)tlv->len),
+ at76_dbg(DBG_TX_MGMT, "%s: AssocReq bssid %s capa x%04x ssid %s rates %s",
+ dev->netdev->name, mac2str(mgmt->addr3),
+ le16_to_cpu(req->capability), dev->obuf,
+ hex2str(orates,tlv->data,min((sizeof(orates)-1)/2,(size_t)tlv->len),
'\0'));
}
/* either send immediately (if no data tx is pending
or put it in pending list */
- return send_mgmt_bulk(dev, tx_buffer);
+ return at76_send_mgmt_bulk(dev, tx_buffer);
}
/* we are currently associated to curr_bss and
want to reassoc to new_bss */
-static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss,
- struct bss_info *new_bss)
+static int at76_reassoc_req(struct at76_priv *dev, struct bss_info *curr_bss,
+ struct bss_info *new_bss)
{
- struct at76c503_tx_buffer *tx_buffer;
+ struct at76_tx_buffer *tx_buffer;
struct ieee80211_hdr_3addr *mgmt;
struct ieee80211_reassoc_request *req;
struct ieee80211_info_element *tlv;
- assert(curr_bss != NULL);
- assert(new_bss != NULL);
+ at76_assert(curr_bss != NULL);
+ at76_assert(new_bss != NULL);
if (curr_bss == NULL || new_bss == NULL)
return -EFAULT;
@@ -2162,7 +2161,7 @@ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss,
/* tlv points behind the supp_rates field */
next_ie(&tlv);
- /* init. at76c503 tx header */
+ /* init. at76_priv tx header */
tx_buffer->wlength = cpu_to_le16((u8 *)tlv-(u8 *)mgmt);
{
@@ -2173,35 +2172,35 @@ static int reassoc_req(struct at76c503 *dev, struct bss_info *curr_bss,
memcpy(dev->obuf, tlv->data, min(sizeof(dev->obuf),(size_t)tlv->len));
dev->obuf[IW_ESSID_MAX_SIZE] = '\0';
next_ie(&tlv); /* points to IE of rates now */
- dbg(DBG_TX_MGMT, "%s: ReAssocReq curr %s new %s capa x%04x ssid %s rates %s",
- dev->netdev->name,
- hex2str(ocurr, req->current_ap, ETH_ALEN, ':'),
- mac2str(mgmt->addr3), le16_to_cpu(req->capability), dev->obuf,
- hex2str(orates,tlv->data,min((sizeof(orates)-1)/2,(size_t)tlv->len),
+ at76_dbg(DBG_TX_MGMT, "%s: ReAssocReq curr %s new %s capa x%04x ssid %s rates %s",
+ dev->netdev->name,
+ hex2str(ocurr, req->current_ap, ETH_ALEN, ':'),
+ mac2str(mgmt->addr3), le16_to_cpu(req->capability), dev->obuf,
+ hex2str(orates,tlv->data,min((sizeof(orates)-1)/2,(size_t)tlv->len),
'\0'));
}
/* either send immediately (if no data tx is pending
or put it in pending list */
- return send_mgmt_bulk(dev, tx_buffer);
+ return at76_send_mgmt_bulk(dev, tx_buffer);
}
/* shamelessly copied from usbnet.c (oku) */
-static void at76_defer_event(struct at76c503 *dev, int flag)
+static void at76_defer_event(struct at76_priv *dev, int flag)
{
set_bit(flag, &dev->devent_flags);
if (!schedule_work(&dev->devent_queue))
- dbg(DBG_DEVENT, "%s: devent %d may have been dropped",
- dev->netdev->name, flag);
+ at76_dbg(DBG_DEVENT, "%s: devent %d may have been dropped",
+ dev->netdev->name, flag);
else
- dbg(DBG_DEVENT, "%s: devent %d scheduled",
- dev->netdev->name, flag);
+ at76_dbg(DBG_DEVENT, "%s: devent %d scheduled",
+ dev->netdev->name, flag);
}
static void at76_devent(struct work_struct *work)
{
- struct at76c503 *dev = container_of(work, struct at76c503, devent_queue);
+ struct at76_priv *dev = container_of(work, struct at76_priv, devent_queue);
int ret;
unsigned long flags;
@@ -2209,8 +2208,8 @@ static void at76_devent(struct work_struct *work)
is done. So work will be done next time something
else has to be done. This is ugly. TODO! (oku) */
- dbg(DBG_DEVENT, "%s: %s entry flags: 0x%lx", dev->netdev->name,
- __FUNCTION__, dev->devent_flags);
+ at76_dbg(DBG_DEVENT, "%s: %s entry flags: 0x%lx", dev->netdev->name,
+ __FUNCTION__, dev->devent_flags);
down(&dev->sem);
@@ -2230,24 +2229,24 @@ static void at76_devent(struct work_struct *work)
struct net_device *netdev = dev->netdev;
struct mib_mac_mgmt mac_mgmt;
- ret = get_mib(dev->udev, MIB_MAC_MGMT, (u8*)&mac_mgmt,
+ ret = at76_get_mib(dev->udev, MIB_MAC_MGMT, (u8*)&mac_mgmt,
sizeof(struct mib_mac_mgmt));
if (ret < 0) {
- err("%s: get_mib failed: %d", netdev->name, ret);
+ err("%s: at76_get_mib failed: %d", netdev->name, ret);
goto new_bss_clean;
}
- dbg(DBG_PROGRESS, "ibss_change = 0x%2x", mac_mgmt.ibss_change);
+ at76_dbg(DBG_PROGRESS, "ibss_change = 0x%2x", mac_mgmt.ibss_change);
memcpy(dev->bssid, mac_mgmt.current_bssid, ETH_ALEN);
- dbg(DBG_PROGRESS, "using BSSID %s", mac2str(dev->bssid));
+ at76_dbg(DBG_PROGRESS, "using BSSID %s", mac2str(dev->bssid));
- iwevent_bss_connect(dev->netdev, dev->bssid);
+ at76_iwevent_bss_connect(dev->netdev, dev->bssid);
memset(&dev->mib_buf, 0, sizeof(struct set_mib_buffer));
dev->mib_buf.type = MIB_MAC_MGMT;
dev->mib_buf.size = 1;
dev->mib_buf.index = IBSS_CHANGE_OK_OFFSET;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (ibss change ok) failed: %d", netdev->name, ret);
goto new_bss_clean;
@@ -2266,8 +2265,8 @@ static void at76_devent(struct work_struct *work)
/* check this _before_ AT76_DEVENT_JOIN, 'cause _JOIN sets _STARTIBSS bit */
if (test_bit(AT76_DEVENT_STARTIBSS, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_STARTIBSS, &dev->devent_flags);
- assert(dev->istate == STARTIBSS);
- ret = start_ibss(dev);
+ at76_assert(dev->istate == STARTIBSS);
+ ret = at76_start_ibss(dev);
if (ret < 0) {
err("%s: start_ibss failed: %d", dev->netdev->name, ret);
goto end_startibss;
@@ -2280,11 +2279,11 @@ static void at76_devent(struct work_struct *work)
goto end_startibss;
}
- ret = get_current_bssid(dev);
+ ret = at76_get_current_bssid(dev);
if (ret < 0)
goto end_startibss;
- ret = get_current_channel(dev);
+ ret = at76_get_current_channel(dev);
if (ret < 0)
goto end_startibss;
@@ -2293,7 +2292,7 @@ static void at76_devent(struct work_struct *work)
dev->mib_buf.type = MIB_MAC_MGMT;
dev->mib_buf.size = 1;
dev->mib_buf.index = IBSS_CHANGE_OK_OFFSET;
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (ibss change ok) failed: %d", dev->netdev->name, ret);
goto end_startibss;
@@ -2310,17 +2309,17 @@ end_startibss:
if (dev->istate == INIT) {
goto end_join;
}
- assert(dev->istate == JOINING);
+ at76_assert(dev->istate == JOINING);
/* dev->curr_bss == NULL signals a new round,
starting with list_entry(dev->bss_list.next, ...) */
/* secure the access to dev->curr_bss ! */
spin_lock_irqsave(&dev->bss_list_spinlock, flags);
- dev->curr_bss = find_matching_bss(dev, dev->curr_bss);
+ dev->curr_bss = at76_match_bss(dev, dev->curr_bss);
spin_unlock_irqrestore(&dev->bss_list_spinlock, flags);
if (dev->curr_bss != NULL) {
- if ((ret = join_bss(dev, dev->curr_bss)) < 0) {
+ if ((ret = at76_join_bss(dev, dev->curr_bss)) < 0) {
err("%s: join_bss failed with %d",
dev->netdev->name, ret);
goto end_join;
@@ -2350,7 +2349,7 @@ end_startibss:
memcpy(dev->essid, bptr->ssid, bptr->ssid_len);
memcpy(dev->bssid, bptr->bssid, ETH_ALEN);
dev->channel = bptr->channel;
- iwevent_bss_connect(dev->netdev, bptr->bssid);
+ at76_iwevent_bss_connect(dev->netdev, bptr->bssid);
netif_carrier_on(dev->netdev);
netif_start_queue(dev->netdev);
/* just to be sure */
@@ -2358,9 +2357,9 @@ end_startibss:
} else {
/* send auth req */
dev->istate = AUTHENTICATING;
- auth_req(dev, dev->curr_bss, 1, NULL);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_auth_req(dev, dev->curr_bss, 1, NULL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
}
goto end_join;
@@ -2380,25 +2379,25 @@ end_join:
if (test_bit(AT76_DEVENT_MGMT_TIMEOUT, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_MGMT_TIMEOUT, &dev->devent_flags);
- handle_mgmt_timeout(dev);
+ at76_handle_mgmt_timeout(dev);
}
if (test_bit(AT76_DEVENT_SCAN, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_SCAN, &dev->devent_flags);
- assert(dev->istate == SCANNING);
+ at76_assert(dev->istate == SCANNING);
/* only clear the bss list when a scan is actively initiated,
- * otherwise simply rely on bss_list_timeout */
+ * otherwise simply rely on at76_bss_list_timeout */
if (dev->site_survey_state == SITE_SURVEY_IN_PROGRESS)
- free_bss_list(dev);
+ at76_free_bss_list(dev);
dev->scan_runs = 2;
- if ((ret = start_scan(dev, 0, 1)) < 0) {
+ if ((ret = at76_start_scan(dev, 0, 1)) < 0) {
err("%s: %s: start_scan failed with %d",
dev->netdev->name, __FUNCTION__, ret);
} else {
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer, jiffies + SCAN_POLL_INTERVAL);
}
@@ -2407,21 +2406,21 @@ end_join:
if (test_bit(AT76_DEVENT_SUBMIT_RX, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_SUBMIT_RX, &dev->devent_flags);
- submit_rx_urb(dev);
+ at76_submit_rx_urb(dev);
}
if (test_bit(AT76_DEVENT_RESTART, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_RESTART, &dev->devent_flags);
#if 0
- assert(dev->istate == INIT);
+ at76_assert(dev->istate == INIT);
#endif
- startup_device(dev);
+ at76_startup_device(dev);
/* call it here for default_iw_mode == IW_MODE_MONITOR and
no subsequent "iwconfig ethX mode monitor" or
"iwpriv ethX monitor 1|2 C" to set dev->netdev->type
correctly */
- set_monitor_mode(dev, dev->monitor_prism_header);
+ at76_set_monitor_mode(dev, dev->monitor_prism_header);
netif_carrier_off(dev->netdev); /* disable running netdev watchdog */
@@ -2431,10 +2430,10 @@ end_join:
at76_defer_event(dev, AT76_DEVENT_SCAN);
} else {
dev->istate = MONITORING;
- start_scan(dev, 0, 0);
- dbg(DBG_MGMT_TIMER,
- "%s:%d: starting mgmt_timer for %d ticks",
- __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
+ at76_start_scan(dev, 0, 0);
+ at76_dbg(DBG_MGMT_TIMER,
+ "%s:%d: starting mgmt_timer for %d ticks",
+ __FUNCTION__, __LINE__, SCAN_POLL_INTERVAL);
mod_timer(&dev->mgmt_timer,
jiffies + SCAN_POLL_INTERVAL);
}
@@ -2443,10 +2442,10 @@ end_join:
/* start processing network packets and setup PM in infra mode: */
if (test_bit(AT76_DEVENT_ASSOC_DONE, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_ASSOC_DONE, &dev->devent_flags);
- assert(dev->istate == ASSOCIATING ||
+ at76_assert(dev->istate == ASSOCIATING ||
dev->istate == REASSOCIATING);
if (dev->iw_mode == IW_MODE_INFRA) {
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss != NULL && dev->pm_mode != AT76_PM_OFF) {
/* calc the listen interval in units of
beacon intervals of the curr_bss */
@@ -2457,33 +2456,33 @@ end_join:
pm_period_beacon = max(pm_period_beacon, 2u);
pm_period_beacon = min(pm_period_beacon, 0xffffu);
- dbg(DBG_PM, "%s: pm_mode %d assoc id x%x listen int %d",
- dev->netdev->name, dev->pm_mode,
- dev->curr_bss->assoc_id, pm_period_beacon);
+ at76_dbg(DBG_PM, "%s: pm_mode %d assoc id x%x listen int %d",
+ dev->netdev->name, dev->pm_mode,
+ dev->curr_bss->assoc_id, pm_period_beacon);
- set_associd(dev, dev->curr_bss->assoc_id);
- set_listen_interval(dev, (u16)pm_period_beacon);
+ at76_set_associd(dev, dev->curr_bss->assoc_id);
+ at76_set_listen_interval(dev, (u16)pm_period_beacon);
#ifdef DEBUG
- dump_mib_mac(dev);
- dump_mib_mac_mgmt(dev);
+ at76_dump_mib_mac(dev);
+ at76_dump_mib_mac_mgmt(dev);
#endif
}
}
- set_pm_mode(dev);
+ at76_set_pm_mode(dev);
netif_carrier_on(dev->netdev);
netif_wake_queue(dev->netdev);
dev->istate = CONNECTED;
- iwevent_bss_connect(dev->netdev, dev->curr_bss->bssid);
- dbg(DBG_PROGRESS, "%s: connected to BSSID %s",
- dev->netdev->name, mac2str(dev->curr_bss->bssid));
+ at76_iwevent_bss_connect(dev->netdev, dev->curr_bss->bssid);
+ at76_dbg(DBG_PROGRESS, "%s: connected to BSSID %s",
+ dev->netdev->name, mac2str(dev->curr_bss->bssid));
}
if (test_bit(AT76_DEVENT_RESET_DEVICE, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_RESET_DEVICE, &dev->devent_flags);
- dbg(DBG_DEVSTART, "resetting the device");
+ at76_dbg(DBG_DEVSTART, "resetting the device");
usb_reset_device(dev->udev);
@@ -2495,8 +2494,8 @@ end_join:
clear_bit(AT76_DEVENT_EXTERNAL_FW, &dev->devent_flags);
- op_mode = get_op_mode(dev->udev);
- dbg(DBG_DEVSTART, "opmode %d", op_mode);
+ op_mode = at76_get_op_mode(dev->udev);
+ at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
err("unexpected opmode %d", op_mode);
@@ -2504,8 +2503,8 @@ end_join:
}
if (dev->extfw && dev->extfw_size) {
- ret = download_external_fw(dev->udev, dev->extfw,
- dev->extfw_size);
+ ret = at76_download_external_fw(dev->udev, dev->extfw,
+ dev->extfw_size);
if (ret < 0) {
err("Downloading external firmware failed: %d", ret);
goto end_external_fw;
@@ -2518,7 +2517,7 @@ end_join:
}
}
dev->istate = INIT;
- if((ret = init_new_device(dev)) < 0) {
+ if((ret = at76_init_new_device(dev)) < 0) {
err("Downloading external firmware failed: %d", ret);
goto end_external_fw;
}
@@ -2528,28 +2527,28 @@ end_external_fw:
if (test_bit(AT76_DEVENT_INTERNAL_FW, &dev->devent_flags)) {
clear_bit(AT76_DEVENT_INTERNAL_FW, &dev->devent_flags);
- dbg(DBG_DEVSTART, "downloading internal firmware");
+ at76_dbg(DBG_DEVSTART, "downloading internal firmware");
- ret = usbdfu_download(dev->udev, dev->intfw,
- dev->intfw_size,
- dev->board_type ==
- BOARDTYPE_505A_RFMD_2958 ? 2000 : 0);
+ ret = at76_usbdfu_download(dev->udev, dev->intfw,
+ dev->intfw_size,
+ dev->board_type ==
+ BOARDTYPE_505A_RFMD_2958 ? 2000 : 0);
if (ret < 0) {
err("downloading internal fw failed with %d", ret);
goto end_internal_fw;
}
- dbg(DBG_DEVSTART, "sending REMAP");
+ at76_dbg(DBG_DEVSTART, "sending REMAP");
/* no REMAP for 505A (see SF driver) */
if (dev->board_type != BOARDTYPE_505A_RFMD_2958)
- if ((ret = at76c503_remap(dev->udev)) < 0) {
+ if ((ret = at76_remap(dev->udev)) < 0) {
err("sending REMAP failed with %d", ret);
goto end_internal_fw;
}
- dbg(DBG_DEVSTART, "sleeping for 2 seconds");
+ at76_dbg(DBG_DEVSTART, "sleeping for 2 seconds");
dev->istate = EXTFW_DOWNLOAD;
mod_timer(&dev->fw_dl_timer, jiffies + 2 * HZ + 1);
}
@@ -2557,40 +2556,40 @@ end_internal_fw:
up(&dev->sem);
- dbg(DBG_DEVENT, "%s: %s exit flags: 0x%lx", dev->netdev->name,
+ at76_dbg(DBG_DEVENT, "%s: %s exit flags: 0x%lx", dev->netdev->name,
__FUNCTION__, dev->devent_flags);
return;
}
-static int essid_matched(struct at76c503 *dev, struct bss_info *ptr)
+static int at76_essid_matched(struct at76_priv *dev, struct bss_info *ptr)
{
/* common criteria for both modi */
- int retval = (dev->essid_size == 0 /* ANY ssid */ ||
+ int ret = (dev->essid_size == 0 /* ANY ssid */ ||
(dev->essid_size == ptr->ssid_len &&
!memcmp(dev->essid, ptr->ssid, ptr->ssid_len)));
- if (!retval)
- dbg(DBG_BSS_MATCH, "%s bss table entry %p: essid didn't match",
- dev->netdev->name, ptr);
- return retval;
+ if (!ret)
+ at76_dbg(DBG_BSS_MATCH, "%s bss table entry %p: essid didn't match",
+ dev->netdev->name, ptr);
+ return ret;
}
-static inline int mode_matched(struct at76c503 *dev, struct bss_info *ptr)
+static inline int at76_mode_matched(struct at76_priv *dev, struct bss_info *ptr)
{
- int retval;
+ int ret;
if (dev->iw_mode == IW_MODE_ADHOC)
- retval = ptr->capa & WLAN_CAPABILITY_IBSS;
+ ret = ptr->capa & WLAN_CAPABILITY_IBSS;
else
- retval = ptr->capa & WLAN_CAPABILITY_ESS;
- if (!retval)
- dbg(DBG_BSS_MATCH, "%s bss table entry %p: mode didn't match",
- dev->netdev->name, ptr);
- return retval;
+ ret = ptr->capa & WLAN_CAPABILITY_ESS;
+ if (!ret)
+ at76_dbg(DBG_BSS_MATCH, "%s bss table entry %p: mode didn't match",
+ dev->netdev->name, ptr);
+ return ret;
}
-static int rates_matched(struct at76c503 *dev, struct bss_info *ptr)
+static int at76_rates_matched(struct at76_priv *dev, struct bss_info *ptr)
{
int i;
u8 *rate;
@@ -2603,28 +2602,28 @@ static int rates_matched(struct at76c503 *dev, struct bss_info *ptr)
&& *rate != (0x80 | hw_rates[1])
&& *rate != (0x80 | hw_rates[2])
&& *rate != (0x80 | hw_rates[3])) {
- dbg(DBG_BSS_MATCH,
- "%s: bss table entry %p: basic rate %02x not supported",
- dev->netdev->name, ptr, *rate);
+ at76_dbg(DBG_BSS_MATCH,
+ "%s: bss table entry %p: basic rate %02x not supported",
+ dev->netdev->name, ptr, *rate);
return 0;
}
}
/* if we use short preamble, the bss must support it */
if (dev->preamble_type == PREAMBLE_TYPE_SHORT &&
!(ptr->capa & WLAN_CAPABILITY_SHORT_PREAMBLE)) {
- dbg(DBG_BSS_MATCH, "%s: %p does not support short preamble",
- dev->netdev->name, ptr);
+ at76_dbg(DBG_BSS_MATCH, "%s: %p does not support short preamble",
+ dev->netdev->name, ptr);
return 0;
} else
return 1;
}
-static inline int wep_matched(struct at76c503 *dev, struct bss_info *ptr)
+static inline int at76_wep_matched(struct at76_priv *dev, struct bss_info *ptr)
{
if (!dev->wep_enabled && ptr->capa & WLAN_CAPABILITY_PRIVACY) {
/* we have disabled WEP, but the BSS signals privacy */
- dbg(DBG_BSS_MATCH, "%s: bss table entry %p: requires encryption",
- dev->netdev->name, ptr);
+ at76_dbg(DBG_BSS_MATCH, "%s: bss table entry %p: requires encryption",
+ dev->netdev->name, ptr);
return 0;
}
/* otherwise if the BSS does not signal privacy it may well
@@ -2632,23 +2631,21 @@ static inline int wep_matched(struct at76c503 *dev, struct bss_info *ptr)
return 1;
}
-static inline int bssid_matched(struct at76c503 *dev, struct bss_info *ptr)
+static inline int at76_bssid_matched(struct at76_priv *dev, struct bss_info *ptr)
{
if (!dev->wanted_bssid_valid ||
!compare_ether_addr(ptr->bssid, dev->wanted_bssid)) {
return 1;
} else {
- if (at76_debug & DBG_BSS_MATCH) {
- dbg_uc("%s: requested bssid - %s does not match",
- dev->netdev->name, mac2str(dev->wanted_bssid));
- dbg_uc(" AP bssid - %s of bss table entry %p",
- mac2str(ptr->bssid), ptr);
- }
+ at76_dbg(DBG_BSS_MATCH, "%s: requested bssid - %s does not match",
+ dev->netdev->name, mac2str(dev->wanted_bssid));
+ at76_dbg(DBG_BSS_MATCH, " AP bssid - %s of bss table entry %p",
+ mac2str(ptr->bssid), ptr);
return 0;
}
}
-static void dump_bss_table(struct at76c503 *dev)
+static void at76_dump_bss_table(struct at76_priv *dev)
{
struct bss_info *ptr;
unsigned long flags;
@@ -2657,31 +2654,30 @@ static void dump_bss_table(struct at76c503 *dev)
spin_lock_irqsave(&dev->bss_list_spinlock, flags);
- dbg_uc("%s BSS table (curr=%p, new=%p):", dev->netdev->name,
- dev->curr_bss, dev->new_bss);
+ pr_debug("%s BSS table (curr=%p, new=%p):", dev->netdev->name,
+ dev->curr_bss, dev->new_bss);
list_for_each(lptr, &dev->bss_list) {
ptr = list_entry(lptr, struct bss_info, list);
- dbg_uc("0x%p: bssid %s channel %d ssid %s (%s)"
- " capa x%04x rates %s rssi %d link %d noise %d",
- ptr, mac2str(ptr->bssid),
- ptr->channel,
- ptr->ssid,
- hex2str(dev->obuf, ptr->ssid,
+ pr_debug("0x%p: bssid %s channel %d ssid %s (%s)"
+ " capa x%04x rates %s rssi %d link %d noise %d",
+ ptr, mac2str(ptr->bssid),
+ ptr->channel,
+ ptr->ssid,
+ hex2str(dev->obuf, ptr->ssid,
min((sizeof(dev->obuf) - 1) / 2,
(size_t) ptr->ssid_len), '\0'),
- ptr->capa,
- hex2str(obuf_s, ptr->rates,
+ ptr->capa,
+ hex2str(obuf_s, ptr->rates,
min(sizeof(obuf_s) / 3,
(size_t) ptr->rates_len), ' '),
- ptr->rssi, ptr->link_qual, ptr->noise_level);
+ ptr->rssi, ptr->link_qual, ptr->noise_level);
}
-
spin_unlock_irqrestore(&dev->bss_list_spinlock, flags);
}
/**
- * find_matching_bss - try to find a matching bss in dev->bss
+ * at76_match_bss - try to find a matching bss in dev->bss
*
* last - last bss tried
*
@@ -2689,7 +2685,7 @@ static void dump_bss_table(struct at76c503 *dev)
* this function must be called inside an acquired dev->bss_list_spinlock
* otherwise the timeout on bss may remove the newly chosen entry
*/
-static struct bss_info *find_matching_bss(struct at76c503 *dev,
+static struct bss_info *at76_match_bss(struct at76_priv *dev,
struct bss_info *last)
{
struct bss_info *ptr = NULL;
@@ -2698,10 +2694,11 @@ static struct bss_info *find_matching_bss(struct at76c503 *dev,
curr = last != NULL ? last->list.next : dev->bss_list.next;
while (curr != &dev->bss_list) {
ptr = list_entry(curr, struct bss_info, list);
- if (essid_matched(dev, ptr) &&
- mode_matched(dev, ptr) &&
- wep_matched(dev, ptr) &&
- rates_matched(dev, ptr) && bssid_matched(dev, ptr))
+ if (at76_essid_matched(dev, ptr) &&
+ at76_mode_matched(dev, ptr) &&
+ at76_wep_matched(dev, ptr) &&
+ at76_rates_matched(dev, ptr) &&
+ at76_bssid_matched(dev, ptr))
break;
curr = curr->next;
}
@@ -2710,14 +2707,14 @@ static struct bss_info *find_matching_bss(struct at76c503 *dev,
ptr = NULL;
/* otherwise ptr points to the struct bss_info we have chosen */
- dbg(DBG_BSS_TABLE, "%s %s: returned %p", dev->netdev->name,
- __FUNCTION__, ptr);
+ at76_dbg(DBG_BSS_TABLE, "%s %s: returned %p", dev->netdev->name,
+ __FUNCTION__, ptr);
return ptr;
-} /* find_matching_bss */
+} /* at76_find_matching_bss */
/* we got an association response */
-static void rx_mgmt_assoc(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_assoc(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct ieee80211_assoc_response *resp =
(struct ieee80211_assoc_response *)buf->packet;
@@ -2725,13 +2722,13 @@ static void rx_mgmt_assoc(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
u16 assoc_id = le16_to_cpu(resp->aid);
u16 status = le16_to_cpu(resp->status);
u16 capa = le16_to_cpu(resp->capability);
- dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa x%04x status x%04x "
- "assoc_id x%04x rates %s",
+ at76_dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa x%04x status x%04x "
+ "assoc_id x%04x rates %s",
dev->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id,
hex2str(dev->obuf, resp->info_element->data,
min((size_t)resp->info_element->len, (sizeof(dev->obuf)-1)/2), '\0'));
if (dev->istate == ASSOCIATING) {
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss == NULL)
return;
@@ -2753,10 +2750,10 @@ static void rx_mgmt_assoc(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
info("%s: AssocResp in state %d ignored",
dev->netdev->name, dev->istate);
}
-} /* rx_mgmt_assoc */
+} /* at76_rx_mgmt_assoc */
-static void rx_mgmt_reassoc(struct at76c503 *dev,
- struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_reassoc(struct at76_priv *dev,
+ struct at76_rx_buffer *buf)
{
struct ieee80211_assoc_response *resp =
(struct ieee80211_assoc_response *)buf->packet;
@@ -2766,14 +2763,14 @@ static void rx_mgmt_reassoc(struct at76c503 *dev,
u16 status = le16_to_cpu(resp->status);
u16 assoc_id = le16_to_cpu(resp->aid);
- dbg(DBG_RX_MGMT, "%s: rx ReAssocResp bssid %s capa x%04x status x%04x "
- "assoc_id x%04x rates %s",
- dev->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id,
- hex2str(dev->obuf, resp->info_element->data,
+ at76_dbg(DBG_RX_MGMT, "%s: rx ReAssocResp bssid %s capa x%04x status x%04x "
+ "assoc_id x%04x rates %s",
+ dev->netdev->name, mac2str(mgmt->addr3), capa, status, assoc_id,
+ hex2str(dev->obuf, resp->info_element->data,
min((size_t) resp->info_element->len,
(sizeof(dev->obuf) - 1) / 2), '\0'));
if (dev->istate == REASSOCIATING) {
- assert(dev->new_bss != NULL);
+ at76_assert(dev->new_bss != NULL);
if (dev->new_bss == NULL)
return;
@@ -2782,7 +2779,7 @@ static void rx_mgmt_reassoc(struct at76c503 *dev,
bptr->assoc_id = assoc_id;
dev->istate = CONNECTED;
- iwevent_bss_connect(dev->netdev, bptr->bssid);
+ at76_iwevent_bss_connect(dev->netdev, bptr->bssid);
spin_lock_irqsave(&dev->bss_list_spinlock, flags);
dev->curr_bss = dev->new_bss;
@@ -2794,8 +2791,8 @@ static void rx_mgmt_reassoc(struct at76c503 *dev,
memcpy(dev->essid, bptr->ssid, bptr->ssid_len);
memcpy(dev->bssid, bptr->bssid, ETH_ALEN);
dev->channel = bptr->channel;
- dbg(DBG_PROGRESS, "%s: reassociated to BSSID %s",
- dev->netdev->name, mac2str(dev->bssid));
+ at76_dbg(DBG_PROGRESS, "%s: reassociated to BSSID %s",
+ dev->netdev->name, mac2str(dev->bssid));
at76_defer_event(dev, AT76_DEVENT_ASSOC_DONE);
} else {
del_timer_sync(&dev->mgmt_timer);
@@ -2806,28 +2803,28 @@ static void rx_mgmt_reassoc(struct at76c503 *dev,
info("%s: ReAssocResp in state %d ignored",
dev->netdev->name, dev->istate);
}
-} /* rx_mgmt_reassoc */
+} /* at76_rx_mgmt_reassoc */
-static void rx_mgmt_disassoc(struct at76c503 *dev,
- struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_disassoc(struct at76_priv *dev,
+ struct at76_rx_buffer *buf)
{
struct ieee80211_disassoc *resp =
(struct ieee80211_disassoc *)buf->packet;
struct ieee80211_hdr_3addr *mgmt = &resp->header;
- dbg(DBG_RX_MGMT, "%s: rx DisAssoc bssid %s reason x%04x destination %s",
- dev->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(resp->reason),
- hex2str(dev->obuf, mgmt->addr1,
+ at76_dbg(DBG_RX_MGMT, "%s: rx DisAssoc bssid %s reason x%04x destination %s",
+ dev->netdev->name, mac2str(mgmt->addr3),
+ le16_to_cpu(resp->reason),
+ hex2str(dev->obuf, mgmt->addr1,
min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':'));
if (dev->istate == SCANNING || dev->istate == INIT)
return;
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss == NULL)
return;
if (dev->istate == REASSOCIATING) {
- assert(dev->new_bss != NULL);
+ at76_assert(dev->new_bss != NULL);
if (dev->new_bss == NULL)
return;
}
@@ -2845,7 +2842,7 @@ static void rx_mgmt_disassoc(struct at76c503 *dev,
if (dev->istate == CONNECTED) {
netif_carrier_off(dev->netdev);
netif_stop_queue(dev->netdev);
- iwevent_bss_disconnect(dev->netdev);
+ at76_iwevent_bss_disconnect(dev->netdev);
}
del_timer_sync(&dev->mgmt_timer);
dev->istate = JOINING;
@@ -2859,7 +2856,7 @@ static void rx_mgmt_disassoc(struct at76c503 *dev,
/* ignore DisAssoc to other STA or from other BSSID */
} /* rx_mgmt_disassoc */
-static void rx_mgmt_auth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_auth(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct ieee80211_auth *resp = (struct ieee80211_auth *)buf->packet;
struct ieee80211_hdr_3addr *mgmt = &resp->header;
@@ -2867,17 +2864,17 @@ static void rx_mgmt_auth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
int alg = le16_to_cpu(resp->algorithm);
int status = le16_to_cpu(resp->status);
- dbg(DBG_RX_MGMT, "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d "
- "destination %s",
- dev->netdev->name, mac2str(mgmt->addr3),
- alg, seq_nr, status,
- hex2str(dev->obuf, mgmt->addr1,
+ at76_dbg(DBG_RX_MGMT, "%s: rx AuthFrame bssid %s alg %d seq_nr %d status %d "
+ "destination %s",
+ dev->netdev->name, mac2str(mgmt->addr3),
+ alg, seq_nr, status,
+ hex2str(dev->obuf, mgmt->addr1,
min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':'));
if (alg == WLAN_AUTH_SHARED_KEY && seq_nr == 2) {
- dbg(DBG_RX_MGMT, "%s: AuthFrame challenge %s ...",
- dev->netdev->name,
- hex2str(dev->obuf, (u8 *) resp->info_element,
+ at76_dbg(DBG_RX_MGMT, "%s: AuthFrame challenge %s ...",
+ dev->netdev->name,
+ hex2str(dev->obuf, (u8 *) resp->info_element,
min((int)sizeof(dev->obuf) / 3, 18), ' '));
}
if (dev->istate != AUTHENTICATING) {
@@ -2891,7 +2888,7 @@ static void rx_mgmt_auth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
return;
}
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss == NULL)
return;
@@ -2910,40 +2907,40 @@ static void rx_mgmt_auth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
if (dev->auth_mode == WLAN_AUTH_OPEN || seq_nr == 4) {
dev->retries = ASSOC_RETRIES;
dev->istate = ASSOCIATING;
- assoc_req(dev, dev->curr_bss);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_assoc_req(dev, dev->curr_bss);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
return;
}
- assert(seq_nr == 2);
- auth_req(dev, dev->curr_bss, seq_nr + 1, resp->info_element);
- dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
- __FUNCTION__, __LINE__);
+ at76_assert(seq_nr == 2);
+ at76_auth_req(dev, dev->curr_bss, seq_nr + 1, resp->info_element);
+ at76_dbg(DBG_MGMT_TIMER, "%s:%d: starting mgmt_timer + HZ",
+ __FUNCTION__, __LINE__);
mod_timer(&dev->mgmt_timer, jiffies + HZ);
}
/* else: ignore AuthFrames to other recipients */
-} /* rx_mgmt_auth */
+} /* at76_rx_mgmt_auth */
-static void rx_mgmt_deauth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_deauth(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct ieee80211_disassoc *resp =
(struct ieee80211_disassoc *)buf->packet;
struct ieee80211_hdr_3addr *mgmt = &resp->header;
- dbg(DBG_RX_MGMT | DBG_PROGRESS,
- "%s: rx DeAuth bssid %s reason x%04x destination %s",
- dev->netdev->name, mac2str(mgmt->addr3),
- le16_to_cpu(resp->reason),
- hex2str(dev->obuf, mgmt->addr1,
+ at76_dbg(DBG_RX_MGMT | DBG_PROGRESS,
+ "%s: rx DeAuth bssid %s reason x%04x destination %s",
+ dev->netdev->name, mac2str(mgmt->addr3),
+ le16_to_cpu(resp->reason),
+ hex2str(dev->obuf, mgmt->addr1,
min((int)sizeof(dev->obuf) / 3, ETH_ALEN), ':'));
if (dev->istate == DISASSOCIATING ||
dev->istate == AUTHENTICATING ||
dev->istate == ASSOCIATING ||
dev->istate == REASSOCIATING ||
dev->istate == CONNECTED) {
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss == NULL)
return;
@@ -2953,7 +2950,7 @@ static void rx_mgmt_deauth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
/* this is a DeAuth from the BSS we are connected or
trying to connect to, directed to us or broadcasted */
if (dev->istate == CONNECTED) {
- iwevent_bss_disconnect(dev->netdev);
+ at76_iwevent_bss_disconnect(dev->netdev);
}
dev->istate = JOINING;
at76_defer_event(dev, AT76_DEVENT_JOIN);
@@ -2965,9 +2962,9 @@ static void rx_mgmt_deauth(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
info("%s: DeAuth in state %d ignored",
dev->netdev->name, dev->istate);
}
-} /* rx_mgmt_deauth */
+} /* at76_rx_mgmt_deauth */
-static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt_beacon(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
/* beacon content */
struct ieee80211_beacon *bdata = (struct ieee80211_beacon *)buf->packet;
@@ -2993,7 +2990,7 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
if (dev->istate == CONNECTED) {
/* in state CONNECTED we use the mgmt_timer to control
the beacon of the BSS */
- assert(dev->curr_bss != NULL);
+ at76_assert(dev->curr_bss != NULL);
if (dev->curr_bss == NULL)
goto rx_mgmt_beacon_end;
if (!compare_ether_addr(dev->curr_bss->bssid, mgmt->addr3)) {
@@ -3021,8 +3018,8 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
if (match == NULL) {
/* haven't found the bss in the list */
if ((match=kmalloc(sizeof(struct bss_info), GFP_ATOMIC)) == NULL) {
- dbg(DBG_BSS_TABLE, "%s: cannot kmalloc new bss info (%zd byte)",
- dev->netdev->name, sizeof(struct bss_info));
+ at76_dbg(DBG_BSS_TABLE, "%s: cannot kmalloc new bss info (%zd byte)",
+ dev->netdev->name, sizeof(struct bss_info));
goto rx_mgmt_beacon_end;
}
memset(match, 0, sizeof(*match));
@@ -3044,12 +3041,12 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
match->noise_level = buf->noise_level;
memcpy(match->mac, mgmt->addr2, ETH_ALEN); /* just for info */
memcpy(match->bssid, mgmt->addr3, ETH_ALEN);
- dbg(DBG_RX_BEACON, "%s: bssid %s", dev->netdev->name,
- mac2str(match->bssid));
+ at76_dbg(DBG_RX_BEACON, "%s: bssid %s", dev->netdev->name,
+ mac2str(match->bssid));
tlv = bdata->info_element;
- /* This routine steps through the bdata->data array to try and get
+ /* This routine steps through the bdata->data array to tries to get
* some useful information about the access point.
* Currently, this implementation supports receipt of: SSID,
* supported transfer rates and channel, in any order, with some
@@ -3059,7 +3056,7 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
* reports of some of the useful information fields arriving in a
* different order).
* It does not support any more IE types although MFIE_TYPE_TIM may
- * be supported (on my AP at least).
+ * be supported (on my AP at least).
* The bdata->data array is about 1500 bytes long but only ~36 of those
* bytes are useful, hence the have_ssid etc optimizations. */
@@ -3071,7 +3068,7 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
case MFIE_TYPE_SSID:
len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
if (!have_ssid && ((new_entry) ||
- !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
@@ -3083,8 +3080,8 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
match->ssid[len] = '\0'; /* terminate the
string for
printing */
- dbg(DBG_RX_BEACON, "%s: SSID - %s",
- dev->netdev->name, match->ssid);
+ at76_dbg(DBG_RX_BEACON, "%s: SSID - %s",
+ dev->netdev->name, match->ssid);
}
have_ssid = 1;
break;
@@ -3096,10 +3093,10 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
memcpy(match->rates, tlv->data,
match->rates_len);
have_rates = 1;
- dbg(DBG_RX_BEACON,
- "%s: SUPPORTED RATES %s",
- dev->netdev->name,
- hex2str(dev->obuf, tlv->data,
+ at76_dbg(DBG_RX_BEACON,
+ "%s: SUPPORTED RATES %s",
+ dev->netdev->name,
+ hex2str(dev->obuf, tlv->data,
min_t(int, (sizeof(dev->obuf)-1)/2,
tlv->len), '\0'));
}
@@ -3109,8 +3106,8 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
if (!have_channel) {
match->channel = tlv->data[0];
have_channel = 1;
- dbg(DBG_RX_BEACON, "%s: CHANNEL - %d",
- dev->netdev->name, match->channel);
+ at76_dbg(DBG_RX_BEACON, "%s: CHANNEL - %d",
+ dev->netdev->name, match->channel);
}
break;
@@ -3119,9 +3116,9 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
case MFIE_TYPE_IBSS_SET:
default:
{
- dbg(DBG_RX_BEACON, "%s: beacon IE id %d len %d %s",
- dev->netdev->name, tlv->id, tlv->len,
- hex2str(dev->obuf, tlv->data,
+ at76_dbg(DBG_RX_BEACON, "%s: beacon IE id %d len %d %s",
+ dev->netdev->name, tlv->id, tlv->len,
+ hex2str(dev->obuf, tlv->data,
min_t(int, (sizeof(dev->obuf)-1)/2,
tlv->len), '\0'));
break;
@@ -3141,18 +3138,18 @@ static void rx_mgmt_beacon(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
* comes from the AP - although little of it may be useful */
}
- dbg(DBG_RX_BEACON, "%s: Finished processing beacon data",
- dev->netdev->name);
+ at76_dbg(DBG_RX_BEACON, "%s: Finished processing beacon data",
+ dev->netdev->name);
match->last_rx = jiffies; /* record last rx of beacon */
rx_mgmt_beacon_end:
spin_unlock_irqrestore(&dev->bss_list_spinlock, flags);
-} /* rx_mgmt_beacon */
+} /* at76_rx_mgmt_beacon */
/* calc the link level from a given rx_buffer */
-static void calc_level(struct at76c503 *dev, struct at76c503_rx_buffer *buf,
+static void at76_calc_level(struct at76_priv *dev, struct at76_rx_buffer *buf,
struct iw_quality *qual)
{
int max_rssi = 42; /* just a gues for now, might be different for other chips */
@@ -3160,12 +3157,12 @@ static void calc_level(struct at76c503 *dev, struct at76c503_rx_buffer *buf,
qual->level = (buf->rssi * 100 / max_rssi);
if (qual->level > 100)
qual->level = 100;
- qual->updated |= IW_QUAL_LEVEL_UPDATED;
+ qual->updated |= IW_QUAL_LEVEL_UPDATED;
}
/* calc the link quality from a given rx_buffer */
-static void calc_qual(struct at76c503 *dev, struct at76c503_rx_buffer *buf, struct iw_quality* qual)
+static void at76_calc_qual(struct at76_priv *dev, struct at76_rx_buffer *buf, struct iw_quality* qual)
{
if ((dev->board_type == BOARDTYPE_503_INTERSIL_3861) ||
(dev->board_type == BOARDTYPE_503_INTERSIL_3863)) {
@@ -3189,22 +3186,22 @@ static void calc_qual(struct at76c503 *dev, struct at76c503_rx_buffer *buf, stru
}
/* calc the noise quality from a given rx_buffer */
-static void calc_noise(struct at76c503 *dev, struct at76c503_rx_buffer *buf,
+static void at76_calc_noise(struct at76_priv *dev, struct at76_rx_buffer *buf,
struct iw_quality *qual)
{
qual->noise = 0;
qual->updated |= IW_QUAL_NOISE_INVALID;
}
-static void update_wstats(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_update_wstats(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct iw_quality *qual = &dev->wstats.qual;
if (buf->rssi && dev->istate == CONNECTED) {
qual->updated = 0;
- calc_level(dev, buf, qual);
- calc_qual(dev, buf, qual);
- calc_noise(dev, buf, qual);
+ at76_calc_level(dev, buf, qual);
+ at76_calc_qual(dev, buf, qual);
+ at76_calc_noise(dev, buf, qual);
} else {
qual->qual = 0;
qual->level = 0;
@@ -3213,7 +3210,7 @@ static void update_wstats(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
}
}
-static void rx_mgmt(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_rx_mgmt(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct ieee80211_hdr_3addr *mgmt =
(struct ieee80211_hdr_3addr *)buf->packet;
@@ -3228,42 +3225,40 @@ static void rx_mgmt(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
only read link quality info from management packets.
Atmel driver actually averages the present, and previous
values, we just present the raw value at the moment - TJS */
- update_wstats(dev, buf);
+ at76_update_wstats(dev, buf);
}
}
- if (at76_debug & DBG_RX_MGMT_CONTENT) {
- dbg_uc("%s rx mgmt subtype x%x %s",
- dev->netdev->name, subtype,
- hex2str(dev->obuf, (u8 *) mgmt,
- min((sizeof(dev->obuf) - 1) / 2,
- (size_t) le16_to_cpu(buf->wlength)), '\0'));
- }
+ at76_dbg(DBG_RX_MGMT_CONTENT, "%s rx mgmt subtype x%x %s",
+ dev->netdev->name, subtype,
+ hex2str(dev->obuf, (u8 *) mgmt,
+ min((sizeof(dev->obuf) - 1) / 2,
+ (size_t) le16_to_cpu(buf->wlength)), '\0'));
switch (subtype) {
case IEEE80211_STYPE_BEACON:
case IEEE80211_STYPE_PROBE_RESP:
- rx_mgmt_beacon(dev, buf);
+ at76_rx_mgmt_beacon(dev, buf);
break;
case IEEE80211_STYPE_ASSOC_RESP:
- rx_mgmt_assoc(dev, buf);
+ at76_rx_mgmt_assoc(dev, buf);
break;
case IEEE80211_STYPE_REASSOC_RESP:
- rx_mgmt_reassoc(dev, buf);
+ at76_rx_mgmt_reassoc(dev, buf);
break;
case IEEE80211_STYPE_DISASSOC:
- rx_mgmt_disassoc(dev, buf);
+ at76_rx_mgmt_disassoc(dev, buf);
break;
case IEEE80211_STYPE_AUTH:
- rx_mgmt_auth(dev, buf);
+ at76_rx_mgmt_auth(dev, buf);
break;
case IEEE80211_STYPE_DEAUTH:
- rx_mgmt_deauth(dev, buf);
+ at76_rx_mgmt_deauth(dev, buf);
break;
default:
@@ -3274,7 +3269,7 @@ static void rx_mgmt(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
return;
}
-static void dbg_dumpbuf(const char *tag, const u8 *buf, int size)
+static void at76_dbg_dumpbuf(const char *tag, const u8 *buf, int size)
{
int i;
@@ -3284,12 +3279,12 @@ static void dbg_dumpbuf(const char *tag, const u8 *buf, int size)
for (i = 0; i < size; i++) {
if ((i % 8) == 0) {
if (i)
- printk("\n");
- printk(KERN_DEBUG __FILE__ ": %s: ", tag);
+ pr_debug("\n");
+ pr_debug(__FILE__ ": %s: ", tag);
}
- printk("%02x ", buf[i]);
+ pr_debug("%02x ", buf[i]);
}
- printk("\n");
+ pr_debug("\n");
}
/* A short overview on Ethernet-II, 802.2, 802.3 and SNAP
@@ -3342,7 +3337,7 @@ SNAP (802.3 with 802.2 and SNAP headers)
* This routine returns with the skbuff pointing to the actual data (just past
* the end of the newly-created ethernet header).
*/
-static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
+static void at76_ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
{
struct ieee80211_hdr_3addr *i802_11_hdr;
struct ethhdr *eth_hdr_p;
@@ -3353,14 +3348,9 @@ static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data;
-#ifdef DEBUG
- {
- dbg_uc("%s: ENTRY skb len %d data %s", __FUNCTION__,
- skb->len, hex2str(dev->obuf, skb->data,
- min((int)sizeof(dev->obuf) / 3, 64),
- ' '));
- }
-#endif
+ dbg("%s: ENTRY skb len %d data %s", __FUNCTION__,
+ skb->len, hex2str(dev->obuf, skb->data,
+ min((int)sizeof(dev->obuf) / 3, 64), ' '));
skb_pull(skb, sizeof(struct ieee80211_hdr_3addr));
@@ -3424,23 +3414,21 @@ static void ieee80211_to_eth(struct sk_buff *skb, int iw_mode)
}
#ifdef DEBUG
- {
- char da[3*ETH_ALEN], sa[3*ETH_ALEN];
- dbg_uc("%s: EXIT skb da %s sa %s proto x%04x len %d data %s", __FUNCTION__,
- hex2str(da, eth_hdr(skb)->h_dest, ETH_ALEN, ':'),
- hex2str(sa, eth_hdr(skb)->h_source, ETH_ALEN, ':'),
- ntohs(skb->protocol), skb->len,
- hex2str(dev->obuf, skb->data,
- min((int)sizeof(dev->obuf)/3,64), ' '));
- }
+ char da[3*ETH_ALEN], sa[3*ETH_ALEN];
#endif
+ dbg("%s: EXIT skb da %s sa %s proto x%04x len %d data %s", __FUNCTION__,
+ hex2str(da, eth_hdr(skb)->h_dest, ETH_ALEN, ':'),
+ hex2str(sa, eth_hdr(skb)->h_source, ETH_ALEN, ':'),
+ ntohs(skb->protocol), skb->len,
+ hex2str(dev->obuf, skb->data,
+ min((int)sizeof(dev->obuf)/3,64), ' '));
}
/* Adjust the skb to trim the hardware header and CRC, and set up skb->mac,
* skb->protocol, etc.
*/
-static void ieee80211_fixup(struct sk_buff *skb, int iw_mode)
+static void at76_ieee80211_fixup(struct sk_buff *skb, int iw_mode)
{
struct ieee80211_hdr_3addr *i802_11_hdr;
struct ethhdr *eth_hdr_p;
@@ -3500,10 +3488,10 @@ static void ieee80211_fixup(struct sk_buff *skb, int iw_mode)
or thrown away. The check for rx_copybreak is moved here.
Every returned skb starts with the ieee802_11 header and contains
_no_ FCS at the end */
-static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
+static struct sk_buff *at76_check_for_rx_frags(struct at76_priv *dev)
{
struct sk_buff *skb = (struct sk_buff *)dev->rx_skb;
- struct at76c503_rx_buffer *buf = (struct at76c503_rx_buffer *)skb->data;
+ struct at76_rx_buffer *buf = (struct at76_rx_buffer *)skb->data;
struct ieee80211_hdr_3addr *i802_11_hdr =
(struct ieee80211_hdr_3addr *)buf->packet;
/* seq_ctrl, fragment_number, sequence number of new packet */
@@ -3513,7 +3501,7 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
u16 frame_ctl = le16_to_cpu(i802_11_hdr->frame_ctl);
/* length including the IEEE802.11 header, excl. the trailing FCS,
- excl. the struct at76c503_rx_buffer */
+ excl. the struct at76_rx_buffer */
int length = le16_to_cpu(buf->wlength) - dev->rx_data_fcs_len;
/* where does the data payload start in skb->data ? */
@@ -3526,18 +3514,18 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
struct rx_data_buf *bptr, *optr;
unsigned long oldest = ~0UL;
- dbg(DBG_RX_FRAGS, "%s: rx data frame_ctl %04x addr2 %s seq/frag %d/%d "
- "length %d data %d: %s ...",
- dev->netdev->name, frame_ctl,
- mac2str(i802_11_hdr->addr2),
- seqnr, fragnr, length, data_len,
- hex2str(dev->obuf, data,
+ at76_dbg(DBG_RX_FRAGS, "%s: rx data frame_ctl %04x addr2 %s seq/frag %d/%d "
+ "length %d data %d: %s ...",
+ dev->netdev->name, frame_ctl,
+ mac2str(i802_11_hdr->addr2),
+ seqnr, fragnr, length, data_len,
+ hex2str(dev->obuf, data,
min((int)(sizeof(dev->obuf) - 1) / 2, 32), '\0'));
- dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p "
- "tail %p end %p len %d",
- dev->netdev->name, skb->head, skb->data, skb->tail,
- skb->end, skb->len);
+ at76_dbg(DBG_RX_FRAGS_SKB, "%s: incoming skb: head %p data %p "
+ "tail %p end %p len %d",
+ dev->netdev->name, skb->head, skb->data, skb->tail,
+ skb->end, skb->len);
if (data_len <= 0) {
/* buffers contains no data */
@@ -3549,32 +3537,32 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
/* unfragmented packet received */
if (length < rx_copybreak && (skb = dev_alloc_skb(length)) != NULL) {
memcpy(skb_put(skb, length),
- dev->rx_skb->data + AT76C503_RX_HDRLEN, length);
+ dev->rx_skb->data + AT76_RX_HDRLEN, length);
} else {
- skb_pull(skb, AT76C503_RX_HDRLEN);
+ skb_pull(skb, AT76_RX_HDRLEN);
skb_trim(skb, length);
/* Use a new skb for the next receive */
dev->rx_skb = NULL;
}
- dbg(DBG_RX_FRAGS, "%s: unfragmented", dev->netdev->name);
+ at76_dbg(DBG_RX_FRAGS, "%s: unfragmented", dev->netdev->name);
return skb;
}
- /* remove the at76c503_rx_buffer header - we don't need it anymore */
+ /* remove the at76_rx_buffer header - we don't need it anymore */
/* we need the IEEE802.11 header (for the addresses) if this packet
is the first of a chain */
- assert(length > AT76C503_RX_HDRLEN);
- skb_pull(skb, AT76C503_RX_HDRLEN);
+ at76_assert(length > AT76_RX_HDRLEN);
+ skb_pull(skb, AT76_RX_HDRLEN);
/* remove FCS at end */
skb_trim(skb, length);
- dbg(DBG_RX_FRAGS_SKB, "%s: trimmed skb: head %p data %p tail %p "
- "end %p len %d data %p data_len %d",
- dev->netdev->name, skb->head, skb->data, skb->tail,
- skb->end, skb->len, data, data_len);
+ at76_dbg(DBG_RX_FRAGS_SKB, "%s: trimmed skb: head %p data %p tail %p "
+ "end %p len %d data %p data_len %d",
+ dev->netdev->name, skb->head, skb->data, skb->tail,
+ skb->end, skb->len, data, data_len);
/* look if we've got a chain for the sender address.
afterwards optr points to first free or the oldest entry,
@@ -3603,9 +3591,9 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
if (i < NR_RX_DATA_BUF) {
- dbg(DBG_RX_FRAGS, "%s: %d. cacheentry (seq/frag=%d/%d) "
- "matched sender addr",
- dev->netdev->name, i, bptr->seqnr, bptr->fragnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: %d. cacheentry (seq/frag=%d/%d) "
+ "matched sender addr",
+ dev->netdev->name, i, bptr->seqnr, bptr->fragnr);
/* bptr points to an entry for the sender address */
if (bptr->seqnr == seqnr) {
@@ -3630,15 +3618,15 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
/* this was the last fragment - send it */
skb = bptr->skb;
bptr->skb = NULL; /* free the entry */
- dbg(DBG_RX_FRAGS, "%s: last frag of seq %d",
- dev->netdev->name, seqnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: last frag of seq %d",
+ dev->netdev->name, seqnr);
return skb;
} else
return NULL;
} else {
/* wrong fragment number -> ignore it */
- dbg(DBG_RX_FRAGS, "%s: frag nr does not match: %d+1 != %d",
- dev->netdev->name, bptr->fragnr, fragnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: frag nr does not match: %d+1 != %d",
+ dev->netdev->name, bptr->fragnr, fragnr);
return NULL;
}
} else {
@@ -3647,9 +3635,9 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
/* it's the start of a new chain - replace the
old one by this */
/* bptr->sender has the correct value already */
- dbg(DBG_RX_FRAGS, "%s: start of new seq %d, "
- "removing old seq %d", dev->netdev->name,
- seqnr, bptr->seqnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: start of new seq %d, "
+ "removing old seq %d", dev->netdev->name,
+ seqnr, bptr->seqnr);
bptr->seqnr = seqnr;
bptr->fragnr = 0;
bptr->last_rx = jiffies;
@@ -3660,9 +3648,9 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
} else {
/* it from the middle of a new chain ->
delete the old entry and skip the new one */
- dbg(DBG_RX_FRAGS, "%s: middle of new seq %d (%d) "
- "removing old seq %d", dev->netdev->name,
- seqnr, fragnr, bptr->seqnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: middle of new seq %d (%d) "
+ "removing old seq %d", dev->netdev->name,
+ seqnr, fragnr, bptr->seqnr);
dev_kfree_skb(bptr->skb);
bptr->skb = NULL;
}
@@ -3674,11 +3662,11 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
if (fragnr != 0) {
/* this is not the begin of a fragment chain ... */
- dbg(DBG_RX_FRAGS, "%s: no chain for non-first fragment (%d)",
- dev->netdev->name, fragnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: no chain for non-first fragment (%d)",
+ dev->netdev->name, fragnr);
return NULL;
}
- assert(optr != NULL);
+ at76_assert(optr != NULL);
if (optr == NULL)
return NULL;
@@ -3688,16 +3676,16 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
optr->skb = dev->rx_skb;
dev->rx_skb = skb;
- dbg(DBG_RX_FRAGS, "%s: free old contents: sender %s seq/frag %d/%d",
- dev->netdev->name, mac2str(optr->sender),
- optr->seqnr, optr->fragnr);
+ at76_dbg(DBG_RX_FRAGS, "%s: free old contents: sender %s seq/frag %d/%d",
+ dev->netdev->name, mac2str(optr->sender),
+ optr->seqnr, optr->fragnr);
} else {
/* take the skb from dev->rx_skb */
optr->skb = dev->rx_skb;
- dev->rx_skb = NULL; /* let submit_rx_urb() allocate a new skb */
+ dev->rx_skb = NULL; /* let at76_submit_rx_urb() allocate a new skb */
- dbg(DBG_RX_FRAGS, "%s: use a free entry", dev->netdev->name);
+ at76_dbg(DBG_RX_FRAGS, "%s: use a free entry", dev->netdev->name);
}
memcpy(optr->sender, i802_11_hdr->addr2, ETH_ALEN);
optr->seqnr = seqnr;
@@ -3706,29 +3694,29 @@ static struct sk_buff *check_for_rx_frags(struct at76c503 *dev)
return NULL;
}
-} /* check_for_rx_frags */
+} /* at76_check_for_rx_frags */
/* rx interrupt: we expect the complete data buffer in dev->rx_skb */
-static void rx_data(struct at76c503 *dev)
+static void at76_rx_data(struct at76_priv *dev)
{
struct net_device *netdev = (struct net_device *)dev->netdev;
struct net_device_stats *stats = &dev->stats;
struct sk_buff *skb = dev->rx_skb;
- struct at76c503_rx_buffer *buf = (struct at76c503_rx_buffer *)skb->data;
+ struct at76_rx_buffer *buf = (struct at76_rx_buffer *)skb->data;
struct ieee80211_hdr_3addr *i802_11_hdr;
int length = le16_to_cpu(buf->wlength);
+ at76_dbg(DBG_RX_DATA, "%s received data packet:", netdev->name);
if (at76_debug & DBG_RX_DATA) {
- dbg_uc("%s received data packet:", netdev->name);
- dbg_dumpbuf(" rxhdr", skb->data, AT76C503_RX_HDRLEN);
+ at76_dbg_dumpbuf(" rxhdr", skb->data, AT76_RX_HDRLEN);
}
if (at76_debug & DBG_RX_DATA_CONTENT)
- dbg_dumpbuf("packet", skb->data + AT76C503_RX_HDRLEN, length);
+ at76_dbg_dumpbuf("packet", skb->data + AT76_RX_HDRLEN, length);
- if ((skb = check_for_rx_frags(dev)) == NULL)
+ if ((skb = at76_check_for_rx_frags(dev)) == NULL)
return;
- /* if an skb is returned, the at76c503_rx_buffer and the FCS is already removed */
+ /* if an skb is returned, the at76_rx_buffer and the FCS is already removed */
i802_11_hdr = (struct ieee80211_hdr_3addr *)skb->data;
skb->dev = netdev;
@@ -3744,9 +3732,9 @@ static void rx_data(struct at76c503 *dev)
}
if (netdev->type == ARPHRD_ETHER) {
- ieee80211_to_eth(skb, dev->iw_mode);
+ at76_ieee80211_to_eth(skb, dev->iw_mode);
} else {
- ieee80211_fixup(skb, dev->iw_mode);
+ at76_ieee80211_fixup(skb, dev->iw_mode);
}
netdev->last_rx = jiffies;
@@ -3757,7 +3745,7 @@ static void rx_data(struct at76c503 *dev)
return;
}
-static int submit_rx_urb(struct at76c503 *dev)
+static int at76_submit_rx_urb(struct at76_priv *dev)
{
int ret, size;
struct sk_buff *skb = dev->rx_skb;
@@ -3768,7 +3756,7 @@ static int submit_rx_urb(struct at76c503 *dev)
}
if (skb == NULL) {
- skb = dev_alloc_skb(sizeof(struct at76c503_rx_buffer));
+ skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
if (skb == NULL) {
err("%s: unable to allocate rx skbuff.", dev->netdev->name);
ret = -ENOMEM;
@@ -3784,11 +3772,11 @@ static int submit_rx_urb(struct at76c503 *dev)
usb_fill_bulk_urb(dev->read_urb, dev->udev,
usb_rcvbulkpipe(dev->udev, dev->bulk_in_endpointAddr),
skb_put(skb, size), size,
- (usb_complete_t)at76c503_read_bulk_callback, dev);
+ (usb_complete_t)at76_read_bulk_callback, dev);
ret = usb_submit_urb(dev->read_urb, GFP_ATOMIC);
if (ret < 0) {
if (ret == -ENODEV)
- 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", dev->netdev->name, ret);
}
@@ -3820,34 +3808,33 @@ exit:
*/
/* Or maybe because our BH handler is preempting bttv's BH handler.. BHs don't
* solve everything.. (alex) */
-static void at76c503_read_bulk_callback(struct urb *urb)
+static void at76_read_bulk_callback(struct urb *urb)
{
- struct at76c503 *dev = (struct at76c503 *)urb->context;
-
- dev->rx_urb = urb;
- tasklet_schedule(&dev->tasklet);
+ struct at76_priv *priv = (struct at76_priv *)urb->context;
+ priv->rx_urb = urb;
+ tasklet_schedule(&priv->tasklet);
return;
}
-static void rx_monitor_mode(struct at76c503 *dev)
+static void at76_rx_monitor_mode(struct at76_priv *dev)
{
struct net_device *netdev = (struct net_device *)dev->netdev;
- struct at76c503_rx_buffer *buf =
- (struct at76c503_rx_buffer *)dev->rx_skb->data;
+ struct at76_rx_buffer *buf =
+ (struct at76_rx_buffer *)dev->rx_skb->data;
/* length including the IEEE802.11 header, excl. the trailing FCS,
- excl. the struct at76c503_rx_buffer */
+ excl. the struct at76_rx_buffer */
int length = le16_to_cpu(buf->wlength) - dev->rx_data_fcs_len;
struct sk_buff *skb = dev->rx_skb;
struct net_device_stats *stats = &dev->stats;
struct iw_statistics *wstats = &dev->wstats;
- update_wstats(dev, buf);
+ at76_update_wstats(dev, buf);
if (length < 0) {
/* buffer contains no data */
- dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE: rx skb without data",
- dev->netdev->name);
+ at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE: rx skb without data",
+ dev->netdev->name);
return;
}
@@ -3926,7 +3913,7 @@ static void rx_monitor_mode(struct at76c503 *dev)
memcpy(payload, buf->packet, length);
} else {
/* netdev->type != ARPHRD_IEEE80211_PRISM */
- skb_pull(skb, AT76C503_RX_HDRLEN);
+ skb_pull(skb, AT76_RX_HDRLEN);
skb_trim(skb, length);
dev->rx_skb = NULL;
}
@@ -3941,15 +3928,15 @@ static void rx_monitor_mode(struct at76c503 *dev)
netif_rx(skb);
stats->rx_packets++;
stats->rx_bytes += length;
-} /* end of rx_monitor_mode */
+} /* at76_end of rx_monitor_mode */
-static void rx_tasklet(unsigned long param)
+static void at76_rx_tasklet(unsigned long param)
{
- struct at76c503 *dev = (struct at76c503 *)param;
+ struct at76_priv *dev = (struct at76_priv *)param;
struct urb *urb;
struct net_device *netdev;
- struct at76c503_rx_buffer *buf;
+ struct at76_rx_buffer *buf;
struct ieee80211_hdr_3addr *i802_11_hdr;
u16 frame_ctl;
@@ -3959,9 +3946,9 @@ static void rx_tasklet(unsigned long param)
netdev = (struct net_device *)dev->netdev;
if (dev->device_unplugged) {
- dbg(DBG_DEVSTART, "device unplugged");
+ at76_dbg(DBG_DEVSTART, "device unplugged");
if (urb)
- dbg(DBG_DEVSTART, "urb status %d", urb->status);
+ at76_dbg(DBG_DEVSTART, "urb status %d", urb->status);
return;
}
@@ -3969,7 +3956,7 @@ static void rx_tasklet(unsigned long param)
if (!urb || !dev->rx_skb || !netdev || !dev->rx_skb->data)
return;
- buf = (struct at76c503_rx_buffer *)dev->rx_skb->data;
+ buf = (struct at76_rx_buffer *)dev->rx_skb->data;
if (!buf)
return;
@@ -3982,36 +3969,34 @@ static void rx_tasklet(unsigned long param)
if (urb->status != 0) {
if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) {
- dbg(DBG_URB,
- "%s %s: - nonzero read bulk status received: %d",
- __FUNCTION__, netdev->name, urb->status);
+ at76_dbg(DBG_URB,
+ "%s %s: - nonzero read bulk status received: %d",
+ __FUNCTION__, netdev->name, urb->status);
goto no_more_urb;
}
return;
}
- if (at76_debug & DBG_RX_ATMEL_HDR) {
- dbg_uc("%s: rx frame: rate %d rssi %d noise %d link %d %s",
- dev->netdev->name,
- buf->rx_rate, buf->rssi, buf->noise_level,
- buf->link_quality,
- hex2str(dev->obuf,(u8 *)i802_11_hdr,
- min((int)(sizeof(dev->obuf)-1)/2,48),'\0'));
- }
+ at76_dbg(DBG_RX_ATMEL_HDR, "%s: rx frame: rate %d rssi %d noise %d link %d %s",
+ dev->netdev->name,
+ buf->rx_rate, buf->rssi, buf->noise_level,
+ buf->link_quality,
+ hex2str(dev->obuf,(u8 *)i802_11_hdr,
+ min((int)(sizeof(dev->obuf)-1)/2,48),'\0'));
if (dev->istate == MONITORING) {
- rx_monitor_mode(dev);
+ at76_rx_monitor_mode(dev);
goto finish;
}
/* there is a new bssid around, accept it: */
if (buf->newbss && dev->iw_mode == IW_MODE_ADHOC) {
- dbg(DBG_PROGRESS, "%s: rx newbss", netdev->name);
+ at76_dbg(DBG_PROGRESS, "%s: rx newbss", netdev->name);
at76_defer_event(dev, AT76_DEVENT_NEW_BSS);
}
switch (frame_ctl & IEEE80211_FCTL_FTYPE) {
case IEEE80211_FTYPE_DATA:
- rx_data(dev);
+ at76_rx_data(dev);
break;
case IEEE80211_FTYPE_MGMT:
@@ -4019,14 +4004,14 @@ static void rx_tasklet(unsigned long param)
other frames than management (might depend on the
radio chip / firmware version !) */
- iwspy_update(dev, buf);
+ at76_iwspy_update(dev, buf);
- rx_mgmt(dev, buf);
+ at76_rx_mgmt(dev, buf);
break;
case IEEE80211_FTYPE_CTL:
- dbg(DBG_RX_CTRL, "%s: ignored ctrl frame: %04x",
- dev->netdev->name, frame_ctl);
+ at76_dbg(DBG_RX_CTRL, "%s: ignored ctrl frame: %04x",
+ dev->netdev->name, frame_ctl);
break;
default:
@@ -4034,24 +4019,24 @@ static void rx_tasklet(unsigned long param)
frame_ctl);
} /* switch (frame_ctl & IEEE80211_FCTL_FTYPE) */
finish:
- submit_rx_urb(dev);
+ at76_submit_rx_urb(dev);
no_more_urb:
return;
}
-static void at76c503_write_bulk_callback(struct urb *urb)
+static void at76_write_bulk_callback(struct urb *urb)
{
- struct at76c503 *dev = (struct at76c503 *)urb->context;
+ struct at76_priv *dev = (struct at76_priv *)urb->context;
struct net_device_stats *stats = &dev->stats;
unsigned long flags;
- struct at76c503_tx_buffer *mgmt_buf;
+ struct at76_tx_buffer *mgmt_buf;
int ret;
if (urb->status != 0) {
if ((urb->status != -ENOENT) && (urb->status != -ECONNRESET)) {
- dbg(DBG_URB,
- "%s - nonzero write bulk status received: %d",
- __FUNCTION__, urb->status);
+ at76_dbg(DBG_URB,
+ "%s - nonzero write bulk status received: %d",
+ __FUNCTION__, urb->status);
} else
return; /* urb has been unlinked */
stats->tx_errors++;
@@ -4068,14 +4053,14 @@ static void at76c503_write_bulk_callback(struct urb *urb)
to the length */
memcpy(dev->bulk_out_buffer, mgmt_buf,
le16_to_cpu(mgmt_buf->wlength) +
- offsetof(struct at76c503_tx_buffer, packet));
+ offsetof(struct at76_tx_buffer, packet));
usb_fill_bulk_urb(dev->write_urb, dev->udev,
usb_sndbulkpipe(dev->udev,
dev->bulk_out_endpointAddr),
dev->bulk_out_buffer,
le16_to_cpu(mgmt_buf->wlength) +
- mgmt_buf->padding + AT76C503_TX_HDRLEN,
- (usb_complete_t) at76c503_write_bulk_callback,
+ mgmt_buf->padding + AT76_TX_HDRLEN,
+ (usb_complete_t) at76_write_bulk_callback,
dev);
ret = usb_submit_urb(dev->write_urb, GFP_ATOMIC);
if (ret) {
@@ -4088,15 +4073,15 @@ static void at76c503_write_bulk_callback(struct urb *urb)
}
-static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev)
+static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
struct net_device_stats *stats = &dev->stats;
int ret = 0;
int wlen;
int submit_len;
- struct at76c503_tx_buffer *tx_buffer =
- (struct at76c503_tx_buffer *)dev->bulk_out_buffer;
+ struct at76_tx_buffer *tx_buffer =
+ (struct at76_tx_buffer *)dev->bulk_out_buffer;
struct ieee80211_hdr_3addr *i802_11_hdr =
(struct ieee80211_hdr_3addr *)&(tx_buffer->packet);
u8 *payload = tx_buffer->packet + sizeof(struct ieee80211_hdr_3addr);
@@ -4124,12 +4109,12 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev)
return 0;
}
- 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
- dbg(DBG_TX, "skb->data - skb->head = %d", skb->data - skb->head); */
+ at76_dbg(DBG_TX, "skb->data - skb->head = %d", skb->data - skb->head); */
if (ntohs(*(__be16 *) (skb->data + 2 * ETH_ALEN)) <= 1518) {
/* this is a 802.3 packet */
@@ -4186,22 +4171,22 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev)
memset(tx_buffer->reserved, 0, 4);
- tx_buffer->padding = calc_padding(wlen);
- submit_len = wlen + AT76C503_TX_HDRLEN + tx_buffer->padding;
+ tx_buffer->padding = at76_calc_padding(wlen);
+ submit_len = wlen + AT76_TX_HDRLEN + tx_buffer->padding;
{
- dbg(DBG_TX_DATA_CONTENT, "%s skb->data %s", dev->netdev->name,
- hex2str(dev->obuf, skb->data,
+ at76_dbg(DBG_TX_DATA_CONTENT, "%s skb->data %s", dev->netdev->name,
+ hex2str(dev->obuf, skb->data,
min((int)(sizeof(dev->obuf) - 1) / 2, 32), '\0'));
- dbg(DBG_TX_DATA, "%s tx wlen x%x pad x%x rate %d hdr %s",
- dev->netdev->name,
- le16_to_cpu(tx_buffer->wlength),
- tx_buffer->padding, tx_buffer->tx_rate,
- hex2str(dev->obuf, (u8 *) i802_11_hdr,
+ at76_dbg(DBG_TX_DATA, "%s tx wlen x%x pad x%x rate %d hdr %s",
+ dev->netdev->name,
+ le16_to_cpu(tx_buffer->wlength),
+ tx_buffer->padding, tx_buffer->tx_rate,
+ hex2str(dev->obuf, (u8 *) i802_11_hdr,
min((sizeof(dev->obuf) - 1) / 2,
sizeof(struct ieee80211_hdr_3addr)), '\0'));
- dbg(DBG_TX_DATA_CONTENT, "%s payload %s", dev->netdev->name,
- hex2str(dev->obuf, payload,
+ at76_dbg(DBG_TX_DATA_CONTENT, "%s payload %s", dev->netdev->name,
+ hex2str(dev->obuf, payload,
min((int)(sizeof(dev->obuf) - 1) / 2, 48), '\0'));
}
@@ -4212,7 +4197,7 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev)
usb_fill_bulk_urb(dev->write_urb, dev->udev,
usb_sndbulkpipe(dev->udev, dev->bulk_out_endpointAddr),
tx_buffer, submit_len,
- (usb_complete_t)at76c503_write_bulk_callback, dev);
+ (usb_complete_t)at76_write_bulk_callback, dev);
ret = usb_submit_urb(dev->write_urb, GFP_ATOMIC);
if (ret) {
stats->tx_errors++;
@@ -4234,9 +4219,9 @@ static int at76c503_tx(struct sk_buff *skb, struct net_device *netdev)
return ret;
}
-static void at76c503_tx_timeout(struct net_device *netdev)
+static void at76_tx_timeout(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
if (!dev)
return;
@@ -4246,20 +4231,20 @@ static void at76c503_tx_timeout(struct net_device *netdev)
dev->stats.tx_errors++;
}
-static int startup_device(struct at76c503 *dev)
+static int at76_startup_device(struct at76_priv *dev)
{
- struct at76c503_card_config *ccfg = &dev->card_config;
+ struct at76_card_config *ccfg = &dev->card_config;
int ret;
if (at76_debug & DBG_PARAMS) {
char ossid[IW_ESSID_MAX_SIZE + 1];
/* make dev->essid printable */
- assert(dev->essid_size <= IW_ESSID_MAX_SIZE);
+ at76_assert(dev->essid_size <= IW_ESSID_MAX_SIZE);
memcpy(ossid, dev->essid, dev->essid_size);
ossid[dev->essid_size] = '\0';
- dbg_uc("%s param: ssid %s (%s) mode %s ch %d wep %s key %d keylen %d",
+ dbg("%s param: ssid %s (%s) mode %s ch %d wep %s key %d keylen %d",
dev->netdev->name, ossid,
hex2str(dev->obuf, dev->essid,
min((int)(sizeof(dev->obuf)-1)/2,
@@ -4268,7 +4253,7 @@ static int startup_device(struct at76c503 *dev)
dev->channel,
dev->wep_enabled ? "enabled" : "disabled",
dev->wep_key_id, dev->wep_keys_len[dev->wep_key_id]);
- dbg_uc("%s param: preamble %s rts %d retry %d frag %d "
+ dbg("%s param: preamble %s rts %d retry %d frag %d "
"txrate %s auth_mode %d",
dev->netdev->name,
dev->preamble_type == PREAMBLE_TYPE_SHORT ? "short" : "long",
@@ -4280,7 +4265,7 @@ static int startup_device(struct at76c503 *dev)
dev->txrate == TX_RATE_11MBIT ? "11MBit" :
dev->txrate == TX_RATE_AUTO ? "auto" : "<invalid>",
dev->auth_mode);
- dbg_uc("%s param: pm_mode %d pm_period %d auth_mode %s "
+ dbg("%s param: pm_mode %d pm_period %d auth_mode %s "
"scan_times %d %d scan_mode %s international_roaming %d",
dev->netdev->name,
dev->pm_mode, dev->pm_period,
@@ -4291,7 +4276,7 @@ static int startup_device(struct at76c503 *dev)
dev->international_roaming);
}
- memset(ccfg, 0, sizeof(struct at76c503_card_config));
+ memset(ccfg, 0, sizeof(struct at76_card_config));
ccfg->promiscuous_mode = 0;
ccfg->short_retry_limit = dev->short_retry_limit;
@@ -4325,10 +4310,10 @@ static int startup_device(struct at76c503 *dev)
ccfg->short_preamble = dev->preamble_type;
ccfg->beacon_period = cpu_to_le16(dev->beacon_period);
- ret = set_card_command(dev->udev, CMD_STARTUP, (unsigned char *)&dev->card_config,
- sizeof(struct at76c503_card_config));
+ ret = at76_set_card_command(dev->udev, CMD_STARTUP, (unsigned char *)&dev->card_config,
+ sizeof(struct at76_card_config));
if (ret < 0) {
- err("%s: set_card_command failed: %d", dev->netdev->name, ret);
+ err("%s: at76_set_card_command failed: %d", dev->netdev->name, ret);
return ret;
}
@@ -4337,44 +4322,46 @@ static int startup_device(struct at76c503 *dev)
/* remove BSSID from previous run */
memset(dev->bssid, 0, ETH_ALEN);
- if (set_radio(dev, 1) == 1)
+ if (at76_set_radio(dev, 1) == 1)
at76_wait_completion(dev, CMD_RADIO);
- if ((ret = set_preamble(dev, dev->preamble_type)) < 0)
+ if ((ret = at76_set_preamble(dev, dev->preamble_type)) < 0)
return ret;
- if ((ret = set_frag(dev, dev->frag_threshold)) < 0)
+
+ if ((ret = at76_set_frag(dev, dev->frag_threshold)) < 0)
return ret;
- if ((ret = set_rts(dev, dev->rts_threshold)) < 0)
+ if ((ret = at76_set_rts(dev, dev->rts_threshold)) < 0)
return ret;
- if ((ret = set_autorate_fallback(dev, dev->txrate == TX_RATE_AUTO ? 1 : 0)) < 0)
+ if ((ret = at76_set_autorate_fallback(dev, dev->txrate == TX_RATE_AUTO ? 1 : 0)) < 0)
return ret;
- if ((ret = set_pm_mode(dev)) < 0)
+ if ((ret = at76_set_pm_mode(dev)) < 0)
return ret;
- if ((ret = set_iroaming(dev, dev->international_roaming)) < 0)
+
+ if ((ret = at76_set_iroaming(dev, dev->international_roaming)) < 0)
return ret;
if (at76_debug & DBG_MIB) {
- dump_mib_mac(dev);
- dump_mib_mac_addr(dev);
- dump_mib_mac_mgmt(dev);
- dump_mib_mac_wep(dev);
- dump_mib_mdomain(dev);
- dump_mib_phy(dev);
- dump_mib_local(dev);
+ at76_dump_mib_mac(dev);
+ at76_dump_mib_mac_addr(dev);
+ at76_dump_mib_mac_mgmt(dev);
+ at76_dump_mib_mac_wep(dev);
+ at76_dump_mib_mdomain(dev);
+ at76_dump_mib_phy(dev);
+ at76_dump_mib_local(dev);
}
return 0;
}
-static int at76c503_open(struct net_device *netdev)
+static int at76_open(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = 0;
- dbg(DBG_PROC_ENTRY, "at76c503_open entry");
+ at76_dbg(DBG_PROC_ENTRY, "at76_open entry");
if (down_interruptible(&dev->sem))
return -EINTR;
@@ -4382,19 +4369,19 @@ static int at76c503_open(struct net_device *netdev)
/* if netdev->dev_addr != dev->mac_addr we must
set the mac address in the device ! */
if (compare_ether_addr(netdev->dev_addr, dev->mac_addr)) {
- if (set_mac_address(dev, netdev->dev_addr) >= 0)
- dbg(DBG_PROGRESS, "%s: set new MAC addr %s",
- netdev->name, mac2str(netdev->dev_addr));
+ if (at76_add_mac_address(dev, netdev->dev_addr) >= 0)
+ at76_dbg(DBG_PROGRESS, "%s: set new MAC addr %s",
+ netdev->name, mac2str(netdev->dev_addr));
}
#ifdef DEBUG
- dump_mib_mac_addr(dev);
+ at76_dump_mib_mac_addr(dev);
#endif
dev->site_survey_state = SITE_SURVEY_IDLE;
dev->last_survey = jiffies;
dev->nr_submit_rx_tries = NR_SUBMIT_RX_TRIES; /* init counter */
- if ((ret = submit_rx_urb(dev)) < 0) {
+ if ((ret = at76_submit_rx_urb(dev)) < 0) {
err("%s: open: submit_rx_urb failed: %d", netdev->name, ret);
goto err;
}
@@ -4403,18 +4390,18 @@ static int at76c503_open(struct net_device *netdev)
at76_defer_event(dev, AT76_DEVENT_RESTART);
- dbg(DBG_PROC_ENTRY, "at76c503_open end");
+ at76_dbg(DBG_PROC_ENTRY, "at76_open end");
err:
up(&dev->sem);
return ret < 0 ? ret : 0;
}
-static int at76c503_stop(struct net_device *netdev)
+static int at76_stop(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
unsigned long flags;
- dbg(DBG_DEVSTART, "%s: ENTER", __FUNCTION__);
+ at76_dbg(DBG_DEVSTART, "%s: ENTER", __FUNCTION__);
if (down_interruptible(&dev->sem))
return -EINTR;
@@ -4426,7 +4413,7 @@ static int at76c503_stop(struct net_device *netdev)
if (!(dev->device_unplugged)) {
/* we are called by "ifconfig ethX down", not because the
device isn't avail. anymore */
- set_radio(dev, 0);
+ at76_set_radio(dev, 0);
/* we unlink the read urb, because the _open()
submits it again. _delete_device() takes care of the
@@ -4444,38 +4431,38 @@ static int at76c503_stop(struct net_device *netdev)
spin_unlock_irqrestore(&dev->mgmt_spinlock, flags);
/* free the bss_list */
- free_bss_list(dev);
+ at76_free_bss_list(dev);
- assert(dev->open_count > 0);
+ at76_assert(dev->open_count > 0);
dev->open_count--;
up(&dev->sem);
- dbg(DBG_DEVSTART, "%s: EXIT", __FUNCTION__);
+ at76_dbg(DBG_DEVSTART, "%s: EXIT", __FUNCTION__);
return 0;
}
-static struct net_device_stats *at76c503_get_stats(struct net_device *netdev)
+static struct net_device_stats *at76_get_stats(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
return &dev->stats;
}
-static struct iw_statistics *at76c503_get_wireless_stats(struct net_device
+static struct iw_statistics *at76_get_wireless_stats(struct net_device
*netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- dbg(DBG_IOCTL, "RETURN qual %d level %d noise %d updated %d",
- dev->wstats.qual.qual, dev->wstats.qual.level,
- dev->wstats.qual.noise, dev->wstats.qual.updated);
+ at76_dbg(DBG_IOCTL, "RETURN qual %d level %d noise %d updated %d",
+ dev->wstats.qual.qual, dev->wstats.qual.level,
+ dev->wstats.qual.noise, dev->wstats.qual.updated);
return &dev->wstats;
}
-static void at76c503_set_multicast(struct net_device *netdev)
+static void at76_set_multicast(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int promisc;
promisc = ((netdev->flags & IFF_PROMISC) != 0);
@@ -4487,8 +4474,8 @@ static void at76c503_set_multicast(struct net_device *netdev)
}
/* we only store the new mac address in netdev struct,
- it got set when the netdev gets opened. */
-static int at76c503_set_mac_address(struct net_device *netdev, void *addr)
+ it gets set when the netdev is opened. */
+static int at76_set_mac_address(struct net_device *netdev, void *addr)
{
struct sockaddr *mac = addr;
memcpy(netdev->dev_addr, mac->sa_data, ETH_ALEN);
@@ -4496,9 +4483,9 @@ static int at76c503_set_mac_address(struct net_device *netdev, void *addr)
}
/**
- * iwspy_update - check if we spy on the sender address of buf and update stats
+ * at76_iwspy_update - check if we spy on the sender address of buf and update stats
*/
-static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
+static void at76_iwspy_update(struct at76_priv *dev, struct at76_rx_buffer *buf)
{
struct ieee80211_hdr_3addr *hdr =
(struct ieee80211_hdr_3addr *)buf->packet;
@@ -4508,7 +4495,7 @@ static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
qual.updated = IW_QUAL_QUAL_INVALID | IW_QUAL_NOISE_INVALID;
qual.level = 0;
qual.noise = 0;
- calc_level(dev, buf, &qual);
+ at76_calc_level(dev, buf, &qual);
spin_lock_bh(&(dev->spy_spinlock));
@@ -4516,13 +4503,13 @@ static void iwspy_update(struct at76c503 *dev, struct at76c503_rx_buffer *buf)
wireless_spy_update(dev->netdev, hdr->addr2, &qual);
}
spin_unlock_bh(&(dev->spy_spinlock));
-} /* iwspy_update */
+} /* at76_iwspy_update */
/*******************************************************************************
* structure that describes the private ioctls/iw handlers of this driver
*/
-static const struct iw_priv_args at76c503_priv_args[] = {
+static const struct iw_priv_args at76_priv_args[] = {
{PRIV_IOCTL_SET_SHORT_PREAMBLE,
IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0,
"short_preamble"}, /* 0 - long, 1 -short */
@@ -4559,16 +4546,16 @@ static const struct iw_priv_args at76c503_priv_args[] = {
};
/*******************************************************************************
- * at76c503 implementations of iw_handler functions:
+ * at76_priv implementations of iw_handler functions:
*/
-static int at76c503_iw_handler_commit(struct net_device *netdev,
+static int at76_iw_handler_commit(struct net_device *netdev,
struct iw_request_info *info,
void *null, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
unsigned long flags;
- dbg(DBG_IOCTL, "%s %s: restarting the device", netdev->name,
- __FUNCTION__);
+ at76_dbg(DBG_IOCTL, "%s %s: restarting the device", netdev->name,
+ __FUNCTION__);
/* TODO: stop any pending tx bulk urb */
if (dev->istate != INIT) {
@@ -4595,23 +4582,23 @@ static int at76c503_iw_handler_commit(struct net_device *netdev,
return 0;
}
-static int at76c503_iw_handler_get_name(struct net_device *netdev,
+static int at76_iw_handler_get_name(struct net_device *netdev,
struct iw_request_info *info,
char *name, char *extra)
{
strcpy(name, "IEEE 802.11b");
- dbg(DBG_IOCTL, "%s: SIOCGIWNAME - name %s", netdev->name, name);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWNAME - name %s", netdev->name, name);
return 0;
}
-static int at76c503_iw_handler_set_freq(struct net_device *netdev,
+static int at76_iw_handler_set_freq(struct net_device *netdev,
struct iw_request_info *info,
struct iw_freq *freq, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int chan = -1;
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d", netdev->name,
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - freq.m %d freq.e %d", netdev->name,
freq->m, freq->e);
/* modelled on orinoco.c */
@@ -4650,38 +4637,38 @@ static int at76c503_iw_handler_set_freq(struct net_device *netdev,
if (ret == -EIWCOMMIT) {
dev->channel = chan;
- dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name, chan);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWFREQ - ch %d", netdev->name, chan);
}
return ret;
}
-static int at76c503_iw_handler_get_freq(struct net_device *netdev,
+static int at76_iw_handler_get_freq(struct net_device *netdev,
struct iw_request_info *info,
struct iw_freq *freq, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
freq->m = dev->channel;
freq->e = 0;
if (dev->channel) {
- dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d",
- netdev->name, channel_frequency[dev->channel - 1], 6);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - freq %ld x 10e%d",
+ netdev->name, channel_frequency[dev->channel - 1], 6);
}
- dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name, dev->channel);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWFREQ - ch %d", netdev->name, dev->channel);
return 0;
}
-static int at76c503_iw_handler_set_mode(struct net_device *netdev,
+static int at76_iw_handler_set_mode(struct net_device *netdev,
struct iw_request_info *info,
__u32 * mode, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: SIOCSIWMODE - %d", netdev->name, *mode);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWMODE - %d", netdev->name, *mode);
if ((*mode != IW_MODE_ADHOC) && (*mode != IW_MODE_INFRA) &&
(*mode != IW_MODE_MONITOR)) {
@@ -4694,25 +4681,25 @@ static int at76c503_iw_handler_set_mode(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_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)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
*mode = dev->iw_mode;
- dbg(DBG_IOCTL, "%s: SIOCGIWMODE - %d", netdev->name, *mode);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWMODE - %d", netdev->name, *mode);
return 0;
}
-static int at76c503_iw_handler_get_range(struct net_device *netdev,
+static int at76_iw_handler_get_range(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
/* inspired by atmel.c */
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
struct iw_range *range = (struct iw_range *)extra;
int i;
@@ -4790,20 +4777,20 @@ static int at76c503_iw_handler_get_range(struct net_device *netdev,
}
}
- dbg(DBG_IOCTL, "%s: SIOCGIWRANGE", netdev->name);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWRANGE", netdev->name);
return 0;
}
-static int at76c503_iw_handler_set_spy(struct net_device *netdev,
+static int at76_iw_handler_set_spy(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = 0;
- dbg(DBG_IOCTL, "%s: SIOCSIWSPY - number of addresses %d",
- netdev->name, data->length);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWSPY - number of addresses %d",
+ netdev->name, data->length);
spin_lock_bh(&(dev->spy_spinlock));
ret = iw_handler_set_spy(dev->netdev, info, (union iwreq_data *)data,
@@ -4813,12 +4800,12 @@ static int at76c503_iw_handler_set_spy(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_spy(struct net_device *netdev,
+static int at76_iw_handler_get_spy(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = 0;
spin_lock_bh(&(dev->spy_spinlock));
@@ -4826,21 +4813,21 @@ static int at76c503_iw_handler_get_spy(struct net_device *netdev,
(union iwreq_data *)data, extra);
spin_unlock_bh(&(dev->spy_spinlock));
- dbg(DBG_IOCTL, "%s: SIOCGIWSPY - number of addresses %d",
- netdev->name, data->length);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWSPY - number of addresses %d",
+ netdev->name, data->length);
return ret;
}
-static int at76c503_iw_handler_set_thrspy(struct net_device *netdev,
+static int at76_iw_handler_set_thrspy(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret;
- dbg(DBG_IOCTL, "%s: SIOCSIWTHRSPY - number of addresses %d)",
- netdev->name, data->length);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWTHRSPY - number of addresses %d)",
+ netdev->name, data->length);
spin_lock_bh(&(dev->spy_spinlock));
ret = iw_handler_set_thrspy(netdev, info, (union iwreq_data *)data,
@@ -4850,11 +4837,11 @@ static int at76c503_iw_handler_set_thrspy(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_thrspy(struct net_device *netdev,
+static int at76_iw_handler_get_thrspy(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret;
spin_lock_bh(&(dev->spy_spinlock));
@@ -4862,20 +4849,20 @@ static int at76c503_iw_handler_get_thrspy(struct net_device *netdev,
extra);
spin_unlock_bh(&(dev->spy_spinlock));
- dbg(DBG_IOCTL, "%s: SIOCGIWTHRSPY - number of addresses %d)",
- netdev->name, data->length);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWTHRSPY - number of addresses %d)",
+ netdev->name, data->length);
return ret;
}
-static int at76c503_iw_handler_set_wap(struct net_device *netdev,
+static int at76_iw_handler_set_wap(struct net_device *netdev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- dbg(DBG_IOCTL, "%s: SIOCSIWAP - wap/bssid %s", netdev->name,
- mac2str(ap_addr->sa_data));
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWAP - wap/bssid %s", netdev->name,
+ mac2str(ap_addr->sa_data));
/* if the incoming address == ff:ff:ff:ff:ff:ff, the user has
chosen any or auto AP preference */
@@ -4891,31 +4878,31 @@ static int at76c503_iw_handler_set_wap(struct net_device *netdev,
return -EIWCOMMIT;
}
-static int at76c503_iw_handler_get_wap(struct net_device *netdev,
+static int at76_iw_handler_get_wap(struct net_device *netdev,
struct iw_request_info *info,
struct sockaddr *ap_addr, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
ap_addr->sa_family = ARPHRD_ETHER;
memcpy(ap_addr->sa_data, dev->bssid, ETH_ALEN);
- dbg(DBG_IOCTL, "%s: SIOCGIWAP - wap/bssid %s", netdev->name,
- mac2str(ap_addr->sa_data));
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWAP - wap/bssid %s", netdev->name,
+ mac2str(ap_addr->sa_data));
return 0;
}
-static int at76c503_iw_handler_set_scan(struct net_device *netdev,
+static int at76_iw_handler_set_scan(struct net_device *netdev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
unsigned long flags;
int ret = 0;
struct iw_scan_req *req = NULL;
- dbg(DBG_IOCTL, "%s: SIOCSIWSCAN", netdev->name);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWSCAN", netdev->name);
if (!netif_running(netdev))
return -ENETDOWN;
@@ -4985,11 +4972,11 @@ static int at76c503_iw_handler_set_scan(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_scan(struct net_device *netdev,
+static int at76_iw_handler_get_scan(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
unsigned long flags;
struct list_head *lptr, *nptr;
struct bss_info *curr_bss;
@@ -4997,7 +4984,7 @@ static int at76c503_iw_handler_get_scan(struct net_device *netdev,
char *curr_val, *curr_pos = extra;
int i;
- dbg(DBG_IOCTL, "%s: SIOCGIWSCAN", netdev->name);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWSCAN", netdev->name);
if (!iwe)
return -ENOMEM;
@@ -5110,13 +5097,13 @@ static int at76c503_iw_handler_get_scan(struct net_device *netdev,
return 0;
}
-static int at76c503_iw_handler_set_essid(struct net_device *netdev,
+static int at76_iw_handler_set_essid(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- dbg(DBG_IOCTL, "%s: SIOCSIWESSID - %s", netdev->name, extra);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWESSID - %s", netdev->name, extra);
if (data->flags) {
memcpy(dev->essid, extra, data->length);
@@ -5129,11 +5116,11 @@ static int at76c503_iw_handler_set_essid(struct net_device *netdev,
return -EIWCOMMIT;
}
-static int at76c503_iw_handler_get_essid(struct net_device *netdev,
+static int at76_iw_handler_get_essid(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
if (dev->essid_size) {
/* not the ANY ssid in dev->essid */
@@ -5158,18 +5145,18 @@ static int at76c503_iw_handler_get_essid(struct net_device *netdev,
}
}
- dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra);
return 0;
}
-static int at76c503_iw_handler_set_nickname(struct net_device *netdev,
+static int at76_iw_handler_set_nickname(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- dbg(DBG_IOCTL, "%s: SIOCSIWNICKN - %s", netdev->name, extra);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWNICKN - %s", netdev->name, extra);
/* iwconfig gives length including 0 byte like in the case of essid */
memcpy(dev->nickn, extra, data->length);
@@ -5177,30 +5164,30 @@ static int at76c503_iw_handler_set_nickname(struct net_device *netdev,
return 0;
}
-static int at76c503_iw_handler_get_nickname(struct net_device *netdev,
+static int at76_iw_handler_get_nickname(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *data, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
data->length = strlen(dev->nickn);
memcpy(extra, dev->nickn, data->length);
extra[data->length] = '\0';
data->length += 1;
- dbg(DBG_IOCTL, "%s: SIOCGIWNICKN - %s", netdev->name, extra);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWNICKN - %s", netdev->name, extra);
return 0;
}
-static int at76c503_iw_handler_set_rate(struct net_device *netdev,
+static int at76_iw_handler_set_rate(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *bitrate, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = -EIWCOMMIT;
- 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:
@@ -5225,11 +5212,11 @@ static int at76c503_iw_handler_set_rate(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_rate(struct net_device *netdev,
+static int at76_iw_handler_get_rate(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *bitrate, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = 0;
switch (dev->txrate) {
@@ -5256,22 +5243,22 @@ static int at76c503_iw_handler_get_rate(struct net_device *netdev,
bitrate->fixed = (dev->txrate != TX_RATE_AUTO);
bitrate->disabled = 0;
- dbg(DBG_IOCTL, "%s: SIOCGIWRATE - %d", netdev->name,
- bitrate->value);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWRATE - %d", netdev->name,
+ bitrate->value);
return ret;
}
-static int at76c503_iw_handler_set_rts(struct net_device *netdev,
+static int at76_iw_handler_set_rts(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = -EIWCOMMIT;
int rthr = rts->value;
- dbg(DBG_IOCTL, "%s: SIOCSIWRTS - value %d disabled %s",
- netdev->name, rts->value, (rts->disabled) ? "true" : "false");
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWRTS - value %d disabled %s",
+ netdev->name, rts->value, (rts->disabled) ? "true" : "false");
if (rts->disabled)
rthr = MAX_RTS_THRESHOLD;
@@ -5285,32 +5272,32 @@ static int at76c503_iw_handler_set_rts(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_rts(struct net_device *netdev,
+static int at76_iw_handler_get_rts(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *rts, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
rts->value = dev->rts_threshold;
rts->disabled = (rts->value >= MAX_RTS_THRESHOLD);
rts->fixed = 1;
- dbg(DBG_IOCTL, "%s: SIOCGIWRTS - value %d disabled %s",
- netdev->name, rts->value, (rts->disabled) ? "true" : "false");
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWRTS - value %d disabled %s",
+ netdev->name, rts->value, (rts->disabled) ? "true" : "false");
return 0;
}
-static int at76c503_iw_handler_set_frag(struct net_device *netdev,
+static int at76_iw_handler_set_frag(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *frag, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = -EIWCOMMIT;
int fthr = frag->value;
- dbg(DBG_IOCTL, "%s: SIOCSIWFRAG - value %d, disabled %s",
- netdev->name, frag->value, (frag->disabled) ? "true" : "false");
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWFRAG - value %d, disabled %s",
+ netdev->name, frag->value, (frag->disabled) ? "true" : "false");
if (frag->disabled)
fthr = MAX_FRAG_THRESHOLD;
@@ -5324,23 +5311,23 @@ static int at76c503_iw_handler_set_frag(struct net_device *netdev,
return ret;
}
-static int at76c503_iw_handler_get_frag(struct net_device *netdev,
+static int at76_iw_handler_get_frag(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *frag, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
frag->value = dev->frag_threshold;
frag->disabled = (frag->value >= MAX_FRAG_THRESHOLD);
frag->fixed = 1;
- dbg(DBG_IOCTL, "%s: SIOCGIWFRAG - value %d, disabled %s",
- netdev->name, frag->value, (frag->disabled) ? "true" : "false");
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWFRAG - value %d, disabled %s",
+ netdev->name, frag->value, (frag->disabled) ? "true" : "false");
return 0;
}
-static int at76c503_iw_handler_get_txpow(struct net_device *netdev,
+static int at76_iw_handler_get_txpow(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *power, char *extra)
{
@@ -5349,23 +5336,23 @@ static int at76c503_iw_handler_get_txpow(struct net_device *netdev,
power->disabled = 0;
power->flags = IW_TXPOW_DBM;
- dbg(DBG_IOCTL, "%s: SIOCGIWTXPOW - txpow %d dBm", netdev->name,
- power->value);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWTXPOW - txpow %d dBm", netdev->name,
+ power->value);
return 0;
}
/* jal: short retry is handled by the firmware (at least 0.90.x),
while long retry is not (?) */
-static int at76c503_iw_handler_set_retry(struct net_device *netdev,
+static int at76_iw_handler_set_retry(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *retry, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: SIOCSIWRETRY disabled %d flags x%x val %d",
- netdev->name, retry->disabled, retry->flags, retry->value);
+ at76_dbg(DBG_IOCTL, "%s: SIOCSIWRETRY disabled %d flags x%x val %d",
+ netdev->name, retry->disabled, retry->flags, retry->value);
if (!retry->disabled && (retry->flags & IW_RETRY_LIMIT)) {
if ((retry->flags & IW_RETRY_MIN) ||
@@ -5381,13 +5368,13 @@ static int at76c503_iw_handler_set_retry(struct net_device *netdev,
}
/* adapted (ripped) from atmel.c */
-static int at76c503_iw_handler_get_retry(struct net_device *netdev,
+static int at76_iw_handler_get_retry(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *retry, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- dbg(DBG_IOCTL, "%s: SIOCGIWRETRY", netdev->name);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWRETRY", netdev->name);
retry->disabled = 0; /* Can't be disabled */
@@ -5398,23 +5385,23 @@ static int at76c503_iw_handler_get_retry(struct net_device *netdev,
return 0;
}
-static int at76c503_iw_handler_set_encode(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 at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
int len = encoding->length;
- dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - enc.flags %08x "
- "pointer %p len %d", netdev->name, encoding->flags,
- encoding->pointer, encoding->length);
- dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - old wepstate: enabled %s key_id %d "
- "auth_mode %s",
- netdev->name, (dev->wep_enabled) ? "true" : "false",
- dev->wep_key_id,
- (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
+ 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, (dev->wep_enabled) ? "true" : "false",
+ dev->wep_key_id,
+ (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
/* take the old default key if index is invalid */
if ((index < 0) || (index >= WEP_KEYS))
@@ -5439,21 +5426,21 @@ static int at76c503_iw_handler_set_encode(struct net_device *netdev,
if (encoding->flags & IW_ENCODE_OPEN)
dev->auth_mode = WLAN_AUTH_OPEN;
- dbg(DBG_IOCTL, "%s: SIOCSIWENCODE - new wepstate: enabled %s key_id %d "
- "key_len %d auth_mode %s",
- netdev->name, (dev->wep_enabled) ? "true" : "false",
- dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id],
- (dev->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, (dev->wep_enabled) ? "true" : "false",
+ dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id],
+ (dev->auth_mode == WLAN_AUTH_SHARED_KEY) ? "restricted" : "open");
return -EIWCOMMIT;
}
-static int at76c503_iw_handler_get_encode(struct net_device *netdev,
+static int at76_iw_handler_get_encode(struct net_device *netdev,
struct iw_request_info *info,
struct iw_point *encoding,
char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int index = (encoding->flags & IW_ENCODE_INDEX) - 1;
if ((index < 0) || (index >= WEP_KEYS))
@@ -5474,10 +5461,10 @@ static int at76c503_iw_handler_get_encode(struct net_device *netdev,
encoding->flags |= (index + 1);
}
- dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - enc.flags %08x "
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - enc.flags %08x "
"pointer %p len %d", netdev->name, encoding->flags,
encoding->pointer, encoding->length);
- dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - wepstate: enabled %s key_id %d "
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWENCODE - wepstate: enabled %s key_id %d "
"key_len %d auth_mode %s",
netdev->name, (dev->wep_enabled) ? "true" : "false",
dev->wep_key_id + 1, dev->wep_keys_len[dev->wep_key_id],
@@ -5487,16 +5474,16 @@ static int at76c503_iw_handler_get_encode(struct net_device *netdev,
return 0;
}
-static int at76c503_iw_handler_set_power(struct net_device *netdev,
+static int at76_iw_handler_set_power(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *prq, char *extra)
{
int err = -EIWCOMMIT;
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
- 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) {
dev->pm_mode = AT76_PM_OFF;
@@ -5522,11 +5509,11 @@ out:
return err;
}
-static int at76c503_iw_handler_get_power(struct net_device *netdev,
+static int at76_iw_handler_get_power(struct net_device *netdev,
struct iw_request_info *info,
struct iw_param *power, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
if ((power->disabled = (dev->pm_mode == AT76_PM_OFF)))
return 0;
@@ -5536,9 +5523,9 @@ static int at76c503_iw_handler_get_power(struct net_device *netdev,
}
power->flags |= IW_POWER_ALL_R;
- dbg(DBG_IOCTL, "%s: SIOCGIWPOWER - disabled %s flags x%x value x%x",
- netdev->name, (power->disabled) ? "true" : "false",
- power->flags, power->value);
+ at76_dbg(DBG_IOCTL, "%s: SIOCGIWPOWER - disabled %s flags x%x value x%x",
+ netdev->name, (power->disabled) ? "true" : "false",
+ power->flags, power->value);
return 0;
}
@@ -5547,16 +5534,16 @@ static int at76c503_iw_handler_get_power(struct net_device *netdev,
/*******************************************************************************
* Private IOCTLS
*/
-static int at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE
+static int at76_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int val = *((int *)name);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SHORT_PREAMBLE, %d",
- netdev->name, val);
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SHORT_PREAMBLE, %d",
+ netdev->name, val);
if (val < 0 || val > 2) {
/* allow value of 2 - in the win98 driver it stands
@@ -5569,7 +5556,7 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE
return ret;
}
-static int at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG
+static int at76_iw_handler_PRIV_IOCTL_SET_DEBUG
(struct net_device *netdev, struct iw_request_info *info,
struct iw_point *data, char *extra)
{
@@ -5583,17 +5570,17 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG
val = DBG_DEFAULTS;
}
- dbg_uc("%s: PRIV_IOCTL_SET_DEBUG input %d: %s -> x%x",
+ dbg("%s: PRIV_IOCTL_SET_DEBUG input %d: %s -> x%x",
netdev->name, data->length, extra, val);
} else {
val = DBG_DEFAULTS;
}
- dbg_uc("%s: PRIV_IOCTL_SET_DEBUG, old 0x%x new 0x%x",
+ dbg("%s: PRIV_IOCTL_SET_DEBUG, old 0x%x new 0x%x",
netdev->name, at76_debug, val);
/* jal: some more output to pin down lockups */
- dbg_uc("%s: netif running %d queue_stopped %d carrier_ok %d",
+ dbg("%s: netif running %d queue_stopped %d carrier_ok %d",
netdev->name,
netif_running(netdev),
netif_queue_stopped(netdev), netif_carrier_ok(netdev));
@@ -5603,18 +5590,18 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG
return 0;
}
-static int at76c503_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE
+static int at76_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int val = *((int *)name);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_POWERSAVE_MODE, %d (%s)",
- netdev->name, val,
- val == AT76_PM_OFF ? "active" : val == AT76_PM_ON ? "save" :
- val == AT76_PM_SMART ? "smart save" : "<invalid>");
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_POWERSAVE_MODE, %d (%s)",
+ netdev->name, val,
+ val == AT76_PM_OFF ? "active" : val == AT76_PM_ON ? "save" :
+ val == AT76_PM_SMART ? "smart save" : "<invalid>");
if (val < AT76_PM_OFF || val > AT76_PM_SMART) {
ret = -EINVAL;
} else {
@@ -5624,17 +5611,17 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE
return ret;
}
-static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES
+static int at76_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int mint = *((int *)name);
int maxt = *((int *)name + 1);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_TIMES - min %d max %d",
- netdev->name, mint, maxt);
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_TIMES - min %d max %d",
+ netdev->name, mint, maxt);
if (mint <= 0 || maxt <= 0 || mint > maxt) {
ret = -EINVAL;
} else {
@@ -5651,17 +5638,17 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES
return ret;
}
-static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_MODE
+static int at76_iw_handler_PRIV_IOCTL_SET_SCAN_MODE
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int val = *((int *)name);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_MODE - mode %s",
- netdev->name, (val = SCAN_TYPE_ACTIVE) ? "active" :
- (val = SCAN_TYPE_PASSIVE) ? "passive" : "<invalid>");
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_SCAN_MODE - mode %s",
+ netdev->name, (val = SCAN_TYPE_ACTIVE) ? "active" :
+ (val = SCAN_TYPE_PASSIVE) ? "passive" : "<invalid>");
if (val != SCAN_TYPE_ACTIVE && val != SCAN_TYPE_PASSIVE) {
ret = -EINVAL;
@@ -5672,7 +5659,7 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_MODE
return ret;
}
-static int set_iroaming(struct at76c503 *dev, int onoff)
+static int at76_set_iroaming(struct at76_priv *dev, int onoff)
{
int ret = 0;
@@ -5681,7 +5668,7 @@ static int set_iroaming(struct at76c503 *dev, int onoff)
dev->mib_buf.size = 1;
dev->mib_buf.index = IROAMING_OFFSET;
dev->mib_buf.data[0] = (dev->international_roaming ? 1 : 0);
- ret = set_mib(dev, &dev->mib_buf);
+ ret = at76_set_mib(dev, &dev->mib_buf);
if (ret < 0) {
err("%s: set_mib (intl_roaming_enable) failed: %d", dev->netdev->name, ret);
}
@@ -5689,24 +5676,24 @@ static int set_iroaming(struct at76c503 *dev, int onoff)
return ret;
}
-static int at76c503_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING
+static int at76_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int val = *((int *)name);
int ret = -EIWCOMMIT;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_INTL_ROAMING - mode %s",
- netdev->name, (val == IR_OFF) ? "off" :
- (val == IR_ON) ? "on" : "<invalid>");
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_INTL_ROAMING - mode %s",
+ netdev->name, (val == IR_OFF) ? "off" :
+ (val == IR_ON) ? "on" : "<invalid>");
if (val != IR_OFF && val != IR_ON) {
ret = -EINVAL;
} else {
if (dev->international_roaming != val) {
dev->international_roaming = val;
- set_iroaming(dev, val);
+ at76_set_iroaming(dev, val);
}
}
@@ -5716,36 +5703,36 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING
/**
* set_monitor_mode - sets dev->netdev->type
*/
-static void set_monitor_mode(struct at76c503 *dev, int use_prism)
+static void at76_set_monitor_mode(struct at76_priv *dev, int use_prism)
{
if (dev->iw_mode == IW_MODE_MONITOR) {
if (use_prism) {
- dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON: "
- "Prism headers ARE used", dev->netdev->name);
+ at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON: "
+ "Prism headers ARE used", dev->netdev->name);
dev->netdev->type = ARPHRD_IEEE80211_PRISM;
} else {
- dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON: "
- "Prism headers NOT used", dev->netdev->name);
+ at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON: "
+ "Prism headers NOT used", dev->netdev->name);
dev->netdev->type = ARPHRD_IEEE80211;
}
} else {
- dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF",
- dev->netdev->name);
+ at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF",
+ dev->netdev->name);
dev->netdev->type = ARPHRD_ETHER;
}
-} /* set_monitor_mode */
+} /* at76_set_monitor_mode */
-static int at76c503_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE
+static int at76_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE
(struct net_device *netdev, struct iw_request_info *info,
char *name, char *extra)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
int *params = ((int *)name);
int mode = params[0];
int channel = params[1];
int ret = 0;
- dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_MONITOR_MODE - mode %d ch %d",
+ at76_dbg(DBG_IOCTL, "%s: PRIV_IOCTL_SET_MONITOR_MODE - mode %d ch %d",
netdev->name, mode, channel);
if (mode != MM_OFF && mode != MM_ON && mode != MM_ON_NO_PRISM)
@@ -5771,7 +5758,7 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE
dev->iw_mode = IW_MODE_INFRA;
}
}
- set_monitor_mode(dev, dev->monitor_prism_header);
+ at76_set_monitor_mode(dev, dev->monitor_prism_header);
}
return ret;
@@ -5780,76 +5767,76 @@ static int at76c503_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE
/*******************************************************************************
* structure that advertises the iw handlers of this driver
*/
-static const iw_handler at76c503_handlers[] =
-{
- [SIOCSIWCOMMIT-SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_commit,
- [SIOCGIWNAME -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_name,
- [SIOCSIWFREQ -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_freq,
- [SIOCGIWFREQ -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_freq,
- [SIOCSIWMODE -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_mode,
- [SIOCGIWMODE -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_mode,
- [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_range,
- [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_spy,
- [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_spy,
- [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_thrspy,
- [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_thrspy,
- [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_wap,
- [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_wap,
- [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_scan,
- [SIOCGIWSCAN -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_scan,
- [SIOCSIWESSID -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_essid,
- [SIOCGIWESSID -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_essid,
- [SIOCSIWNICKN -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_nickname,
- [SIOCGIWNICKN -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_nickname,
- [SIOCSIWRATE -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_rate,
- [SIOCGIWRATE -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_rate,
- [SIOCSIWRTS -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_rts,
- [SIOCGIWRTS -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_rts,
- [SIOCSIWFRAG -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_frag,
- [SIOCGIWFRAG -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_frag,
- [SIOCGIWTXPOW -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_txpow,
- [SIOCSIWRETRY -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_retry,
- [SIOCGIWRETRY -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_retry,
- [SIOCSIWENCODE-SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_encode,
- [SIOCGIWENCODE-SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_encode,
- [SIOCSIWPOWER -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_set_power,
- [SIOCGIWPOWER -SIOCIWFIRST] = (iw_handler) at76c503_iw_handler_get_power,
+static const iw_handler at76_handlers[] =
+{
+ [SIOCSIWCOMMIT-SIOCIWFIRST] = (iw_handler) at76_iw_handler_commit,
+ [SIOCGIWNAME -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_name,
+ [SIOCSIWFREQ -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_freq,
+ [SIOCGIWFREQ -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_freq,
+ [SIOCSIWMODE -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_mode,
+ [SIOCGIWMODE -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_mode,
+ [SIOCGIWRANGE -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_range,
+ [SIOCSIWSPY -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_spy,
+ [SIOCGIWSPY -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_spy,
+ [SIOCSIWTHRSPY-SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_thrspy,
+ [SIOCGIWTHRSPY-SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_thrspy,
+ [SIOCSIWAP -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_wap,
+ [SIOCGIWAP -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_wap,
+ [SIOCSIWSCAN -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_scan,
+ [SIOCGIWSCAN -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_scan,
+ [SIOCSIWESSID -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_essid,
+ [SIOCGIWESSID -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_essid,
+ [SIOCSIWNICKN -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_nickname,
+ [SIOCGIWNICKN -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_nickname,
+ [SIOCSIWRATE -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_rate,
+ [SIOCGIWRATE -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_rate,
+ [SIOCSIWRTS -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_rts,
+ [SIOCGIWRTS -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_rts,
+ [SIOCSIWFRAG -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_frag,
+ [SIOCGIWFRAG -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_frag,
+ [SIOCGIWTXPOW -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_txpow,
+ [SIOCSIWRETRY -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_retry,
+ [SIOCGIWRETRY -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_retry,
+ [SIOCSIWENCODE-SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_encode,
+ [SIOCGIWENCODE-SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_encode,
+ [SIOCSIWPOWER -SIOCIWFIRST] = (iw_handler) at76_iw_handler_set_power,
+ [SIOCGIWPOWER -SIOCIWFIRST] = (iw_handler) at76_iw_handler_get_power,
};
/*structure that advertises the private iw handlers of this driver */
-static const iw_handler at76c503_priv_handlers[] = {
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE,
+static const iw_handler at76_priv_handlers[] = {
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_SHORT_PREAMBLE,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_DEBUG,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_DEBUG,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_POWERSAVE_MODE,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_SCAN_TIMES,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_SCAN_MODE,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_SCAN_MODE,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_INTL_ROAMING,
(iw_handler) NULL,
- (iw_handler) at76c503_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE,
+ (iw_handler) at76_iw_handler_PRIV_IOCTL_SET_MONITOR_MODE,
(iw_handler) NULL,
};
-static const struct iw_handler_def at76c503_handler_def =
+static const struct iw_handler_def at76_handler_def =
{
- .num_standard = ARRAY_SIZE(at76c503_handlers),
- .num_private = ARRAY_SIZE(at76c503_priv_handlers),
- .num_private_args = ARRAY_SIZE(at76c503_priv_args),
- .standard = (iw_handler *) at76c503_handlers,
- .private = (iw_handler *) at76c503_priv_handlers,
- .private_args = (struct iw_priv_args *) at76c503_priv_args,
- .get_wireless_stats = at76c503_get_wireless_stats,
+ .num_standard = ARRAY_SIZE(at76_handlers),
+ .num_private = ARRAY_SIZE(at76_priv_handlers),
+ .num_private_args = ARRAY_SIZE(at76_priv_args),
+ .standard = (iw_handler *) at76_handlers,
+ .private = (iw_handler *) at76_priv_handlers,
+ .private_args = (struct iw_priv_args *) at76_priv_args,
+ .get_wireless_stats = at76_get_wireless_stats,
};
-static void at76c503_ethtool_get_drvinfo(struct net_device *netdev,
+static void at76_ethtool_get_drvinfo(struct net_device *netdev,
struct ethtool_drvinfo *info)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
@@ -5865,18 +5852,18 @@ static void at76c503_ethtool_get_drvinfo(struct net_device *netdev,
dev->fw_version.patch, dev->fw_version.build);
}
-static u32 at76c503_ethtool_get_link(struct net_device *netdev)
+static u32 at76_ethtool_get_link(struct net_device *netdev)
{
- struct at76c503 *dev = netdev_priv(netdev);
+ struct at76_priv *dev = netdev_priv(netdev);
return dev->istate == CONNECTED;
}
-static struct ethtool_ops at76c503_ethtool_ops = {
- .get_drvinfo = at76c503_ethtool_get_drvinfo,
- .get_link = at76c503_ethtool_get_link,
+static struct ethtool_ops at76_ethtool_ops = {
+ .get_drvinfo = at76_ethtool_get_drvinfo,
+ .get_link = at76_ethtool_get_link,
};
-static void at76c503_delete_device(struct at76c503 *dev)
+static void at76_delete_device(struct at76_priv *dev)
{
int i;
@@ -5886,7 +5873,7 @@ static void at76c503_delete_device(struct at76c503 *dev)
/* signal to _stop() that the device is gone */
dev->device_unplugged = 1;
- dbg(DBG_PROC_ENTRY, "%s: ENTER",__FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: ENTER",__FUNCTION__);
if (dev->netdev_registered) {
unregister_netdev(dev->netdev);
@@ -5915,16 +5902,16 @@ static void at76c503_delete_device(struct at76c503 *dev)
usb_free_urb(dev->ctrl_urb);
}
- dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: unlinked urbs", __FUNCTION__);
if (dev->rx_skb != NULL)
kfree_skb(dev->rx_skb);
- free_bss_list(dev);
+ at76_free_bss_list(dev);
del_timer_sync(&dev->bss_list_timer);
if (dev->istate == CONNECTED) {
- iwevent_bss_disconnect(dev->netdev);
+ at76_iwevent_bss_disconnect(dev->netdev);
}
for (i = 0; i < NR_RX_DATA_BUF; i++)
@@ -5932,13 +5919,13 @@ static void at76c503_delete_device(struct at76c503 *dev)
dev_kfree_skb(dev->rx_data[i].skb);
dev->rx_data[i].skb = NULL;
}
- dbg(DBG_PROC_ENTRY, "%s: before freeing dev/netdev", __FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: before freeing dev/netdev", __FUNCTION__);
free_netdev(dev->netdev); /* dev is in net_dev */
- dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__);
}
-static int at76c503_alloc_urbs(struct at76c503 *dev)
+static int at76_alloc_urbs(struct at76_priv *dev)
{
struct usb_interface *interface = dev->interface;
struct usb_endpoint_descriptor *endpoint;
@@ -5946,16 +5933,16 @@ static int at76c503_alloc_urbs(struct at76c503 *dev)
int i, buffer_size;
struct usb_host_interface *iface_desc;
- dbg(DBG_PROC_ENTRY, "%s: ENTER", __FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: ENTER", __FUNCTION__);
- dbg(DBG_URB, "%s: NumEndpoints %d ", __FUNCTION__,
+ at76_dbg(DBG_URB, "%s: NumEndpoints %d ", __FUNCTION__,
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;
- dbg(DBG_URB, "%s: %d. endpoint: addr x%x attr x%x",
+ at76_dbg(DBG_URB, "%s: %d. endpoint: addr x%x attr x%x",
__FUNCTION__,
i, endpoint->bEndpointAddress, endpoint->bmAttributes);
@@ -5979,7 +5966,7 @@ static int at76c503_alloc_urbs(struct at76c503 *dev)
err("no free urbs available");
return -ENOMEM;
}
- buffer_size = sizeof(struct at76c503_tx_buffer) +
+ buffer_size = sizeof(struct at76_tx_buffer) +
MAX_PADDING_SIZE;
dev->bulk_out_size = buffer_size;
dev->bulk_out_endpointAddr = endpoint->bEndpointAddress;
@@ -5992,7 +5979,7 @@ static int at76c503_alloc_urbs(struct at76c503 *dev)
usb_sndbulkpipe(udev,
endpoint->bEndpointAddress),
dev->bulk_out_buffer, buffer_size,
- (usb_complete_t)at76c503_write_bulk_callback, dev);
+ (usb_complete_t)at76_write_bulk_callback, dev);
}
}
@@ -6007,20 +5994,20 @@ static int at76c503_alloc_urbs(struct at76c503 *dev)
return -ENOMEM;
}
- dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__);
+ at76_dbg(DBG_PROC_ENTRY, "%s: EXIT", __FUNCTION__);
return 0;
}
-static struct at76c503 *alloc_new_device(struct usb_device *udev,
+static struct at76_priv *alloc_new_device(struct usb_device *udev,
int board_type)
{
struct net_device *netdev;
- struct at76c503 *dev = NULL;
+ struct at76_priv *dev = NULL;
int i;
/* allocate memory for our device state and initialize it */
- netdev = alloc_etherdev(sizeof(struct at76c503));
+ netdev = alloc_etherdev(sizeof(struct at76_priv));
if (netdev == NULL) {
err("out of memory");
return NULL;
@@ -6039,15 +6026,15 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev,
init_timer(&dev->restart_timer);
dev->restart_timer.data = (unsigned long)dev;
- dev->restart_timer.function = restart_timeout;
+ dev->restart_timer.function = at76_restart_timeout;
init_timer(&dev->mgmt_timer);
dev->mgmt_timer.data = (unsigned long)dev;
- dev->mgmt_timer.function = mgmt_timeout;
+ dev->mgmt_timer.function = at76_mgmt_timeout;
init_timer(&dev->fw_dl_timer);
dev->fw_dl_timer.data = (unsigned long)dev;
- dev->fw_dl_timer.function = fw_dl_timeout;
+ dev->fw_dl_timer.function = at76_fw_dl_timeout;
spin_lock_init(&dev->mgmt_spinlock);
dev->next_mgmt_bulk = NULL;
@@ -6060,7 +6047,7 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev,
init_timer(&dev->bss_list_timer);
dev->bss_list_timer.data = (unsigned long)dev;
- dev->bss_list_timer.function = bss_list_timeout;
+ dev->bss_list_timer.function = at76_bss_list_timeout;
spin_lock_init(&dev->spy_spinlock);
@@ -6068,7 +6055,7 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev,
for (i = 0; i < NR_RX_DATA_BUF; i++)
dev->rx_data[i].skb = NULL;
- dev->tasklet.func = rx_tasklet;
+ dev->tasklet.func = at76_rx_tasklet;
dev->tasklet.data = (unsigned long)dev;
dev->board_type = board_type;
@@ -6077,17 +6064,17 @@ static struct at76c503 *alloc_new_device(struct usb_device *udev,
dev->pm_period = 0;
return dev;
-} /* alloc_new_device */
+} /* at76_alloc_new_device */
/**
- * init_new_device - continue device intialization after firmware download
+ * at76_init_new_device - continue device intialization after firmware download
*
* FIXME: We may have to move the register_netdev into alloc_new_device,
* because hotplug may try to configure the netdev _before_ (or parallel to)
* the download of firmware
*/
-static int init_new_device(struct at76c503 *dev)
+static int at76_init_new_device(struct at76_priv *dev)
{
struct net_device *netdev = dev->netdev;
int ret;
@@ -6097,14 +6084,14 @@ static int init_new_device(struct at76c503 *dev)
dev->interface = dev->udev->actconfig->interface[0];
- dbg(DBG_DEVSTART, "USB interface: %d endpoints",
- dev->interface->cur_altsetting->desc.bNumEndpoints);
+ at76_dbg(DBG_DEVSTART, "USB interface: %d endpoints",
+ dev->interface->cur_altsetting->desc.bNumEndpoints);
- if ((ret = at76c503_alloc_urbs(dev)) < 0)
+ if ((ret = at76_alloc_urbs(dev)) < 0)
goto error;
/* get firmware version */
- ret = get_mib(dev->udev, MIB_FW_VERSION, (u8*)&dev->fw_version, sizeof(dev->fw_version));
+ ret = at76_get_mib(dev->udev, MIB_FW_VERSION, (u8*)&dev->fw_version, sizeof(dev->fw_version));
if ((ret < 0) || ((dev->fw_version.major == 0) &&
(dev->fw_version.minor == 0) &&
(dev->fw_version.patch == 0) &&
@@ -6128,13 +6115,13 @@ static int init_new_device(struct at76c503 *dev)
dev->rx_data_fcs_len);
/* MAC address */
- ret = get_hw_config(dev);
+ ret = at76_get_hw_config(dev);
if (ret < 0) {
err("could not get MAC address");
goto error;
}
- dev->domain = getRegDomain(dev->regulatory_domain);
+ dev->domain = at76_get_reg_domain(dev->regulatory_domain);
/* init. netdev->dev_addr */
memcpy(netdev->dev_addr, dev->mac_addr, ETH_ALEN);
info("device's MAC %s, regulatory domain %s (id %d)",
@@ -6163,22 +6150,22 @@ static int init_new_device(struct at76c503 *dev)
dev->monitor_scan_max_time = monitor_scan_max_time;
netdev->flags &= ~IFF_MULTICAST; /* not yet or never */
- netdev->open = at76c503_open;
- netdev->stop = at76c503_stop;
- netdev->get_stats = at76c503_get_stats;
- netdev->ethtool_ops = &at76c503_ethtool_ops;
+ netdev->open = at76_open;
+ netdev->stop = at76_stop;
+ netdev->get_stats = at76_get_stats;
+ netdev->ethtool_ops = &at76_ethtool_ops;
/* Add pointers to enable iwspy support. */
dev->wireless_data.spy_data = &dev->spy_data;
netdev->wireless_data = &dev->wireless_data;
- netdev->hard_start_xmit = at76c503_tx;
- netdev->tx_timeout = at76c503_tx_timeout;
+ netdev->hard_start_xmit = at76_tx;
+ netdev->tx_timeout = at76_tx_timeout;
netdev->watchdog_timeo = 2 * HZ;
netdev->wireless_handlers =
- (struct iw_handler_def *)&at76c503_handler_def;
- netdev->set_multicast_list = at76c503_set_multicast;
- netdev->set_mac_address = at76c503_set_mac_address;
+ (struct iw_handler_def *)&at76_handler_def;
+ netdev->set_multicast_list = at76_set_multicast;
+ netdev->set_mac_address = at76_set_mac_address;
ret = register_netdev(dev->netdev);
if (ret) {
@@ -6194,19 +6181,19 @@ static int init_new_device(struct at76c503 *dev)
return 0;
error:
- at76c503_delete_device(dev);
+ at76_delete_device(dev);
return ret;
-} /* init_new_device */
+} /* at76_init_new_device */
/**
- * at76c503_get_fw_info - disassembles the firmware image
+ * at76_get_fw_info - disassembles the firmware image
*
* get version, str, internal and external fw part.
* returns 0 on success, < 0 on error
*/
-static int at76c503_get_fw_info(u8 *fw_data, int fw_size,
+static int at76_get_fw_info(u8 *fw_data, int fw_size,
u32 *board, u32 *version, char **str,
u8 **int_fw, int *int_fw_size,
u8 **ext_fw, int *ext_fw_size)
@@ -6214,7 +6201,7 @@ static int at76c503_get_fw_info(u8 *fw_data, int fw_size,
/* fw structure (all numbers are little_endian)
offset length description
0 4 crc 32 (seed ~0, no post, all gaps are zeros, header included)
- 4 4 board type (see at76c503.h)
+ 4 4 board type (see at76_usb.h)
8 4 version (major<<24|middle<<16|minor<<8|build)
c 4 offset of printable string (id) area from begin of image
(must be \0 terminated !)
@@ -6257,14 +6244,14 @@ static int at76c503_get_fw_info(u8 *fw_data, int fw_size,
}
/**
- * at76c503_do_probe - have a look at the firmware
+ * at76_do_probe - have a look at the firmware
*/
-static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
+static int at76_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
u32 board_type)
{
struct usb_interface *intf = udev->actconfig->interface[0];
int ret;
- struct at76c503 *dev = NULL;
+ struct at76_priv *dev = NULL;
int op_mode;
char *id_str;
u32 version;
@@ -6276,12 +6263,12 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
goto error;
}
- op_mode = get_op_mode(udev);
+ op_mode = at76_get_op_mode(udev);
usb_set_intfdata(intf, dev);
dev->interface = intf;
- dbg(DBG_DEVSTART, "opmode %d", op_mode);
+ at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
/* we get OPMODE_NONE with 2.4.23, SMC2662W-AR ???
we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
@@ -6296,49 +6283,49 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH &&
op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
- dbg(DBG_DEVSTART, "need to download firmware");
+ at76_dbg(DBG_DEVSTART, "need to download firmware");
/* disassem. the firmware */
if ((ret =
- at76c503_get_fw_info(fw_data, fw_size, &dev->board_type,
+ at76_get_fw_info(fw_data, fw_size, &dev->board_type,
&version, &id_str, &dev->intfw,
&dev->intfw_size, &dev->extfw,
&dev->extfw_size))) {
goto error;
}
- dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u#%u "
- "(int %x:%tx, ext %x:%tx)",
- dev->board_type, version >> 24, (version >> 16) & 0xff,
- (version >> 8) & 0xff, version & 0xff,
- dev->intfw_size, dev->intfw - fw_data,
- dev->extfw_size, dev->extfw - fw_data);
+ at76_dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u#%u "
+ "(int %x:%tx, ext %x:%tx)",
+ dev->board_type, version >> 24, (version >> 16) & 0xff,
+ (version >> 8) & 0xff, version & 0xff,
+ dev->intfw_size, dev->intfw - fw_data,
+ dev->extfw_size, dev->extfw - fw_data);
if (*id_str)
- dbg(DBG_DEVSTART, "firmware id %s",id_str);
+ at76_dbg(DBG_DEVSTART, "firmware id %s",id_str);
if (dev->board_type != board_type) {
err("inconsistent board types %u != %u",
board_type, dev->board_type);
- at76c503_delete_device(dev);
+ at76_delete_device(dev);
goto error;
}
/* download internal firmware part */
- dbg(DBG_DEVSTART, "downloading internal firmware");
- dev->istate = INTFW_DOWNLOAD;
- at76_defer_event(dev, AT76_DEVENT_INTERNAL_FW);
+ at76_dbg(DBG_DEVSTART, "downloading internal firmware");
+ dev->istate = INTFW_DOWNLOAD;
+ at76_defer_event(dev, AT76_DEVENT_INTERNAL_FW);
} else {
/* internal firmware already inside the device */
/* get firmware version to test if external firmware is loaded */
/* This works only for newer firmware, e.g. the Intersil 0.90.x
- says "control timeout on ep0in" and subsequent get_op_mode() fail
+ says "control timeout on ep0in" and subsequent at76_get_op_mode() fail
too :-( */
int force_fw_dwl = 0;
/* disassem. the firmware */
if ((ret =
- at76c503_get_fw_info(fw_data, fw_size, &dev->board_type,
+ at76_get_fw_info(fw_data, fw_size, &dev->board_type,
&version, &id_str, &dev->intfw,
&dev->intfw_size, &dev->extfw,
&dev->extfw_size))) {
@@ -6350,7 +6337,7 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
if (version >= ((0 << 24) | (100 << 16))
|| (op_mode == OPMODE_NORMAL_NIC_WITH_FLASH)) {
ret =
- get_mib(udev, MIB_FW_VERSION,
+ at76_get_mib(udev, MIB_FW_VERSION,
(u8 *) & dev->fw_version,
sizeof(dev->fw_version));
} else {
@@ -6364,24 +6351,24 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
&& (dev->fw_version.patch == 0)
&& (dev->fw_version.build == 0))) {
if (force_fw_dwl)
- dbg(DBG_DEVSTART, "forced download of external firmware part");
+ at76_dbg(DBG_DEVSTART, "forced download of external firmware part");
else
- dbg(DBG_DEVSTART, "cannot get firmware (ret %d) or all zeros "
- "- download external firmware", ret);
- dbg(DBG_DEVSTART,
- "firmware board %u version %u.%u.%u#%u "
- "(int %x:%tx, ext %x:%tx)", dev->board_type,
- version >> 24, (version >> 16) & 0xff,
- (version >> 8) & 0xff, version & 0xff,
- dev->intfw_size, dev->intfw - fw_data,
- dev->extfw_size, dev->extfw - fw_data);
+ at76_dbg(DBG_DEVSTART, "cannot get firmware (ret %d) or all zeros "
+ "- download external firmware", ret);
+ at76_dbg(DBG_DEVSTART,
+ "firmware board %u version %u.%u.%u#%u "
+ "(int %x:%tx, ext %x:%tx)", dev->board_type,
+ version >> 24, (version >> 16) & 0xff,
+ (version >> 8) & 0xff, version & 0xff,
+ dev->intfw_size, dev->intfw - fw_data,
+ dev->extfw_size, dev->extfw - fw_data);
if (*id_str)
- dbg(DBG_DEVSTART, "firmware id %s",id_str);
+ at76_dbg(DBG_DEVSTART, "firmware id %s",id_str);
if (dev->board_type != board_type) {
err("inconsistent board types %u != %u",
board_type, dev->board_type);
- at76c503_delete_device(dev);
+ at76_delete_device(dev);
goto error;
}
@@ -6389,7 +6376,7 @@ static int at76c503_do_probe(struct usb_device *udev, u8 *fw_data, int fw_size,
at76_defer_event(dev, AT76_DEVENT_EXTERNAL_FW);
} else {
dev->istate = INIT;
- if ((ret = init_new_device(dev)) < 0) {
+ if ((ret = at76_init_new_device(dev)) < 0) {
goto error;
}
}
@@ -6403,10 +6390,10 @@ error:
return ret;
}
-static int at76c50x_probe(struct usb_interface *interface,
- const struct usb_device_id *id)
+static int at76_probe(struct usb_interface *interface,
+ const struct usb_device_id *id)
{
- int retval;
+ int ret;
struct usb_device *udev;
int boardtype = (int)id->driver_info;
@@ -6415,51 +6402,51 @@ static int at76c50x_probe(struct usb_interface *interface,
udev = interface_to_usbdev(interface);
if (fw == NULL) {
- dbg(DBG_FW, "downloading firmware %s", fw_name);
- retval = request_firmware(&fw, fw_name, &udev->dev);
- if (retval == 0) {
- dbg(DBG_FW, "got it.");
+ at76_dbg(DBG_FW, "downloading firmware %s", fw_name);
+ ret = request_firmware(&fw, fw_name, &udev->dev);
+ if (ret == 0) {
+ at76_dbg(DBG_FW, "got it.");
} else {
err("firmware %s not found.", fw_name);
err("You may need to download the firmware from "
"https://developer.berlios.de/projects/at76c503a/");
- return retval;
+ return ret;
}
} else
- dbg(DBG_FW, "re-using previously loaded fw");
+ at76_dbg(DBG_FW, "re-using previously loaded fw");
- retval = at76c503_do_probe(udev, fw->data, fw->size, boardtype);
- return retval;
+ ret = at76_do_probe(udev, fw->data, fw->size, boardtype);
+ return ret;
}
-static void at76c50x_disconnect(struct usb_interface *interface)
+static void at76_disconnect(struct usb_interface *interface)
{
- struct at76c503 *ptr;
+ struct at76_priv *priv;
- ptr = usb_get_intfdata(interface);
+ priv = usb_get_intfdata(interface);
usb_set_intfdata(interface, NULL);
- info("%s disconnecting", ((struct at76c503 *)ptr)->netdev->name);
- at76c503_delete_device(ptr);
+ info("%s disconnecting", ((struct at76_priv *)priv)->netdev->name);
+ at76_delete_device(priv);
info(DRIVER_NAME " disconnected");
}
/* structure for registering this driver with the USB subsystem */
-static struct usb_driver module_usb = {
+static struct usb_driver at76_driver = {
.name = DRIVER_NAME,
- .probe = at76c50x_probe,
- .disconnect = at76c50x_disconnect,
+ .probe = at76_probe,
+ .disconnect = at76_disconnect,
.id_table = dev_table,
};
-static int __init mod_init(void)
+static int __init at76_mod_init(void)
{
int result;
info(DRIVER_DESC " " DRIVER_VERSION " loading");
/* register this driver with the USB subsystem */
- result = usb_register(&module_usb);
+ result = usb_register(&at76_driver);
if (result < 0) {
err("usb_register failed (status %d)", result);
}
@@ -6468,12 +6455,12 @@ static int __init mod_init(void)
return result;
}
-static void __exit mod_exit(void)
+static void __exit at76_mod_exit(void)
{
int i;
info(DRIVER_DESC " " DRIVER_VERSION " unloading");
- usb_deregister(&module_usb);
+ usb_deregister(&at76_driver);
for (i = 0; i < ARRAY_SIZE(firmwares); i++) {
if (firmwares[i].fw)
release_firmware(firmwares[i].fw);
@@ -6504,8 +6491,8 @@ MODULE_PARM_DESC(monitor_scan_min_time, "scan min channel time in MONITOR MODE (
module_param(monitor_scan_max_time, int, 0400);
MODULE_PARM_DESC(monitor_scan_max_time, "scan max channel time in MONITOR MODE (default: 600)");
-module_init(mod_init);
-module_exit(mod_exit);
+module_init(at76_mod_init);
+module_exit(at76_mod_exit);
MODULE_AUTHOR("Oliver Kurth <oku@masqmail.cx>");
MODULE_AUTHOR("Joerg Albert <joerg.albert@gmx.de>");
diff --git a/at76_usb.h b/at76_usb.h
index ad3d4a4..b0f5b15 100644
--- a/at76_usb.h
+++ b/at76_usb.h
@@ -19,8 +19,8 @@
* kept binary only). Thanks for that decision to Atmel!
*/
-#ifndef _AT76C503_H
-#define _AT76C503_H
+#ifndef _AT76_USB_H
+#define _AT76_USB_H
#include <net/ieee80211.h>
@@ -168,7 +168,7 @@ struct hwcfg_intersil {
#define WEP_SMALL_KEY_LEN (40/8)
#define WEP_LARGE_KEY_LEN (104/8)
-struct at76c503_card_config {
+struct at76_card_config {
u8 exclude_unencrypted;
u8 promiscuous_mode;
u8 short_retry_limit;
@@ -187,16 +187,16 @@ struct at76c503_card_config {
__le16 beacon_period;
} __attribute__ ((packed));
-struct at76c503_command {
+struct at76_command {
u8 cmd;
u8 reserved;
__le16 size;
} __attribute__ ((packed));
/* the length of the Atmel firmware specific rx header before IEEE 802.11 starts */
-#define AT76C503_RX_HDRLEN offsetof(struct at76c503_rx_buffer, packet)
+#define AT76_RX_HDRLEN offsetof(struct at76_rx_buffer, packet)
-struct at76c503_rx_buffer {
+struct at76_rx_buffer {
__le16 wlength;
u8 rx_rate;
u8 newbss;
@@ -209,9 +209,9 @@ struct at76c503_rx_buffer {
} __attribute__ ((packed));
/* the length of the Atmel firmware specific tx header before IEEE 802.11 starts */
-#define AT76C503_TX_HDRLEN offsetof(struct at76c503_tx_buffer, packet)
+#define AT76_TX_HDRLEN offsetof(struct at76_tx_buffer, packet)
-struct at76c503_tx_buffer {
+struct at76_tx_buffer {
__le16 wlength;
u8 tx_rate;
u8 padding;
@@ -223,7 +223,7 @@ struct at76c503_tx_buffer {
#define SCAN_TYPE_ACTIVE 0
#define SCAN_TYPE_PASSIVE 1
-struct at76c503_start_scan {
+struct at76_start_scan {
u8 bssid[ETH_ALEN];
u8 essid[32];
u8 scan_type;
@@ -235,7 +235,7 @@ struct at76c503_start_scan {
u8 international_scan;
} __attribute__ ((packed));
-struct at76c503_start_bss {
+struct at76_start_bss {
u8 bssid[ETH_ALEN];
u8 essid[32];
u8 bss_type;
@@ -244,7 +244,7 @@ struct at76c503_start_bss {
u8 reserved[3];
} __attribute__ ((packed));
-struct at76c503_join {
+struct at76_join {
u8 bssid[ETH_ALEN];
u8 essid[32];
u8 bss_type;
@@ -459,7 +459,7 @@ struct rx_data_buf {
/* how often do we try to submit a rx urb until giving up */
#define NR_SUBMIT_RX_TRIES 8
-struct at76c503 {
+struct at76_priv {
struct usb_device *udev; /* USB device pointer */
struct net_device *netdev; /* net device pointer */
struct net_device_stats stats;
@@ -541,7 +541,7 @@ struct at76c503 {
spinlock_t mgmt_spinlock; /* this spinlock protects access to
next_mgmt_bulk */
- struct at76c503_tx_buffer *next_mgmt_bulk; /* pending management msg to
+ struct at76_tx_buffer *next_mgmt_bulk; /* pending management msg to
send via bulk out */
enum infra_state istate;
enum {
@@ -583,7 +583,7 @@ struct at76c503 {
u8 low_power_values[14];
u8 normal_power_values[14];
- struct at76c503_card_config card_config;
+ struct at76_card_config card_config;
struct mib_fw_version fw_version;
int rx_data_fcs_len; /* length of the trailing FCS
@@ -597,7 +597,7 @@ struct at76c503 {
until device is reset */
int extfw_size;
int intfw_size;
- /* these point into a buffer managed by at76c503-xxx.o, no need to dealloc */
+ /* these point into a buffer managed by the firmware dl functions, no need to dealloc */
u8 *extfw; /* points to external firmware part, extfw_size bytes long */
u8 *intfw; /* points to internal firmware part, intfw_size bytes long */
unsigned int device_unplugged:1;
@@ -663,20 +663,20 @@ struct p80211msg {
#define BEACON_MAX_DATA_LENGTH 1500
#define DISASSOC_FRAME_SIZE \
- (AT76C503_TX_HDRLEN + sizeof(struct ieee80211_disassoc))
+ (AT76_TX_HDRLEN + sizeof(struct ieee80211_disassoc))
/* the maximum size of an AssocReq packet */
#define ASSOCREQ_MAX_SIZE \
- (AT76C503_TX_HDRLEN + sizeof(struct ieee80211_assoc_request) + \
+ (AT76_TX_HDRLEN + sizeof(struct ieee80211_assoc_request) + \
1+1+IW_ESSID_MAX_SIZE + 1+1+4)
/* the maximum size of an AssocReq packet */
#define REASSOCREQ_MAX_SIZE \
- (AT76C503_TX_HDRLEN + sizeof(struct ieee80211_reassoc_request) + \
+ (AT76_TX_HDRLEN + sizeof(struct ieee80211_reassoc_request) + \
1+1+IW_ESSID_MAX_SIZE + 1+1+4)
/* for shared secret auth, add the challenge text size */
-#define AUTH_FRAME_SIZE (AT76C503_TX_HDRLEN + sizeof(struct ieee80211_auth))
+#define AUTH_FRAME_SIZE (AT76_TX_HDRLEN + sizeof(struct ieee80211_auth))
/* how often do we re-try these packets ? */
#define AUTH_RETRIES 3
@@ -743,21 +743,16 @@ static const u8 hw_rates[4] = { 0x82, 0x84, 0x0b, 0x16 };
#define DBG_DEFAULTS 0
/* Use our own dbg macro */
-#undef dbg
-#define dbg(bits, format, arg...) \
+#define at76_dbg(bits, format, arg...) \
do { \
if (at76_debug & (bits)) \
printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg);\
} while (0)
-/* uncond. debug output */
-#define dbg_uc(format, arg...) \
- printk(KERN_DEBUG __FILE__ ": " format "\n" , ## arg)
-
-#define assert(x) \
+#define at76_assert(x) \
do {\
if (!(x)) \
err("%d: assertion " #x " failed", __LINE__);\
} while (0)
-#endif /* _AT76C503_H */
+#endif /* _AT76_USB_H */