aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2014-10-13 18:55:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-10-13 20:18:27 -0400
commit068c11dac2a5df02c650b8511e10055c95073d5a (patch)
tree0a420116dcd6256a54092aade43f321fccb4e7d7
parent5df1415aee48e1d20328238d3077e39793e83232 (diff)
staging: wlan-ng: use %*pEhp to print SN
This is a generic specifier to print an escaped buffer by given criteria. Let's use it instead of custom approach. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: "John W . Linville" <linville@tuxdriver.com> Cc: Johannes Berg <johannes@sipsolutions.net> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Joe Perches <joe@perches.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--drivers/staging/wlan-ng/prism2sta.c28
1 files changed, 2 insertions, 26 deletions
diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c
index 799ce8aa70ef..df577dfe7ffb 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -60,7 +60,6 @@
60#include <linux/netdevice.h> 60#include <linux/netdevice.h>
61#include <linux/workqueue.h> 61#include <linux/workqueue.h>
62#include <linux/byteorder/generic.h> 62#include <linux/byteorder/generic.h>
63#include <linux/ctype.h>
64 63
65#include <linux/io.h> 64#include <linux/io.h>
66#include <linux/delay.h> 65#include <linux/delay.h>
@@ -81,27 +80,6 @@
81#include "hfa384x.h" 80#include "hfa384x.h"
82#include "prism2mgmt.h" 81#include "prism2mgmt.h"
83 82
84/* Create a string of printable chars from something that might not be */
85/* It's recommended that the str be 4*len + 1 bytes long */
86#define wlan_mkprintstr(buf, buflen, str, strlen) \
87{ \
88 int i = 0; \
89 int j = 0; \
90 memset(str, 0, (strlen)); \
91 for (i = 0; i < (buflen); i++) { \
92 if (isprint((buf)[i])) { \
93 (str)[j] = (buf)[i]; \
94 j++; \
95 } else { \
96 (str)[j] = '\\'; \
97 (str)[j+1] = 'x'; \
98 (str)[j+2] = hex_asc_hi((buf)[i]); \
99 (str)[j+3] = hex_asc_lo((buf)[i]); \
100 j += 4; \
101 } \
102 } \
103}
104
105static char *dev_info = "prism2_usb"; 83static char *dev_info = "prism2_usb";
106static wlandevice_t *create_wlan(void); 84static wlandevice_t *create_wlan(void);
107 85
@@ -607,7 +585,6 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
607 hfa384x_t *hw = (hfa384x_t *) wlandev->priv; 585 hfa384x_t *hw = (hfa384x_t *) wlandev->priv;
608 u16 temp; 586 u16 temp;
609 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN]; 587 u8 snum[HFA384x_RID_NICSERIALNUMBER_LEN];
610 char pstr[(HFA384x_RID_NICSERIALNUMBER_LEN * 4) + 1];
611 588
612 /* Collect version and compatibility info */ 589 /* Collect version and compatibility info */
613 /* Some are critical, some are not */ 590 /* Some are critical, some are not */
@@ -862,9 +839,8 @@ static int prism2sta_getcardinfo(wlandevice_t *wlandev)
862 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER, 839 result = hfa384x_drvr_getconfig(hw, HFA384x_RID_NICSERIALNUMBER,
863 snum, HFA384x_RID_NICSERIALNUMBER_LEN); 840 snum, HFA384x_RID_NICSERIALNUMBER_LEN);
864 if (!result) { 841 if (!result) {
865 wlan_mkprintstr(snum, HFA384x_RID_NICSERIALNUMBER_LEN, 842 netdev_info(wlandev->netdev, "Prism2 card SN: %*pEhp\n",
866 pstr, sizeof(pstr)); 843 HFA384x_RID_NICSERIALNUMBER_LEN, snum);
867 netdev_info(wlandev->netdev, "Prism2 card SN: %s\n", pstr);
868 } else { 844 } else {
869 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n"); 845 netdev_err(wlandev->netdev, "Failed to retrieve Prism2 Card SN\n");
870 goto failed; 846 goto failed;