staging: rtl8191u: ieee80211: prefer pr_debug() to printk(KERN_DEBUG, ...)
PATCH 1/1 staging: rtl8191u: ieee80211: prefer pr_debug() to printk(KERN_DEBUG, ...)
This patch replaces call to printk with pr_debug function thus addressing the following checkpatch script warning:
WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
--- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +12 -12
@@ -74,7 +74,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->tx_tfm_arc4 =crypto_alloc_skcipher ("ecb(arc4)" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tx_tfm_arc4)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API arc4\n" ); priv->tx_tfm_arc4 =NULL ; goto fail;
@@ -83,7 +83,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->tx_tfm_michael =crypto_alloc_ahash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tx_tfm_michael)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API michael_mic\n" ); priv->tx_tfm_michael =NULL ; goto fail;
@@ -92,7 +92,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->rx_tfm_arc4 =crypto_alloc_skcipher ("ecb(arc4)" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->rx_tfm_arc4)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API arc4\n" ); priv->rx_tfm_arc4 =NULL ; goto fail;
@@ -101,7 +101,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->rx_tfm_michael =crypto_alloc_ahash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->rx_tfm_michael)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API michael_mic\n" ); priv->rx_tfm_michael =NULL ; goto fail;
@@ -396,20 +396,20 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3 ];if (!(keyidx & (1 <<5 ))) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: received packet without ExtIV" +pr_debug ("TKIP: received packet without ExtIV" " flag from %pM\n" , hdr->addr2); }return -2 ; } keyidx >>=6 ;if (tkey->key_idx != keyidx) { -printk (KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " +pr_debug ("TKIP: RX tkey->key_idx=%d frame " "keyidx=%d priv=%p\n" , tkey->key_idx, keyidx, priv);return -6 ; }if (!tkey->key_set) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: received packet from %pM" +pr_debug ("TKIP: received packet from %pM" " with keyid=%d that does not have a configured" " key\n" , hdr->addr2, keyidx); }
@@ -425,7 +425,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)if (iv32 < tkey->rx_iv32 || (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: replay detected: STA=%pM" +pr_debug ("TKIP: replay detected: STA=%pM" " previous TSC %08x%04x received TSC " "%08x%04x\n" , hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);
@@ -453,7 +453,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)skcipher_request_zero (req);if (err) {if (net_ratelimit ()) { -printk (KERN_DEBUG ": TKIP: failed to decrypt " +pr_debug (": TKIP: failed to decrypt " "received packet from %pM\n" , hdr->addr2); }
@@ -476,7 +476,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) tkey->rx_phase1_done =0 ; }if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: ICV error detected: STA=" +pr_debug ("TKIP: ICV error detected: STA=" "%pM\n" , hdr->addr2); } tkey->dot11RSNAStatsTKIPICVErrors++;
@@ -567,7 +567,7 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri hdr = (struct rtl_80211_hdr_4addr *) skb->data;if (skb_tailroom (skb) <8 || skb->len < hdr_len) { -printk (KERN_DEBUG "Invalid packet for Michael MIC add " +pr_debug ("Invalid packet for Michael MIC add " "(tailroom=%d hdr_len=%d skb->len=%d)\n" ,skb_tailroom (skb), hdr_len, skb->len);return -1 ;
@@ -636,7 +636,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,struct rtl_80211_hdr_4addr *hdr; hdr = (struct rtl_80211_hdr_4addr *) skb->data; -printk (KERN_DEBUG "%s: Michael MIC verification failed for " +pr_debug ("%s: Michael MIC verification failed for " "MSDU from %pM keyidx=%d\n" , skb->dev ? skb->dev->name :"N/A" , hdr->addr2, keyidx);
Signature · 1 line
2.7.4
Quoted 15 lines · Aastha Gupta
This patch replaces call to printk with
pr_debugfunction thus addressing the following checkpatch script warning:WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
Signed-off-by Aastha Gupta <[email protected]>--- .../rtl8192u/ieee80211/ieee80211_crypt_tkip.c | 24 +++++++++++----------- 1 file changed, 12 insertions(+), 12 deletions(-)drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +0
-0
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c static void *ieee80211_tkip_init(int key_idx) · line 78
Quoted 6 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +1
-1@@ -74,7 +74,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->tx_tfm_arc4 =crypto_alloc_skcipher ("ecb(arc4)" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tx_tfm_arc4)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API arc4\n" );
If you just focus on the first four, you could save some space and better respect the kernel coding style by replacing the name of the driver, ie ieee80211_crypt_tkip by %s and the function name, obtained via __func__ (not the same string, but the amount of information seems to be the same). And then put the string all on one line rather than using string concatenation, which will make things easier if someone needs to grep for the message.
julia
Quoted 108 lines
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +11
-12priv->tx_tfm_arc4 =NULL ; goto fail;@@ -83,7 +83,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->tx_tfm_michael =crypto_alloc_ahash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->tx_tfm_michael)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API michael_mic\n" ); priv->tx_tfm_michael =NULL ; goto fail;@@ -92,7 +92,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->rx_tfm_arc4 =crypto_alloc_skcipher ("ecb(arc4)" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->rx_tfm_arc4)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API arc4\n" ); priv->rx_tfm_arc4 =NULL ; goto fail;@@ -101,7 +101,7 @@ static void *ieee80211_tkip_init(int key_idx) priv->rx_tfm_michael =crypto_alloc_ahash ("michael_mic" ,0 ,CRYPTO_ALG_ASYNC );if (IS_ERR (priv->rx_tfm_michael)) { -printk (KERN_DEBUG "ieee80211_crypt_tkip: could not allocate " +pr_debug ("ieee80211_crypt_tkip: could not allocate " "crypto API michael_mic\n" ); priv->rx_tfm_michael =NULL ; goto fail;@@ -396,20 +396,20 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) keyidx = pos[3 ];if (!(keyidx & (1 <<5 ))) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: received packet without ExtIV" +pr_debug ("TKIP: received packet without ExtIV" " flag from %pM\n" , hdr->addr2); }return -2 ; } keyidx >>=6 ;if (tkey->key_idx != keyidx) { -printk (KERN_DEBUG "TKIP: RX tkey->key_idx=%d frame " +pr_debug ("TKIP: RX tkey->key_idx=%d frame " "keyidx=%d priv=%p\n" , tkey->key_idx, keyidx, priv);return -6 ; }if (!tkey->key_set) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: received packet from %pM" +pr_debug ("TKIP: received packet from %pM" " with keyid=%d that does not have a configured" " key\n" , hdr->addr2, keyidx); }@@ -425,7 +425,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)if (iv32 < tkey->rx_iv32 || (iv32 == tkey->rx_iv32 && iv16 <= tkey->rx_iv16)) {if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: replay detected: STA=%pM" +pr_debug ("TKIP: replay detected: STA=%pM" " previous TSC %08x%04x received TSC " "%08x%04x\n" , hdr->addr2, tkey->rx_iv32, tkey->rx_iv16, iv32, iv16);@@ -453,7 +453,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)skcipher_request_zero (req);if (err) {if (net_ratelimit ()) { -printk (KERN_DEBUG ": TKIP: failed to decrypt " +pr_debug (": TKIP: failed to decrypt " "received packet from %pM\n" , hdr->addr2); }@@ -476,7 +476,7 @@ static int ieee80211_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv) tkey->rx_phase1_done =0 ; }if (net_ratelimit ()) { -printk (KERN_DEBUG "TKIP: ICV error detected: STA=" +pr_debug ("TKIP: ICV error detected: STA=" "%pM\n" , hdr->addr2); } tkey->dot11RSNAStatsTKIPICVErrors++;@@ -567,7 +567,7 @@ static int ieee80211_michael_mic_add(struct sk_buff *skb, int hdr_len, void *pri hdr = (struct rtl_80211_hdr_4addr *) skb->data;if (skb_tailroom (skb) <8 || skb->len < hdr_len) { -printk (KERN_DEBUG "Invalid packet for Michael MIC add " +pr_debug ("Invalid packet for Michael MIC add " "(tailroom=%d hdr_len=%d skb->len=%d)\n" ,skb_tailroom (skb), hdr_len, skb->len);return -1 ;@@ -636,7 +636,7 @@ static int ieee80211_michael_mic_verify(struct sk_buff *skb, int keyidx,struct rtl_80211_hdr_4addr *hdr; hdr = (struct rtl_80211_hdr_4addr *) skb->data; -printk (KERN_DEBUG "%s: Michael MIC verification failed for " +pr_debug ("%s: Michael MIC verification failed for " "MSDU from %pM keyidx=%d\n" , skb->dev ? skb->dev->name :"N/A" , hdr->addr2, keyidx); --2.7.4
--
You received this message because you are subscribed to the Google Groups "outreachy-kernel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/1505563212-2690-1-git-send-email-aastha.gupta4104%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Greg Kroah-Hartman
maintainerQuoted 6 lines · Aastha Gupta
This patch replaces call to printk with
pr_debugfunction thus addressing the following checkpatch script warning:WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
Signed-off-by Aastha Gupta <[email protected]>
As this is a network device, it should be using netdev_dbg() instead, right? Or, worse case, dev_dbg(), almost no driver should ever call a "raw" pr_debug() call.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Aastha Gupta
This patch replaces call to printk with
pr_debugfunction thus addressing the following checkpatch script warning:WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
Signed-off-by Aastha Gupta <[email protected]>
Quoted 7 lines
As this is a network device, it should be using
netdev_dbg()instead, right? Or, worse case,dev_dbg(), almost no driver should ever call a "raw"pr_debug()call.thanks,
greg k-h
I did think of replacing it with netdev_dbg() but netdev_dbg() requires an object of netdev which is not present in the file. Including it won't be right. Or is the parameter optional?
Aastha
Quoted 14 lines · Aastha Gupta
Quoted 12 lines · Greg Kroah-Hartman
Quoted 6 lines · Aastha Gupta
This patch replaces call to printk with
pr_debugfunction thus addressing the following checkpatch script warning:WARNING: Prefer [subsystem eg: netdev]_dbg([subsystem]dev, ... then dev_dbg(dev, ... then pr_debug(... to printk(KERN_DEBUG ...
Signed-off-by Aastha Gupta <[email protected]>As this is a network device, it should be using
netdev_dbg()instead, right? Or, worse case,dev_dbg(), almost no driver should ever call a "raw"pr_debug()call.
Quoted 7 lines
Quoted 3 lines
thanks,
greg k-h
I did think of replacing it with
netdev_dbg()butnetdev_dbg()requires an object of netdev which is not present in the file. Including it won't be right. Or is the parameter optional?
Maybe you can add it to the containing function, if the calling context has the information available. You might have to work back through several calling contexts.
julia