diff options
author | Joe Perches <joe@perches.com> | 2010-07-26 17:39:57 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2010-07-27 15:14:13 -0400 |
commit | e1db74fcc3d95c8a051ec457241b5aa65a01a603 (patch) | |
tree | 4165af9c4cb369a806fc34e50a24a6378f5a123f /include/net/cfg80211.h | |
parent | 97c5e2756e3f0711877c5b6f2323151964229260 (diff) |
include/net/cfg80211.h: Add wiphy_<level> printk equivalents
Simplify logging messages for wiphy devices
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'include/net/cfg80211.h')
-rw-r--r-- | include/net/cfg80211.h | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 4d1f19d70798..7fe774c2d43d 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h | |||
@@ -1416,7 +1416,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy) | |||
1416 | * | 1416 | * |
1417 | * @wiphy: The wiphy whose name to return | 1417 | * @wiphy: The wiphy whose name to return |
1418 | */ | 1418 | */ |
1419 | static inline const char *wiphy_name(struct wiphy *wiphy) | 1419 | static inline const char *wiphy_name(const struct wiphy *wiphy) |
1420 | { | 1420 | { |
1421 | return dev_name(&wiphy->dev); | 1421 | return dev_name(&wiphy->dev); |
1422 | } | 1422 | } |
@@ -2420,4 +2420,66 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev, | |||
2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, | 2420 | enum nl80211_cqm_rssi_threshold_event rssi_event, |
2421 | gfp_t gfp); | 2421 | gfp_t gfp); |
2422 | 2422 | ||
2423 | #ifdef __KERNEL__ | ||
2424 | |||
2425 | /* Logging, debugging and troubleshooting/diagnostic helpers. */ | ||
2426 | |||
2427 | /* wiphy_printk helpers, similar to dev_printk */ | ||
2428 | |||
2429 | #define wiphy_printk(level, wiphy, format, args...) \ | ||
2430 | printk(level "%s: " format, wiphy_name(wiphy), ##args) | ||
2431 | #define wiphy_emerg(wiphy, format, args...) \ | ||
2432 | wiphy_printk(KERN_EMERG, wiphy, format, ##args) | ||
2433 | #define wiphy_alert(wiphy, format, args...) \ | ||
2434 | wiphy_printk(KERN_ALERT, wiphy, format, ##args) | ||
2435 | #define wiphy_crit(wiphy, format, args...) \ | ||
2436 | wiphy_printk(KERN_CRIT, wiphy, format, ##args) | ||
2437 | #define wiphy_err(wiphy, format, args...) \ | ||
2438 | wiphy_printk(KERN_ERR, wiphy, format, ##args) | ||
2439 | #define wiphy_warn(wiphy, format, args...) \ | ||
2440 | wiphy_printk(KERN_WARNING, wiphy, format, ##args) | ||
2441 | #define wiphy_notice(wiphy, format, args...) \ | ||
2442 | wiphy_printk(KERN_NOTICE, wiphy, format, ##args) | ||
2443 | #define wiphy_info(wiphy, format, args...) \ | ||
2444 | wiphy_printk(KERN_INFO, wiphy, format, ##args) | ||
2445 | #define wiphy_debug(wiphy, format, args...) \ | ||
2446 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | ||
2447 | |||
2448 | #if defined(DEBUG) | ||
2449 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2450 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args) | ||
2451 | #elif defined(CONFIG_DYNAMIC_DEBUG) | ||
2452 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2453 | dynamic_pr_debug("%s: " format, wiphy_name(dev), ##args) | ||
2454 | #else | ||
2455 | #define wiphy_dbg(wiphy, format, args...) \ | ||
2456 | ({ \ | ||
2457 | if (0) \ | ||
2458 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2459 | 0; \ | ||
2460 | }) | ||
2461 | #endif | ||
2462 | |||
2463 | #if defined(VERBOSE_DEBUG) | ||
2464 | #define wiphy_vdbg wiphy_dbg | ||
2465 | #else | ||
2466 | |||
2467 | #define wiphy_vdbg(wiphy, format, args...) \ | ||
2468 | ({ \ | ||
2469 | if (0) \ | ||
2470 | wiphy_printk(KERN_DEBUG, wiphy, format, ##args); \ | ||
2471 | 0; \ | ||
2472 | }) | ||
2473 | #endif | ||
2474 | |||
2475 | /* | ||
2476 | * wiphy_WARN() acts like wiphy_printk(), but with the key difference | ||
2477 | * of using a WARN/WARN_ON to get the message out, including the | ||
2478 | * file/line information and a backtrace. | ||
2479 | */ | ||
2480 | #define wiphy_WARN(wiphy, format, args...) \ | ||
2481 | WARN(1, "wiphy: %s\n" format, wiphy_name(wiphy), ##args); | ||
2482 | |||
2483 | #endif | ||
2484 | |||
2423 | #endif /* __NET_CFG80211_H */ | 2485 | #endif /* __NET_CFG80211_H */ |