aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/wlan-ng
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/wlan-ng')
-rw-r--r--drivers/staging/wlan-ng/cfg80211.c41
-rw-r--r--drivers/staging/wlan-ng/hfa384x.h5
-rw-r--r--drivers/staging/wlan-ng/hfa384x_usb.c171
-rw-r--r--drivers/staging/wlan-ng/p80211conv.c132
-rw-r--r--drivers/staging/wlan-ng/p80211netdev.c8
-rw-r--r--drivers/staging/wlan-ng/p80211wep.c10
-rw-r--r--drivers/staging/wlan-ng/prism2fw.c6
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.c2
-rw-r--r--drivers/staging/wlan-ng/prism2mgmt.h1
-rw-r--r--drivers/staging/wlan-ng/prism2mib.c36
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c31
-rw-r--r--drivers/staging/wlan-ng/prism2usb.c20
12 files changed, 157 insertions, 306 deletions
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 8c1e3f06a215..8bad018eda47 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -73,13 +73,13 @@ static int prism2_domibset_uint32(wlandevice_t *wlandev, u32 did, u32 data)
{
struct p80211msg_dot11req_mibset msg;
p80211item_uint32_t *mibitem =
- (p80211item_uint32_t *) &msg.mibattribute.data;
+ (p80211item_uint32_t *)&msg.mibattribute.data;
msg.msgcode = DIDmsg_dot11req_mibset;
mibitem->did = did;
mibitem->data = data;
- return p80211req_dorequest(wlandev, (u8 *) &msg);
+ return p80211req_dorequest(wlandev, (u8 *)&msg);
}
static int prism2_domibset_pstr32(wlandevice_t *wlandev,
@@ -87,14 +87,14 @@ static int prism2_domibset_pstr32(wlandevice_t *wlandev,
{
struct p80211msg_dot11req_mibset msg;
p80211item_pstr32_t *mibitem =
- (p80211item_pstr32_t *) &msg.mibattribute.data;
+ (p80211item_pstr32_t *)&msg.mibattribute.data;
msg.msgcode = DIDmsg_dot11req_mibset;
mibitem->did = did;
mibitem->data.len = len;
memcpy(mibitem->data.data, data, len);
- return p80211req_dorequest(wlandev, (u8 *) &msg);
+ return p80211req_dorequest(wlandev, (u8 *)&msg);
}
/* The interface functions, called by the cfg80211 layer */
@@ -239,7 +239,9 @@ static int prism2_del_key(struct wiphy *wiphy, struct net_device *dev,
int result = 0;
/* There is no direct way in the hardware (AFAIK) of removing
- a key, so we will cheat by setting the key to a bogus value */
+ * a key, so we will cheat by setting the key to a bogus value
+ */
+
/* send key to driver */
switch (key_index) {
case 0:
@@ -315,7 +317,7 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
if (wlandev->mlmerequest == NULL)
return -EOPNOTSUPP;
- result = wlandev->mlmerequest(wlandev, (struct p80211msg *) &quality);
+ result = wlandev->mlmerequest(wlandev, (struct p80211msg *)&quality);
if (result == 0) {
sinfo->txrate.legacy = quality.txrate.data;
@@ -387,7 +389,7 @@ static int prism2_scan(struct wiphy *wiphy,
msg1.maxchanneltime.data = 250;
msg1.minchanneltime.data = 200;
- result = p80211req_dorequest(wlandev, (u8 *) &msg1);
+ result = p80211req_dorequest(wlandev, (u8 *)&msg1);
if (result) {
err = prism2_result2err(msg1.resultcode.data);
goto exit;
@@ -402,7 +404,7 @@ static int prism2_scan(struct wiphy *wiphy,
msg2.msgcode = DIDmsg_dot11req_scan_results;
msg2.bssindex.data = i;
- result = p80211req_dorequest(wlandev, (u8 *) &msg2);
+ result = p80211req_dorequest(wlandev, (u8 *)&msg2);
if ((result != 0) ||
(msg2.resultcode.data != P80211ENUM_resultcode_success)) {
break;
@@ -417,7 +419,7 @@ static int prism2_scan(struct wiphy *wiphy,
bss = cfg80211_inform_bss(wiphy,
ieee80211_get_channel(wiphy, freq),
CFG80211_BSS_FTYPE_UNKNOWN,
- (const u8 *) &(msg2.bssid.data.data),
+ (const u8 *)&(msg2.bssid.data.data),
msg2.timestamp.data, msg2.capinfo.data,
msg2.beaconperiod.data,
ie_buf,
@@ -558,12 +560,12 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
(u8 *)sme->key);
if (result)
goto exit;
-
}
/* Assume we should set privacy invoked and exclude unencrypted
- We could possibly use sme->privacy here, but the assumption
- seems reasonable anyway */
+ * We could possible use sme->privacy here, but the assumption
+ * seems reasonable anyways
+ */
result = prism2_domibset_uint32(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_true);
@@ -578,7 +580,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
} else {
/* Assume we should unset privacy invoked
- and exclude unencrypted */
+ * and exclude unencrypted
+ */
result = prism2_domibset_uint32(wlandev,
DIDmib_dot11smt_dot11PrivacyTable_dot11PrivacyInvoked,
P80211ENUM_truth_false);
@@ -590,17 +593,17 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
P80211ENUM_truth_false);
if (result)
goto exit;
-
}
/* Now do the actual join. Note there is no way that I can
- see to request a specific bssid */
+ * see to request a specific bssid
+ */
msg_join.msgcode = DIDmsg_lnxreq_autojoin;
memcpy(msg_join.ssid.data.data, sme->ssid, length);
msg_join.ssid.data.len = length;
- result = p80211req_dorequest(wlandev, (u8 *) &msg_join);
+ result = p80211req_dorequest(wlandev, (u8 *)&msg_join);
exit:
if (result)
@@ -623,7 +626,7 @@ static int prism2_disconnect(struct wiphy *wiphy, struct net_device *dev,
memcpy(msg_join.ssid.data.data, "---", 3);
msg_join.ssid.data.len = 3;
- result = p80211req_dorequest(wlandev, (u8 *) &msg_join);
+ result = p80211req_dorequest(wlandev, (u8 *)&msg_join);
if (result)
err = -EFAULT;
@@ -679,12 +682,12 @@ static int prism2_get_tx_power(struct wiphy *wiphy, struct wireless_dev *wdev,
int result;
int err = 0;
- mibitem = (p80211item_uint32_t *) &msg.mibattribute.data;
+ mibitem = (p80211item_uint32_t *)&msg.mibattribute.data;
msg.msgcode = DIDmsg_dot11req_mibget;
mibitem->did =
DIDmib_dot11phy_dot11PhyTxPowerTable_dot11CurrentTxPowerLevel;
- result = p80211req_dorequest(wlandev, (u8 *) &msg);
+ result = p80211req_dorequest(wlandev, (u8 *)&msg);
if (result) {
err = -EFAULT;
diff --git a/drivers/staging/wlan-ng/hfa384x.h b/drivers/staging/wlan-ng/hfa384x.h
index 8dfe4381ddf7..cec6d0ba3b65 100644
--- a/drivers/staging/wlan-ng/hfa384x.h
+++ b/drivers/staging/wlan-ng/hfa384x.h
@@ -1360,7 +1360,6 @@ void hfa384x_destroy(hfa384x_t *hw);
int
hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis);
-int hfa384x_drvr_commtallies(hfa384x_t *hw);
int hfa384x_drvr_disable(hfa384x_t *hw, u16 macport);
int hfa384x_drvr_enable(hfa384x_t *hw, u16 macport);
int hfa384x_drvr_flashdl_enable(hfa384x_t *hw);
@@ -1391,10 +1390,6 @@ static inline int hfa384x_drvr_setconfig16(hfa384x_t *hw, u16 rid, u16 val)
}
int
-hfa384x_drvr_getconfig_async(hfa384x_t *hw,
- u16 rid, ctlx_usercb_t usercb, void *usercb_data);
-
-int
hfa384x_drvr_setconfig_async(hfa384x_t *hw,
u16 rid,
void *buf,
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 7551ac25d89d..21a92df85931 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -126,8 +126,6 @@
#include <linux/usb.h>
#include <linux/byteorder/generic.h>
-#define SUBMIT_URB(u, f) usb_submit_urb(u, f)
-
#include "p80211types.h"
#include "p80211hdr.h"
#include "p80211mgmt.h"
@@ -145,11 +143,11 @@ enum cmd_mode {
DOASYNC
};
-#define THROTTLE_JIFFIES (HZ/8)
+#define THROTTLE_JIFFIES (HZ / 8)
#define URB_ASYNC_UNLINK 0
#define USB_QUEUE_BULK 0
-#define ROUNDUP64(a) (((a)+63)&~63)
+#define ROUNDUP64(a) (((a) + 63) & ~63)
#ifdef DEBUG_USB
static void dbprint_urb(struct urb *urb);
@@ -213,8 +211,6 @@ unlocked_usbctlx_cancel_async(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx);
static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx);
-static void hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx);
-
static int
usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp,
hfa384x_cmdresult_t *result);
@@ -332,7 +328,7 @@ static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
int result;
skb = dev_alloc_skb(sizeof(hfa384x_usbin_t));
- if (skb == NULL) {
+ if (!skb) {
result = -ENOMEM;
goto done;
}
@@ -348,7 +344,7 @@ static int submit_rx_urb(hfa384x_t *hw, gfp_t memflags)
result = -ENOLINK;
if (!hw->wlandev->hwremoved &&
!test_bit(WORK_RX_HALT, &hw->usb_flags)) {
- result = SUBMIT_URB(&hw->rx_urb, memflags);
+ result = usb_submit_urb(&hw->rx_urb, memflags);
/* Check whether we need to reset the RX pipe */
if (result == -EPIPE) {
@@ -397,7 +393,7 @@ static int submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags)
if (netif_running(netdev)) {
if (!hw->wlandev->hwremoved &&
!test_bit(WORK_TX_HALT, &hw->usb_flags)) {
- result = SUBMIT_URB(tx_urb, memflags);
+ result = usb_submit_urb(tx_urb, memflags);
/* Test whether we need to reset the TX pipe */
if (result == -EPIPE) {
@@ -816,43 +812,6 @@ static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
}
}
-/*----------------------------------------------------------------
-* hfa384x_cb_rrid
-*
-* CTLX completion handler for async RRID type control exchanges.
-*
-* Note: If the handling is changed here, it should probably be
-* changed in dorrid as well.
-*
-* Arguments:
-* hw hw struct
-* ctlx completed CTLX
-*
-* Returns:
-* nothing
-*
-* Side effects:
-*
-* Call context:
-* interrupt
-----------------------------------------------------------------*/
-static void hfa384x_cb_rrid(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
-{
- if (ctlx->usercb != NULL) {
- hfa384x_rridresult_t rridresult;
-
- if (ctlx->state != CTLX_COMPLETE) {
- memset(&rridresult, 0, sizeof(rridresult));
- rridresult.rid = le16_to_cpu(ctlx->outbuf.rridreq.rid);
- } else {
- usbctlx_get_rridresult(&ctlx->inbuf.rridresp,
- &rridresult);
- }
-
- ctlx->usercb(hw, &rridresult, ctlx->usercb_data);
- }
-}
-
static inline int hfa384x_docmd_wait(hfa384x_t *hw, hfa384x_metacmd_t *cmd)
{
return hfa384x_docmd(hw, DOWAIT, cmd, NULL, NULL, NULL);
@@ -1012,7 +971,6 @@ int hfa384x_cmd_initialize(hfa384x_t *hw)
----------------------------------------------------------------*/
int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
{
- int result = 0;
hfa384x_metacmd_t cmd;
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_DISABLE) |
@@ -1021,9 +979,7 @@ int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
cmd.parm1 = 0;
cmd.parm2 = 0;
- result = hfa384x_docmd_wait(hw, &cmd);
-
- return result;
+ return hfa384x_docmd_wait(hw, &cmd);
}
/*----------------------------------------------------------------
@@ -1048,7 +1004,6 @@ int hfa384x_cmd_disable(hfa384x_t *hw, u16 macport)
----------------------------------------------------------------*/
int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
{
- int result = 0;
hfa384x_metacmd_t cmd;
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_ENABLE) |
@@ -1057,9 +1012,7 @@ int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
cmd.parm1 = 0;
cmd.parm2 = 0;
- result = hfa384x_docmd_wait(hw, &cmd);
-
- return result;
+ return hfa384x_docmd_wait(hw, &cmd);
}
/*----------------------------------------------------------------
@@ -1093,7 +1046,6 @@ int hfa384x_cmd_enable(hfa384x_t *hw, u16 macport)
----------------------------------------------------------------*/
int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
{
- int result = 0;
hfa384x_metacmd_t cmd;
cmd.cmd = HFA384x_CMD_CMDCODE_SET(HFA384x_CMDCODE_MONITOR) |
@@ -1102,9 +1054,7 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
cmd.parm1 = 0;
cmd.parm2 = 0;
- result = hfa384x_docmd_wait(hw, &cmd);
-
- return result;
+ return hfa384x_docmd_wait(hw, &cmd);
}
/*----------------------------------------------------------------
@@ -1148,7 +1098,6 @@ int hfa384x_cmd_monitor(hfa384x_t *hw, u16 enable)
int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
u16 highaddr, u16 codelen)
{
- int result = 0;
hfa384x_metacmd_t cmd;
pr_debug("mode=%d, lowaddr=0x%04x, highaddr=0x%04x, codelen=%d\n",
@@ -1161,9 +1110,7 @@ int hfa384x_cmd_download(hfa384x_t *hw, u16 mode, u16 lowaddr,
cmd.parm1 = highaddr;
cmd.parm2 = codelen;
- result = hfa384x_docmd_wait(hw, &cmd);
-
- return result;
+ return hfa384x_docmd_wait(hw, &cmd);
}
/*----------------------------------------------------------------
@@ -1351,7 +1298,7 @@ hfa384x_docmd(hfa384x_t *hw,
hfa384x_usbctlx_t *ctlx;
ctlx = usbctlx_alloc();
- if (ctlx == NULL) {
+ if (!ctlx) {
result = -ENOMEM;
goto done;
}
@@ -1441,7 +1388,7 @@ hfa384x_dorrid(hfa384x_t *hw,
hfa384x_usbctlx_t *ctlx;
ctlx = usbctlx_alloc();
- if (ctlx == NULL) {
+ if (!ctlx) {
result = -ENOMEM;
goto done;
}
@@ -1522,7 +1469,7 @@ hfa384x_dowrid(hfa384x_t *hw,
hfa384x_usbctlx_t *ctlx;
ctlx = usbctlx_alloc();
- if (ctlx == NULL) {
+ if (!ctlx) {
result = -ENOMEM;
goto done;
}
@@ -1610,7 +1557,7 @@ hfa384x_dormem(hfa384x_t *hw,
hfa384x_usbctlx_t *ctlx;
ctlx = usbctlx_alloc();
- if (ctlx == NULL) {
+ if (!ctlx) {
result = -ENOMEM;
goto done;
}
@@ -1703,7 +1650,7 @@ hfa384x_dowmem(hfa384x_t *hw,
pr_debug("page=0x%04x offset=0x%04x len=%d\n", page, offset, len);
ctlx = usbctlx_alloc();
- if (ctlx == NULL) {
+ if (!ctlx) {
result = -ENOMEM;
goto done;
}
@@ -1747,37 +1694,6 @@ done:
}
/*----------------------------------------------------------------
-* hfa384x_drvr_commtallies
-*
-* Send a commtallies inquiry to the MAC. Note that this is an async
-* call that will result in an info frame arriving sometime later.
-*
-* Arguments:
-* hw device structure
-*
-* Returns:
-* zero success.
-*
-* Side effects:
-*
-* Call context:
-* process
-----------------------------------------------------------------*/
-int hfa384x_drvr_commtallies(hfa384x_t *hw)
-{
- hfa384x_metacmd_t cmd;
-
- cmd.cmd = HFA384x_CMDCODE_INQ;
- cmd.parm0 = HFA384x_IT_COMMTALLIES;
- cmd.parm1 = 0;
- cmd.parm2 = 0;
-
- hfa384x_docmd_async(hw, &cmd, NULL, NULL, NULL);
-
- return 0;
-}
-
-/*----------------------------------------------------------------
* hfa384x_drvr_disable
*
* Issues the disable command to stop communications on one of
@@ -2122,41 +2038,6 @@ int hfa384x_drvr_getconfig(hfa384x_t *hw, u16 rid, void *buf, u16 len)
}
/*----------------------------------------------------------------
- * hfa384x_drvr_getconfig_async
- *
- * Performs the sequence necessary to perform an async read of
- * of a config/info item.
- *
- * Arguments:
- * hw device structure
- * rid config/info record id (host order)
- * buf host side record buffer. Upon return it will
- * contain the body portion of the record (minus the
- * RID and len).
- * len buffer length (in bytes, should match record length)
- * cbfn caller supplied callback, called when the command
- * is done (successful or not).
- * cbfndata pointer to some caller supplied data that will be
- * passed in as an argument to the cbfn.
- *
- * Returns:
- * nothing the cbfn gets a status argument identifying if
- * any errors occur.
- * Side effects:
- * Queues an hfa384x_usbcmd_t for subsequent execution.
- *
- * Call context:
- * Any
- ----------------------------------------------------------------*/
-int
-hfa384x_drvr_getconfig_async(hfa384x_t *hw,
- u16 rid, ctlx_usercb_t usercb, void *usercb_data)
-{
- return hfa384x_dorrid_async(hw, rid, NULL, 0,
- hfa384x_cb_rrid, usercb, usercb_data);
-}
-
-/*----------------------------------------------------------------
* hfa384x_drvr_setconfig_async
*
* Performs the sequence necessary to write a config/info item.
@@ -2810,8 +2691,7 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev)
static void hfa384x_usbctlx_reaper_task(unsigned long data)
{
hfa384x_t *hw = (hfa384x_t *)data;
- struct list_head *entry;
- struct list_head *temp;
+ hfa384x_usbctlx_t *ctlx, *temp;
unsigned long flags;
spin_lock_irqsave(&hw->ctlxq.lock, flags);
@@ -2819,10 +2699,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
/* This list is guaranteed to be empty if someone
* has unplugged the adapter.
*/
- list_for_each_safe(entry, temp, &hw->ctlxq.reapable) {
- hfa384x_usbctlx_t *ctlx;
-
- ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
+ list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.reapable, list) {
list_del(&ctlx->list);
kfree(ctlx);
}
@@ -2847,8 +2724,7 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data)
static void hfa384x_usbctlx_completion_task(unsigned long data)
{
hfa384x_t *hw = (hfa384x_t *)data;
- struct list_head *entry;
- struct list_head *temp;
+ hfa384x_usbctlx_t *ctlx, *temp;
unsigned long flags;
int reap = 0;
@@ -2858,11 +2734,7 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
/* This list is guaranteed to be empty if someone
* has unplugged the adapter ...
*/
- list_for_each_safe(entry, temp, &hw->ctlxq.completing) {
- hfa384x_usbctlx_t *ctlx;
-
- ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
-
+ list_for_each_entry_safe(ctlx, temp, &hw->ctlxq.completing, list) {
/* Call the completion function that this
* command was assigned, assuming it has one.
*/
@@ -3051,7 +2923,7 @@ static void hfa384x_usbctlxq_run(hfa384x_t *hw)
hw->ctlx_urb.transfer_flags |= USB_QUEUE_BULK;
/* Now submit the URB and update the CTLX's state */
- result = SUBMIT_URB(&hw->ctlx_urb, GFP_ATOMIC);
+ result = usb_submit_urb(&hw->ctlx_urb, GFP_ATOMIC);
if (result == 0) {
/* This CTLX is now running on the active queue */
head->state = CTLX_REQ_SUBMITTED;
@@ -3574,7 +3446,7 @@ static void hfa384x_int_rxmonitor(wlandevice_t *wlandev,
}
skb = dev_alloc_skb(skblen);
- if (skb == NULL)
+ if (!skb)
return;
/* only prepend the prism header if in the right mode */
@@ -3985,8 +3857,7 @@ static void hfa384x_usb_throttlefn(unsigned long data)
pr_debug("flags=0x%lx\n", hw->usb_flags);
if (!hw->wlandev->hwremoved &&
((test_and_clear_bit(THROTTLE_RX, &hw->usb_flags) &&
- !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags))
- |
+ !test_and_set_bit(WORK_RX_RESUME, &hw->usb_flags)) |
(test_and_clear_bit(THROTTLE_TX, &hw->usb_flags) &&
!test_and_set_bit(WORK_TX_RESUME, &hw->usb_flags))
)) {
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c
index 1b02cdf9d1fa..0a8f3960d465 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -49,7 +49,8 @@
*
* --------------------------------------------------------------------
*
-*================================================================ */
+*================================================================
+*/
#include <linux/module.h>
#include <linux/kernel.h>
@@ -101,12 +102,12 @@ static u8 oui_8021h[] = { 0x00, 0x00, 0xf8 };
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
struct sk_buff *skb, union p80211_hdr *p80211_hdr,
struct p80211_metawep *p80211_wep)
{
-
__le16 fc;
u16 proto;
struct wlan_ethhdr e_hdr;
@@ -148,11 +149,11 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
/* tack on SNAP */
e_snap =
- (struct wlan_snap *) skb_push(skb,
+ (struct wlan_snap *)skb_push(skb,
sizeof(struct wlan_snap));
e_snap->type = htons(proto);
- if (ethconv == WLAN_ETHCONV_8021h
- && p80211_stt_findproto(proto)) {
+ if (ethconv == WLAN_ETHCONV_8021h &&
+ p80211_stt_findproto(proto)) {
memcpy(e_snap->oui, oui_8021h,
WLAN_IEEE_OUI_LEN);
} else {
@@ -162,12 +163,11 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
/* tack on llc */
e_llc =
- (struct wlan_llc *) skb_push(skb,
+ (struct wlan_llc *)skb_push(skb,
sizeof(struct wlan_llc));
e_llc->dsap = 0xAA; /* SNAP, see IEEE 802 */
e_llc->ssap = 0xAA;
e_llc->ctl = 0x03;
-
}
}
@@ -202,8 +202,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
p80211_wep->data = NULL;
- if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED)
- && (wlandev->hostwep & HOSTWEP_ENCRYPT)) {
+ if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) &&
+ (wlandev->hostwep & HOSTWEP_ENCRYPT)) {
/* XXXX need to pick keynum other than default? */
p80211_wep->data = kmalloc(skb->len, GFP_ATOMIC);
@@ -215,8 +215,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv,
p80211_wep->iv, p80211_wep->icv);
if (foo) {
netdev_warn(wlandev->netdev,
- "Host en-WEP failed, dropping frame (%d).\n",
- foo);
+ "Host en-WEP failed, dropping frame (%d).\n",
+ foo);
return 2;
}
fc |= cpu_to_le16(WLAN_SET_FC_ISWEP(1));
@@ -238,10 +238,10 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac,
int i;
/* Gather wireless spy statistics: for each packet, compare the
- * source address with out list, and if match, get the stats... */
+ * source address with out list, and if match, get the stats...
+ */
for (i = 0; i < wlandev->spy_number; i++) {
-
if (!memcmp(wlandev->spy_address[i], mac, ETH_ALEN)) {
memcpy(wlandev->spy_address[i], mac, ETH_ALEN);
wlandev->spy_stat[i].level = rxmeta->signal;
@@ -273,7 +273,8 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char *mac,
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
struct sk_buff *skb)
{
@@ -293,19 +294,19 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
payload_length = skb->len - WLAN_HDR_A3_LEN - WLAN_CRC_LEN;
payload_offset = WLAN_HDR_A3_LEN;
- w_hdr = (union p80211_hdr *) skb->data;
+ w_hdr = (union p80211_hdr *)skb->data;
/* setup some vars for convenience */
fc = le16_to_cpu(w_hdr->a3.fc);
if ((WLAN_GET_FC_TODS(fc) == 0) && (WLAN_GET_FC_FROMDS(fc) == 0)) {
ether_addr_copy(daddr, w_hdr->a3.a1);
ether_addr_copy(saddr, w_hdr->a3.a2);
- } else if ((WLAN_GET_FC_TODS(fc) == 0)
- && (WLAN_GET_FC_FROMDS(fc) == 1)) {
+ } else if ((WLAN_GET_FC_TODS(fc) == 0) &&
+ (WLAN_GET_FC_FROMDS(fc) == 1)) {
ether_addr_copy(daddr, w_hdr->a3.a1);
ether_addr_copy(saddr, w_hdr->a3.a3);
- } else if ((WLAN_GET_FC_TODS(fc) == 1)
- && (WLAN_GET_FC_FROMDS(fc) == 0)) {
+ } else if ((WLAN_GET_FC_TODS(fc) == 1) &&
+ (WLAN_GET_FC_FROMDS(fc) == 0)) {
ether_addr_copy(daddr, w_hdr->a3.a3);
ether_addr_copy(saddr, w_hdr->a3.a2);
} else {
@@ -320,18 +321,19 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
}
/* perform de-wep if necessary.. */
- if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && WLAN_GET_FC_ISWEP(fc)
- && (wlandev->hostwep & HOSTWEP_DECRYPT)) {
+ if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) &&
+ WLAN_GET_FC_ISWEP(fc) &&
+ (wlandev->hostwep & HOSTWEP_DECRYPT)) {
if (payload_length <= 8) {
netdev_err(netdev,
"WEP frame too short (%u).\n", skb->len);
return 1;
}
foo = wep_decrypt(wlandev, skb->data + payload_offset + 4,
- payload_length - 8, -1,
- skb->data + payload_offset,
- skb->data + payload_offset +
- payload_length - 4);
+ payload_length - 8, -1,
+ skb->data + payload_offset,
+ skb->data + payload_offset +
+ payload_length - 4);
if (foo) {
/* de-wep failed, drop skb. */
pr_debug("Host de-WEP failed, dropping frame (%d).\n",
@@ -350,11 +352,11 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
wlandev->rx.decrypt++;
}
- e_hdr = (struct wlan_ethhdr *) (skb->data + payload_offset);
+ e_hdr = (struct wlan_ethhdr *)(skb->data + payload_offset);
- e_llc = (struct wlan_llc *) (skb->data + payload_offset);
+ e_llc = (struct wlan_llc *)(skb->data + payload_offset);
e_snap =
- (struct wlan_snap *) (skb->data + payload_offset +
+ (struct wlan_snap *)(skb->data + payload_offset +
sizeof(struct wlan_llc));
/* Test for the various encodings */
@@ -369,7 +371,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* A bogus length ethfrm has been encap'd. */
/* Is someone trying an oflow attack? */
netdev_err(netdev, "ENCAP frame too large (%d > %d)\n",
- payload_length, netdev->mtu + ETH_HLEN);
+ payload_length, netdev->mtu + ETH_HLEN);
return 1;
}
@@ -379,15 +381,15 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
skb_trim(skb, skb->len - WLAN_CRC_LEN);
} else if ((payload_length >= sizeof(struct wlan_llc) +
- sizeof(struct wlan_snap))
- && (e_llc->dsap == 0xaa)
- && (e_llc->ssap == 0xaa)
- && (e_llc->ctl == 0x03)
- &&
- (((memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) == 0)
- && (ethconv == WLAN_ETHCONV_8021h)
- && (p80211_stt_findproto(le16_to_cpu(e_snap->type))))
- || (memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) !=
+ sizeof(struct wlan_snap)) &&
+ (e_llc->dsap == 0xaa) &&
+ (e_llc->ssap == 0xaa) &&
+ (e_llc->ctl == 0x03) &&
+ (((memcmp(e_snap->oui, oui_rfc1042,
+ WLAN_IEEE_OUI_LEN) == 0) &&
+ (ethconv == WLAN_ETHCONV_8021h) &&
+ (p80211_stt_findproto(le16_to_cpu(e_snap->type)))) ||
+ (memcmp(e_snap->oui, oui_rfc1042, WLAN_IEEE_OUI_LEN) !=
0))) {
pr_debug("SNAP+RFC1042 len: %d\n", payload_length);
/* it's a SNAP + RFC1042 frame && protocol is in STT */
@@ -398,7 +400,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* A bogus length ethfrm has been sent. */
/* Is someone trying an oflow attack? */
netdev_err(netdev, "SNAP frame too large (%d > %d)\n",
- payload_length, netdev->mtu);
+ payload_length, netdev->mtu);
return 1;
}
@@ -415,13 +417,14 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
skb_trim(skb, skb->len - WLAN_CRC_LEN);
} else if ((payload_length >= sizeof(struct wlan_llc) +
- sizeof(struct wlan_snap))
- && (e_llc->dsap == 0xaa)
- && (e_llc->ssap == 0xaa)
- && (e_llc->ctl == 0x03)) {
+ sizeof(struct wlan_snap)) &&
+ (e_llc->dsap == 0xaa) &&
+ (e_llc->ssap == 0xaa) &&
+ (e_llc->ctl == 0x03)) {
pr_debug("802.1h/RFC1042 len: %d\n", payload_length);
/* it's an 802.1h frame || (an RFC1042 && protocol not in STT)
- build a DIXII + RFC894 */
+ * build a DIXII + RFC894
+ */
/* Test for an overlength frame */
if ((payload_length - sizeof(struct wlan_llc) -
@@ -430,9 +433,9 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* A bogus length ethfrm has been sent. */
/* Is someone trying an oflow attack? */
netdev_err(netdev, "DIXII frame too large (%ld > %d)\n",
- (long int)(payload_length -
- sizeof(struct wlan_llc) -
- sizeof(struct wlan_snap)), netdev->mtu);
+ (long int)(payload_length -
+ sizeof(struct wlan_llc) -
+ sizeof(struct wlan_snap)), netdev->mtu);
return 1;
}
@@ -465,7 +468,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* A bogus length ethfrm has been sent. */
/* Is someone trying an oflow attack? */
netdev_err(netdev, "OTHER frame too large (%d > %d)\n",
- payload_length, netdev->mtu);
+ payload_length, netdev->mtu);
return 1;
}
@@ -480,7 +483,6 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* chop off the 802.11 CRC */
skb_trim(skb, skb->len - WLAN_CRC_LEN);
-
}
/*
@@ -521,14 +523,15 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
int p80211_stt_findproto(u16 proto)
{
/* Always return found for now. This is the behavior used by the */
- /* Zoom Win95 driver when 802.1h mode is selected */
+ /* Zoom Win95 driver when 802.1h mode is selected */
/* TODO: If necessary, add an actual search we'll probably
- need this to match the CMAC's way of doing things.
- Need to do some testing to confirm.
+ * need this to match the CMAC's way of doing things.
+ * Need to do some testing to confirm.
*/
if (proto == ETH_P_AARP) /* APPLETALK */
@@ -551,24 +554,25 @@ int p80211_stt_findproto(u16 proto)
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
void p80211skb_rxmeta_detach(struct sk_buff *skb)
{
struct p80211_rxmeta *rxmeta;
struct p80211_frmmeta *frmmeta;
/* Sanity checks */
- if (skb == NULL) { /* bad skb */
+ if (!skb) { /* bad skb */
pr_debug("Called w/ null skb.\n");
return;
}
frmmeta = P80211SKB_FRMMETA(skb);
- if (frmmeta == NULL) { /* no magic */
+ if (!frmmeta) { /* no magic */
pr_debug("Called w/ bad frmmeta magic.\n");
return;
}
rxmeta = frmmeta->rx;
- if (rxmeta == NULL) { /* bad meta ptr */
+ if (!rxmeta) { /* bad meta ptr */
pr_debug("Called w/ bad rxmeta ptr.\n");
return;
}
@@ -595,7 +599,8 @@ void p80211skb_rxmeta_detach(struct sk_buff *skb)
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
{
int result = 0;
@@ -603,7 +608,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
struct p80211_frmmeta *frmmeta;
/* If these already have metadata, we error out! */
- if (P80211SKB_RXMETA(skb) != NULL) {
+ if (P80211SKB_RXMETA(skb)) {
netdev_err(wlandev->netdev,
"%s: RXmeta already attached!\n", wlandev->name);
result = 0;
@@ -613,7 +618,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
/* Allocate the rxmeta */
rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC);
- if (rxmeta == NULL) {
+ if (!rxmeta) {
netdev_err(wlandev->netdev,
"%s: Failed to allocate rxmeta.\n", wlandev->name);
result = 1;
@@ -626,7 +631,7 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb)
/* Overlay a frmmeta_t onto skb->cb */
memset(skb->cb, 0, sizeof(struct p80211_frmmeta));
- frmmeta = (struct p80211_frmmeta *) (skb->cb);
+ frmmeta = (struct p80211_frmmeta *)(skb->cb);
frmmeta->magic = P80211_FRMMETA_MAGIC;
frmmeta->rx = rxmeta;
exit:
@@ -648,7 +653,8 @@ exit:
*
* Call context:
* May be called in interrupt or non-interrupt context
-----------------------------------------------------------------*/
+*----------------------------------------------------------------
+*/
void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb)
{
struct p80211_frmmeta *meta;
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index a9c1e0bafa62..88255ce2871b 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -328,7 +328,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
p80211_wep.data = NULL;
- if (skb == NULL)
+ if (!skb)
return NETDEV_TX_OK;
if (wlandev->state != WLAN_DEVICE_OPEN) {
@@ -388,7 +388,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
goto failed;
}
}
- if (wlandev->txframe == NULL) {
+ if (!wlandev->txframe) {
result = 1;
goto failed;
}
@@ -736,7 +736,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
/* Allocate and initialize the wiphy struct */
wiphy = wlan_create_wiphy(physdev, wlandev);
- if (wiphy == NULL) {
+ if (!wiphy) {
dev_err(physdev, "Failed to alloc wiphy.\n");
return 1;
}
@@ -744,7 +744,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev)
/* Allocate and initialize the struct device */
netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d",
NET_NAME_UNKNOWN, ether_setup);
- if (netdev == NULL) {
+ if (!netdev) {
dev_err(physdev, "Failed to alloc netdev.\n");
wlan_free_wiphy(wiphy);
result = 1;
diff --git a/drivers/staging/wlan-ng/p80211wep.c b/drivers/staging/wlan-ng/p80211wep.c
index c363456d93a3..22c79703e328 100644
--- a/drivers/staging/wlan-ng/p80211wep.c
+++ b/drivers/staging/wlan-ng/p80211wep.c
@@ -140,8 +140,8 @@ int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen)
}
/*
- 4-byte IV at start of buffer, 4-byte ICV at end of buffer.
- if successful, buf start is payload begin, length -= 8;
+ * 4-byte IV at start of buffer, 4-byte ICV at end of buffer.
+ * if successful, buf start is payload begin, length -= 8;
*/
int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,
u8 *iv, u8 *icv)
@@ -188,7 +188,8 @@ int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,
/* Apply the RC4 to the data, update the CRC32 */
crc = ~0;
- i = j = 0;
+ i = 0;
+ j = 0;
for (k = 0; k < len; k++) {
i = (i + 1) & 0xff;
j = (j + s[i]) & 0xff;
@@ -260,7 +261,8 @@ int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum,
/* Update CRC32 then apply RC4 to the data */
crc = ~0;
- i = j = 0;
+ i = 0;
+ j = 0;
for (k = 0; k < len; k++) {
crc = wep_crc32_table[(crc ^ buf[k]) & 0xff] ^ (crc >> 8);
i = (i + 1) & 0xff;
diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c
index 8fc80df0b53e..8564d9eb918f 100644
--- a/drivers/staging/wlan-ng/prism2fw.c
+++ b/drivers/staging/wlan-ng/prism2fw.c
@@ -333,6 +333,10 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr,
/* Make the image chunks */
result = mkimage(fchunk, &nfchunks);
+ if (result) {
+ netdev_err(wlandev->netdev, "Failed to make image chunk.\n");
+ return 1;
+ }
/* Do any plugging */
result = plugimage(fchunk, nfchunks, s3plug, ns3plug, &pda);
@@ -538,7 +542,7 @@ static int mkimage(struct imgchunk *clist, unsigned int *ccnt)
/* Allocate buffer space for chunks */
for (i = 0; i < *ccnt; i++) {
clist[i].data = kzalloc(clist[i].len, GFP_KERNEL);
- if (clist[i].data == NULL) {
+ if (!clist[i].data) {
pr_err("failed to allocate image space, exitting.\n");
return 1;
}
diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c
index 013a6240f193..d8ed9a05789c 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.c
+++ b/drivers/staging/wlan-ng/prism2mgmt.c
@@ -375,7 +375,7 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp)
int count;
- req = (struct p80211msg_dot11req_scan_results *) msgp;
+ req = msgp;
req->resultcode.status = P80211ENUM_msgitem_status_data_ok;
diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h
index 7a9f424607b7..e6472034da33 100644
--- a/drivers/staging/wlan-ng/prism2mgmt.h
+++ b/drivers/staging/wlan-ng/prism2mgmt.h
@@ -87,7 +87,6 @@ int prism2mgmt_autojoin(wlandevice_t *wlandev, void *msgp);
* Prism2 data types
---------------------------------------------------------------*/
/* byte area conversion functions*/
-void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr);
void prism2mgmt_bytearea2pstr(u8 *bytearea, p80211pstrd_t *pstr, int len);
/* byte string conversion functions*/
diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c
index cdda07d1c268..fe914b1f904b 100644
--- a/drivers/staging/wlan-ng/prism2mib.c
+++ b/drivers/staging/wlan-ng/prism2mib.c
@@ -379,7 +379,7 @@ static int prism2mib_bytearea2pstr(struct mibrec *mib,
void *data)
{
int result;
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
+ p80211pstrd_t *pstr = data;
u8 bytebuf[MIB_TMP_MAXLEN];
if (isget) {
@@ -388,7 +388,7 @@ static int prism2mib_bytearea2pstr(struct mibrec *mib,
prism2mgmt_bytearea2pstr(bytebuf, pstr, mib->parm2);
} else {
memset(bytebuf, 0, mib->parm2);
- prism2mgmt_pstr2bytearea(bytebuf, pstr);
+ memcpy(bytebuf, pstr->data, pstr->len);
result =
hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, mib->parm2);
}
@@ -428,7 +428,7 @@ static int prism2mib_uint32(struct mibrec *mib,
struct p80211msg_dot11req_mibset *msg, void *data)
{
int result;
- u32 *uint32 = (u32 *) data;
+ u32 *uint32 = data;
u8 bytebuf[MIB_TMP_MAXLEN];
u16 *wordbuf = (u16 *) bytebuf;
@@ -475,7 +475,7 @@ static int prism2mib_flag(struct mibrec *mib,
struct p80211msg_dot11req_mibset *msg, void *data)
{
int result;
- u32 *uint32 = (u32 *) data;
+ u32 *uint32 = data;
u8 bytebuf[MIB_TMP_MAXLEN];
u16 *wordbuf = (u16 *) bytebuf;
u32 flags;
@@ -533,7 +533,7 @@ static int prism2mib_wepdefaultkey(struct mibrec *mib,
void *data)
{
int result;
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
+ p80211pstrd_t *pstr = data;
u8 bytebuf[MIB_TMP_MAXLEN];
u16 len;
@@ -543,7 +543,7 @@ static int prism2mib_wepdefaultkey(struct mibrec *mib,
len = (pstr->len > 5) ? HFA384x_RID_CNFWEP128DEFAULTKEY_LEN :
HFA384x_RID_CNFWEPDEFAULTKEY_LEN;
memset(bytebuf, 0, len);
- prism2mgmt_pstr2bytearea(bytebuf, pstr);
+ memcpy(bytebuf, pstr->data, pstr->len);
result = hfa384x_drvr_setconfig(hw, mib->parm1, bytebuf, len);
}
@@ -660,7 +660,7 @@ static int prism2mib_fragmentationthreshold(struct mibrec *mib,
struct p80211msg_dot11req_mibset *msg,
void *data)
{
- u32 *uint32 = (u32 *) data;
+ u32 *uint32 = data;
if (!isget)
if ((*uint32) % 2) {
@@ -705,7 +705,7 @@ static int prism2mib_priv(struct mibrec *mib,
hfa384x_t *hw,
struct p80211msg_dot11req_mibset *msg, void *data)
{
- p80211pstrd_t *pstr = (p80211pstrd_t *) data;
+ p80211pstrd_t *pstr = data;
switch (mib->did) {
case DIDmib_lnx_lnxConfigTable_lnxRSNAIE:{
@@ -759,26 +759,6 @@ void prism2mgmt_pstr2bytestr(struct hfa384x_bytestr *bytestr,
}
/*----------------------------------------------------------------
-* prism2mgmt_pstr2bytearea
-*
-* Convert the pstr data in the WLAN message structure into an hfa384x
-* byte area format.
-*
-* Arguments:
-* bytearea hfa384x byte area data type
-* pstr wlan message data
-*
-* Returns:
-* Nothing
-*
-----------------------------------------------------------------*/
-
-void prism2mgmt_pstr2bytearea(u8 *bytearea, p80211pstrd_t *pstr)
-{
- memcpy(bytearea, pstr->data, pstr->len);
-}
-
-/*----------------------------------------------------------------
* prism2mgmt_bytestr2pstr
*
* Convert the data in an hfa384x byte string format into a
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 131223afd918..64f90722b01b 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -242,7 +242,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
union p80211_hdr *p80211_hdr,
struct p80211_metawep *p80211_wep)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
/* If necessary, set the 802.11 WEP bit */
if ((wlandev->hostwep & (HOSTWEP_PRIVACYINVOKED | HOSTWEP_ENCRYPT)) ==
@@ -279,7 +279,7 @@ static int prism2sta_txframe(wlandevice_t *wlandev, struct sk_buff *skb,
*/
static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
int result = 0;
@@ -409,7 +409,7 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg)
*/
u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
u32 result;
result = P80211ENUM_resultcode_implementation_failure;
@@ -583,7 +583,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate)
static int prism2sta_getcardinfo(wlandevice_t *wlandev)
{
int result = 0;
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
u16 temp;
u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
@@ -911,7 +911,7 @@ done:
*/
static int prism2sta_globalsetup(wlandevice_t *wlandev)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
/* Set the maximum frame size */
return hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFMAXDATALEN,
@@ -921,7 +921,7 @@ static int prism2sta_globalsetup(wlandevice_t *wlandev)
static int prism2sta_setmulticast(wlandevice_t *wlandev, netdevice_t *dev)
{
int result = 0;
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
u16 promisc;
@@ -985,7 +985,7 @@ static void prism2sta_inf_handover(wlandevice_t *wlandev,
static void prism2sta_inf_tallies(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
u16 *src16;
u32 *dst;
u32 *src32;
@@ -1032,7 +1032,7 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
int nbss;
hfa384x_ScanResult_t *sr = &(inf->info.scanresult);
int i;
@@ -1087,7 +1087,7 @@ static void prism2sta_inf_scanresults(wlandevice_t *wlandev,
static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
int nbss;
nbss = (inf->framelen - 3) / 32;
@@ -1128,7 +1128,7 @@ static void prism2sta_inf_hostscanresults(wlandevice_t *wlandev,
static void prism2sta_inf_chinforesults(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
unsigned int i, n;
hw->channel_info.results.scanchannels =
@@ -1441,7 +1441,7 @@ void prism2sta_processing_defer(struct work_struct *data)
static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
hw->link_status_new = le16_to_cpu(inf->info.linkstatus.linkstatus);
@@ -1469,7 +1469,7 @@ static void prism2sta_inf_linkstatus(wlandevice_t *wlandev,
static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
hfa384x_AssocStatus_t rec;
int i;
@@ -1530,7 +1530,7 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev,
static void prism2sta_inf_authreq(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
struct sk_buff *skb;
skb = dev_alloc_skb(sizeof(*inf));
@@ -1545,7 +1545,7 @@ static void prism2sta_inf_authreq(wlandevice_t *wlandev,
static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
hfa384x_authenticateStation_data_t rec;
int i, added, result, cnt;
@@ -1719,7 +1719,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t *wlandev,
static void prism2sta_inf_psusercnt(wlandevice_t *wlandev,
hfa384x_InfFrame_t *inf)
{
- hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
+ hfa384x_t *hw = wlandev->priv;
hw->psusercount = le16_to_cpu(inf->info.psusercnt.usercnt);
}
@@ -1886,7 +1886,6 @@ static wlandevice_t *create_wlan(void)
hw = kzalloc(sizeof(hfa384x_t), GFP_KERNEL);
if (!wlandev || !hw) {
- pr_err("%s: Memory allocation failure.\n", dev_info);
kfree(wlandev);
kfree(hw);
return NULL;
diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c
index 8abf3f87a2d5..41358bbc6246 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -67,7 +67,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface,
dev = interface_to_usbdev(interface);
wlandev = create_wlan();
- if (wlandev == NULL) {
+ if (!wlandev) {
dev_err(&interface->dev, "Memory allocation failure.\n");
result = -EIO;
goto failed;
@@ -139,8 +139,7 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
wlandev = (wlandevice_t *)usb_get_intfdata(interface);
if (wlandev != NULL) {
LIST_HEAD(cleanlist);
- struct list_head *entry;
- struct list_head *temp;
+ hfa384x_usbctlx_t *ctlx, *temp;
unsigned long flags;
hfa384x_t *hw = wlandev->priv;
@@ -178,18 +177,15 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
tasklet_kill(&hw->completion_bh);
tasklet_kill(&hw->reaper_bh);
- flush_scheduled_work();
+ cancel_work_sync(&hw->link_bh);
+ cancel_work_sync(&hw->commsqual_bh);
/* Now we complete any outstanding commands
* and tell everyone who is waiting for their
* responses that we have shut down.
*/
- list_for_each(entry, &cleanlist) {
- hfa384x_usbctlx_t *ctlx;
-
- ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
+ list_for_each_entry(ctlx, &cleanlist, list)
complete(&ctlx->done);
- }
/* Give any outstanding synchronous commands
* a chance to complete. All they need to do
@@ -199,12 +195,8 @@ static void prism2sta_disconnect_usb(struct usb_interface *interface)
msleep(100);
/* Now delete the CTLXs, because no-one else can now. */
- list_for_each_safe(entry, temp, &cleanlist) {
- hfa384x_usbctlx_t *ctlx;
-
- ctlx = list_entry(entry, hfa384x_usbctlx_t, list);
+ list_for_each_entry_safe(ctlx, temp, &cleanlist, list)
kfree(ctlx);
- }
/* Unhook the wlandev */
unregister_wlandev(wlandev);