From 02d9b1eb4b21b9309efdf8c8aee023a59d3f76e0 Mon Sep 17 00:00:00 2001 From: Vitaly Osipov Date: Sun, 18 May 2014 16:59:36 +1000 Subject: staging: wlan-ng: use netdev_() instead of printk() Replaced all uses of printk() in wlan-ng with netdev_err / _warn where a netdev exists. If a few cases where a netdev does not yet exist, dev_ or pr_ was used. Checkpatch complains about lines over 80 chars or split string constants - the messages are just too long, keeping it completely happy would make the code less readable. Signed-off-by: Vitaly Osipov Signed-off-by: Greg Kroah-Hartman --- drivers/staging/wlan-ng/prism2fw.c | 101 ++++++++++++++++++------------------- 1 file changed, 48 insertions(+), 53 deletions(-) (limited to 'drivers/staging/wlan-ng/prism2fw.c') 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; } -- cgit v1.1