Re: [PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-06 Thread Greg KH
On Mon, Mar 05, 2018 at 01:02:56PM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
> 
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *change the subject line, in v1 driver name was wrong.
> 
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> index e6648f7..200fe5f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>  
>   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
>   if (IS_ERR(priv->tfm)) {
> - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
> + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");

Why would this need to be ratelimited at all?

Same for the other changes in this file.  Only use the _ratelimited()
calls if the message can be triggered a lot.

> @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>   keyidx = pos[3];
>   if (!(keyidx & (1 << 5))) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet without ExtIV 
> flag from %pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: received packet without 
> ExtIV flag from %pM\n",
> + hdr->addr2);

Also, "ratelimit" is already checked right above this, so that's a hint
you don't need to check it again :)

thanks,

greg k-h


Re: [PATCH v2] staging: rtl8192u: Replace printk() with appropriate net_*macro_ratelimited()

2018-03-06 Thread Greg KH
On Mon, Mar 05, 2018 at 01:02:56PM +0530, Arushi Singhal wrote:
> Replace printk having a log level with the appropriate
> net_*macro_ratelimited.
> It's better to use actual device name as a prefix in error messages.
> Indentation is also changed, to fix the  checkpatch issue if line is not
> exceding 80 characters.
> 
> Signed-off-by: Arushi Singhal 
> ---
> changes in v2
> *change the subject line, in v1 driver name was wrong.
> 
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c  | 22 
> +++---
>  1 file changed, 11 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c 
> b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> index e6648f7..200fe5f 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_ccmp.c
> @@ -73,7 +73,7 @@ static void *ieee80211_ccmp_init(int key_idx)
>  
>   priv->tfm = (void *)crypto_alloc_cipher("aes", 0, CRYPTO_ALG_ASYNC);
>   if (IS_ERR(priv->tfm)) {
> - printk(KERN_DEBUG "ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");
> + net_dbg_ratelimited("ieee80211_crypt_ccmp: could not allocate 
> crypto API aes\n");

Why would this need to be ratelimited at all?

Same for the other changes in this file.  Only use the _ratelimited()
calls if the message can be triggered a lot.

> @@ -276,22 +276,22 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, 
> int hdr_len, void *priv)
>   keyidx = pos[3];
>   if (!(keyidx & (1 << 5))) {
>   if (net_ratelimit()) {
> - printk(KERN_DEBUG "CCMP: received packet without ExtIV 
> flag from %pM\n",
> - hdr->addr2);
> + net_dbg_ratelimited("CCMP: received packet without 
> ExtIV flag from %pM\n",
> + hdr->addr2);

Also, "ratelimit" is already checked right above this, so that's a hint
you don't need to check it again :)

thanks,

greg k-h