Skip to contentSkip to conversation

include/net/cfg80211.h: wiphy_<level> messages use dev_printk

RFC PATCH In review Joe Perches 3 participants 5 messages Aug 19, 2010 – Aug 25, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 include/net/cfg80211.h: wiphy_<level> messages use dev_printk

Adding device to the wiphy logging messages could be useful.

---
 include/net/cfg80211.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
include/net/cfg80211.h +1 -1
index 6a98b1b..61bc007 100644
@@ -2439,7 +2439,7 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 /* wiphy_printk helpers, similar to dev_printk */
 
 #define wiphy_printk(level, wiphy, format, args...)		\
-	printk(level "%s: " format, wiphy_name(wiphy), ##args)
+	dev_printk(level, &wiphy->dev, "%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...)			\
maintainer
#1 lore raw

include/net/cfg80211.h void cfg80211_cqm_rssi_notify(struct net_device *dev, · line 2442

Quoted 5 lines · Joe Perches

Adding device to the wiphy logging messages could be useful.

#define wiphy_printk(level, wiphy, format, args...) \

include/net/cfg80211.h +1 -1
-	printk(level "%s: " format, wiphy_name(wiphy), ##args)
+	dev_printk(level, &wiphy->dev, "%s: " format, wiphy_name(wiphy), ##args)

what will that actually print?

johannes

#2 lore raw
Quoted 6 lines · Johannes Berg

Review

Quoted 4 lines · Joe Perches

Adding device to the wiphy logging messages could be useful.
#define wiphy_printk(level, wiphy, format, args...) \

(quoted diff) +1 -1
-	printk(level "%s: " format, wiphy_name(wiphy), ##args)
+	dev_printk(level, &wiphy->dev, "%s: " format, wiphy_name(wiphy), ##args)

what will that actually print?

As is, that'd print:

"<level>dev_driver_string(&wiphy->dev) dev_name(&wiphy->dev): wiphy_name(wiphy): " fmt, ##args

for instance:

[   41.261941] ieee80211 phy0: phy0: Selected rate control algorithm 'minstrel_ht'

ie: redundant.
wiphy_name(wiphy) is an inline for dev_name(&wiphy->dev)

So it's appropriate to use:

#define wiphy_<level>(wiphy, fmt, arg...) dev_<level>(&wiphy->dev, fmt, ##arg)

and the output becomes:

[   41.261941] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'
---
 include/net/cfg80211.h |   37 +++++++++++------------------------
 net/wireless/core.c    |   49 ------------------------------------------------
 2 files changed, 12 insertions(+), 74 deletions(-)
include/net/cfg80211.h +12 -25
index f274053..ab5c746 100644
@@ -2548,49 +2548,36 @@ void cfg80211_cqm_rssi_notify(struct net_device *dev,
 /* wiphy_printk helpers, similar to dev_printk */
 
 #define wiphy_printk(level, wiphy, format, args...)		\
-	printk(level "%s: " format, wiphy_name(wiphy), ##args)
+	dev_printk(level, &(wiphy)->dev, format, ##args)
 #define wiphy_emerg(wiphy, format, args...)			\
-	wiphy_printk(KERN_EMERG, wiphy, format, ##args)
+	dev_emerg(&(wiphy)->dev, format, ##args)
 #define wiphy_alert(wiphy, format, args...)			\
-	wiphy_printk(KERN_ALERT, wiphy, format, ##args)
+	dev_alert(&(wiphy)->dev, format, ##args)
 #define wiphy_crit(wiphy, format, args...)			\
-	wiphy_printk(KERN_CRIT, wiphy, format, ##args)
+	dev_crit(&(wiphy)->dev, format, ##args)
 #define wiphy_err(wiphy, format, args...)			\
-	wiphy_printk(KERN_ERR, wiphy, format, ##args)
+	dev_err(&(wiphy)->dev, format, ##args)
 #define wiphy_warn(wiphy, format, args...)			\
-	wiphy_printk(KERN_WARNING, wiphy, format, ##args)
+	dev_warn(&(wiphy)->dev, format, ##args)
 #define wiphy_notice(wiphy, format, args...)			\
-	wiphy_printk(KERN_NOTICE, wiphy, format, ##args)
+	dev_notice(&(wiphy)->dev, format, ##args)
 #define wiphy_info(wiphy, format, args...)			\
-	wiphy_printk(KERN_INFO, wiphy, format, ##args)
+	dev_info(&(wiphy)->dev, 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...)			\
+#define wiphy_debug(wiphy, format, args...)			\
 	wiphy_printk(KERN_DEBUG, wiphy, format, ##args)
-#elif defined(CONFIG_DYNAMIC_DEBUG)
+
 #define wiphy_dbg(wiphy, format, args...)			\
-	dynamic_pr_debug("%s: " format,	wiphy_name(wiphy), ##args)
-#else
-#define wiphy_dbg(wiphy, format, args...)				\
-({									\
-	if (0)								\
-		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
-	0;								\
-})
-#endif
+	dev_dbg(&(wiphy)->dev, format, ##args)
 
 #if defined(VERBOSE_DEBUG)
 #define wiphy_vdbg	wiphy_dbg
 #else
-
 #define wiphy_vdbg(wiphy, format, args...)				\
 ({									\
 	if (0)								\
 		wiphy_printk(KERN_DEBUG, wiphy, format, ##args);	\
-		0;							\
+	0;								\
 })
 #endif
 
net/wireless/core.c +0 -49

52 lines not on this page · raw message

#3 lore raw
Quoted 21 lines · Joe Perches
Quoted 6 lines · Johannes Berg

Review

Quoted 4 lines · Joe Perches

Adding device to the wiphy logging messages could be useful.
#define wiphy_printk(level, wiphy, format, args...) \

(quoted diff) +1 -1
-	printk(level "%s: " format, wiphy_name(wiphy), ##args)
+	dev_printk(level, &wiphy->dev, "%s: " format, wiphy_name(wiphy), ##args)

what will that actually print?

As is, that'd print:

"<level>dev_driver_string(&wiphy->dev) dev_name(&wiphy->dev): wiphy_name(wiphy): " fmt, ##args

for instance:

[   41.261941] ieee80211 phy0: phy0: Selected rate control algorithm 'minstrel_ht'

ie: redundant.
wiphy_name(wiphy) is an inline for dev_name(&wiphy->dev)

So it's appropriate to use:

Quoted 7 lines

#define wiphy_<level>(wiphy, fmt, arg...) dev_<level>(&wiphy->dev, fmt, ##arg)

and the output becomes:

[   41.261941] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'

Everyone OK w/ this version?

Signature · 2 lines
John W. Linville		Someday the world will need a hero, and you
[email protected]			might be all we have.  Be ready.
maintainer
#4 lore raw
Quoted 13 lines · John W. Linville
Quoted 13 lines

"<level>dev_driver_string(&wiphy->dev) dev_name(&wiphy->dev): wiphy_name(wiphy): " fmt, ##args

for instance:

[   41.261941] ieee80211 phy0: phy0: Selected rate control algorithm 'minstrel_ht'

ie: redundant.
wiphy_name(wiphy) is an inline for dev_name(&wiphy->dev)

So it's appropriate to use:

#define wiphy_<level>(wiphy, fmt, arg...) dev_<level>(&wiphy->dev, fmt, ##arg)

Quoted 7 lines
Quoted 5 lines

and the output becomes:

[   41.261941] ieee80211 phy0: Selected rate control algorithm 'minstrel_ht'

Everyone OK w/ this version?

I don't care much :)

johannes