linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
@ 2018-03-04 22:32 Arushi Singhal
  2018-03-05  6:27 ` Greg KH
  2018-03-05 10:03 ` Dan Carpenter
  0 siblings, 2 replies; 8+ messages in thread
From: Arushi Singhal @ 2018-03-04 22:32 UTC (permalink / raw)
  To: gregkh; +Cc: devel, outreachy-kernel, linux-kernel

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 <arushisinghal19971997@gmail.com>
---
 .../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");
 		priv->tfm = NULL;
 		goto fail;
 	}
@@ -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);
 		}
 		key->dot11RSNAStatsCCMPFormatErrors++;
 		return -2;
 	}
 	keyidx >>= 6;
 	if (key->key_idx != keyidx) {
-		printk(KERN_DEBUG "CCMP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n",
-			key->key_idx, keyidx, priv);
+		net_dbg_ratelimited("CCMP: RX tkey->key_idx=%d frame keyidx=%d priv=%p\n",
+				    key->key_idx, keyidx, priv);
 		return -6;
 	}
 	if (!key->key_set) {
 		if (net_ratelimit()) {
-			printk(KERN_DEBUG "CCMP: received packet from %pM with keyid=%d that does not have a configured key\n",
-				hdr->addr2, keyidx);
+			net_dbg_ratelimited("CCMP: received packet from %pM with keyid=%d that does not have a configured key\n",
+					    hdr->addr2, keyidx);
 		}
 		return -3;
 	}
@@ -306,8 +306,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 
 	if (memcmp(pn, key->rx_pn, CCMP_PN_LEN) <= 0) {
 		if (net_ratelimit()) {
-			printk(KERN_DEBUG "CCMP: replay detected: STA=%pM previous PN %pm received PN %pm\n",
-			       hdr->addr2, key->rx_pn, pn);
+			net_dbg_ratelimited("CCMP: replay detected: STA=%pM previous PN %pm received PN %pm\n",
+					    hdr->addr2, key->rx_pn, pn);
 		}
 		key->dot11RSNAStatsCCMPReplays++;
 		return -4;
@@ -341,8 +341,8 @@ static int ieee80211_ccmp_decrypt(struct sk_buff *skb, int hdr_len, void *priv)
 
 		if (memcmp(mic, a, CCMP_MIC_LEN) != 0) {
 			if (net_ratelimit()) {
-				printk(KERN_DEBUG "CCMP: decrypt failed: STA=%pM\n",
-					hdr->addr2);
+				net_dbg_ratelimited("CCMP: decrypt failed: STA=%pM\n",
+						    hdr->addr2);
 			}
 			key->dot11RSNAStatsCCMPDecryptErrors++;
 			return -5;
-- 
2.7.4

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-04 22:32 [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited() Arushi Singhal
@ 2018-03-05  6:27 ` Greg KH
  2018-03-05 10:03 ` Dan Carpenter
  1 sibling, 0 replies; 8+ messages in thread
From: Greg KH @ 2018-03-05  6:27 UTC (permalink / raw)
  To: Arushi Singhal; +Cc: devel, outreachy-kernel, linux-kernel

On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
> ---
>  .../rtl8192u/ieee80211/ieee80211_crypt_ccmp.c      | 22 +++++++++++-----------
>  1 file changed, 11 insertions(+), 11 deletions(-)

Your subject line does not match the file you are changing :(
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-04 22:32 [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited() Arushi Singhal
  2018-03-05  6:27 ` Greg KH
@ 2018-03-05 10:03 ` Dan Carpenter
  2018-03-05 18:11   ` Arushi Singhal
  1 sibling, 1 reply; 8+ messages in thread
From: Dan Carpenter @ 2018-03-05 10:03 UTC (permalink / raw)
  To: Arushi Singhal; +Cc: devel, gregkh, linux-kernel, outreachy-kernel

On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
> ---
>  .../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");


This should probably just be deleted.

>  		priv->tfm = NULL;
>  		goto fail;
>  	}
> @@ -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);
>  		}

The "if (net_ratelimit()) " already means the message is ratelimited so
it's net_dbg() ok?  I think so, but I've never looked at this before.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-05 10:03 ` Dan Carpenter
@ 2018-03-05 18:11   ` Arushi Singhal
  2018-03-05 21:03     ` [Outreachy kernel] " Julia Lawall
  2018-03-06  9:53     ` Dan Carpenter
  0 siblings, 2 replies; 8+ messages in thread
From: Arushi Singhal @ 2018-03-05 18:11 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Greg KH, driverdevel, outreachy-kernel, LKML

[-- Attachment #1: Type: text/plain, Size: 2429 bytes --]

On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter <dan.carpenter@oracle.com>
wrote:

> On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
> > ---
> >  .../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");
>
>
> This should probably just be deleted.
>
Hello Dan
Why we should make this change?
According to me it's use here to print debug message.
Wanted to know more about your thought on this.

>
> >               priv->tfm = NULL;
> >               goto fail;
> >       }
> > @@ -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);
> >               }
>
> The "if (net_ratelimit()) " already means the message is ratelimited so
> it's net_dbg() ok?  I think so, but I've never looked at this before.
>

net_dbg() is an implicit declaration of a function. So we can't do this
change.

Thanks
Arushi


>
> regards,
> dan carpenter
>
>

[-- Attachment #2: Type: text/html, Size: 3705 bytes --]

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

* Re: [Outreachy kernel] Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-05 18:11   ` Arushi Singhal
@ 2018-03-05 21:03     ` Julia Lawall
  2018-03-06 12:04       ` SIMRAN SINGHAL
  2018-03-06 12:22       ` Arushi Singhal
  2018-03-06  9:53     ` Dan Carpenter
  1 sibling, 2 replies; 8+ messages in thread
From: Julia Lawall @ 2018-03-05 21:03 UTC (permalink / raw)
  To: Arushi Singhal
  Cc: driverdevel, Greg KH, LKML, Dan Carpenter, outreachy-kernel

[-- Attachment #1: Type: text/plain, Size: 2845 bytes --]



On Mon, 5 Mar 2018, Arushi Singhal wrote:

>
>
> On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>       On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
>       > ---
>       >  .../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");
>
>
>       This should probably just be deleted.
>
> Hello Dan
> Why we should make this change?
> According to me it's use here to print debug message.
> Wanted to know more about your thought on this.
>
>       >               priv->tfm = NULL;
>       >               goto fail;
>       >       }
>       > @@ -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);
>       >               }
>
>       The "if (net_ratelimit()) " already means the message is ratelimited so
>       it's net_dbg() ok?  I think so, but I've never looked at this before.
>
>  
> net_dbg() is an implicit declaration of a function. So we can't do this change.

Perhaps you can add the header file that declares net_dbg.

julia

[-- Attachment #2: Type: text/plain, Size: 169 bytes --]

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-05 18:11   ` Arushi Singhal
  2018-03-05 21:03     ` [Outreachy kernel] " Julia Lawall
@ 2018-03-06  9:53     ` Dan Carpenter
  1 sibling, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2018-03-06  9:53 UTC (permalink / raw)
  To: Arushi Singhal; +Cc: driverdevel, Greg KH, LKML, outreachy-kernel

On Mon, Mar 05, 2018 at 11:41:43PM +0530, Arushi Singhal wrote:
> On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter <dan.carpenter@oracle.com>
> wrote:
> 
> > On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
> > > ---
> > >  .../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");
> >
> >
> > This should probably just be deleted.
> >
> Hello Dan
> Why we should make this change?
> According to me it's use here to print debug message.
> Wanted to know more about your thought on this.

Actually, I looked at this wrong.  I though that crypto_alloc_cipher()
had its own error messages.  Sorry about that.

regards,
dan carpenter
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [Outreachy kernel] Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-05 21:03     ` [Outreachy kernel] " Julia Lawall
@ 2018-03-06 12:04       ` SIMRAN SINGHAL
  2018-03-06 12:22       ` Arushi Singhal
  1 sibling, 0 replies; 8+ messages in thread
From: SIMRAN SINGHAL @ 2018-03-06 12:04 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Arushi Singhal, driverdevel, Greg KH, LKML, outreachy-kernel,
	Dan Carpenter

On Tue, Mar 6, 2018 at 2:33 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:
>
>
> On Mon, 5 Mar 2018, Arushi Singhal wrote:
>
>>
>>
>> On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
>>       On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
>>       > ---
>>       >  .../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");
>>
>>
>>       This should probably just be deleted.
>>
>> Hello Dan
>> Why we should make this change?
>> According to me it's use here to print debug message.
>> Wanted to know more about your thought on this.
>>
>>       >               priv->tfm = NULL;
>>       >               goto fail;
>>       >       }
>>       > @@ -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);
>>       >               }
>>
>>       The "if (net_ratelimit()) " already means the message is ratelimited so
>>       it's net_dbg() ok?  I think so, but I've never looked at this before.
>>
>>
>> net_dbg() is an implicit declaration of a function. So we can't do this change.
>
> Perhaps you can add the header file that declares net_dbg.

Hi Julia

There is such header file which declares net_dbg.
We can use dev_dbg() for all struct device object.
We can use netdev_dbg() for all struct netdevice object.
For net subsystem when there is no struct device object we can go with
net_dbg_ratelimited (preferred) or pr_debug.

I have understood this from my readings. If I am wrong somewhere
please correct me.

Thanks
Arushi

>
> julia
>
> --
> 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 outreachy-kernel+unsubscribe@googlegroups.com.
> To post to this group, send email to outreachy-kernel@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/alpine.DEB.2.20.1803052203001.2763%40hadrien.
> For more options, visit https://groups.google.com/d/optout.
_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [Outreachy kernel] Re: [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited()
  2018-03-05 21:03     ` [Outreachy kernel] " Julia Lawall
  2018-03-06 12:04       ` SIMRAN SINGHAL
@ 2018-03-06 12:22       ` Arushi Singhal
  1 sibling, 0 replies; 8+ messages in thread
From: Arushi Singhal @ 2018-03-06 12:22 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Dan Carpenter, Greg KH, driverdevel, outreachy-kernel, LKML

[-- Attachment #1: Type: text/plain, Size: 3336 bytes --]

On Tue, Mar 6, 2018 at 2:33 AM, Julia Lawall <julia.lawall@lip6.fr> wrote:

>
>
> On Mon, 5 Mar 2018, Arushi Singhal wrote:
>
> >
> >
> > On Mon, Mar 5, 2018 at 3:33 PM, Dan Carpenter <dan.carpenter@oracle.com>
> wrote:
> >       On Mon, Mar 05, 2018 at 04:02:06AM +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 <arushisinghal19971997@gmail.com>
> >       > ---
> >       >  .../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");
> >
> >
> >       This should probably just be deleted.
> >
> > Hello Dan
> > Why we should make this change?
> > According to me it's use here to print debug message.
> > Wanted to know more about your thought on this.
> >
> >       >               priv->tfm = NULL;
> >       >               goto fail;
> >       >       }
> >       > @@ -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);
> >       >               }
> >
> >       The "if (net_ratelimit()) " already means the message is
> ratelimited so
> >       it's net_dbg() ok?  I think so, but I've never looked at this
> before.
> >
> >
> > net_dbg() is an implicit declaration of a function. So we can't do this
> change.
>
> Perhaps you can add the header file that declares net_dbg.
>
>
**Resending it again**

There is no such header file which declares net_dbg.
We can use dev_dbg() for all struct device object.
We can use netdev_dbg() for all struct netdevice object.
For net subsystem when there is no struct device object we can go with
net_dbg_ratelimited (preferred) or pr_debug.

I have understood this from my readings. If I am wrong somewhere
please correct me.

Thanks
Arushi


> julia

[-- Attachment #2: Type: text/html, Size: 4976 bytes --]

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

end of thread, other threads:[~2018-03-06 12:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-04 22:32 [PATCH] staging: irda: Replace printk() with appropriate net_*macro_ratelimited() Arushi Singhal
2018-03-05  6:27 ` Greg KH
2018-03-05 10:03 ` Dan Carpenter
2018-03-05 18:11   ` Arushi Singhal
2018-03-05 21:03     ` [Outreachy kernel] " Julia Lawall
2018-03-06 12:04       ` SIMRAN SINGHAL
2018-03-06 12:22       ` Arushi Singhal
2018-03-06  9:53     ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).