Commit 884dd244 authored by Joe Perches's avatar Joe Perches Committed by John W. Linville

rtlwifi: Neaten RT_ASSERT, RT_TRACE, RTPRINT, RT_PRINT_DATA macros

Make the macros a bit more readable.

Use do {...} while (0) without terminating semicolons.
Add missing terminating semicolon to a few uses.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Acked-by: default avatarLarry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 3084f3b6
...@@ -156,53 +156,47 @@ enum dbgp_flag_e { ...@@ -156,53 +156,47 @@ enum dbgp_flag_e {
DBGP_TYPE_MAX DBGP_TYPE_MAX
}; };
#define RT_ASSERT(_exp, fmt) \ #define RT_ASSERT(_exp, fmt) \
do { \ do { \
if (!(_exp)) { \ if (!(_exp)) { \
printk(KERN_DEBUG "%s:%s(): ", KBUILD_MODNAME, \ printk(KERN_DEBUG "%s:%s(): ", \
__func__); \ KBUILD_MODNAME, __func__); \
printk fmt; \ printk fmt; \
} \ } \
} while (0); } while (0)
#define RT_TRACE(rtlpriv, comp, level, fmt)\ #define RT_TRACE(rtlpriv, comp, level, fmt) \
do { \ do { \
if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \ if (unlikely(((comp) & rtlpriv->dbg.global_debugcomponents) && \
((level) <= rtlpriv->dbg.global_debuglevel))) {\ ((level) <= rtlpriv->dbg.global_debuglevel))) { \
printk(KERN_DEBUG "%s:%s():<%lx-%x> ", KBUILD_MODNAME, \ printk(KERN_DEBUG "%s:%s():<%lx-%x> ", \
__func__, in_interrupt(), in_atomic()); \ KBUILD_MODNAME, __func__, \
printk fmt; \ in_interrupt(), in_atomic()); \
} \ printk fmt; \
} while (0); } \
} while (0)
#define RTPRINT(rtlpriv, dbgtype, dbgflag, printstr) \
do { \ #define RTPRINT(rtlpriv, dbgtype, dbgflag, printstr) \
if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \ do { \
printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \ if (unlikely(rtlpriv->dbg.dbgp_type[dbgtype] & dbgflag)) { \
printk printstr; \ printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \
} \ printk printstr; \
} while (0); } \
} while (0)
#define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \
_hexdatalen) \ #define RT_PRINT_DATA(rtlpriv, _comp, _level, _titlestring, _hexdata, \
do {\ _hexdatalen) \
if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) &&\ do { \
(_level <= rtlpriv->dbg.global_debuglevel))) { \ if (unlikely(((_comp) & rtlpriv->dbg.global_debugcomponents) && \
int __i; \ (_level <= rtlpriv->dbg.global_debuglevel))) { \
u8* ptr = (u8 *)_hexdata; \ printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \
printk(KERN_DEBUG "%s: ", KBUILD_MODNAME); \ pr_cont("In process \"%s\" (pid %i):", \
printk("In process \"%s\" (pid %i):", current->comm,\ current->comm, current->pid); \
current->pid); \ printk(_titlestring); \
printk(_titlestring); \ print_hex_dump_bytes("", DUMP_PREFIX_NONE, \
for (__i = 0; __i < (int)_hexdatalen; __i++) { \ _hexdata, _hexdatalen); \
printk("%02X%s", ptr[__i], (((__i + 1) % 4)\ } \
== 0) ? " " : " ");\ } while (0)
if (((__i + 1) % 16) == 0) \
printk("\n"); \
} \
printk(KERN_DEBUG "\n"); \
} \
} while (0);
void rtl_dbgp_flag_init(struct ieee80211_hw *hw); void rtl_dbgp_flag_init(struct ieee80211_hw *hw);
#endif #endif
...@@ -374,7 +374,7 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw) ...@@ -374,7 +374,7 @@ void rtl92ce_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE,
("Switch to %s bandwidth\n", ("Switch to %s bandwidth\n",
rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
"20MHz" : "40MHz")) "20MHz" : "40MHz"));
if (is_hal_stop(rtlhal)) { if (is_hal_stop(rtlhal)) {
rtlphy->set_bwmode_inprogress = false; rtlphy->set_bwmode_inprogress = false;
......
...@@ -360,7 +360,7 @@ void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw) ...@@ -360,7 +360,7 @@ void rtl92cu_phy_set_bw_mode_callback(struct ieee80211_hw *hw)
RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE, RT_TRACE(rtlpriv, COMP_SCAN, DBG_TRACE,
("Switch to %s bandwidth\n", ("Switch to %s bandwidth\n",
rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ? rtlphy->current_chan_bw == HT_CHANNEL_WIDTH_20 ?
"20MHz" : "40MHz")) "20MHz" : "40MHz"));
if (is_hal_stop(rtlhal)) { if (is_hal_stop(rtlhal)) {
rtlphy->set_bwmode_inprogress = false; rtlphy->set_bwmode_inprogress = false;
return; return;
......
...@@ -1617,7 +1617,7 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw, ...@@ -1617,7 +1617,7 @@ static void _rtl92de_read_txpower_info(struct ieee80211_hw *hw,
RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG, RT_TRACE(rtlpriv, COMP_INIT, DBG_DMESG,
("Is D cut,Internal PA0 %d Internal PA1 %d\n", ("Is D cut,Internal PA0 %d Internal PA1 %d\n",
rtlefuse->internal_pa_5g[0], rtlefuse->internal_pa_5g[0],
rtlefuse->internal_pa_5g[1])) rtlefuse->internal_pa_5g[1]));
} }
rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6]; rtlefuse->eeprom_c9 = hwinfo[EEPROM_RF_OPT6];
rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7]; rtlefuse->eeprom_cc = hwinfo[EEPROM_RF_OPT7];
......
...@@ -414,7 +414,7 @@ static struct sk_buff *_rtl_prep_rx_urb(struct ieee80211_hw *hw, ...@@ -414,7 +414,7 @@ static struct sk_buff *_rtl_prep_rx_urb(struct ieee80211_hw *hw,
gfp_mask); gfp_mask);
if (!skb) { if (!skb) {
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
("Failed to __dev_alloc_skb!!\n")) ("Failed to __dev_alloc_skb!!\n"));
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
} }
...@@ -632,14 +632,14 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw) ...@@ -632,14 +632,14 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_KERNEL);
if (!urb) { if (!urb) {
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
("Failed to alloc URB!!\n")) ("Failed to alloc URB!!\n"));
goto err_out; goto err_out;
} }
skb = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL); skb = _rtl_prep_rx_urb(hw, rtlusb, urb, GFP_KERNEL);
if (IS_ERR(skb)) { if (IS_ERR(skb)) {
RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG, RT_TRACE(rtlpriv, COMP_USB, DBG_EMERG,
("Failed to prep_rx_urb!!\n")) ("Failed to prep_rx_urb!!\n"));
err = PTR_ERR(skb); err = PTR_ERR(skb);
goto err_out; goto err_out;
} }
......
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