All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
@ 2020-03-10 21:26 Lourdes Pedrajas
  2020-03-10 21:40 ` [Outreachy kernel] " Julia Lawall
  2020-03-10 21:43 ` Stefano Brivio
  0 siblings, 2 replies; 8+ messages in thread
From: Lourdes Pedrajas @ 2020-03-10 21:26 UTC (permalink / raw)
  To: outreachy-kernel, gregkh

printk() is deprecated, use netdev_warn() instead, which is a message printing
function for network devices, defined in include/linux/netdevice.h.
Issue found by checkpatch.

Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
---
Changes since v1:
 - Replace message printing function pr_warn with network devices
   specific, netdev_warn()

 drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
index 0118edb0b9ab..58c1a8da7a8d 100644
--- a/drivers/staging/rtl8192u/r8192U_wx.c
+++ b/drivers/staging/rtl8192u/r8192U_wx.c
@@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
 				hwkey);                 /* KeyContent */
 
 		} else {
-			printk("wrong type in WEP, not WEP40 and WEP104\n");
+			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");
 		}
 
 	}
-- 
2.17.1



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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 21:26 [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk() Lourdes Pedrajas
@ 2020-03-10 21:40 ` Julia Lawall
  2020-03-10 21:43 ` Stefano Brivio
  1 sibling, 0 replies; 8+ messages in thread
From: Julia Lawall @ 2020-03-10 21:40 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel, gregkh



On Tue, 10 Mar 2020, Lourdes Pedrajas wrote:

> printk() is deprecated, use netdev_warn() instead, which is a message printing
> function for network devices, defined in include/linux/netdevice.h.
> Issue found by checkpatch.
>
> Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> ---
> Changes since v1:
>  - Replace message printing function pr_warn with network devices
>    specific, netdev_warn()
>
>  drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
> index 0118edb0b9ab..58c1a8da7a8d 100644
> --- a/drivers/staging/rtl8192u/r8192U_wx.c
> +++ b/drivers/staging/rtl8192u/r8192U_wx.c
> @@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
>  				hwkey);                 /* KeyContent */
>
>  		} else {
> -			printk("wrong type in WEP, not WEP40 and WEP104\n");
> +			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");

This does not look correct.  Are you sure that you actually compiled this
file.  Ie, do you have a corresponding .o file?

julia

>  		}
>
>  	}
> --
> 2.17.1
>
> --
> 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 view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20200310212658.4075-1-lu%40pplo.net.
>


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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 21:26 [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk() Lourdes Pedrajas
  2020-03-10 21:40 ` [Outreachy kernel] " Julia Lawall
@ 2020-03-10 21:43 ` Stefano Brivio
  2020-03-10 22:10   ` Lourdes Pedrajas
  1 sibling, 1 reply; 8+ messages in thread
From: Stefano Brivio @ 2020-03-10 21:43 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel, gregkh

On Tue, 10 Mar 2020 22:26:58 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> printk() is deprecated, use netdev_warn() instead, which is a message printing
> function for network devices, defined in include/linux/netdevice.h.
> Issue found by checkpatch.
> 
> Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> ---
> Changes since v1:
>  - Replace message printing function pr_warn with network devices
>    specific, netdev_warn()
> 
>  drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
> index 0118edb0b9ab..58c1a8da7a8d 100644
> --- a/drivers/staging/rtl8192u/r8192U_wx.c
> +++ b/drivers/staging/rtl8192u/r8192U_wx.c
> @@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
>  				hwkey);                 /* KeyContent */
>  
>  		} else {
> -			printk("wrong type in WEP, not WEP40 and WEP104\n");
> +			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");

Err, wait, did you try to compile this? :)

The idea of netdev_warn() is that it prefixes the error message by a
reference to the specific network device, so that one knows what device
is actually giving the problem (let's say you have two of these
adapters on a system, or that you have virtual interfaces, etc.).

But for that to happen, it needs a pointer to the appropriate struct
net_device.

-- 
Stefano



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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 21:43 ` Stefano Brivio
@ 2020-03-10 22:10   ` Lourdes Pedrajas
  2020-03-10 22:15     ` Stefano Brivio
  0 siblings, 1 reply; 8+ messages in thread
From: Lourdes Pedrajas @ 2020-03-10 22:10 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: outreachy-kernel, gregkh, julia.lawall

On Tue, Mar 10, 2020 at 10:43:17PM +0100, Stefano Brivio wrote:
> On Tue, 10 Mar 2020 22:26:58 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
> 
> > printk() is deprecated, use netdev_warn() instead, which is a message printing
> > function for network devices, defined in include/linux/netdevice.h.
> > Issue found by checkpatch.
> > 
> > Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> > ---
> > Changes since v1:
> >  - Replace message printing function pr_warn with network devices
> >    specific, netdev_warn()
> > 
> >  drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
> > index 0118edb0b9ab..58c1a8da7a8d 100644
> > --- a/drivers/staging/rtl8192u/r8192U_wx.c
> > +++ b/drivers/staging/rtl8192u/r8192U_wx.c
> > @@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
> >  				hwkey);                 /* KeyContent */
> >  
> >  		} else {
> > -			printk("wrong type in WEP, not WEP40 and WEP104\n");
> > +			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");
> 
> Err, wait, did you try to compile this? :)
> 
> The idea of netdev_warn() is that it prefixes the error message by a
> reference to the specific network device, so that one knows what device
> is actually giving the problem (let's say you have two of these
> adapters on a system, or that you have virtual interfaces, etc.).
> 
> But for that to happen, it needs a pointer to the appropriate struct
> net_device.
> 
> -- 
> Stefano
> 
Stefano, Julia: oh my bad, I did the worst error: break the compilation! :(
It won't happen again!

Will search wich function is correct here.

Lourdes


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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 22:10   ` Lourdes Pedrajas
@ 2020-03-10 22:15     ` Stefano Brivio
  2020-03-10 22:28       ` Lourdes Pedrajas
  0 siblings, 1 reply; 8+ messages in thread
From: Stefano Brivio @ 2020-03-10 22:15 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel, gregkh, julia.lawall

On Tue, 10 Mar 2020 23:10:18 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> On Tue, Mar 10, 2020 at 10:43:17PM +0100, Stefano Brivio wrote:
> > On Tue, 10 Mar 2020 22:26:58 +0100
> > Lourdes Pedrajas <lu@pplo.net> wrote:
> >   
> > > printk() is deprecated, use netdev_warn() instead, which is a message printing
> > > function for network devices, defined in include/linux/netdevice.h.
> > > Issue found by checkpatch.
> > > 
> > > Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> > > ---
> > > Changes since v1:
> > >  - Replace message printing function pr_warn with network devices
> > >    specific, netdev_warn()
> > > 
> > >  drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
> > > index 0118edb0b9ab..58c1a8da7a8d 100644
> > > --- a/drivers/staging/rtl8192u/r8192U_wx.c
> > > +++ b/drivers/staging/rtl8192u/r8192U_wx.c
> > > @@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
> > >  				hwkey);                 /* KeyContent */
> > >  
> > >  		} else {
> > > -			printk("wrong type in WEP, not WEP40 and WEP104\n");
> > > +			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");  
> > 
> > Err, wait, did you try to compile this? :)
> > 
> > The idea of netdev_warn() is that it prefixes the error message by a
> > reference to the specific network device, so that one knows what device
> > is actually giving the problem (let's say you have two of these
> > adapters on a system, or that you have virtual interfaces, etc.).
> > 
> > But for that to happen, it needs a pointer to the appropriate struct
> > net_device.
> > 
> > -- 
> > Stefano
> >   
> Stefano, Julia: oh my bad, I did the worst error: break the compilation! :(
> It won't happen again!
> 
> Will search wich function is correct here.

The one you already found, that part was correct. :)

-- 
Stefano



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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 22:15     ` Stefano Brivio
@ 2020-03-10 22:28       ` Lourdes Pedrajas
  2020-03-11 11:22         ` Stefano Brivio
  0 siblings, 1 reply; 8+ messages in thread
From: Lourdes Pedrajas @ 2020-03-10 22:28 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: outreachy-kernel, gregkh, julia.lawall

On Tue, Mar 10, 2020 at 11:15:05PM +0100, Stefano Brivio wrote:
> On Tue, 10 Mar 2020 23:10:18 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
> 
> > On Tue, Mar 10, 2020 at 10:43:17PM +0100, Stefano Brivio wrote:
> > > On Tue, 10 Mar 2020 22:26:58 +0100
> > > Lourdes Pedrajas <lu@pplo.net> wrote:
> > >   
> > > > printk() is deprecated, use netdev_warn() instead, which is a message printing
> > > > function for network devices, defined in include/linux/netdevice.h.
> > > > Issue found by checkpatch.
> > > > 
> > > > Signed-off-by: Lourdes Pedrajas <lu@pplo.net>
> > > > ---
> > > > Changes since v1:
> > > >  - Replace message printing function pr_warn with network devices
> > > >    specific, netdev_warn()
> > > > 
> > > >  drivers/staging/rtl8192u/r8192U_wx.c | 2 +-
> > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/staging/rtl8192u/r8192U_wx.c b/drivers/staging/rtl8192u/r8192U_wx.c
> > > > index 0118edb0b9ab..58c1a8da7a8d 100644
> > > > --- a/drivers/staging/rtl8192u/r8192U_wx.c
> > > > +++ b/drivers/staging/rtl8192u/r8192U_wx.c
> > > > @@ -588,7 +588,7 @@ static int r8192_wx_set_enc(struct net_device *dev,
> > > >  				hwkey);                 /* KeyContent */
> > > >  
> > > >  		} else {
> > > > -			printk("wrong type in WEP, not WEP40 and WEP104\n");
> > > > +			netdev_warn("wrong type in WEP, not WEP40 and WEP104\n");  
> > > 
> > > Err, wait, did you try to compile this? :)
> > > 
> > > The idea of netdev_warn() is that it prefixes the error message by a
> > > reference to the specific network device, so that one knows what device
> > > is actually giving the problem (let's say you have two of these
> > > adapters on a system, or that you have virtual interfaces, etc.).
> > > 
> > > But for that to happen, it needs a pointer to the appropriate struct
> > > net_device.
> > > 
> > > -- 
> > > Stefano
> > >   
> > Stefano, Julia: oh my bad, I did the worst error: break the compilation! :(
> > It won't happen again!
> > 
> > Will search wich function is correct here.
> 
> The one you already found, that part was correct. :)
> 
> -- 
> Stefano
> 
Indeed, also found dev_warn and dev_printk functions, but they are
similar, they expect a pointer to a network device. Also thank for your
explanation, I re-read those functions and now makes me sense.

Lourdes


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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-10 22:28       ` Lourdes Pedrajas
@ 2020-03-11 11:22         ` Stefano Brivio
  2020-03-11 18:15           ` Lourdes Pedrajas
  0 siblings, 1 reply; 8+ messages in thread
From: Stefano Brivio @ 2020-03-11 11:22 UTC (permalink / raw)
  To: Lourdes Pedrajas; +Cc: outreachy-kernel, gregkh, julia.lawall

On Tue, 10 Mar 2020 23:28:44 +0100
Lourdes Pedrajas <lu@pplo.net> wrote:

> Indeed, also found dev_warn and dev_printk functions, but they are
> similar, they expect a pointer to a network device.

Careful, those expect a more generic "struct device" instead, not a
network device: a "struct net_device" embeds a "struct device".

About the representation of a "device", you can have a look at LDD3,
chapter 14, page 381 (note: the book might be outdated, especially
API-wise, but for general concepts I find it's still very actual):
	https://lwn.net/Kernel/LDD3/

a struct net_device is a complicated, horrible beast. Chapter 17 in
LDD3 has some notes, but a quick look at:
	https://www.kernel.org/doc/htmldocs/networking/API-struct-net-device.html

should be enough to give you an idea. You don't need to understand all
the details now, of course!

-- 
Stefano



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

* Re: [Outreachy kernel] [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk()
  2020-03-11 11:22         ` Stefano Brivio
@ 2020-03-11 18:15           ` Lourdes Pedrajas
  0 siblings, 0 replies; 8+ messages in thread
From: Lourdes Pedrajas @ 2020-03-11 18:15 UTC (permalink / raw)
  To: Stefano Brivio; +Cc: outreachy-kernel, gregkh, julia.lawall

On Wed, Mar 11, 2020 at 12:22:53PM +0100, Stefano Brivio wrote:
> On Tue, 10 Mar 2020 23:28:44 +0100
> Lourdes Pedrajas <lu@pplo.net> wrote:
> 
> > Indeed, also found dev_warn and dev_printk functions, but they are
> > similar, they expect a pointer to a network device.
> 
> Careful, those expect a more generic "struct device" instead, not a
> network device: a "struct net_device" embeds a "struct device".
> 
> About the representation of a "device", you can have a look at LDD3,
> chapter 14, page 381 (note: the book might be outdated, especially
> API-wise, but for general concepts I find it's still very actual):
> 	https://lwn.net/Kernel/LDD3/
> 
> a struct net_device is a complicated, horrible beast. Chapter 17 in
> LDD3 has some notes, but a quick look at:
> 	https://www.kernel.org/doc/htmldocs/networking/API-struct-net-device.html
> 
> should be enough to give you an idea. You don't need to understand all
> the details now, of course!
> 
> -- 
> Stefano
> 
Thank you, I'll read that :) About the patch, pr_warn() is better this
time.


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

end of thread, other threads:[~2020-03-11 18:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-10 21:26 [PATCH v2] staging: rtl8192u: r8192U_wx: use netdev_warn() instead of printk() Lourdes Pedrajas
2020-03-10 21:40 ` [Outreachy kernel] " Julia Lawall
2020-03-10 21:43 ` Stefano Brivio
2020-03-10 22:10   ` Lourdes Pedrajas
2020-03-10 22:15     ` Stefano Brivio
2020-03-10 22:28       ` Lourdes Pedrajas
2020-03-11 11:22         ` Stefano Brivio
2020-03-11 18:15           ` Lourdes Pedrajas

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.