Add some consistent use styles to wiphy messages Joe Perches (4): include/net/cfg80211.h: Add wiphy_<level> printk equivalents drivers/net/wireless: Use wiphy_<level> drivers/net/wireless/at76c50x-usb.c: Neaten macros wireless: Convert wiphy_debug macro to function drivers/net/wireless/adm8211.c | 53 ++++---- drivers/net/wireless/at76c50x-usb.c | 168 +++++++++++------------ drivers/net/wireless/ath/ar9170/cmd.c | 7 +- drivers/net/wireless/ath/ar9170/led.c | 4 +- drivers/net/wireless/ath/ar9170/main.c | 172 +++++++++++------------- drivers/net/wireless/ath/ar9170/phy.c | 8 +- drivers/net/wireless/ath/ath9k/ahb.c | 7 +- drivers/net/wireless/ath/ath9k/pci.c | 7 +- drivers/net/wireless/iwlwifi/iwl-agn.c | 11 +- drivers/net/wireless/iwlwifi/iwl-core.c | 2 +- drivers/net/wireless/iwlwifi/iwl3945-base.c | 13 +- drivers/net/wireless/mac80211_hwsim.c | 99 +++++++------- drivers/net/wireless/mwl8k.c | 123 +++++++---------- drivers/net/wireless/orinoco/cfg.c | 5 +- drivers/net/wireless/p54/eeprom.c | 76 +++++------ drivers/net/wireless/p54/fwio.c | 53 ++++---- drivers/net/wireless/p54/led.c | 8 +- drivers/net/wireless/p54/p54pci.c | 3 +- drivers/net/wireless/p54/txrx.c | 36 +++--- drivers/net/wireless/rtl818x/rtl8180_dev.c | 17 +-- drivers/net/wireless/rtl818x/rtl8187_dev.c | 11 +- drivers/net/wireless/rtl818x/rtl8187_rtl8225.c | 8 +- include/net/cfg80211.h | 65 +++++++++- net/wireless/core.c | 53 +++++++ 24 files changed, 528 insertions(+), 481 deletions(-) --
Save a few bytes of text
(allyesconfig)
$ size drivers/net/wireless/built-in.o*
text data bss dec hex filename
3924568 100548 871056 4896172 4ab5ac drivers/net/wireless/built-in.o.new
3926520 100548 871464 4898532 4abee4 drivers/net/wireless/built-in.o.old
$ size net/wireless/core.o*
text data bss dec hex filename
12843 216 3768 16827 41bb net/wireless/core.o.new
12328 216 3656 16200 3f48 net/wireless/core.o
Signed-off-by: Joe Perches <joe@perches.com>
---
include/net/cfg80211.h | 5 ++-
net/wireless/core.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 56 insertions(+), 2 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 7fe774c..ae80f8f 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -2442,8 +2442,9 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
wiphy_printk(KERN_NOTICE, wiphy, format, ##args)
#define wiphy_info(wiphy, format, args...) \
wiphy_printk(KERN_INFO, wiphy, format, ##args)
-#define wiphy_debug(wiphy, format, args...) \
- wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
+
+int wiphy_debug(const struct wiphy *wiphy, const char *format, ...)
+ __attribute__ ((format (printf, 2, 3)));
#if defined(DEBUG)
#define wiphy_dbg(wiphy, format, args...) \
diff --git a/net/wireless/core.c b/net/wireless/core.c
index f65c649..1f9de8a 100644
--- a/net/wireless/core.c
+++ b/net/wireless/core.c
@@ -907,3 +907,56 @@ static void __exit cfg80211_exit(void)
destroy_workqueue(cfg80211_wq);
}
module_exit(cfg80211_exit);
+
+#ifdef __KERNEL__
+
+static int ___wiphy_printk(const char *level, const struct wiphy *wiphy,
+ struct va_format *vaf)
+{
+ if (!wiphy)
+ return printk("%s(NULL wiphy *): %pV", level, vaf);
+
+ return printk("%s%s: %pV", level, wiphy_name(wiphy), vaf);
+}
+
+int __wiphy_printk(const char *level, const struct wiphy *wiphy,
+ const char *fmt, ...Do we need this part? -- John W. Linville Someday the world will need a hero, and you linville@tuxdriver.com might be all we have. Be ready. --
No, not really. I'm not too sure about the need for the added cfg80211.h #ifdef __KERNEL__ either. --
Good point -- I'll remove both of them. John -- John W. Linville Someday the world will need a hero, and you linville@tuxdriver.com might be all we have. Be ready. --
Simplify logging messages for wiphy devices
Signed-off-by: Joe Perches <joe@perches.com>
---
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 4d1f19d..7fe774c 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1416,7 +1416,7 @@ static inline struct device *wiphy_dev(struct wiphy *wiphy)
*
* @wiphy: The wiphy whose name to return
*/
-static inline const char *wiphy_name(struct wiphy *wiphy)
+static inline const char *wiphy_name(const struct wiphy *wiphy)
{
return dev_name(&wiphy->dev);
}
@@ -2420,4 +2420,66 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
enum nl80211_cqm_rssi_threshold_event rssi_event,
gfp_t gfp);
+#ifdef __KERNEL__
+
+/* Logging, debugging and troubleshooting/diagnostic helpers. */
+
+/* wiphy_printk helpers, similar to dev_printk */
+
+#define wiphy_printk(level, wiphy, format, args...) \
+ printk(level "%s: " format, wiphy_name(wiphy), ##args)
+#define wiphy_emerg(wiphy, format, args...) \
+ wiphy_printk(KERN_EMERG, wiphy, format, ##args)
+#define wiphy_alert(wiphy, format, args...) \
+ wiphy_printk(KERN_ALERT, wiphy, format, ##args)
+#define wiphy_crit(wiphy, format, args...) \
+ wiphy_printk(KERN_CRIT, wiphy, format, ##args)
+#define wiphy_err(wiphy, format, args...) \
+ wiphy_printk(KERN_ERR, wiphy, format, ##args)
+#define wiphy_warn(wiphy, format, args...) \
+ wiphy_printk(KERN_WARNING, wiphy, format, ##args)
+#define wiphy_notice(wiphy, format, args...) \
+ wiphy_printk(KERN_NOTICE, wiphy, format, ##args)
+#define wiphy_info(wiphy, format, args...) \
+ wiphy_printk(KERN_INFO, wiphy, format, ##args)
+#define wiphy_debug(wiphy, format, args...) \
+ wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
+
+#if defined(DEBUG)
+#define wiphy_dbg(wiphy, format, args...) \
+ wiphy_printk(KERN_DEBUG, wiphy, format, ...Standardize the logging macros used.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/wireless/adm8211.c | 53 ++++----
drivers/net/wireless/at76c50x-usb.c | 139 +++++++++----------
drivers/net/wireless/ath/ar9170/cmd.c | 7 +-
drivers/net/wireless/ath/ar9170/led.c | 4 +-
drivers/net/wireless/ath/ar9170/main.c | 172 +++++++++++-------------
drivers/net/wireless/ath/ar9170/phy.c | 8 +-
drivers/net/wireless/ath/ath9k/ahb.c | 7 +-
drivers/net/wireless/ath/ath9k/pci.c | 7 +-
drivers/net/wireless/iwlwifi/iwl-agn.c | 11 +-
drivers/net/wireless/iwlwifi/iwl-core.c | 2 +-
drivers/net/wireless/iwlwifi/iwl3945-base.c | 13 +-
drivers/net/wireless/mac80211_hwsim.c | 99 +++++++-------
drivers/net/wireless/mwl8k.c | 123 +++++++----------
drivers/net/wireless/orinoco/cfg.c | 5 +-
drivers/net/wireless/p54/eeprom.c | 76 +++++------
drivers/net/wireless/p54/fwio.c | 53 ++++----
drivers/net/wireless/p54/led.c | 8 +-
drivers/net/wireless/p54/p54pci.c | 3 +-
drivers/net/wireless/p54/txrx.c | 36 +++---
drivers/net/wireless/rtl818x/rtl8180_dev.c | 17 +--
drivers/net/wireless/rtl818x/rtl8187_dev.c | 11 +-
drivers/net/wireless/rtl818x/rtl8187_rtl8225.c | 8 +-
22 files changed, 398 insertions(+), 464 deletions(-)
diff --git a/drivers/net/wireless/adm8211.c b/drivers/net/wireless/adm8211.c
index bde2fa8..a105087 100644
--- a/drivers/net/wireless/adm8211.c
+++ b/drivers/net/wireless/adm8211.c
@@ -373,8 +373,8 @@ static void adm8211_interrupt_rci(struct ieee80211_hw *dev)
pktlen = status & RDES0_STATUS_FL;
if (pktlen > RX_PKT_SIZE) {
if (net_ratelimit())
- printk(KERN_DEBUG "%s: frame too long (%d)\n",
- wiphy_name(dev->wiphy), pktlen);
+ wiphy_debug(dev->wiphy, "frame too ...