diff options
Diffstat (limited to 'drivers/net/wireless/libertas/debugfs.c')
-rw-r--r-- | drivers/net/wireless/libertas/debugfs.c | 334 |
1 files changed, 162 insertions, 172 deletions
diff --git a/drivers/net/wireless/libertas/debugfs.c b/drivers/net/wireless/libertas/debugfs.c index debefb6eab7..b62ebca9ab6 100644 --- a/drivers/net/wireless/libertas/debugfs.c +++ b/drivers/net/wireless/libertas/debugfs.c @@ -103,7 +103,6 @@ static ssize_t libertas_sleepparams_write(struct file *file, wlan_private *priv = file->private_data; ssize_t buf_size, res; int p1, p2, p3, p4, p5, p6; - struct sleep_params sp; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; @@ -117,14 +116,12 @@ static ssize_t libertas_sleepparams_write(struct file *file, res = -EFAULT; goto out_unlock; } - sp.sp_error = p1; - sp.sp_offset = p2; - sp.sp_stabletime = p3; - sp.sp_calcontrol = p4; - sp.sp_extsleepclk = p5; - sp.sp_reserved = p6; - - memcpy(&priv->adapter->sp, &sp, sizeof(struct sleep_params)); + priv->adapter->sp.sp_error = p1; + priv->adapter->sp.sp_offset = p2; + priv->adapter->sp.sp_stabletime = p3; + priv->adapter->sp.sp_calcontrol = p4; + priv->adapter->sp.sp_extsleepclk = p5; + priv->adapter->sp.sp_reserved = p6; res = libertas_prepare_and_send_command(priv, cmd_802_11_sleep_params, @@ -408,8 +405,8 @@ static int libertas_event_initcmd(wlan_private *priv, void **response_buf, (*cmdnode)->cmdflags |= CMD_F_HOSTCMD; (*cmdnode)->cmdwaitqwoken = 0; *cmd = (struct cmd_ds_command *)(*cmdnode)->bufvirtualaddr; - (*cmd)->command = cmd_802_11_subscribe_event; - (*cmd)->seqnum = ++priv->adapter->seqnum; + (*cmd)->command = cpu_to_le16(cmd_802_11_subscribe_event); + (*cmd)->seqnum = cpu_to_le16(++priv->adapter->seqnum); (*cmd)->result = 0; return 0; } @@ -435,26 +432,25 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -462,17 +458,17 @@ static ssize_t libertas_lowrssi_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_rssithreshold *Lowrssi; - case TLV_TYPE_RSSI_LOW: - Lowrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - Lowrssi->rssivalue, - Lowrssi->rssifreq, - (event->events & 0x0001)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_RSSI_LOW): + Lowrssi = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d %d %d\n", + Lowrssi->rssivalue, + Lowrssi->rssifreq, + (event->events & cpu_to_le16(0x0001))?1:0); default: cmd_len += sizeof(struct mrvlietypes_snrthreshold); break; @@ -500,21 +496,20 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) return res; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); return 0; } @@ -526,7 +521,7 @@ static u16 libertas_get_events_bitmap(wlan_private *priv) } event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - event_bitmap = event->events; + event_bitmap = le16_to_cpu(event->events); kfree(response_buf); return event_bitmap; } @@ -567,7 +562,7 @@ static ssize_t libertas_lowrssi_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_rssithreshold)); @@ -576,30 +571,30 @@ static ssize_t libertas_lowrssi_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); rssi_threshold->header.type = cpu_to_le16(0x0104); - rssi_threshold->header.len = 2; - rssi_threshold->rssivalue = cpu_to_le16(value); - rssi_threshold->rssifreq = cpu_to_le16(freq); + rssi_threshold->header.len = cpu_to_le16(2); + rssi_threshold->rssivalue = value; + rssi_threshold->rssifreq = freq; event_bitmap |= subscribed ? 0x0001 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -633,27 +628,26 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -661,17 +655,17 @@ static ssize_t libertas_lowsnr_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_snrthreshold *LowSnr; - case TLV_TYPE_SNR_LOW: - LowSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - LowSnr->snrvalue, - LowSnr->snrfreq, - (event->events & 0x0002)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_SNR_LOW): + LowSnr = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d %d %d\n", + LowSnr->snrvalue, + LowSnr->snrfreq, + (event->events & cpu_to_le16(0x0002))?1:0); default: cmd_len += sizeof(struct mrvlietypes_snrthreshold); break; @@ -721,7 +715,7 @@ static ssize_t libertas_lowsnr_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_snrthreshold)); @@ -729,30 +723,30 @@ static ssize_t libertas_lowsnr_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_LOW); - snr_threshold->header.len = 2; - snr_threshold->snrvalue = cpu_to_le16(value); - snr_threshold->snrfreq = cpu_to_le16(freq); + snr_threshold->header.len = cpu_to_le16(2); + snr_threshold->snrvalue = value; + snr_threshold->snrfreq = freq; event_bitmap |= subscribed ? 0x0002 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -787,27 +781,26 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -815,17 +808,17 @@ static ssize_t libertas_failcount_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_failurecount *failcount; - case TLV_TYPE_FAILCOUNT: - failcount = (struct mrvlietypes_failurecount *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - failcount->failvalue, - failcount->Failfreq, - (event->events & 0x0004)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_FAILCOUNT): + failcount = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d %d %d\n", + failcount->failvalue, + failcount->Failfreq, + (event->events & cpu_to_le16(0x0004))?1:0); default: cmd_len += sizeof(struct mrvlietypes_failurecount); break; @@ -874,7 +867,7 @@ static ssize_t libertas_failcount_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_failurecount)); @@ -882,30 +875,30 @@ static ssize_t libertas_failcount_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; failcount = (struct mrvlietypes_failurecount *)(ptr); failcount->header.type = cpu_to_le16(TLV_TYPE_FAILCOUNT); - failcount->header.len = 2; - failcount->failvalue = cpu_to_le16(value); - failcount->Failfreq = cpu_to_le16(freq); + failcount->header.len = cpu_to_le16(2); + failcount->failvalue = value; + failcount->Failfreq = freq; event_bitmap |= subscribed ? 0x0004 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = (struct cmd_ds_command *)response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -939,27 +932,26 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); free_page(addr); kfree(response_buf); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); free_page(addr); kfree(response_buf); @@ -967,16 +959,16 @@ static ssize_t libertas_bcnmiss_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_beaconsmissed *bcnmiss; - case TLV_TYPE_BCNMISS: - bcnmiss = (struct mrvlietypes_beaconsmissed *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", - bcnmiss->beaconmissed, - (event->events & 0x0008)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_BCNMISS): + bcnmiss = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d N/A %d\n", + bcnmiss->beaconmissed, + (event->events & cpu_to_le16(0x0008))?1:0); default: cmd_len += sizeof(struct mrvlietypes_beaconsmissed); break; @@ -1026,7 +1018,7 @@ static ssize_t libertas_bcnmiss_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_beaconsmissed)); @@ -1034,29 +1026,29 @@ static ssize_t libertas_bcnmiss_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; bcnmiss = (struct mrvlietypes_beaconsmissed *)(ptr); bcnmiss->header.type = cpu_to_le16(TLV_TYPE_BCNMISS); - bcnmiss->header.len = 2; - bcnmiss->beaconmissed = cpu_to_le16(value); + bcnmiss->header.len = cpu_to_le16(2); + bcnmiss->beaconmissed = value; event_bitmap |= subscribed ? 0x0008 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); free_page(addr); kfree(response_buf); @@ -1090,27 +1082,26 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -1118,17 +1109,17 @@ static ssize_t libertas_highrssi_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_rssithreshold *Highrssi; - case TLV_TYPE_RSSI_HIGH: - Highrssi = (struct mrvlietypes_rssithreshold *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - Highrssi->rssivalue, - Highrssi->rssifreq, - (event->events & 0x0010)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_RSSI_HIGH): + Highrssi = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d %d %d\n", + Highrssi->rssivalue, + Highrssi->rssifreq, + (event->events & cpu_to_le16(0x0010))?1:0); default: cmd_len += sizeof(struct mrvlietypes_snrthreshold); break; @@ -1178,7 +1169,7 @@ static ssize_t libertas_highrssi_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_rssithreshold)); @@ -1186,29 +1177,29 @@ static ssize_t libertas_highrssi_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; rssi_threshold = (struct mrvlietypes_rssithreshold *)(ptr); rssi_threshold->header.type = cpu_to_le16(TLV_TYPE_RSSI_HIGH); - rssi_threshold->header.len = 2; - rssi_threshold->rssivalue = cpu_to_le16(value); - rssi_threshold->rssifreq = cpu_to_le16(freq); + rssi_threshold->header.len = cpu_to_le16(2); + rssi_threshold->rssivalue = value; + rssi_threshold->rssifreq = freq; event_bitmap |= subscribed ? 0x0010 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); return 0; @@ -1241,27 +1232,26 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, } event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_get; - pcmdptr->size = - cpu_to_le16(sizeof(struct cmd_ds_802_11_subscribe_event) + S_DS_GEN); + event->action = cpu_to_le16(cmd_act_get); + pcmdptr->size = cpu_to_le16(sizeof(*event) + S_DS_GEN); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); @@ -1269,17 +1259,17 @@ static ssize_t libertas_highsnr_read(struct file *file, char __user *userbuf, } cmd_len = S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event); - event = (struct cmd_ds_802_11_subscribe_event *)(response_buf + S_DS_GEN); - while (cmd_len < pcmdptr->size) { - struct mrvlietypesheader *header = (struct mrvlietypesheader *)(response_buf + cmd_len); - switch(header->type) { + event = (void *)(response_buf + S_DS_GEN); + while (cmd_len < le16_to_cpu(pcmdptr->size)) { + struct mrvlietypesheader *header = (void *)(response_buf + cmd_len); + switch (header->type) { struct mrvlietypes_snrthreshold *HighSnr; - case TLV_TYPE_SNR_HIGH: - HighSnr = (struct mrvlietypes_snrthreshold *)(response_buf + cmd_len); - pos += snprintf(buf+pos, len-pos, "%d %d %d\n", - HighSnr->snrvalue, - HighSnr->snrfreq, - (event->events & 0x0020)?1:0); + case __constant_cpu_to_le16(TLV_TYPE_SNR_HIGH): + HighSnr = (void *)(response_buf + cmd_len); + pos += snprintf(buf+pos, len-pos, "%d %d %d\n", + HighSnr->snrvalue, + HighSnr->snrfreq, + (event->events & cpu_to_le16(0x0020))?1:0); default: cmd_len += sizeof(struct mrvlietypes_snrthreshold); break; @@ -1329,7 +1319,7 @@ static ssize_t libertas_highsnr_write(struct file *file, goto out_unlock; event = &pcmdptr->params.subscribe_event; - event->action = cmd_act_set; + event->action = cpu_to_le16(cmd_act_set); pcmdptr->size = cpu_to_le16(S_DS_GEN + sizeof(struct cmd_ds_802_11_subscribe_event) + sizeof(struct mrvlietypes_snrthreshold)); @@ -1337,30 +1327,30 @@ static ssize_t libertas_highsnr_write(struct file *file, ptr = (u8*) pcmdptr+cmd_len; snr_threshold = (struct mrvlietypes_snrthreshold *)(ptr); snr_threshold->header.type = cpu_to_le16(TLV_TYPE_SNR_HIGH); - snr_threshold->header.len = 2; - snr_threshold->snrvalue = cpu_to_le16(value); - snr_threshold->snrfreq = cpu_to_le16(freq); + snr_threshold->header.len = cpu_to_le16(2); + snr_threshold->snrvalue = value; + snr_threshold->snrfreq = freq; event_bitmap |= subscribed ? 0x0020 : 0x0; - event->events = event_bitmap; + event->events = cpu_to_le16(event_bitmap); libertas_queue_cmd(adapter, pcmdnode, 1); wake_up_interruptible(&priv->mainthread.waitq); /* Sleep until response is generated by FW */ wait_event_interruptible(pcmdnode->cmdwait_q, - pcmdnode->cmdwaitqwoken); + pcmdnode->cmdwaitqwoken); pcmdptr = response_buf; if (pcmdptr->result) { - lbs_pr_err("%s: fail, result=%d\n", __FUNCTION__, - pcmdptr->result); + lbs_pr_err("%s: fail, result=%d\n", __func__, + le16_to_cpu(pcmdptr->result)); kfree(response_buf); free_page(addr); return 0; } - if (pcmdptr->command != cmd_ret_802_11_subscribe_event) { + if (pcmdptr->command != cpu_to_le16(cmd_ret_802_11_subscribe_event)) { lbs_pr_err("command response incorrect!\n"); kfree(response_buf); free_page(addr); |