Skip to contentSkip to conversation

Staging: speakup: Use pr_warn() defined in <linux/printk.h>.

PATCH In review Sam Muhammed 3 participants 4 messages Mar 22, 2020 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: speakup: Use pr_warn() defined in <linux/printk.h>.

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.

---
 drivers/staging/speakup/spk_priv.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/speakup/spk_priv.h +2 -4
index ac6a74883af4..c75b40838794 100644
@@ -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

Reviewed-by on v1 1/1
#1 lore raw

Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:

Quoted 7 lines

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.

Thanks!

Quoted 27 lines
---
 drivers/staging/speakup/spk_priv.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/speakup/spk_priv.h +2 -5
index ac6a74883af4..c75b40838794 100644
@@ -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

#2 lore raw
Quoted 11 lines · Samuel Thibault

Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:

Quoted 7 lines

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.

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

Quoted 30 lines

Thanks!

Quoted 27 lines
---
 drivers/staging/speakup/spk_priv.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/speakup/spk_priv.h +2 -5
index ac6a74883af4..c75b40838794 100644
@@ -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

#3 lore raw
Quoted 19 lines · Sam Muhammed
Quoted 11 lines · Samuel Thibault

Sam Muhammed, le dim. 22 mars 2020 10:33:22 -0400, a ecrit:

Quoted 7 lines

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.

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

Quoted 7 lines

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

Quoted 40 lines

Sam

Quoted 19 lines

Thanks!

Quoted 17 lines
---
 drivers/staging/speakup/spk_priv.h | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/speakup/spk_priv.h +2 -0
index ac6a74883af4..c75b40838794 100644
@@ -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"
 
Quoted 11 lines
Quoted 10 lines
drivers/staging/speakup/spk_priv.h +0 -5
-#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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/35ae3f18d6f774d19119d0fed29773f14f99da94.camel%40gmail.com.