All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level>
@ 2017-06-21 12:19 simran singhal
  2017-06-21 16:31 ` Joe Perches
  2017-06-23 16:34 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: simran singhal @ 2017-06-21 12:19 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: devel, linux-kernel

Use the current logging style.
Coalesce formats where appropriate.

Signed-off-by: simran singhal <singhalsimran0@gmail.com>
---
 drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 34 ++++++++++-------------
 1 file changed, 14 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
index 7a31510..d1a86bb 100644
--- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
+++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
@@ -236,8 +236,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
 
 	#ifdef NOT_YET
 	if (ieee->iw_mode == IW_MODE_MASTER) {
-		printk(KERN_DEBUG "%s: Master mode not yet supported.\n",
-		       ieee->dev->name);
+		pr_debug("%s: Master mode not yet supported.\n",
+			 ieee->dev->name);
 		return 0;
 /*
   hostap_update_sta_ps(ieee, (struct hostap_ieee80211_hdr_4addr *)
@@ -265,9 +265,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
 
 	    if (ieee->iw_mode == IW_MODE_MASTER) {
 		if (type != WLAN_FC_TYPE_MGMT && type != WLAN_FC_TYPE_CTRL) {
-			printk(KERN_DEBUG "%s: unknown management frame "
-			       "(type=0x%02x, stype=0x%02x) dropped\n",
-			       skb->dev->name, type, stype);
+			pr_debug("%s: unknown management frame (type=0x%02x, stype=0x%02x) dropped\n",
+				 skb->dev->name, type, stype);
 			return -1;
 		}
 
@@ -275,8 +274,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
 		return 0;
 	}
 
-	printk(KERN_DEBUG "%s: hostap_rx_frame_mgmt: management frame "
-	       "received in non-Host AP mode\n", skb->dev->name);
+	pr_debug("%s: hostap_rx_frame_mgmt: management frame received in non-Host AP mode\n",
+		 skb->dev->name);
 	return -1;
 	#endif
 }
@@ -354,9 +353,8 @@ ieee80211_rx_frame_decrypt(struct ieee80211_device *ieee, struct sk_buff *skb,
 	if (ieee->tkip_countermeasures &&
 	    strcmp(crypt->ops->name, "TKIP") == 0) {
 		if (net_ratelimit()) {
-			printk(KERN_DEBUG "%s: TKIP countermeasures: dropped "
-			       "received packet from %pM\n",
-			       ieee->dev->name, hdr->addr2);
+			pr_debug("%s: TKIP countermeasures: dropped received packet from %pM\n",
+				 ieee->dev->name, hdr->addr2);
 		}
 		return -1;
 	}
@@ -403,9 +401,8 @@ ieee80211_rx_frame_decrypt_msdu(struct ieee80211_device *ieee, struct sk_buff *s
 	res = crypt->ops->decrypt_msdu(skb, keyidx, hdrlen, crypt->priv);
 	atomic_dec(&crypt->refcnt);
 	if (res < 0) {
-		printk(KERN_DEBUG "%s: MSDU decryption/MIC verification failed"
-		       " (SA=%pM keyidx=%d)\n",
-		       ieee->dev->name, hdr->addr2, keyidx);
+		pr_debug("%s: MSDU decryption/MIC verification failed (SA=%pM keyidx=%d)\n",
+			 ieee->dev->name, hdr->addr2, keyidx);
 		return -1;
 	}
 
@@ -923,8 +920,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 	stats = &ieee->stats;
 
 	if (skb->len < 10) {
-		printk(KERN_INFO "%s: SKB length < 10\n",
-		       dev->name);
+		pr_info("%s: SKB length < 10\n", dev->name);
 		goto rx_dropped;
 	}
 
@@ -1170,9 +1166,8 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb,
 			flen -= hdrlen;
 
 		if (frag_skb->tail + flen > frag_skb->end) {
-			printk(KERN_WARNING "%s: host decrypted and "
-			       "reassembled frame did not fit skb\n",
-			       dev->name);
+			pr_warn("%s: host decrypted and reassembled frame did not fit skb\n",
+				dev->name);
 			ieee80211_frag_cache_invalidate(ieee, hdr);
 			goto rx_dropped;
 		}
@@ -2049,8 +2044,7 @@ int ieee80211_parse_info_param(struct ieee80211_device *ieee,
 			}
 			break;
 		case MFIE_TYPE_QOS_PARAMETER:
-			printk(KERN_ERR
-			       "QoS Error need to parse QOS_PARAMETER IE\n");
+			pr_err("QoS Error need to parse QOS_PARAMETER IE\n");
 			break;
 
 		case MFIE_TYPE_COUNTRY:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level>
  2017-06-21 12:19 [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level> simran singhal
@ 2017-06-21 16:31 ` Joe Perches
  2017-06-23 16:34 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Joe Perches @ 2017-06-21 16:31 UTC (permalink / raw)
  To: simran singhal, Greg Kroah-Hartman; +Cc: devel, linux-kernel

On Wed, 2017-06-21 at 17:49 +0530, simran singhal wrote:
> Use the current logging style.
> Coalesce formats where appropriate.
[]
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
[]
> @@ -236,8 +236,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
>  
>  	#ifdef NOT_YET
>  	if (ieee->iw_mode == IW_MODE_MASTER) {
> -		printk(KERN_DEBUG "%s: Master mode not yet supported.\n",
> -		       ieee->dev->name);
> +		pr_debug("%s: Master mode not yet supported.\n",
> +			 ieee->dev->name);

FYI 1:

Conversions of
	printk(KERN_DEBUG ...)
to
	pr_debug(...)
are not equivalent.

The first one is always placed into the object code
and emitted when the logging level is set appropriately.

The second one is only emitted if dynamic_debug is enabled
or if a #define DEBUG is set.

You should mention this change in the changelog.

In any case, for this code only, I think it's probably OK.

FYI 2:

There is a script that does these conversions and a few
other things: https://lwn.net/Articles/380161/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level>
  2017-06-21 12:19 [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level> simran singhal
  2017-06-21 16:31 ` Joe Perches
@ 2017-06-23 16:34 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-23 16:34 UTC (permalink / raw)
  To: simran singhal; +Cc: devel, linux-kernel

On Wed, Jun 21, 2017 at 05:49:32PM +0530, simran singhal wrote:
> Use the current logging style.
> Coalesce formats where appropriate.
> 
> Signed-off-by: simran singhal <singhalsimran0@gmail.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c | 34 ++++++++++-------------
>  1 file changed, 14 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> index 7a31510..d1a86bb 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c
> @@ -236,8 +236,8 @@ ieee80211_rx_frame_mgmt(struct ieee80211_device *ieee, struct sk_buff *skb,
>  
>  	#ifdef NOT_YET
>  	if (ieee->iw_mode == IW_MODE_MASTER) {
> -		printk(KERN_DEBUG "%s: Master mode not yet supported.\n",
> -		       ieee->dev->name);
> +		pr_debug("%s: Master mode not yet supported.\n",
> +			 ieee->dev->name);

This is a network driver, why not use net_dbg() or at the very least,
dev_dbg(), which all drivers should use (never use pr_* or printk in a
driver if at all possible.)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-06-23 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-21 12:19 [PATCH] staging: rtl8192u: ieee80211: Convert printks to pr_<level> simran singhal
2017-06-21 16:31 ` Joe Perches
2017-06-23 16:34 ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.