Commit f4528696 authored by Joe Perches's avatar Joe Perches Committed by Greg Kroah-Hartman

staging: brcm80211: Fix WL_<type> logging macros

These macros use the equivalent of "#define WL_<type>(x) printk x"
which requires an extra level of parentheses.

Convert the macros to use the normal WL_<type>(fmt, args...) style
and remove the extra parentheses from the uses.

Add format argument verification using no_printk as appropriate.
Couple of spelling typo fixes in the formats and argument alignment
at the same time. Also coalesced long formats.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 12b9d5bf
......@@ -24,8 +24,8 @@
#include <wlioctl.h>
#include <wl_iw.h>
#define WL_ERROR(x) printf x
#define WL_TRACE(x)
#define WL_ERROR(fmt, args...) printk(fmt, ##args)
#define WL_TRACE(fmt, args...) no_printk(fmt, ##args)
#ifdef CUSTOMER_HW
extern void bcm_wlan_power_off(int);
......@@ -67,13 +67,13 @@ int dhd_customer_oob_irq_map(unsigned long *irq_flags_ptr)
#endif
if (dhd_oob_gpio_num < 0) {
WL_ERROR(("%s: ERROR customer specific Host GPIO is NOT defined\n",
__func__));
WL_ERROR("%s: ERROR customer specific Host GPIO is NOT defined\n",
__func__);
return dhd_oob_gpio_num;
}
WL_ERROR(("%s: customer specific Host GPIO number is (%d)\n",
__func__, dhd_oob_gpio_num));
WL_ERROR("%s: customer specific Host GPIO number is (%d)\n",
__func__, dhd_oob_gpio_num);
#if defined CUSTOMER_HW
host_oob_irq = MSM_GPIO_TO_INT(dhd_oob_gpio_num);
......@@ -93,40 +93,40 @@ void dhd_customer_gpio_wlan_ctrl(int onoff)
{
switch (onoff) {
case WLAN_RESET_OFF:
WL_TRACE(("%s: call customer specific GPIO to insert WLAN RESET\n",
__func__));
WL_TRACE("%s: call customer specific GPIO to insert WLAN RESET\n",
__func__);
#ifdef CUSTOMER_HW
bcm_wlan_power_off(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
wifi_set_power(0, 0);
#endif
WL_ERROR(("=========== WLAN placed in RESET ========\n"));
WL_ERROR("=========== WLAN placed in RESET ========\n");
break;
case WLAN_RESET_ON:
WL_TRACE(("%s: callc customer specific GPIO to remove WLAN RESET\n",
__func__));
WL_TRACE("%s: callc customer specific GPIO to remove WLAN RESET\n",
__func__);
#ifdef CUSTOMER_HW
bcm_wlan_power_on(2);
#endif /* CUSTOMER_HW */
#ifdef CUSTOMER_HW2
wifi_set_power(1, 0);
#endif
WL_ERROR(("=========== WLAN going back to live ========\n"));
WL_ERROR("=========== WLAN going back to live ========\n");
break;
case WLAN_POWER_OFF:
WL_TRACE(("%s: call customer specific GPIO to turn off WL_REG_ON\n",
__func__));
WL_TRACE("%s: call customer specific GPIO to turn off WL_REG_ON\n",
__func__);
#ifdef CUSTOMER_HW
bcm_wlan_power_off(1);
#endif /* CUSTOMER_HW */
break;
case WLAN_POWER_ON:
WL_TRACE(("%s: call customer specific GPIO to turn on WL_REG_ON\n",
__func__));
WL_TRACE("%s: call customer specific GPIO to turn on WL_REG_ON\n",
__func__);
#ifdef CUSTOMER_HW
bcm_wlan_power_on(1);
#endif /* CUSTOMER_HW */
......@@ -140,7 +140,7 @@ void dhd_customer_gpio_wlan_ctrl(int onoff)
/* Function to get custom MAC address */
int dhd_custom_get_mac_address(unsigned char *buf)
{
WL_TRACE(("%s Enter\n", __func__));
WL_TRACE("%s Enter\n", __func__);
if (!buf)
return -EINVAL;
......
......@@ -54,34 +54,36 @@ struct wl_ibss;
#define WL_DBG_LEVEL 1 /* 0 invalidates all debug messages.
default is 1 */
#define WL_ERR(args) \
#define WL_ERR(fmt, args...) \
do { \
if (wl_dbg_level & WL_DBG_ERR) { \
if (net_ratelimit()) { \
printk(KERN_ERR "ERROR @%s : ", __func__); \
printk args; \
printk(KERN_ERR "ERROR @%s : " fmt, \
__func__, ##args); \
} \
} \
} while (0)
#define WL_INFO(args) \
#define WL_INFO(fmt, args...) \
do { \
if (wl_dbg_level & WL_DBG_INFO) { \
if (net_ratelimit()) { \
printk(KERN_ERR "INFO @%s : ", __func__); \
printk args; \
printk(KERN_ERR "INFO @%s : " fmt, \
__func__, ##args); \
} \
} \
} while (0)
#if (WL_DBG_LEVEL > 0)
#define WL_DBG(args) \
#define WL_DBG(fmt, args...) \
do { \
if (wl_dbg_level & WL_DBG_DBG) { \
printk(KERN_ERR "DEBUG @%s :", __func__); \
printk args; \
printk(KERN_ERR "DEBUG @%s :" fmt, \
__func__, ##args); \
} \
} while (0)
#else /* !(WL_DBG_LEVEL > 0) */
#define WL_DBG(args)
#define WL_DBG(fmt, args...) noprintk(fmt, ##args)
#endif /* (WL_DBG_LEVEL > 0) */
#define WL_SCAN_RETRY_MAX 3 /* used for ibss scan */
......
This diff is collapsed.
......@@ -78,7 +78,7 @@ typedef struct wl_iw_extra_params {
#define CHECK_EXTRA_FOR_NULL(extra) \
if (!extra) { \
WL_ERROR(("%s: error : extra is null pointer\n", __func__)); \
WL_ERROR("%s: error : extra is null pointer\n", __func__); \
return -EINVAL; \
}
......
......@@ -20,15 +20,20 @@
/* wl_msg_level is a bit vector with defs in wlioctl.h */
extern u32 wl_msg_level;
#define WL_PRINT(args) printf args
#define WL_NONE(args)
#define WL_NONE(fmt, args...) no_printk(fmt, ##args)
#define WL_PRINT(level, fmt, args...) \
do { \
if (wl_msg_level & level) \
printk(fmt, ##args); \
} while (0)
#ifdef BCMDBG
#define WL_ERROR(args) do {if ((wl_msg_level & WL_ERROR_VAL)) WL_PRINT(args); } while (0)
#define WL_TRACE(args) do {if (wl_msg_level & WL_TRACE_VAL) WL_PRINT(args); } while (0)
#define WL_AMPDU(args) do {if (wl_msg_level & WL_AMPDU_VAL) WL_PRINT(args); } while (0)
#define WL_FFPLD(args) do {if (wl_msg_level & WL_FFPLD_VAL) WL_PRINT(args); } while (0)
#define WL_ERROR(fmt, args...) WL_PRINT(WL_ERROR_VAL, fmt, ##args)
#define WL_TRACE(fmt, args...) WL_PRINT(WL_TRACE_VAL, fmt, ##args)
#define WL_AMPDU(fmt, args...) WL_PRINT(WL_AMPDU_VAL, fmt, ##args)
#define WL_FFPLD(fmt, args...) WL_PRINT(WL_FFPLD_VAL, fmt, ##args)
#define WL_ERROR_ON() (wl_msg_level & WL_ERROR_VAL)
......@@ -44,35 +49,50 @@ extern u32 wl_msg_level;
extern u32 wl_ampdu_dbg;
#define WL_AMPDU_UPDN(args) do {if (wl_ampdu_dbg & WL_AMPDU_UPDN_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_RX(args) do {if (wl_ampdu_dbg & WL_AMPDU_RX_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_ERR(args) do {if (wl_ampdu_dbg & WL_AMPDU_ERR_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_TX(args) do {if (wl_ampdu_dbg & WL_AMPDU_TX_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_CTL(args) do {if (wl_ampdu_dbg & WL_AMPDU_CTL_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_HW(args) do {if (wl_ampdu_dbg & WL_AMPDU_HW_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_HWTXS(args) do {if (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_HWDBG(args) do {if (wl_ampdu_dbg & WL_AMPDU_HWDBG_VAL) {WL_AMPDU(args); } } while (0)
#define WL_AMPDU_PRINT(level, fmt, args...) \
do { \
if (wl_ampdu_dbg & level) { \
WL_AMPDU(fmt, ##args); \
} \
} while (0)
#define WL_AMPDU_UPDN(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_UPDN_VAL, fmt, ##args)
#define WL_AMPDU_RX(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_RX_VAL, fmt, ##args)
#define WL_AMPDU_ERR(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_ERR_VAL, fmt, ##args)
#define WL_AMPDU_TX(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_TX_VAL, fmt, ##args)
#define WL_AMPDU_CTL(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_CTL_VAL, fmt, ##args)
#define WL_AMPDU_HW(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_HW_VAL, fmt, ##args)
#define WL_AMPDU_HWTXS(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_HWTXS_VAL, fmt, ##args)
#define WL_AMPDU_HWDBG(fmt, args...) \
WL_AMPDU_PRINT(WL_AMPDU_HWDBG_VAL, fmt, ##args)
#define WL_AMPDU_ERR_ON() (wl_ampdu_dbg & WL_AMPDU_ERR_VAL)
#define WL_AMPDU_HW_ON() (wl_ampdu_dbg & WL_AMPDU_HW_VAL)
#define WL_AMPDU_HWTXS_ON() (wl_ampdu_dbg & WL_AMPDU_HWTXS_VAL)
#else /* BCMDBG */
#define WL_ERROR(args)
#define WL_TRACE(args)
#define WL_AMPDU(args)
#define WL_FFPLD(args)
#define WL_ERROR(fmt, args...) no_printk(fmt, ##args)
#define WL_TRACE(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU(fmt, args...) no_printk(fmt, ##args)
#define WL_FFPLD(fmt, args...) no_printk(fmt, ##args)
#define WL_ERROR_ON() 0
#define WL_AMPDU_UPDN(args)
#define WL_AMPDU_RX(args)
#define WL_AMPDU_ERR(args)
#define WL_AMPDU_TX(args)
#define WL_AMPDU_CTL(args)
#define WL_AMPDU_HW(args)
#define WL_AMPDU_HWTXS(args)
#define WL_AMPDU_HWDBG(args)
#define WL_AMPDU_UPDN(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_RX(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_ERR(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_TX(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_CTL(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_HW(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_HWTXS(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_HWDBG(fmt, args...) no_printk(fmt, ##args)
#define WL_AMPDU_ERR_ON() 0
#define WL_AMPDU_HW_ON() 0
#define WL_AMPDU_HWTXS_ON() 0
......
This diff is collapsed.
......@@ -43,7 +43,7 @@ void *wlc_calloc(struct osl_info *osh, uint unit, uint size)
item = kzalloc(size, GFP_ATOMIC);
if (item == NULL)
WL_ERROR(("wl%d: %s: out of memory\n", unit, __func__));
WL_ERROR("wl%d: %s: out of memory\n", unit, __func__);
return item;
}
......
This diff is collapsed.
......@@ -102,7 +102,7 @@ struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc,
asi = kzalloc(sizeof(struct antsel_info), GFP_ATOMIC);
if (!asi) {
WL_ERROR(("wl%d: wlc_antsel_attach: out of mem\n", pub->unit));
WL_ERROR("wl%d: wlc_antsel_attach: out of mem\n", pub->unit);
return NULL;
}
......@@ -131,7 +131,7 @@ struct antsel_info *wlc_antsel_attach(struct wlc_info *wlc,
asi->antsel_avail = false;
} else {
asi->antsel_avail = false;
WL_ERROR(("wlc_antsel_attach: 2o3 board cfg invalid\n"));
WL_ERROR("wlc_antsel_attach: 2o3 board cfg invalid\n");
ASSERT(0);
}
break;
......
This diff is collapsed.
......@@ -567,8 +567,8 @@ struct chan20_info chan20_info[] = {
const locale_info_t *wlc_get_locale_2g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_locale_2g_table)) {
WL_ERROR(("%s: locale 2g index size out of range %d\n",
__func__, locale_idx));
WL_ERROR("%s: locale 2g index size out of range %d\n",
__func__, locale_idx);
ASSERT(locale_idx < ARRAY_SIZE(g_locale_2g_table));
return NULL;
}
......@@ -578,8 +578,8 @@ const locale_info_t *wlc_get_locale_2g(u8 locale_idx)
const locale_info_t *wlc_get_locale_5g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_locale_5g_table)) {
WL_ERROR(("%s: locale 5g index size out of range %d\n",
__func__, locale_idx));
WL_ERROR("%s: locale 5g index size out of range %d\n",
__func__, locale_idx);
ASSERT(locale_idx < ARRAY_SIZE(g_locale_5g_table));
return NULL;
}
......@@ -589,8 +589,8 @@ const locale_info_t *wlc_get_locale_5g(u8 locale_idx)
const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_mimo_2g_table)) {
WL_ERROR(("%s: mimo 2g index size out of range %d\n", __func__,
locale_idx));
WL_ERROR("%s: mimo 2g index size out of range %d\n",
__func__, locale_idx);
return NULL;
}
return g_mimo_2g_table[locale_idx];
......@@ -599,8 +599,8 @@ const locale_mimo_info_t *wlc_get_mimo_2g(u8 locale_idx)
const locale_mimo_info_t *wlc_get_mimo_5g(u8 locale_idx)
{
if (locale_idx >= ARRAY_SIZE(g_mimo_5g_table)) {
WL_ERROR(("%s: mimo 5g index size out of range %d\n", __func__,
locale_idx));
WL_ERROR("%s: mimo 5g index size out of range %d\n",
__func__, locale_idx);
return NULL;
}
return g_mimo_5g_table[locale_idx];
......@@ -614,11 +614,11 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc)
struct wlc_pub *pub = wlc->pub;
char *ccode;
WL_TRACE(("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit));
WL_TRACE("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit);
wlc_cm = kzalloc(sizeof(wlc_cm_info_t), GFP_ATOMIC);
if (wlc_cm == NULL) {
WL_ERROR(("wl%d: %s: out of memory", pub->unit, __func__));
WL_ERROR("wl%d: %s: out of memory", pub->unit, __func__);
return NULL;
}
wlc_cm->pub = pub;
......@@ -629,8 +629,9 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc)
ccode = getvar(wlc->pub->vars, "ccode");
if (ccode) {
strncpy(wlc->pub->srom_ccode, ccode, WLC_CNTRY_BUF_SZ - 1);
WL_NONE(("%s: SROM country code is %c%c\n", __func__,
wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1]));
WL_NONE("%s: SROM country code is %c%c\n",
__func__,
wlc->pub->srom_ccode[0], wlc->pub->srom_ccode[1]);
}
/* internal country information which must match regulatory constraints in firmware */
......@@ -716,7 +717,9 @@ wlc_set_countrycode_rev(wlc_cm_info_t *wlc_cm,
char mapped_ccode[WLC_CNTRY_BUF_SZ];
uint mapped_regrev;
WL_NONE(("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n", __func__, country_abbrev, ccode, regrev, wlc_cm->srom_ccode, wlc_cm->srom_regrev));
WL_NONE("%s: (country_abbrev \"%s\", ccode \"%s\", regrev %d) SPROM \"%s\"/%u\n",
__func__, country_abbrev, ccode, regrev,
wlc_cm->srom_ccode, wlc_cm->srom_regrev);
/* if regrev is -1, lookup the mapped country code,
* otherwise use the ccode and regrev directly
......@@ -827,8 +830,8 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm,
/* check for currently supported ccode size */
if (strlen(ccode) > (WLC_CNTRY_BUF_SZ - 1)) {
WL_ERROR(("wl%d: %s: ccode \"%s\" too long for match\n",
wlc->pub->unit, __func__, ccode));
WL_ERROR("wl%d: %s: ccode \"%s\" too long for match\n",
wlc->pub->unit, __func__, ccode);
return NULL;
}
......@@ -843,7 +846,7 @@ static const country_info_t *wlc_countrycode_map(wlc_cm_info_t *wlc_cm,
if (!strcmp(srom_ccode, ccode)) {
*mapped_regrev = srom_regrev;
mapped = 0;
WL_ERROR(("srom_code == ccode %s\n", __func__));
WL_ERROR("srom_code == ccode %s\n", __func__);
ASSERT(0);
} else {
mapped =
......@@ -895,7 +898,7 @@ static const country_info_t *wlc_country_lookup_direct(const char *ccode,
}
}
WL_ERROR(("%s: Returning NULL\n", __func__));
WL_ERROR("%s: Returning NULL\n", __func__);
ASSERT(0);
return NULL;
}
......@@ -974,7 +977,9 @@ static void wlc_channels_commit(wlc_cm_info_t *wlc_cm)
if (chan == INVCHANNEL) {
/* country/locale with no valid channels, set the radio disable bit */
mboolset(wlc->pub->radio_disabled, WL_RADIO_COUNTRY_DISABLE);
WL_ERROR(("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n", wlc->pub->unit, __func__, wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked));
WL_ERROR("wl%d: %s: no valid channel for \"%s\" nbands %d bandlocked %d\n",
wlc->pub->unit, __func__,
wlc_cm->country_abbrev, NBANDS(wlc), wlc->bandlocked);
} else
if (mboolisset(wlc->pub->radio_disabled,
WL_RADIO_COUNTRY_DISABLE)) {
......@@ -1538,8 +1543,8 @@ wlc_valid_chanspec_ext(wlc_cm_info_t *wlc_cm, chanspec_t chspec, bool dualband)
/* check the chanspec */
if (wf_chspec_malformed(chspec)) {
WL_ERROR(("wl%d: malformed chanspec 0x%x\n", wlc->pub->unit,
chspec));
WL_ERROR("wl%d: malformed chanspec 0x%x\n",
wlc->pub->unit, chspec);
ASSERT(0);
return false;
}
......
......@@ -75,8 +75,8 @@ wlc_eventq_t *wlc_eventq_attach(struct wlc_pub *pub, struct wlc_info *wlc,
eq->timer = wl_init_timer(eq->wl, wlc_timer_cb, eq, "eventq");
if (!eq->timer) {
WL_ERROR(("wl%d: wlc_eventq_attach: timer failed\n",
pub->unit));
WL_ERROR("wl%d: wlc_eventq_attach: timer failed\n",
pub->unit);
kfree(eq);
return NULL;
}
......
......@@ -70,7 +70,8 @@ wlc_phy_shim_info_t *wlc_phy_shim_attach(struct wlc_hw_info *wlc_hw,
physhim = kzalloc(sizeof(wlc_phy_shim_info_t), GFP_ATOMIC);
if (!physhim) {
WL_ERROR(("wl%d: wlc_phy_shim_attach: out of mem\n", wlc_hw->unit));
WL_ERROR("wl%d: wlc_phy_shim_attach: out of mem\n",
wlc_hw->unit);
return NULL;
}
physhim->wlc_hw = wlc_hw;
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment