All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h>.
@ 2020-03-22 14:33 Sam Muhammed
  2020-03-22 14:35 ` Samuel Thibault
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Muhammed @ 2020-03-22 14:33 UTC (permalink / raw)
  To: outreachy-kernel, William Hubbs, Chris Brannon, Kirk Reiser,
	Samuel Thibault, Greg Kroah-Hartman
  Cc: Sam Muhammed

Dropping a user-defined pr_warn() and using the kernel
message printing functions implemented in <linux/printk.h>.

Since both have the same functionality, using the standard
kernel functions is better.

Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com>
---
 drivers/staging/speakup/spk_priv.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
index ac6a74883af4..c75b40838794 100644
--- a/drivers/staging/speakup/spk_priv.h
+++ b/drivers/staging/speakup/spk_priv.h
@@ -11,13 +11,11 @@
 #ifndef _SPEAKUP_PRIVATE_H
 #define _SPEAKUP_PRIVATE_H

+#include <linux/printk.h>
+
 #include "spk_types.h"
 #include "spk_priv_keyinfo.h"

-#ifndef pr_warn
-#define pr_warn(fmt, arg...) printk(KERN_WARNING fmt, ##arg)
-#endif
-
 #define V_LAST_VAR { MAXVARS }
 #define SPACE 0x20
 #define SYNTH_CHECK 20030716 /* today's date ought to do for check value */
---
2.20.1



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

* Re: [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h>.
  2020-03-22 14:33 [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h> Sam Muhammed
@ 2020-03-22 14:35 ` Samuel Thibault
  2020-03-22 14:47   ` [Outreachy kernel] " Sam Muhammed
  0 siblings, 1 reply; 4+ messages in thread
From: Samuel Thibault @ 2020-03-22 14:35 UTC (permalink / raw)
  To: Sam Muhammed
  Cc: outreachy-kernel, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman

Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:
> Dropping a user-defined pr_warn() and using the kernel
> message printing functions implemented in <linux/printk.h>.
> 
> Since both have the same functionality, using the standard
> kernel functions is better.
> 
> Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com>

Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>

Thanks!

> ---
>  drivers/staging/speakup/spk_priv.h | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
> index ac6a74883af4..c75b40838794 100644
> --- a/drivers/staging/speakup/spk_priv.h
> +++ b/drivers/staging/speakup/spk_priv.h
> @@ -11,13 +11,11 @@
>  #ifndef _SPEAKUP_PRIVATE_H
>  #define _SPEAKUP_PRIVATE_H
> 
> +#include <linux/printk.h>
> +
>  #include "spk_types.h"
>  #include "spk_priv_keyinfo.h"
> 
> -#ifndef pr_warn
> -#define pr_warn(fmt, arg...) printk(KERN_WARNING fmt, ##arg)
> -#endif
> -
>  #define V_LAST_VAR { MAXVARS }
>  #define SPACE 0x20
>  #define SYNTH_CHECK 20030716 /* today's date ought to do for check value */
> ---
> 2.20.1
> 


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

* Re: [Outreachy kernel] Re: [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h>.
  2020-03-22 14:35 ` Samuel Thibault
@ 2020-03-22 14:47   ` Sam Muhammed
  2020-03-22 14:54     ` Julia Lawall
  0 siblings, 1 reply; 4+ messages in thread
From: Sam Muhammed @ 2020-03-22 14:47 UTC (permalink / raw)
  To: Samuel Thibault
  Cc: outreachy-kernel, William Hubbs, Chris Brannon, Kirk Reiser,
	Greg Kroah-Hartman

On Sun, 2020-03-22 at 15:35 +0100, Samuel Thibault wrote:
> Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:
> > Dropping a user-defined pr_warn() and using the kernel
> > message printing functions implemented in <linux/printk.h>.
> > 
> > Since both have the same functionality, using the standard
> > kernel functions is better.
> > 
> > Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com>
> 
> Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> 

Thank you!
I have a question though, some drivers define pr_fmt() to include the
driver's KBUILD_MODNAME

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

I added it, it builds fine but prompts me about a warning that its
redefined over the original pr_fmt() in <linux/printk.h>

is this warning usually ignored? because there are lots of drivers
redefined their own pr_fmt()

if so should i add it? 

Sam

> Thanks!
> 
> > ---
> >  drivers/staging/speakup/spk_priv.h | 6 ++----
> >  1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
> > index ac6a74883af4..c75b40838794 100644
> > --- a/drivers/staging/speakup/spk_priv.h
> > +++ b/drivers/staging/speakup/spk_priv.h
> > @@ -11,13 +11,11 @@
> >  #ifndef _SPEAKUP_PRIVATE_H
> >  #define _SPEAKUP_PRIVATE_H
> > 
> > +#include <linux/printk.h>
> > +
> >  #include "spk_types.h"
> >  #include "spk_priv_keyinfo.h"
> > 
> > -#ifndef pr_warn
> > -#define pr_warn(fmt, arg...) printk(KERN_WARNING fmt, ##arg)
> > -#endif
> > -
> >  #define V_LAST_VAR { MAXVARS }
> >  #define SPACE 0x20
> >  #define SYNTH_CHECK 20030716 /* today's date ought to do for check value */
> > ---
> > 2.20.1
> > 
> 




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

* Re: [Outreachy kernel] Re: [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h>.
  2020-03-22 14:47   ` [Outreachy kernel] " Sam Muhammed
@ 2020-03-22 14:54     ` Julia Lawall
  0 siblings, 0 replies; 4+ messages in thread
From: Julia Lawall @ 2020-03-22 14:54 UTC (permalink / raw)
  To: Sam Muhammed
  Cc: Samuel Thibault, outreachy-kernel, William Hubbs, Chris Brannon,
	Kirk Reiser, Greg Kroah-Hartman



On Sun, 22 Mar 2020, Sam Muhammed wrote:

> On Sun, 2020-03-22 at 15:35 +0100, Samuel Thibault wrote:
> > Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:
> > > Dropping a user-defined pr_warn() and using the kernel
> > > message printing functions implemented in <linux/printk.h>.
> > >
> > > Since both have the same functionality, using the standard
> > > kernel functions is better.
> > >
> > > Signed-off-by: Sam Muhammed <jane.pnx9@gmail.com>
> >
> > Reviewed-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
> >
>
> Thank you!
> I have a question though, some drivers define pr_fmt() to include the
> driver's KBUILD_MODNAME
>
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> I added it, it builds fine but prompts me about a warning that its
> redefined over the original pr_fmt() in <linux/printk.h>
>
> is this warning usually ignored? because there are lots of drivers
> redefined their own pr_fmt()
>
> if so should i add it?

I don't know the details of this issue, but you shouldn't add warnings.
If you do make make path/file.i you will see the result of preprocessing
the file.  Then maybe you can see why there is a warning in your case, but
not in the other cases.

julia

>
> Sam
>
> > Thanks!
> >
> > > ---
> > >  drivers/staging/speakup/spk_priv.h | 6 ++----
> > >  1 file changed, 2 insertions(+), 4 deletions(-)
> > >
> > > diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h
> > > index ac6a74883af4..c75b40838794 100644
> > > --- a/drivers/staging/speakup/spk_priv.h
> > > +++ b/drivers/staging/speakup/spk_priv.h
> > > @@ -11,13 +11,11 @@
> > >  #ifndef _SPEAKUP_PRIVATE_H
> > >  #define _SPEAKUP_PRIVATE_H
> > >
> > > +#include <linux/printk.h>
> > > +
> > >  #include "spk_types.h"
> > >  #include "spk_priv_keyinfo.h"
> > >
> > > -#ifndef pr_warn
> > > -#define pr_warn(fmt, arg...) printk(KERN_WARNING fmt, ##arg)
> > > -#endif
> > > -
> > >  #define V_LAST_VAR { MAXVARS }
> > >  #define SPACE 0x20
> > >  #define SYNTH_CHECK 20030716 /* today's date ought to do for check value */
> > > ---
> > > 2.20.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/35ae3f18d6f774d19119d0fed29773f14f99da94.camel%40gmail.com.
>


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

end of thread, other threads:[~2020-03-22 14:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-03-22 14:33 [PATCH] Staging: speakup: Use pr_warn() defined in <linux/printk.h> Sam Muhammed
2020-03-22 14:35 ` Samuel Thibault
2020-03-22 14:47   ` [Outreachy kernel] " Sam Muhammed
2020-03-22 14:54     ` Julia Lawall

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.