diff options
Diffstat (limited to 'drivers/staging/wlan-ng')
-rw-r--r-- | drivers/staging/wlan-ng/hfa384x_usb.c | 227 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/p80211conv.c | 31 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/p80211netdev.c | 139 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/p80211req.c | 9 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2fw.c | 101 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2mgmt.c | 123 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2mgmt.h | 5 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2mib.c | 4 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2sta.c | 25 | ||||
-rw-r--r-- | drivers/staging/wlan-ng/prism2usb.c | 164 |
10 files changed, 383 insertions, 445 deletions
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c index 5b8b094..98343ff7 100644 --- a/drivers/staging/wlan-ng/hfa384x_usb.c +++ b/drivers/staging/wlan-ng/hfa384x_usb.c @@ -203,7 +203,7 @@ static int hfa384x_usbctlx_submit(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx); struct usbctlx_completor { - int (*complete) (struct usbctlx_completor *); + int (*complete)(struct usbctlx_completor *); }; static int @@ -272,7 +272,7 @@ static int hfa384x_isgood_pdrcode(u16 pdrcode); static inline const char *ctlxstr(CTLX_STATE s) { - static const char *ctlx_str[] = { + static const char * const ctlx_str[] = { "Initial state", "Complete", "Request failed", @@ -350,14 +350,14 @@ 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)) { + !test_bit(WORK_RX_HALT, &hw->usb_flags)) { result = SUBMIT_URB(&hw->rx_urb, memflags); /* Check whether we need to reset the RX pipe */ if (result == -EPIPE) { netdev_warn(hw->wlandev->netdev, - "%s rx pipe stalled: requesting reset\n", - hw->wlandev->netdev->name); + "%s rx pipe stalled: requesting reset\n", + hw->wlandev->netdev->name); if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags)) schedule_work(&hw->usb_work); } @@ -398,16 +398,15 @@ static int submit_tx_urb(hfa384x_t *hw, struct urb *tx_urb, gfp_t memflags) result = -ENOLINK; if (netif_running(netdev)) { - - if (!hw->wlandev->hwremoved - && !test_bit(WORK_TX_HALT, &hw->usb_flags)) { + if (!hw->wlandev->hwremoved && + !test_bit(WORK_TX_HALT, &hw->usb_flags)) { result = SUBMIT_URB(tx_urb, memflags); /* Test whether we need to reset the TX pipe */ if (result == -EPIPE) { netdev_warn(hw->wlandev->netdev, - "%s tx pipe stalled: requesting reset\n", - netdev->name); + "%s tx pipe stalled: requesting reset\n", + netdev->name); set_bit(WORK_TX_HALT, &hw->usb_flags); schedule_work(&hw->usb_work); } else if (result == 0) { @@ -455,11 +454,11 @@ static void hfa384x_usb_defer(struct work_struct *data) ret = usb_clear_halt(hw->usb, hw->endp_in); if (ret != 0) { netdev_err(hw->wlandev->netdev, - "Failed to clear rx pipe for %s: err=%d\n", - netdev->name, ret); + "Failed to clear rx pipe for %s: err=%d\n", + netdev->name, ret); } else { netdev_info(hw->wlandev->netdev, "%s rx pipe reset complete.\n", - netdev->name); + netdev->name); clear_bit(WORK_RX_HALT, &hw->usb_flags); set_bit(WORK_RX_RESUME, &hw->usb_flags); } @@ -472,7 +471,8 @@ static void hfa384x_usb_defer(struct work_struct *data) ret = submit_rx_urb(hw, GFP_KERNEL); if (ret != 0) { netdev_err(hw->wlandev->netdev, - "Failed to resume %s rx pipe.\n", netdev->name); + "Failed to resume %s rx pipe.\n", + netdev->name); } else { clear_bit(WORK_RX_RESUME, &hw->usb_flags); } @@ -486,11 +486,11 @@ static void hfa384x_usb_defer(struct work_struct *data) ret = usb_clear_halt(hw->usb, hw->endp_out); if (ret != 0) { netdev_err(hw->wlandev->netdev, - "Failed to clear tx pipe for %s: err=%d\n", - netdev->name, ret); + "Failed to clear tx pipe for %s: err=%d\n", + netdev->name, ret); } else { netdev_info(hw->wlandev->netdev, "%s tx pipe reset complete.\n", - netdev->name); + netdev->name); clear_bit(WORK_TX_HALT, &hw->usb_flags); set_bit(WORK_TX_RESUME, &hw->usb_flags); @@ -642,8 +642,7 @@ usbctlx_get_status(const hfa384x_usb_cmdresp_t *cmdresp, result->resp1 = le16_to_cpu(cmdresp->resp1); result->resp2 = le16_to_cpu(cmdresp->resp2); - pr_debug("cmdresult:status=0x%04x " - "resp0=0x%04x resp1=0x%04x resp2=0x%04x\n", + pr_debug("cmdresult:status=0x%04x resp0=0x%04x resp1=0x%04x resp2=0x%04x\n", result->status, result->resp0, result->resp1, result->resp2); return result->status & HFA384x_STATUS_RESULT; @@ -656,7 +655,6 @@ usbctlx_get_rridresult(const hfa384x_usb_rridresp_t *rridresp, result->rid = le16_to_cpu(rridresp->rid); result->riddata = rridresp->data; result->riddata_len = ((le16_to_cpu(rridresp->frmlen) - 1) * 2); - } /*---------------------------------------------------------------- @@ -675,7 +673,7 @@ static inline int usbctlx_cmd_completor_fn(struct usbctlx_completor *head) { struct usbctlx_cmd_completor *complete; - complete = (struct usbctlx_cmd_completor *) head; + complete = (struct usbctlx_cmd_completor *)head; return usbctlx_get_status(complete->cmdresp, complete->result); } @@ -710,15 +708,14 @@ static int usbctlx_rrid_completor_fn(struct usbctlx_completor *head) struct usbctlx_rrid_completor *complete; hfa384x_rridresult_t rridresult; - complete = (struct usbctlx_rrid_completor *) head; + complete = (struct usbctlx_rrid_completor *)head; usbctlx_get_rridresult(complete->rridresp, &rridresult); /* Validate the length, note body len calculation in bytes */ if (rridresult.riddata_len != complete->riddatalen) { - printk(KERN_WARNING - "RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n", - rridresult.rid, - complete->riddatalen, rridresult.riddata_len); + pr_warn("RID len mismatch, rid=0x%04x hlen=%d fwlen=%d\n", + rridresult.rid, + complete->riddatalen, rridresult.riddata_len); return -ENODATA; } @@ -745,14 +742,12 @@ static inline struct usbctlx_completor *init_rrid_completor( * Completor object: * Interprets the results of a synchronous RID-write ----------------------------------------------------------------*/ -typedef struct usbctlx_cmd_completor usbctlx_wrid_completor_t; #define init_wrid_completor init_cmd_completor /*---------------------------------------------------------------- * Completor object: * Interprets the results of a synchronous memory-write ----------------------------------------------------------------*/ -typedef struct usbctlx_cmd_completor usbctlx_wmem_completor_t; #define init_wmem_completor init_cmd_completor /*---------------------------------------------------------------- @@ -766,11 +761,11 @@ struct usbctlx_rmem_completor { void *data; unsigned int len; }; -typedef struct usbctlx_rmem_completor usbctlx_rmem_completor_t; static int usbctlx_rmem_completor_fn(struct usbctlx_completor *head) { - usbctlx_rmem_completor_t *complete = (usbctlx_rmem_completor_t *) head; + struct usbctlx_rmem_completor *complete = + (struct usbctlx_rmem_completor *)head; pr_debug("rmemresp:len=%d\n", complete->rmemresp->frmlen); memcpy(complete->data, complete->rmemresp->data, complete->len); @@ -778,7 +773,7 @@ static int usbctlx_rmem_completor_fn(struct usbctlx_completor *head) } static inline struct usbctlx_completor *init_rmem_completor( - usbctlx_rmem_completor_t + struct usbctlx_rmem_completor *completor, hfa384x_usb_rmemresp_t *rmemresp, @@ -991,9 +986,7 @@ int hfa384x_cmd_initialize(hfa384x_t *hw) result = hfa384x_docmd_wait(hw, &cmd); - pr_debug("cmdresp.init: " - "status=0x%04x, resp0=0x%04x, " - "resp1=0x%04x, resp2=0x%04x\n", + pr_debug("cmdresp.init: status=0x%04x, resp0=0x%04x, resp1=0x%04x, resp2=0x%04x\n", cmd.result.status, cmd.result.resp0, cmd.result.resp1, cmd.result.resp2); if (result == 0) { @@ -1212,7 +1205,7 @@ int hfa384x_corereset(hfa384x_t *hw, int holdtime, int settletime, int genesis) result = usb_reset_device(hw->usb); if (result < 0) { netdev_err(hw->wlandev->netdev, "usb_reset_device() failed, result=%d.\n", - result); + result); } return result; @@ -1312,8 +1305,8 @@ cleanup: result = completor->complete(completor); } else { netdev_warn(hw->wlandev->netdev, "CTLX[%d] error: state(%s)\n", - le16_to_cpu(ctlx->outbuf.type), - ctlxstr(ctlx->state)); + le16_to_cpu(ctlx->outbuf.type), + ctlxstr(ctlx->state)); result = -EIO; } @@ -1381,8 +1374,7 @@ hfa384x_docmd(hfa384x_t *hw, ctlx->outbufsize = sizeof(ctlx->outbuf.cmdreq); - pr_debug("cmdreq: cmd=0x%04x " - "parm0=0x%04x parm1=0x%04x parm2=0x%04x\n", + pr_debug("cmdreq: cmd=0x%04x parm0=0x%04x parm1=0x%04x parm2=0x%04x\n", cmd->cmd, cmd->parm0, cmd->parm1, cmd->parm2); ctlx->reapable = mode; @@ -1566,7 +1558,7 @@ hfa384x_dowrid(hfa384x_t *hw, if (result != 0) { kfree(ctlx); } else if (mode == DOWAIT) { - usbctlx_wrid_completor_t completor; + struct usbctlx_cmd_completor completor; hfa384x_cmdresult_t wridresult; result = hfa384x_usbctlx_complete_sync(hw, @@ -1658,7 +1650,7 @@ hfa384x_dormem(hfa384x_t *hw, if (result != 0) { kfree(ctlx); } else if (mode == DOWAIT) { - usbctlx_rmem_completor_t completor; + struct usbctlx_rmem_completor completor; result = hfa384x_usbctlx_complete_sync(hw, ctlx, @@ -1748,7 +1740,7 @@ hfa384x_dowmem(hfa384x_t *hw, if (result != 0) { kfree(ctlx); } else if (mode == DOWAIT) { - usbctlx_wmem_completor_t completor; + struct usbctlx_cmd_completor completor; hfa384x_cmdresult_t wmemresult; result = hfa384x_usbctlx_complete_sync(hw, @@ -2018,7 +2010,8 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) if (hw->dlstate != HFA384x_DLSTATE_FLASHENABLED) return -EINVAL; - netdev_info(hw->wlandev->netdev, "Download %d bytes to flash @0x%06x\n", len, daddr); + netdev_info(hw->wlandev->netdev, + "Download %d bytes to flash @0x%06x\n", len, daddr); /* Convert to flat address for arithmetic */ /* NOTE: dlbuffer RID stores the address in AUX format */ @@ -2026,11 +2019,6 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) HFA384x_ADDR_AUX_MKFLAT(hw->bufinfo.page, hw->bufinfo.offset); pr_debug("dlbuf.page=0x%04x dlbuf.offset=0x%04x dlbufaddr=0x%08x\n", hw->bufinfo.page, hw->bufinfo.offset, dlbufaddr); - -#if 0 - netdev_warn(hw->wlandev->netdev, "dlbuf@0x%06lx len=%d to=%d\n", dlbufaddr, - hw->bufinfo.len, hw->dltimeout); -#endif /* Calculations to determine how many fills of the dlbuffer to do * and how many USB wmemreq's to do for each fill. At this point * in time, the dlbuffer size and the wmemreq size are the same. @@ -2056,15 +2044,15 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) burnhi = HFA384x_ADDR_CMD_MKPAGE(burndaddr); netdev_info(hw->wlandev->netdev, "Writing %d bytes to flash @0x%06x\n", - burnlen, burndaddr); + burnlen, burndaddr); /* Set the download mode */ result = hfa384x_cmd_download(hw, HFA384x_PROGMODE_NV, burnlo, burnhi, burnlen); if (result) { - netdev_err(hw->wlandev->netdev, "download(NV,lo=%x,hi=%x,len=%x) " - "cmd failed, result=%d. Aborting d/l\n", - burnlo, burnhi, burnlen, result); + netdev_err(hw->wlandev->netdev, + "download(NV,lo=%x,hi=%x,len=%x) cmd failed, result=%d. Aborting d/l\n", + burnlo, burnhi, burnlen, result); goto exit_proc; } @@ -2095,9 +2083,8 @@ int hfa384x_drvr_flashdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) 0, 0, 0); if (result) { netdev_err(hw->wlandev->netdev, - "download(NVWRITE,lo=%x,hi=%x,len=%x) " - "cmd failed, result=%d. Aborting d/l\n", - burnlo, burnhi, burnlen, result); + "download(NVWRITE,lo=%x,hi=%x,len=%x) cmd failed, result=%d. Aborting d/l\n", + burnlo, burnhi, burnlen, result); goto exit_proc; } @@ -2280,7 +2267,7 @@ int hfa384x_drvr_ramdl_enable(hfa384x_t *hw, u32 exeaddr) for (i = 0; i < HFA384x_PORTID_MAX; i++) { if (hw->port_enabled[i]) { netdev_err(hw->wlandev->netdev, - "Can't download with a macport enabled.\n"); + "Can't download with a macport enabled.\n"); return -EINVAL; } } @@ -2352,7 +2339,8 @@ int hfa384x_drvr_ramdl_write(hfa384x_t *hw, u32 daddr, void *buf, u32 len) if (hw->dlstate != HFA384x_DLSTATE_RAMENABLED) return -EINVAL; - netdev_info(hw->wlandev->netdev, "Writing %d bytes to ram @0x%06x\n", len, daddr); + netdev_info(hw->wlandev->netdev, "Writing %d bytes to ram @0x%06x\n", + len, daddr); /* How many dowmem calls? */ nwrites = len / HFA384x_USB_RWMEM_MAXLEN; @@ -2450,7 +2438,8 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len) if (result) { netdev_warn(hw->wlandev->netdev, - "Read from index %zd failed, continuing\n", i); + "Read from index %zd failed, continuing\n", + i); continue; } @@ -2462,14 +2451,15 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len) pdrcode = le16_to_cpu(pda[currpdr + 1]); /* Test the record length */ if (pdrlen > HFA384x_PDR_LEN_MAX || pdrlen == 0) { - netdev_err(hw->wlandev->netdev, "pdrlen invalid=%d\n", pdrlen); + netdev_err(hw->wlandev->netdev, + "pdrlen invalid=%d\n", pdrlen); pdaok = 0; break; } /* Test the code */ if (!hfa384x_isgood_pdrcode(pdrcode)) { netdev_err(hw->wlandev->netdev, "pdrcode invalid=%d\n", - pdrcode); + pdrcode); pdaok = 0; break; } @@ -2485,13 +2475,13 @@ int hfa384x_drvr_readpda(hfa384x_t *hw, void *buf, unsigned int len) } if (pdaok) { netdev_info(hw->wlandev->netdev, - "PDA Read from 0x%08x in %s space.\n", - pdaloc[i].cardaddr, - pdaloc[i].auxctl == 0 ? "EXTDS" : - pdaloc[i].auxctl == 1 ? "NV" : - pdaloc[i].auxctl == 2 ? "PHY" : - pdaloc[i].auxctl == 3 ? "ICSRAM" : - "<bogus auxctl>"); + "PDA Read from 0x%08x in %s space.\n", + pdaloc[i].cardaddr, + pdaloc[i].auxctl == 0 ? "EXTDS" : + pdaloc[i].auxctl == 1 ? "NV" : + pdaloc[i].auxctl == 2 ? "PHY" : + pdaloc[i].auxctl == 3 ? "ICSRAM" : + "<bogus auxctl>"); break; } } @@ -2586,7 +2576,8 @@ int hfa384x_drvr_start(hfa384x_t *hw) result = submit_rx_urb(hw, GFP_KERNEL); if (result != 0) { netdev_err(hw->wlandev->netdev, - "Fatal, failed to submit RX URB, result=%d\n", result); + "Fatal, failed to submit RX URB, result=%d\n", + result); goto done; } @@ -2602,12 +2593,13 @@ int hfa384x_drvr_start(hfa384x_t *hw) */ result1 = hfa384x_cmd_initialize(hw); msleep(1000); - result = result2 = hfa384x_cmd_initialize(hw); + result = hfa384x_cmd_initialize(hw); + result2 = result; if (result1 != 0) { if (result2 != 0) { netdev_err(hw->wlandev->netdev, - "cmd_initialize() failed on two attempts, results %d and %d\n", - result1, result2); + "cmd_initialize() failed on two attempts, results %d and %d\n", + result1, result2); usb_kill_urb(&hw->rx_urb); goto done; } else { @@ -2617,9 +2609,9 @@ int hfa384x_drvr_start(hfa384x_t *hw) } } else if (result2 != 0) { netdev_warn(hw->wlandev->netdev, "First cmd_initialize() succeeded, but second attempt failed (result=%d)\n", - result2); + result2); netdev_warn(hw->wlandev->netdev, - "Most likely the card will be functional\n"); + "Most likely the card will be functional\n"); goto done; } @@ -2650,7 +2642,6 @@ done: ----------------------------------------------------------------*/ int hfa384x_drvr_stop(hfa384x_t *hw) { - int result = 0; int i; might_sleep(); @@ -2675,7 +2666,7 @@ int hfa384x_drvr_stop(hfa384x_t *hw) for (i = 0; i < HFA384x_NUMPORTS_MAX; i++) hw->port_enabled[i] = 0; - return result; + return 0; } /*---------------------------------------------------------------- @@ -2784,7 +2775,8 @@ int hfa384x_drvr_txframe(hfa384x_t *hw, struct sk_buff *skb, result = 1; ret = submit_tx_urb(hw, &hw->tx_urb, GFP_ATOMIC); if (ret != 0) { - netdev_err(hw->wlandev->netdev, "submit_tx_urb() failed, error=%d\n", ret); + netdev_err(hw->wlandev->netdev, + "submit_tx_urb() failed, error=%d\n", ret); result = 3; } @@ -2826,7 +2818,7 @@ void hfa384x_tx_timeout(wlandevice_t *wlandev) ----------------------------------------------------------------*/ static void hfa384x_usbctlx_reaper_task(unsigned long data) { - hfa384x_t *hw = (hfa384x_t *) data; + hfa384x_t *hw = (hfa384x_t *)data; struct list_head *entry; struct list_head *temp; unsigned long flags; @@ -2845,7 +2837,6 @@ static void hfa384x_usbctlx_reaper_task(unsigned long data) } spin_unlock_irqrestore(&hw->ctlxq.lock, flags); - } /*---------------------------------------------------------------- @@ -2864,7 +2855,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; + hfa384x_t *hw = (hfa384x_t *)data; struct list_head *entry; struct list_head *temp; unsigned long flags; @@ -3010,7 +3001,8 @@ static void unlocked_usbctlx_complete(hfa384x_t *hw, hfa384x_usbctlx_t *ctlx) default: netdev_err(hw->wlandev->netdev, "CTLX[%d] not in a terminating state(%s)\n", - le16_to_cpu(ctlx->outbuf.type), ctlxstr(ctlx->state)); + le16_to_cpu(ctlx->outbuf.type), + ctlxstr(ctlx->state)); break; } /* switch */ } @@ -3092,8 +3084,8 @@ static void hfa384x_usbctlxq_run(hfa384x_t *hw) * and schedule a reset ... */ netdev_warn(hw->wlandev->netdev, - "%s tx pipe stalled: requesting reset\n", - hw->wlandev->netdev->name); + "%s tx pipe stalled: requesting reset\n", + hw->wlandev->netdev->name); list_move(&head->list, &hw->ctlxq.pending); set_bit(WORK_TX_HALT, &hw->usb_flags); schedule_work(&hw->usb_work); @@ -3102,12 +3094,12 @@ static void hfa384x_usbctlxq_run(hfa384x_t *hw) if (result == -ESHUTDOWN) { netdev_warn(hw->wlandev->netdev, "%s urb shutdown!\n", - hw->wlandev->netdev->name); + hw->wlandev->netdev->name); break; } netdev_err(hw->wlandev->netdev, "Failed to submit CTLX[%d]: error=%d\n", - le16_to_cpu(head->outbuf.type), result); + le16_to_cpu(head->outbuf.type), result); unlocked_usbctlx_complete(hw, head); } /* while */ @@ -3135,7 +3127,7 @@ static void hfa384x_usbin_callback(struct urb *urb) { wlandevice_t *wlandev = urb->context; hfa384x_t *hw; - hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) urb->transfer_buffer; + hfa384x_usbin_t *usbin = (hfa384x_usbin_t *)urb->transfer_buffer; struct sk_buff *skb = NULL; int result; int urb_status; @@ -3174,7 +3166,7 @@ static void hfa384x_usbin_callback(struct urb *urb) case -EPIPE: netdev_warn(hw->wlandev->netdev, "%s rx pipe stalled: requesting reset\n", - wlandev->netdev->name); + wlandev->netdev->name); if (!test_and_set_bit(WORK_RX_HALT, &hw->usb_flags)) schedule_work(&hw->usb_work); ++(wlandev->linux_stats.rx_errors); @@ -3225,8 +3217,8 @@ static void hfa384x_usbin_callback(struct urb *urb) if (result != 0) { netdev_err(hw->wlandev->netdev, - "Fatal, failed to resubmit rx_urb. error=%d\n", - result); + "Fatal, failed to resubmit rx_urb. error=%d\n", + result); } } @@ -3361,9 +3353,9 @@ retry: */ if (ctlx->outbuf.type != intype) { netdev_warn(hw->wlandev->netdev, - "Expected IN[%d], received IN[%d] - ignored.\n", - le16_to_cpu(ctlx->outbuf.type), - le16_to_cpu(intype)); + "Expected IN[%d], received IN[%d] - ignored.\n", + le16_to_cpu(ctlx->outbuf.type), + le16_to_cpu(intype)); goto unlock; } @@ -3397,10 +3389,9 @@ retry: * Throw this CTLX away ... */ netdev_err(hw->wlandev->netdev, - "Matched IN URB, CTLX[%d] in invalid state(%s)." - " Discarded.\n", - le16_to_cpu(ctlx->outbuf.type), - ctlxstr(ctlx->state)); + "Matched IN URB, CTLX[%d] in invalid state(%s). Discarded.\n", + le16_to_cpu(ctlx->outbuf.type), + ctlxstr(ctlx->state)); if (unlocked_usbctlx_cancel_async(hw, ctlx) == 0) run_queue = 1; break; @@ -3464,7 +3455,7 @@ static void hfa384x_usbin_txcompl(wlandevice_t *wlandev, ----------------------------------------------------------------*/ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb) { - hfa384x_usbin_t *usbin = (hfa384x_usbin_t *) skb->data; + hfa384x_usbin_t *usbin = (hfa384x_usbin_t *)skb->data; hfa384x_t *hw = wlandev->priv; int hdrlen; struct p80211_rxmeta *rxmeta; @@ -3535,7 +3526,8 @@ static void hfa384x_usbin_rx(wlandevice_t *wlandev, struct sk_buff *skb) default: netdev_warn(hw->wlandev->netdev, "Received frame on unsupported port=%d\n", - HFA384x_RXSTATUS_MACPORT_GET(usbin->rxfrm.desc.status)); + HFA384x_RXSTATUS_MACPORT_GET( + usbin->rxfrm.desc.status)); goto done; break; } @@ -3597,8 +3589,8 @@ static void hfa384x_int_rxmonitor(wlandevice_t *wlandev, skb = dev_alloc_skb(skblen); if (skb == NULL) { netdev_err(hw->wlandev->netdev, - "alloc_skb failed trying to allocate %d bytes\n", - skblen); + "alloc_skb failed trying to allocate %d bytes\n", + skblen); return; } @@ -3608,7 +3600,7 @@ static void hfa384x_int_rxmonitor(wlandevice_t *wlandev, struct p80211_caphdr *caphdr; /* The NEW header format! */ datap = skb_put(skb, sizeof(struct p80211_caphdr)); - caphdr = (struct p80211_caphdr *) datap; + caphdr = (struct p80211_caphdr *)datap; caphdr->version = htonl(P80211CAPTURE_VERSION); caphdr->length = htonl(sizeof(struct p80211_caphdr)); @@ -3705,7 +3697,6 @@ static void hfa384x_usbout_callback(struct urb *urb) #endif if (wlandev && wlandev->netdev) { - switch (urb->status) { case 0: hfa384x_usbout_tx(wlandev, usbout); @@ -3715,8 +3706,8 @@ static void hfa384x_usbout_callback(struct urb *urb) { hfa384x_t *hw = wlandev->priv; netdev_warn(hw->wlandev->netdev, - "%s tx pipe stalled: requesting reset\n", - wlandev->netdev->name); + "%s tx pipe stalled: requesting reset\n", + wlandev->netdev->name); if (!test_and_set_bit (WORK_TX_HALT, &hw->usb_flags)) schedule_work(&hw->usb_work); @@ -3731,8 +3722,8 @@ static void hfa384x_usbout_callback(struct urb *urb) hfa384x_t *hw = wlandev->priv; if (!test_and_set_bit - (THROTTLE_TX, &hw->usb_flags) - && !timer_pending(&hw->throttle)) { + (THROTTLE_TX, &hw->usb_flags) && + !timer_pending(&hw->throttle)) { mod_timer(&hw->throttle, jiffies + THROTTLE_JIFFIES); } @@ -3748,7 +3739,7 @@ static void hfa384x_usbout_callback(struct urb *urb) default: netdev_info(wlandev->netdev, "unknown urb->status=%d\n", - urb->status); + urb->status); ++(wlandev->linux_stats.tx_errors); break; } /* switch */ @@ -3842,9 +3833,9 @@ retry: default: /* This is NOT a valid CTLX "success" state! */ netdev_err(hw->wlandev->netdev, - "Illegal CTLX[%d] success state(%s, %d) in OUT URB\n", - le16_to_cpu(ctlx->outbuf.type), - ctlxstr(ctlx->state), urb->status); + "Illegal CTLX[%d] success state(%s, %d) in OUT URB\n", + le16_to_cpu(ctlx->outbuf.type), + ctlxstr(ctlx->state), urb->status); break; } /* switch */ } else { @@ -3852,8 +3843,8 @@ retry: if ((urb->status == -EPIPE) && !test_and_set_bit(WORK_TX_HALT, &hw->usb_flags)) { netdev_warn(hw->wlandev->netdev, - "%s tx pipe stalled: requesting reset\n", - hw->wlandev->netdev->name); + "%s tx pipe stalled: requesting reset\n", + hw->wlandev->netdev->name); schedule_work(&hw->usb_work); } @@ -3904,7 +3895,7 @@ delresp: ----------------------------------------------------------------*/ static void hfa384x_usbctlx_reqtimerfn(unsigned long data) { - hfa384x_t *hw = (hfa384x_t *) data; + hfa384x_t *hw = (hfa384x_t *)data; unsigned long flags; spin_lock_irqsave(&hw->ctlxq.lock, flags); @@ -3962,7 +3953,7 @@ static void hfa384x_usbctlx_reqtimerfn(unsigned long data) ----------------------------------------------------------------*/ static void hfa384x_usbctlx_resptimerfn(unsigned long data) { - hfa384x_t *hw = (hfa384x_t *) data; + hfa384x_t *hw = (hfa384x_t *)data; unsigned long flags; spin_lock_irqsave(&hw->ctlxq.lock, flags); @@ -4001,7 +3992,7 @@ static void hfa384x_usbctlx_resptimerfn(unsigned long data) ----------------------------------------------------------------*/ static void hfa384x_usb_throttlefn(unsigned long data) { - hfa384x_t *hw = (hfa384x_t *) data; + hfa384x_t *hw = (hfa384x_t *)data; unsigned long flags; spin_lock_irqsave(&hw->ctlxq.lock, flags); @@ -4139,13 +4130,13 @@ static int hfa384x_isgood_pdrcode(u16 pdrcode) default: if (pdrcode < 0x1000) { /* code is OK, but we don't know exactly what it is */ - pr_debug("Encountered unknown PDR#=0x%04x, " - "assuming it's ok.\n", pdrcode); + pr_debug("Encountered unknown PDR#=0x%04x, assuming it's ok.\n", + pdrcode); return 1; } else { /* bad code */ - pr_debug("Encountered unknown PDR#=0x%04x, " - "(>=0x1000), assuming it's bad.\n", pdrcode); + pr_debug("Encountered unknown PDR#=0x%04x, (>=0x1000), assuming it's bad.\n", + pdrcode); return 0; } break; diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c index 3df753b..913676e 100644 --- a/drivers/staging/wlan-ng/p80211conv.c +++ b/drivers/staging/wlan-ng/p80211conv.c @@ -195,8 +195,8 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, memcpy(p80211_hdr->a3.a3, &e_hdr.saddr, ETH_ALEN); break; default: - printk(KERN_ERR - "Error: Converting eth to wlan in unknown mode.\n"); + netdev_err(wlandev->netdev, + "Error: Converting eth to wlan in unknown mode.\n"); return 1; break; } @@ -213,7 +213,7 @@ int skb_ether_to_p80211(wlandevice_t *wlandev, u32 ethconv, (wlandev->hostwep & HOSTWEP_DEFAULTKEY_MASK), p80211_wep->iv, p80211_wep->icv); if (foo) { - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "Host en-WEP failed, dropping frame (%d).\n", foo); return 2; @@ -310,7 +310,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, } else { payload_offset = WLAN_HDR_A4_LEN; if (payload_length < WLAN_HDR_A4_LEN - WLAN_HDR_A3_LEN) { - printk(KERN_ERR "A4 frame too short!\n"); + netdev_err(netdev, "A4 frame too short!\n"); return 1; } payload_length -= (WLAN_HDR_A4_LEN - WLAN_HDR_A3_LEN); @@ -322,8 +322,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, if ((wlandev->hostwep & HOSTWEP_PRIVACYINVOKED) && WLAN_GET_FC_ISWEP(fc) && (wlandev->hostwep & HOSTWEP_DECRYPT)) { if (payload_length <= 8) { - printk(KERN_ERR "WEP frame too short (%u).\n", - skb->len); + netdev_err(netdev, + "WEP frame too short (%u).\n", skb->len); return 1; } foo = wep_decrypt(wlandev, skb->data + payload_offset + 4, @@ -367,7 +367,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, if (payload_length > (netdev->mtu + WLAN_ETHHDR_LEN)) { /* A bogus length ethfrm has been encap'd. */ /* Is someone trying an oflow attack? */ - printk(KERN_ERR "ENCAP frame too large (%d > %d)\n", + netdev_err(netdev, "ENCAP frame too large (%d > %d)\n", payload_length, netdev->mtu + WLAN_ETHHDR_LEN); return 1; } @@ -396,7 +396,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, if (payload_length > netdev->mtu) { /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ - printk(KERN_ERR "SNAP frame too large (%d > %d)\n", + netdev_err(netdev, "SNAP frame too large (%d > %d)\n", payload_length, netdev->mtu); return 1; } @@ -428,7 +428,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, > netdev->mtu) { /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ - printk(KERN_ERR "DIXII frame too large (%ld > %d)\n", + netdev_err(netdev, "DIXII frame too large (%ld > %d)\n", (long int)(payload_length - sizeof(struct wlan_llc) - sizeof(struct wlan_snap)), netdev->mtu); @@ -463,7 +463,7 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv, if (payload_length > netdev->mtu) { /* A bogus length ethfrm has been sent. */ /* Is someone trying an oflow attack? */ - printk(KERN_ERR "OTHER frame too large (%d > %d)\n", + netdev_err(netdev, "OTHER frame too large (%d > %d)\n", payload_length, netdev->mtu); return 1; } @@ -603,8 +603,8 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) /* If these already have metadata, we error out! */ if (P80211SKB_RXMETA(skb) != NULL) { - printk(KERN_ERR "%s: RXmeta already attached!\n", - wlandev->name); + netdev_err(wlandev->netdev, + "%s: RXmeta already attached!\n", wlandev->name); result = 0; goto exit; } @@ -613,8 +613,8 @@ int p80211skb_rxmeta_attach(struct wlandevice *wlandev, struct sk_buff *skb) rxmeta = kzalloc(sizeof(struct p80211_rxmeta), GFP_ATOMIC); if (rxmeta == NULL) { - printk(KERN_ERR "%s: Failed to allocate rxmeta.\n", - wlandev->name); + netdev_err(wlandev->netdev, + "%s: Failed to allocate rxmeta.\n", wlandev->name); result = 1; goto exit; } @@ -656,6 +656,7 @@ void p80211skb_free(struct wlandevice *wlandev, struct sk_buff *skb) if (meta && meta->rx) p80211skb_rxmeta_detach(skb); else - printk(KERN_ERR "Freeing an skb (%p) w/ no frmmeta.\n", skb); + netdev_err(wlandev->netdev, + "Freeing an skb (%p) w/ no frmmeta.\n", skb); dev_kfree_skb(skb); } diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c index e3ae802..00b186c 100644 --- a/drivers/staging/wlan-ng/p80211netdev.c +++ b/drivers/staging/wlan-ng/p80211netdev.c @@ -90,9 +90,6 @@ #include "cfg80211.c" -/* Support functions */ -static void p80211netdev_rx_bh(unsigned long arg); - /* netdevice method functions */ static int p80211knetdev_init(netdevice_t *netdev); static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev); @@ -243,25 +240,59 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb) tasklet_schedule(&wlandev->rx_bh); } -/*---------------------------------------------------------------- -* p80211netdev_rx_bh -* -* Deferred processing of all received frames. -* -* Arguments: -* wlandev WLAN network device structure -* skb skbuff containing a full 802.11 frame. -* Returns: -* nothing -* Side effects: -* -----------------------------------------------------------------*/ +#define CONV_TO_ETHER_SKIPPED 0x01 +#define CONV_TO_ETHER_FAILED 0x02 + +/** + * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame + * @wlandev: pointer to WLAN device + * @skb: pointer to socket buffer + * + * Returns: 0 if conversion succeeded + * CONV_TO_ETHER_FAILED if conversion failed + * CONV_TO_ETHER_SKIPPED if frame is ignored + */ +static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb) +{ + struct p80211_hdr_a3 *hdr; + + hdr = (struct p80211_hdr_a3 *) skb->data; + if (p80211_rx_typedrop(wlandev, hdr->fc)) + return CONV_TO_ETHER_SKIPPED; + + /* perform mcast filtering: allow my local address through but reject + * anything else that isn't multicast + */ + if (wlandev->netdev->flags & IFF_ALLMULTI) { + if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr, + hdr->a1)) { + if (!is_multicast_ether_addr(hdr->a1)) + return CONV_TO_ETHER_SKIPPED; + } + } + + if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) { + skb->dev->last_rx = jiffies; + wlandev->linux_stats.rx_packets++; + wlandev->linux_stats.rx_bytes += skb->len; + netif_rx_ni(skb); + return 0; + } + + netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n"); + return CONV_TO_ETHER_FAILED; +} + +/** + * p80211netdev_rx_bh - deferred processing of all received frames + * + * @arg: pointer to WLAN network device structure (cast to unsigned long) + */ static void p80211netdev_rx_bh(unsigned long arg) { wlandevice_t *wlandev = (wlandevice_t *) arg; struct sk_buff *skb = NULL; netdevice_t *dev = wlandev->netdev; - struct p80211_hdr_a3 *hdr; /* Let's empty our our queue */ while ((skb = skb_dequeue(&wlandev->nsd_rxq))) { @@ -284,37 +315,8 @@ static void p80211netdev_rx_bh(unsigned long arg) netif_rx_ni(skb); continue; } else { - hdr = (struct p80211_hdr_a3 *) skb->data; - if (p80211_rx_typedrop(wlandev, hdr->fc)) { - dev_kfree_skb(skb); - continue; - } - - /* perform mcast filtering */ - if (wlandev->netdev->flags & IFF_ALLMULTI) { - /* allow my local address through */ - if (memcmp - (hdr->a1, wlandev->netdev->dev_addr, - ETH_ALEN) != 0) { - /* but reject anything else that - isn't multicast */ - if (!(hdr->a1[0] & 0x01)) { - dev_kfree_skb(skb); - continue; - } - } - } - - if (skb_p80211_to_ether - (wlandev, wlandev->ethconv, skb) == 0) { - skb->dev->last_rx = jiffies; - wlandev->linux_stats.rx_packets++; - wlandev->linux_stats.rx_bytes += - skb->len; - netif_rx_ni(skb); + if (!p80211_convert_to_ether(wlandev, skb)) continue; - } - pr_debug("p80211_to_ether failed.\n"); } } dev_kfree_skb(skb); @@ -363,7 +365,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, memset(&p80211_wep, 0, sizeof(struct p80211_metawep)); if (netif_queue_stopped(netdev)) { - pr_debug("called when queue stopped.\n"); + netdev_dbg(netdev, "called when queue stopped.\n"); result = 1; goto failed; } @@ -383,8 +385,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, */ if (skb->protocol != ETH_P_80211_RAW) { netif_start_queue(wlandev->netdev); - printk(KERN_NOTICE - "Tx attempt prior to association, frame dropped.\n"); + netdev_notice(netdev, "Tx attempt prior to association, frame dropped.\n"); wlandev->linux_stats.tx_dropped++; result = 0; goto failed; @@ -406,8 +407,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, (wlandev, wlandev->ethconv, skb, &p80211_hdr, &p80211_wep) != 0) { /* convert failed */ - pr_debug("ether_to_80211(%d) failed.\n", - wlandev->ethconv); + netdev_dbg(netdev, "ether_to_80211(%d) failed.\n", + wlandev->ethconv); result = 1; goto failed; } @@ -432,17 +433,17 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb, result = NETDEV_TX_OK; } else if (txresult == 1) { /* success, no more avail */ - pr_debug("txframe success, no more bufs\n"); + netdev_dbg(netdev, "txframe success, no more bufs\n"); /* netdev->tbusy = 1; don't set here, irqhdlr */ /* may have already cleared it */ result = NETDEV_TX_OK; } else if (txresult == 2) { /* alloc failure, drop frame */ - pr_debug("txframe returned alloc_fail\n"); + netdev_dbg(netdev, "txframe returned alloc_fail\n"); result = NETDEV_TX_BUSY; } else { /* buffer full or queue busy, drop frame. */ - pr_debug("txframe returned full or busy\n"); + netdev_dbg(netdev, "txframe returned full or busy\n"); result = NETDEV_TX_BUSY; } @@ -562,7 +563,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd) wlandevice_t *wlandev = dev->ml_priv; u8 *msgbuf; - pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len); + netdev_dbg(dev, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len); #ifdef SIOCETHTOOL if (cmd == SIOCETHTOOL) { @@ -683,8 +684,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, void *addr) * change the netdev address */ if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) { - printk(KERN_ERR - "Low-level driver failed dot11req_mibset(dot11MACAddress).\n"); + netdev_err(dev, "Low-level driver failed dot11req_mibset(dot11MACAddress).\n"); result = -EADDRNOTAVAIL; } else { /* everything's ok, change the addr in netdev */ @@ -763,7 +763,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) { - printk(KERN_ERR "Failed to alloc wiphy.\n"); + dev_err(physdev, "Failed to alloc wiphy.\n"); return 1; } @@ -771,7 +771,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device *physdev) netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d", ether_setup); if (netdev == NULL) { - printk(KERN_ERR "Failed to alloc netdev.\n"); + dev_err(physdev, "Failed to alloc netdev.\n"); wlan_free_wiphy(wiphy); result = 1; } else { @@ -947,7 +947,8 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc) ftype = WLAN_GET_FC_FTYPE(fc); fstype = WLAN_GET_FC_FSTYPE(fc); #if 0 - pr_debug("rx_typedrop : ftype=%d fstype=%d.\n", ftype, fstype); + netdev_dbg(wlandev->netdev, "rx_typedrop : ftype=%d fstype=%d.\n", + ftype, fstype); #endif switch (ftype) { case WLAN_FTYPE_MGMT: @@ -956,7 +957,7 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc) drop = 1; break; } - pr_debug("rx'd mgmt:\n"); + netdev_dbg(wlandev->netdev, "rx'd mgmt:\n"); wlandev->rx.mgmt++; switch (fstype) { case WLAN_FSTYPE_ASSOCREQ: @@ -1018,7 +1019,7 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc) drop = 1; break; } - pr_debug("rx'd ctl:\n"); + netdev_dbg(wlandev->netdev, "rx'd ctl:\n"); wlandev->rx.ctl++; switch (fstype) { case WLAN_FSTYPE_PSPOLL: @@ -1070,19 +1071,19 @@ static int p80211_rx_typedrop(wlandevice_t *wlandev, u16 fc) wlandev->rx.data__cfack_cfpoll++; break; case WLAN_FSTYPE_NULL: - pr_debug("rx'd data:null\n"); + netdev_dbg(wlandev->netdev, "rx'd data:null\n"); wlandev->rx.null++; break; case WLAN_FSTYPE_CFACK: - pr_debug("rx'd data:cfack\n"); + netdev_dbg(wlandev->netdev, "rx'd data:cfack\n"); wlandev->rx.cfack++; break; case WLAN_FSTYPE_CFPOLL: - pr_debug("rx'd data:cfpoll\n"); + netdev_dbg(wlandev->netdev, "rx'd data:cfpoll\n"); wlandev->rx.cfpoll++; break; case WLAN_FSTYPE_CFACK_CFPOLL: - pr_debug("rx'd data:cfack_cfpoll\n"); + netdev_dbg(wlandev->netdev, "rx'd data:cfack_cfpoll\n"); wlandev->rx.cfack_cfpoll++; break; default: @@ -1103,8 +1104,8 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev) if (wlandev->tx_timeout) { wlandev->tx_timeout(wlandev); } else { - printk(KERN_WARNING "Implement tx_timeout for %s\n", - wlandev->nsdname); + netdev_warn(netdev, "Implement tx_timeout for %s\n", + wlandev->nsdname); netif_wake_queue(wlandev->netdev); } } diff --git a/drivers/staging/wlan-ng/p80211req.c b/drivers/staging/wlan-ng/p80211req.c index cdfd808..7221379 100644 --- a/drivers/staging/wlan-ng/p80211req.c +++ b/drivers/staging/wlan-ng/p80211req.c @@ -95,7 +95,6 @@ static void p80211req_mibset_mibget(wlandevice_t *wlandev, ----------------------------------------------------------------*/ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) { - int result = 0; struct p80211msg *msg = (struct p80211msg *) msgbuf; /* Check to make sure the MSD is running */ @@ -109,9 +108,9 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) /* Check Permissions */ if (!capable(CAP_NET_ADMIN) && (msg->msgcode != DIDmsg_dot11req_mibget)) { - printk(KERN_ERR - "%s: only dot11req_mibget allowed for non-root.\n", - wlandev->name); + netdev_err(wlandev->netdev, + "%s: only dot11req_mibget allowed for non-root.\n", + wlandev->name); return -EPERM; } @@ -129,7 +128,7 @@ int p80211req_dorequest(wlandevice_t *wlandev, u8 *msgbuf) wlandev->mlmerequest(wlandev, msg); clear_bit(1, &(wlandev->request_pending)); - return result; /* if result==0, msg->status still may contain an err */ + return 0; /* if result==0, msg->status still may contain an err */ } /*---------------------------------------------------------------- diff --git a/drivers/staging/wlan-ng/prism2fw.c b/drivers/staging/wlan-ng/prism2fw.c index 2b0c235..f787035 100644 --- a/drivers/staging/wlan-ng/prism2fw.c +++ b/drivers/staging/wlan-ng/prism2fw.c @@ -205,19 +205,20 @@ static int prism2_fwtry(struct usb_device *udev, wlandevice_t *wlandev) { const struct firmware *fw_entry = NULL; - printk(KERN_INFO "prism2_usb: Checking for firmware %s\n", + netdev_info(wlandev->netdev, "prism2_usb: Checking for firmware %s\n", PRISM2_USB_FWFILE); if (request_ihex_firmware(&fw_entry, PRISM2_USB_FWFILE, &udev->dev) != 0) { - printk(KERN_INFO + netdev_info(wlandev->netdev, "prism2_usb: Firmware not available, but not essential\n"); - printk(KERN_INFO + netdev_info(wlandev->netdev, "prism2_usb: can continue to use card anyway.\n"); return 1; } - printk(KERN_INFO "prism2_usb: %s will be processed, size %zu\n", - PRISM2_USB_FWFILE, fw_entry->size); + netdev_info(wlandev->netdev, + "prism2_usb: %s will be processed, size %zu\n", + PRISM2_USB_FWFILE, fw_entry->size); prism2_fwapply((const struct ihex_binrec *)fw_entry->data, wlandev); release_firmware(fw_entry); @@ -275,7 +276,7 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, wlandevice_t *wlandev /* Build the PDA we're going to use. */ if (read_cardpda(&pda, wlandev)) { - printk(KERN_ERR "load_cardpda failed, exiting.\n"); + netdev_err(wlandev->netdev, "load_cardpda failed, exiting.\n"); return 1; } @@ -299,7 +300,7 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, wlandevice_t *wlandev /* DIDmsg_dot11req_mibget */ prism2mgmt_mibset_mibget(wlandev, &getmsg); if (getmsg.resultcode.data != P80211ENUM_resultcode_success) - printk(KERN_ERR "Couldn't fetch PRI-SUP info\n"); + netdev_err(wlandev->netdev, "Couldn't fetch PRI-SUP info\n"); /* Already in host order */ priid.role = *data++; @@ -311,19 +312,21 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, wlandevice_t *wlandev /* Read the S3 file */ result = read_fwfile(rfptr); if (result) { - printk(KERN_ERR "Failed to read the data exiting.\n"); + netdev_err(wlandev->netdev, + "Failed to read the data exiting.\n"); return 1; } result = validate_identity(); if (result) { - printk(KERN_ERR "Incompatible firmware image.\n"); + netdev_err(wlandev->netdev, "Incompatible firmware image.\n"); return 1; } if (startaddr == 0x00000000) { - printk(KERN_ERR "Can't RAM download a Flash image!\n"); + netdev_err(wlandev->netdev, + "Can't RAM download a Flash image!\n"); return 1; } @@ -333,20 +336,20 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, wlandevice_t *wlandev /* Do any plugging */ result = plugimage(fchunk, nfchunks, s3plug, ns3plug, &pda); if (result) { - printk(KERN_ERR "Failed to plug data.\n"); + netdev_err(wlandev->netdev, "Failed to plug data.\n"); return 1; } /* Insert any CRCs */ if (crcimage(fchunk, nfchunks, s3crc, ns3crc)) { - printk(KERN_ERR "Failed to insert all CRCs\n"); + netdev_err(wlandev->netdev, "Failed to insert all CRCs\n"); return 1; } /* Write the image */ result = writeimage(wlandev, fchunk, nfchunks); if (result) { - printk(KERN_ERR "Failed to ramwrite image data.\n"); + netdev_err(wlandev->netdev, "Failed to ramwrite image data.\n"); return 1; } @@ -354,7 +357,7 @@ static int prism2_fwapply(const struct ihex_binrec *rfptr, wlandevice_t *wlandev free_chunks(fchunk, &nfchunks); free_srecs(); - printk(KERN_INFO "prism2_usb: firmware loading finished.\n"); + netdev_info(wlandev->netdev, "prism2_usb: firmware loading finished.\n"); return result; } @@ -410,8 +413,7 @@ static int crcimage(struct imgchunk *fchunk, unsigned int nfchunks, break; } if (c >= nfchunks) { - printk(KERN_ERR - "Failed to find chunk for " + pr_err("Failed to find chunk for " "crcrec[%d], addr=0x%06x len=%d , " "aborting crc.\n", i, s3crc[i].addr, s3crc[i].len); @@ -537,8 +539,7 @@ static int mkimage(struct imgchunk *clist, unsigned int *ccnt) for (i = 0; i < *ccnt; i++) { clist[i].data = kzalloc(clist[i].len, GFP_KERNEL); if (clist[i].data == NULL) { - printk(KERN_ERR - "failed to allocate image space, exitting.\n"); + pr_err("failed to allocate image space, exitting.\n"); return 1; } pr_debug("chunk[%d]: addr=0x%06x len=%d\n", @@ -556,8 +557,7 @@ static int mkimage(struct imgchunk *clist, unsigned int *ccnt) break; } if (((unsigned int)j) >= (*ccnt)) { - printk(KERN_ERR - "s3rec(a=0x%06x,l=%d), no chunk match, exiting.\n", + pr_err("s3rec(a=0x%06x,l=%d), no chunk match, exiting.\n", s3start, s3data[i].len); return 1; } @@ -627,8 +627,7 @@ static int mkpdrlist(struct pda *pda) } if (curroff >= (HFA384x_PDA_LEN_MAX / 2)) { - printk(KERN_ERR - "no end record found or invalid lengths in " + pr_err("no end record found or invalid lengths in " "PDR data, exiting. %x %d\n", curroff, pda->nrec); return 1; } @@ -685,8 +684,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, j = -1; } if (j >= pda->nrec && j != -1) { /* if no matching PDR, fail */ - printk(KERN_WARNING - "warning: Failed to find PDR for " + pr_warn("warning: Failed to find PDR for " "plugrec 0x%04x.\n", s3plug[i].itemcode); continue; /* and move on to the next PDR */ #if 0 @@ -704,8 +702,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, /* Validate plug len against PDR len */ if (j != -1 && s3plug[i].len < le16_to_cpu(pda->rec[j]->len)) { - printk(KERN_ERR - "error: Plug vs. PDR len mismatch for " + pr_err("error: Plug vs. PDR len mismatch for " "plugrec 0x%04x, abort plugging.\n", s3plug[i].itemcode); result = 1; @@ -720,8 +717,7 @@ static int plugimage(struct imgchunk *fchunk, unsigned int nfchunks, break; } if (c >= nfchunks) { - printk(KERN_ERR - "error: Failed to find image chunk for " + pr_err("error: Failed to find image chunk for " "plugrec 0x%04x.\n", s3plug[i].itemcode); result = 1; continue; @@ -898,7 +894,7 @@ static int read_fwfile(const struct ihex_binrec *record) ns3plug++; if (ns3plug == S3PLUG_MAX) { - printk(KERN_ERR "S3 plugrec limit reached - aborting\n"); + pr_err("S3 plugrec limit reached - aborting\n"); return 1; } break; @@ -915,7 +911,7 @@ static int read_fwfile(const struct ihex_binrec *record) s3crc[ns3crc].dowrite); ns3crc++; if (ns3crc == S3CRC_MAX) { - printk(KERN_ERR "S3 crcrec limit reached - aborting\n"); + pr_err("S3 crcrec limit reached - aborting\n"); return 1; } break; @@ -929,7 +925,7 @@ static int read_fwfile(const struct ihex_binrec *record) s3info[ns3info].len, s3info[ns3info].type); if (((s3info[ns3info].len - 1) * sizeof(u16)) > sizeof(s3info[ns3info].info)) { - printk(KERN_ERR " S3 inforec length too long - aborting\n"); + pr_err("S3 inforec length too long - aborting\n"); return 1; } @@ -943,7 +939,7 @@ static int read_fwfile(const struct ihex_binrec *record) ns3info++; if (ns3info == S3INFO_MAX) { - printk(KERN_ERR "S3 inforec limit reached - aborting\n"); + pr_err("S3 inforec limit reached - aborting\n"); return 1; } break; @@ -953,7 +949,7 @@ static int read_fwfile(const struct ihex_binrec *record) s3data[ns3data].data = (uint8_t *) record->data; ns3data++; if (ns3data == S3DATA_MAX) { - printk(KERN_ERR "S3 datarec limit reached - aborting\n"); + pr_err("S3 datarec limit reached - aborting\n"); return 1; } break; @@ -997,9 +993,9 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, if (!rstmsg || !rwrmsg) { kfree(rstmsg); kfree(rwrmsg); - printk(KERN_ERR - "writeimage: no memory for firmware download, " - "aborting download\n"); + netdev_err(wlandev->netdev, + "writeimage: no memory for firmware download, " + "aborting download\n"); return -ENOMEM; } @@ -1042,16 +1038,16 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, result = prism2mgmt_ramdl_state(wlandev, rstmsg); if (result) { - printk(KERN_ERR - "writeimage state enable failed w/ result=%d, " - "aborting download\n", result); + netdev_err(wlandev->netdev, + "writeimage state enable failed w/ result=%d, " + "aborting download\n", result); goto free_result; } resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { - printk(KERN_ERR - "writeimage()->xxxdl_state msg indicates failure, " - "w/ resultcode=%d, aborting download.\n", resultcode); + netdev_err(wlandev->netdev, + "writeimage()->xxxdl_state msg indicates failure, " + "w/ resultcode=%d, aborting download.\n", resultcode); result = 1; goto free_result; } @@ -1085,15 +1081,14 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, /* Check the results */ if (result) { - printk(KERN_ERR - "writeimage chunk write failed w/ result=%d, " - "aborting download\n", result); + netdev_err(wlandev->netdev, + "writeimage chunk write failed w/ " + "result=%d, aborting download\n", result); goto free_result; } resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { - printk(KERN_ERR - "writeimage()->xxxdl_write msg indicates failure, " + pr_err("writeimage()->xxxdl_write msg indicates failure, " "w/ resultcode=%d, aborting download.\n", resultcode); result = 1; @@ -1110,16 +1105,16 @@ static int writeimage(wlandevice_t *wlandev, struct imgchunk *fchunk, result = prism2mgmt_ramdl_state(wlandev, rstmsg); if (result) { - printk(KERN_ERR - "writeimage state disable failed w/ result=%d, " - "aborting download\n", result); + netdev_err(wlandev->netdev, + "writeimage state disable failed w/ result=%d, " + "aborting download\n", result); goto free_result; } resultcode = rstmsg->resultcode.data; if (resultcode != P80211ENUM_resultcode_success) { - printk(KERN_ERR - "writeimage()->xxxdl_state msg indicates failure, " - "w/ resultcode=%d, aborting download.\n", resultcode); + netdev_err(wlandev->netdev, + "writeimage()->xxxdl_state msg indicates failure, " + "w/ resultcode=%d, aborting download.\n", resultcode); result = 1; goto free_result; } diff --git a/drivers/staging/wlan-ng/prism2mgmt.c b/drivers/staging/wlan-ng/prism2mgmt.c index a9909f6..d110b36 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.c +++ b/drivers/staging/wlan-ng/prism2mgmt.c @@ -129,8 +129,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hw->ident_sta_fw.minor, hw->ident_sta_fw.variant) < HFA384x_FIRMWARE_VERSION(1, 3, 2)) { - printk(KERN_ERR - "HostScan not supported with current firmware (<1.3.2).\n"); + netdev_err(wlandev->netdev, + "HostScan not supported with current firmware (<1.3.2).\n"); result = 1; msg->resultcode.data = P80211ENUM_resultcode_not_supported; goto exit; @@ -143,8 +143,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFROAMINGMODE, &roamingmode); if (result) { - printk(KERN_ERR "getconfig(ROAMMODE) failed. result=%d\n", - result); + netdev_err(wlandev->netdev, + "getconfig(ROAMMODE) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -155,8 +155,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFROAMINGMODE, HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); if (result) { - printk(KERN_ERR "setconfig(ROAMINGMODE) failed. result=%d\n", - result); + netdev_err(wlandev->netdev, + "setconfig(ROAMINGMODE) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -176,8 +176,9 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFPASSIVESCANCTRL, word); if (result) { - printk(KERN_WARNING "Passive scan not supported with " - "current firmware. (<1.5.1)\n"); + netdev_warn(wlandev->netdev, + "Passive scan not supported with " + "current firmware. (<1.5.1)\n"); } } @@ -203,8 +204,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) /* Enable the MAC port if it's not already enabled */ result = hfa384x_drvr_getconfig16(hw, HFA384x_RID_PORTSTATUS, &word); if (result) { - printk(KERN_ERR "getconfig(PORTSTATUS) failed. " - "result=%d\n", result); + netdev_err(wlandev->netdev, + "getconfig(PORTSTATUS) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -216,9 +217,9 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFROAMINGMODE, HFA384x_ROAMMODE_HOSTSCAN_HOSTROAM); if (result) { - printk(KERN_ERR - "setconfig(ROAMINGMODE) failed. result=%d\n", - result); + netdev_err(wlandev->netdev, + "setconfig(ROAMINGMODE) failed. result=%d\n", + result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -232,7 +233,7 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) wordbuf, HFA384x_RID_CNFOWNSSID_LEN); if (result) { - printk(KERN_ERR "Failed to set OwnSSID.\n"); + netdev_err(wlandev->netdev, "Failed to set OwnSSID.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -241,7 +242,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) wordbuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { - printk(KERN_ERR "Failed to set DesiredSSID.\n"); + netdev_err(wlandev->netdev, + "Failed to set DesiredSSID.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -251,7 +253,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CNFPORTTYPE, HFA384x_PORTTYPE_IBSS); if (result) { - printk(KERN_ERR "Failed to set CNFPORTTYPE.\n"); + netdev_err(wlandev->netdev, + "Failed to set CNFPORTTYPE.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -261,15 +264,16 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_CREATEIBSS, HFA384x_CREATEIBSS_JOINCREATEIBSS); if (result) { - printk(KERN_ERR "Failed to set CREATEIBSS.\n"); + netdev_err(wlandev->netdev, + "Failed to set CREATEIBSS.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; } result = hfa384x_drvr_enable(hw, 0); if (result) { - printk(KERN_ERR "drvr_enable(0) failed. " - "result=%d\n", result); + netdev_err(wlandev->netdev, + "drvr_enable(0) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -288,8 +292,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) HFA384x_RID_HOSTSCAN, &scanreq, sizeof(hfa384x_HostScanRequest_data_t)); if (result) { - printk(KERN_ERR "setconfig(SCANREQUEST) failed. result=%d\n", - result); + netdev_err(wlandev->netdev, + "setconfig(SCANREQUEST) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -310,8 +314,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) if (istmpenable) { result = hfa384x_drvr_disable(hw, 0); if (result) { - printk(KERN_ERR "drvr_disable(0) failed. " - "result=%d\n", result); + netdev_err(wlandev->netdev, + "drvr_disable(0) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -322,8 +326,8 @@ int prism2mgmt_scan(wlandevice_t *wlandev, void *msgp) result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFROAMINGMODE, roamingmode); if (result) { - printk(KERN_ERR "setconfig(ROAMMODE) failed. result=%d\n", - result); + netdev_err(wlandev->netdev, + "setconfig(ROAMMODE) failed. result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; goto exit; @@ -372,8 +376,9 @@ int prism2mgmt_scan_results(wlandevice_t *wlandev, void *msgp) req->resultcode.status = P80211ENUM_msgitem_status_data_ok; if (!hw->scanresults) { - printk(KERN_ERR - "dot11req_scan_results can only be used after a successful dot11req_scan.\n"); + netdev_err(wlandev->netdev, + "dot11req_scan_results can only be used after " + "a successful dot11req_scan.\n"); result = 2; req->resultcode.data = P80211ENUM_resultcode_invalid_parameters; goto exit; @@ -555,14 +560,14 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFOWNSSID, bytebuf, HFA384x_RID_CNFOWNSSID_LEN); if (result) { - printk(KERN_ERR "Failed to set CnfOwnSSID\n"); + netdev_err(wlandev->netdev, "Failed to set CnfOwnSSID\n"); goto failed; } result = hfa384x_drvr_setconfig(hw, HFA384x_RID_CNFDESIREDSSID, bytebuf, HFA384x_RID_CNFDESIREDSSID_LEN); if (result) { - printk(KERN_ERR "Failed to set CnfDesiredSSID\n"); + netdev_err(wlandev->netdev, "Failed to set CnfDesiredSSID\n"); goto failed; } @@ -574,7 +579,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) word = msg->beaconperiod.data; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFAPBCNint, word); if (result) { - printk(KERN_ERR "Failed to set beacon period=%d.\n", word); + netdev_err(wlandev->netdev, + "Failed to set beacon period=%d.\n", word); goto failed; } @@ -582,7 +588,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) word = msg->dschannel.data; result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFOWNCHANNEL, word); if (result) { - printk(KERN_ERR "Failed to set channel=%d.\n", word); + netdev_err(wlandev->netdev, + "Failed to set channel=%d.\n", word); goto failed; } /* Basic rates */ @@ -610,7 +617,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFBASICRATES, word); if (result) { - printk(KERN_ERR "Failed to set basicrates=%d.\n", word); + netdev_err(wlandev->netdev, + "Failed to set basicrates=%d.\n", word); goto failed; } @@ -639,13 +647,14 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_CNFSUPPRATES, word); if (result) { - printk(KERN_ERR "Failed to set supprates=%d.\n", word); + netdev_err(wlandev->netdev, + "Failed to set supprates=%d.\n", word); goto failed; } result = hfa384x_drvr_setconfig16(hw, HFA384x_RID_TXRATECNTL, word); if (result) { - printk(KERN_ERR "Failed to set txrates=%d.\n", word); + netdev_err(wlandev->netdev, "Failed to set txrates=%d.\n", word); goto failed; } @@ -659,7 +668,8 @@ int prism2mgmt_start(wlandevice_t *wlandev, void *msgp) /* Enable the Port */ result = hfa384x_drvr_enable(hw, 0); if (result) { - printk(KERN_ERR "Enable macport failed, result=%d.\n", result); + netdev_err(wlandev->netdev, + "Enable macport failed, result=%d.\n", result); goto failed; } @@ -704,8 +714,8 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) * state. */ if (wlandev->msdstate != WLAN_MSD_FWLOAD) { - printk(KERN_ERR - "PDA may only be read " "in the fwload state.\n"); + netdev_err(wlandev->netdev, + "PDA may only be read in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; @@ -717,9 +727,9 @@ int prism2mgmt_readpda(wlandevice_t *wlandev, void *msgp) msg->pda.data, HFA384x_PDA_LEN_MAX); if (result) { - printk(KERN_ERR - "hfa384x_drvr_readpda() failed, " - "result=%d\n", result); + netdev_err(wlandev->netdev, + "hfa384x_drvr_readpda() failed, " + "result=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; @@ -766,9 +776,9 @@ int prism2mgmt_ramdl_state(wlandevice_t *wlandev, void *msgp) struct p80211msg_p2req_ramdl_state *msg = msgp; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { - printk(KERN_ERR - "ramdl_state(): may only be called " - "in the fwload state.\n"); + netdev_err(wlandev->netdev, + "ramdl_state(): may only be called " + "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; @@ -825,9 +835,9 @@ int prism2mgmt_ramdl_write(wlandevice_t *wlandev, void *msgp) u8 *buf; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { - printk(KERN_ERR - "ramdl_write(): may only be called " - "in the fwload state.\n"); + netdev_err(wlandev->netdev, + "ramdl_write(): may only be called " + "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; @@ -885,9 +895,9 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) struct p80211msg_p2req_flashdl_state *msg = msgp; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { - printk(KERN_ERR - "flashdl_state(): may only be called " - "in the fwload state.\n"); + netdev_err(wlandev->netdev, + "flashdl_state(): may only be called " + "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; @@ -920,8 +930,9 @@ int prism2mgmt_flashdl_state(wlandevice_t *wlandev, void *msgp) wlandev->msdstate = WLAN_MSD_HWPRESENT; result = prism2sta_ifstate(wlandev, P80211ENUM_ifstate_fwload); if (result != P80211ENUM_resultcode_success) { - printk(KERN_ERR "prism2sta_ifstate(fwload) failed," - "P80211ENUM_resultcode=%d\n", result); + netdev_err(wlandev->netdev, + "prism2sta_ifstate(fwload) failed," + "P80211ENUM_resultcode=%d\n", result); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; result = -1; @@ -958,9 +969,9 @@ int prism2mgmt_flashdl_write(wlandevice_t *wlandev, void *msgp) u8 *buf; if (wlandev->msdstate != WLAN_MSD_FWLOAD) { - printk(KERN_ERR - "flashdl_write(): may only be called " - "in the fwload state.\n"); + netdev_err(wlandev->netdev, + "flashdl_write(): may only be called " + "in the fwload state.\n"); msg->resultcode.data = P80211ENUM_resultcode_implementation_failure; msg->resultcode.status = P80211ENUM_msgitem_status_data_ok; @@ -1153,7 +1164,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) } - printk(KERN_INFO "monitor mode disabled\n"); + netdev_info(wlandev->netdev, "monitor mode disabled\n"); msg->resultcode.data = P80211ENUM_resultcode_success; result = 0; goto exit; @@ -1282,7 +1293,7 @@ int prism2mgmt_wlansniff(wlandevice_t *wlandev, void *msgp) } if (wlandev->netdev->type == ARPHRD_ETHER) - printk(KERN_INFO "monitor mode enabled\n"); + netdev_info(wlandev->netdev, "monitor mode enabled\n"); /* Set the driver state */ /* Do we want the prism2 header? */ diff --git a/drivers/staging/wlan-ng/prism2mgmt.h b/drivers/staging/wlan-ng/prism2mgmt.h index 190d390..b62fdcb 100644 --- a/drivers/staging/wlan-ng/prism2mgmt.h +++ b/drivers/staging/wlan-ng/prism2mgmt.h @@ -109,4 +109,9 @@ void prism2sta_processing_defer(struct work_struct *data); void prism2sta_commsqual_defer(struct work_struct *data); void prism2sta_commsqual_timer(unsigned long data); +/* Interface callback functions, passing data back up to the cfg80211 layer */ +void prism2_connect_result(wlandevice_t *wlandev, u8 failed); +void prism2_disconnected(wlandevice_t *wlandev); +void prism2_roamed(wlandevice_t *wlandev); + #endif diff --git a/drivers/staging/wlan-ng/prism2mib.c b/drivers/staging/wlan-ng/prism2mib.c index 9b5f3b7..0fb42df 100644 --- a/drivers/staging/wlan-ng/prism2mib.c +++ b/drivers/staging/wlan-ng/prism2mib.c @@ -672,7 +672,7 @@ static int prism2mib_fragmentationthreshold(struct mibrec *mib, if (!isget) if ((*uint32) % 2) { - printk(KERN_WARNING "Attempt to set odd number " + netdev_warn(wlandev->netdev, "Attempt to set odd number " "FragmentationThreshold\n"); msg->resultcode.data = P80211ENUM_resultcode_not_supported; @@ -742,7 +742,7 @@ static int prism2mib_priv(struct mibrec *mib, break; } default: - printk(KERN_ERR "Unhandled DID 0x%08x\n", mib->did); + netdev_err(wlandev->netdev, "Unhandled DID 0x%08x\n", mib->did); } return 0; diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index f9ccf23..278b6a1 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -120,10 +120,6 @@ MODULE_PARM_DESC(prism2_reset_settletime, "reset settle time in ms"); MODULE_LICENSE("Dual MPL/GPL"); -void prism2_connect_result(wlandevice_t *wlandev, u8 failed); -void prism2_disconnected(wlandevice_t *wlandev); -void prism2_roamed(wlandevice_t *wlandev); - static int prism2sta_open(wlandevice_t *wlandev); static int prism2sta_close(wlandevice_t *wlandev); static void prism2sta_reset(wlandevice_t *wlandev); @@ -405,8 +401,9 @@ static int prism2sta_mlmerequest(wlandevice_t *wlandev, struct p80211msg *msg) break; } default: - printk(KERN_WARNING "Unknown mgmt request message 0x%08x", - msg->msgcode); + netdev_warn(wlandev->netdev, + "Unknown mgmt request message 0x%08x", + msg->msgcode); break; } @@ -469,7 +466,7 @@ u32 prism2sta_ifstate(wlandevice_t *wlandev, u32 ifstate) result = P80211ENUM_resultcode_success; break; case WLAN_MSD_RUNNING: - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "Cannot enter fwload state from enable state," "you must disable first.\n"); result = P80211ENUM_resultcode_invalid_parameters; @@ -1431,7 +1428,7 @@ void prism2sta_processing_defer(struct work_struct *data) default: /* This is bad, IO port problems? */ - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "unknown linkstatus=0x%02x\n", hw->link_status); return; } @@ -1513,7 +1510,7 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, if (i >= hw->authlist.cnt) { if (rec.assocstatus != HFA384x_ASSOCSTATUS_AUTHFAIL) - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "assocstatus info frame received for non-authenticated station.\n"); } else { hw->authlist.assoc[i] = @@ -1521,7 +1518,7 @@ static void prism2sta_inf_assocstatus(wlandevice_t *wlandev, rec.assocstatus == HFA384x_ASSOCSTATUS_REASSOC); if (rec.assocstatus == HFA384x_ASSOCSTATUS_AUTHFAIL) - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "authfail assocstatus info frame received for authenticated station.\n"); } } @@ -1791,16 +1788,16 @@ void prism2sta_ev_info(wlandevice_t *wlandev, hfa384x_InfFrame_t *inf) prism2sta_inf_psusercnt(wlandev, inf); break; case HFA384x_IT_KEYIDCHANGED: - printk(KERN_WARNING "Unhandled IT_KEYIDCHANGED\n"); + netdev_warn(wlandev->netdev, "Unhandled IT_KEYIDCHANGED\n"); break; case HFA384x_IT_ASSOCREQ: - printk(KERN_WARNING "Unhandled IT_ASSOCREQ\n"); + netdev_warn(wlandev->netdev, "Unhandled IT_ASSOCREQ\n"); break; case HFA384x_IT_MICFAILURE: - printk(KERN_WARNING "Unhandled IT_MICFAILURE\n"); + netdev_warn(wlandev->netdev, "Unhandled IT_MICFAILURE\n"); break; default: - printk(KERN_WARNING + netdev_warn(wlandev->netdev, "Unknown info type=0x%02x\n", inf->infotype); break; } diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index 4739c14..e92bbc1 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -4,103 +4,58 @@ #include "prism2sta.c" #include "prism2fw.c" -#define PRISM_USB_DEVICE(vid, pid, name) \ - USB_DEVICE(vid, pid), \ - .driver_info = (unsigned long) name +#define PRISM_DEV(vid, pid, name) \ + { USB_DEVICE(vid, pid), \ + .driver_info = (unsigned long) name } static struct usb_device_id usb_prism_tbl[] = { - {PRISM_USB_DEVICE(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS")}, - {PRISM_USB_DEVICE(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11")}, - {PRISM_USB_DEVICE(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x049f, 0x0033, - "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")}, - {PRISM_USB_DEVICE - (0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")}, - {PRISM_USB_DEVICE - (0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")}, - {PRISM_USB_DEVICE - (0x8086, 0x1111, "Intel PRO/Wireless 2011B LAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")}, - {PRISM_USB_DEVICE - (0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter")}, - {PRISM_USB_DEVICE(0x0967, 0x0204, "Acer Warplink USB Adapter")}, - {PRISM_USB_DEVICE - (0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated")}, - {PRISM_USB_DEVICE - (0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter")}, - {PRISM_USB_DEVICE - (0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter")}, - {PRISM_USB_DEVICE - (0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter")}, - {PRISM_USB_DEVICE - (0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter")}, - {PRISM_USB_DEVICE - (0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter")}, - {PRISM_USB_DEVICE - (0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter")}, - {PRISM_USB_DEVICE - (0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter")}, - {PRISM_USB_DEVICE(0x0846, 0x4110, "NetGear MA111")}, - {PRISM_USB_DEVICE(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter")}, - {PRISM_USB_DEVICE(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter")}, - {PRISM_USB_DEVICE(0x2001, 0x3700, "DWL-122 Wireless USB Adapter")}, - {PRISM_USB_DEVICE - (0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter")}, - {PRISM_USB_DEVICE(0x50c2, 0x4013, "Averatec USB WLAN Adapter")}, - {PRISM_USB_DEVICE(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter")}, - {PRISM_USB_DEVICE(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter")}, - {PRISM_USB_DEVICE(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter")}, - {PRISM_USB_DEVICE(0x2821, 0x3300, "Hawking HighDB USB Adapter")}, - {PRISM_USB_DEVICE - (0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter")}, - {PRISM_USB_DEVICE(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter")}, - {PRISM_USB_DEVICE - (0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter")}, - {PRISM_USB_DEVICE(0x0bb2, 0x0302, "Ambit Microsystems Corp.")}, - {PRISM_USB_DEVICE - (0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter")}, - {PRISM_USB_DEVICE - (0x0543, 0x0f01, "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)")}, - { /* terminator */ } + PRISM_DEV(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS"), + PRISM_DEV(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11"), + PRISM_DEV(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter"), + PRISM_DEV(0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter"), + PRISM_DEV(0x8086, 0x1111, "Intel PRO/Wireless 2011B LAN USB Adapter"), + PRISM_DEV(0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter"), + PRISM_DEV(0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter"), + PRISM_DEV(0x0967, 0x0204, "Acer Warplink USB Adapter"), + PRISM_DEV(0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated"), + PRISM_DEV(0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter"), + PRISM_DEV(0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter"), + PRISM_DEV(0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter"), + PRISM_DEV(0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter"), + PRISM_DEV(0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter"), + PRISM_DEV(0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter"), + PRISM_DEV(0x0846, 0x4110, "NetGear MA111"), + PRISM_DEV(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter"), + PRISM_DEV(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter"), + PRISM_DEV(0x2001, 0x3700, "DWL-122 Wireless USB Adapter"), + PRISM_DEV(0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter"), + PRISM_DEV(0x50c2, 0x4013, "Averatec USB WLAN Adapter"), + PRISM_DEV(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter"), + PRISM_DEV(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter"), + PRISM_DEV(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter"), + PRISM_DEV(0x2821, 0x3300, "Hawking HighDB USB Adapter"), + PRISM_DEV(0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter"), + PRISM_DEV(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter"), + PRISM_DEV(0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter"), + PRISM_DEV(0x0bb2, 0x0302, "Ambit Microsystems Corp."), + PRISM_DEV(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter"), + PRISM_DEV(0x0543, 0x0f01, + "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)"), + PRISM_DEV(0x067c, 0x1022, + "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter"), + PRISM_DEV(0x049f, 0x0033, + "Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter"), + { } /* terminator */ }; - MODULE_DEVICE_TABLE(usb, usb_prism_tbl); -/*---------------------------------------------------------------- -* prism2sta_probe_usb -* -* Probe routine called by the USB subsystem. -* -* Arguments: -* dev ptr to the usb_device struct -* ifnum interface number being offered -* -* Returns: -* NULL - we're not claiming the device+interface -* non-NULL - we are claiming the device+interface and -* this is a ptr to the data we want back -* when disconnect is called. -* -* Side effects: -* -* Call context: -* I'm not sure, assume it's interrupt. -* -----------------------------------------------------------------*/ static int prism2sta_probe_usb(struct usb_interface *interface, const struct usb_device_id *id) { @@ -141,7 +96,8 @@ static int prism2sta_probe_usb(struct usb_interface *interface, prism2_reset_settletime, 0); if (result != 0) { result = -EIO; - dev_err(&interface->dev, "hfa384x_corereset() failed.\n"); + dev_err(&interface->dev, + "hfa384x_corereset() failed.\n"); goto failed_reset; } } @@ -176,31 +132,11 @@ done: return result; } -/*---------------------------------------------------------------- -* prism2sta_disconnect_usb -* -* Called when a device previously claimed by probe is removed -* from the USB. -* -* Arguments: -* dev ptr to the usb_device struct -* ptr ptr returned by probe() when the device -* was claimed. -* -* Returns: -* Nothing -* -* Side effects: -* -* Call context: -* process -----------------------------------------------------------------*/ static void prism2sta_disconnect_usb(struct usb_interface *interface) { wlandevice_t *wlandev; wlandev = (wlandevice_t *) usb_get_intfdata(interface); - if (wlandev != NULL) { LIST_HEAD(cleanlist); struct list_head *entry; @@ -292,6 +228,7 @@ static int prism2sta_suspend(struct usb_interface *interface, { hfa384x_t *hw = NULL; wlandevice_t *wlandev; + wlandev = (wlandevice_t *) usb_get_intfdata(interface); if (!wlandev) return -ENODEV; @@ -314,6 +251,7 @@ static int prism2sta_resume(struct usb_interface *interface) int result = 0; hfa384x_t *hw = NULL; wlandevice_t *wlandev; + wlandev = (wlandevice_t *) usb_get_intfdata(interface); if (!wlandev) return -ENODEV; |