Skip to contentSkip to conversation

drm/print: cleanup coding style in drm_print.h

PATCH In review Jingyu Wang 3 participants 4 messages Sep 4, 2022 – Sep 5, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/print: cleanup coding style in drm_print.h

Fix everything checkpatch.pl complained about in drm_print.h

---
 include/drm/drm_print.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
include/drm/drm_print.h +6 -5
index 22fabdeed297..4332fbeb76a8 100644
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */
 /*
  * Copyright (C) 2016 Red Hat
  *
@@ -103,7 +104,7 @@ __printf(2, 0)
  * @va: the va_list
  */
 static inline void
-drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list * va)
 {
 	struct va_format vaf = { .fmt = fmt, .va = va };
 
@@ -426,16 +427,16 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 
 
 #define drm_info(drm, fmt, ...)					\
-	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), info, fmt, ##__VA_ARGS__)
 
 #define drm_notice(drm, fmt, ...)				\
-	__drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), notice, fmt, ##__VA_ARGS__)
 
 #define drm_warn(drm, fmt, ...)					\
-	__drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), warn, fmt, ##__VA_ARGS__)
 
 #define drm_err(drm, fmt, ...)					\
-	__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
+	__drm_printk((drm), err, "*ERROR* " fmt, ##__VA_ARGS__)
 
 
 #define drm_info_once(drm, fmt, ...)				\

base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
prerequisite-patch-id: f039528bc88876d6e0f64e843da089e85f6d3f58
prerequisite-patch-id: c14ed2e970be2c3f8ba746634e8161b94c148e88

Signature · 1 line
2.34.1
#1 lore raw
Quoted 1 line · Jingyu Wang

Fix everything checkpatch.pl complained about in drm_print.h

Sorry, you just can't assume the checkpatch.pl complaints are all correct, or that it would be this trivial to fix them.

This is broken.

include/drm/drm_print.h line 1

Quoted 11 lines
---
 include/drm/drm_print.h | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
include/drm/drm_print.h +1 -0
index 22fabdeed297..4332fbeb76a8 100644
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: MIT */

What's the point of having both the SPDX and full license text in the header? But unless you're the license holder, I'd be pretty careful about removing the license text.

include/drm/drm_print.h __printf(2, 0) · line 107

Quoted 9 lines
include/drm/drm_print.h +1 -1
 /*
  * Copyright (C) 2016 Red Hat
  *
@@ -103,7 +104,7 @@ __printf(2, 0)
  * @va: the va_list
  */
 static inline void
-drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list * va)

Checkpatch is just confused here. Look at all the other params, why would you add an extra space here?

Quoted 11 lines
include/drm/drm_print.h +1 -1
 {
 	struct va_format vaf = { .fmt = fmt, .va = va };
 
@@ -426,16 +427,16 @@ void drm_dev_dbg(const struct device *dev, enum drm_debug_category category,
 
 
 #define drm_info(drm, fmt, ...)					\
-	__drm_printk((drm), info,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), info, fmt, ##__VA_ARGS__)
 
 #define drm_notice(drm, fmt, ...)				\

include/drm/drm_print.h void drm_dev_dbg(const struct device *dev, enum drm_debug_category category, · line 439

Quoted 10 lines
include/drm/drm_print.h +3 -3
-	__drm_printk((drm), notice,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), notice, fmt, ##__VA_ARGS__)
 
 #define drm_warn(drm, fmt, ...)					\
-	__drm_printk((drm), warn,, fmt, ##__VA_ARGS__)
+	__drm_printk((drm), warn, fmt, ##__VA_ARGS__)
 
 #define drm_err(drm, fmt, ...)					\
-	__drm_printk((drm), err,, "*ERROR* " fmt, ##__VA_ARGS__)
+	__drm_printk((drm), err, "*ERROR* " fmt, ##__VA_ARGS__)

This is macro magic, and that ,, there passes an empty arg. You remove it completely, shifting all the args to the wrong place, breaking drm error logging.

BR,
Jani.

Quoted 7 lines
include/drm/drm_print.h +0 -0
 #define drm_info_once(drm, fmt, ...)				\
 

base-commit: e47eb90a0a9ae20b82635b9b99a8d0979b757ad8
prerequisite-patch-id: f039528bc88876d6e0f64e843da089e85f6d3f58
prerequisite-patch-id: c14ed2e970be2c3f8ba746634e8161b94c148e88

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#2 lore raw
Quoted 2 lines · Jani Nikula
Quoted 1 line · Jingyu Wang

Fix everything checkpatch.pl complained about in drm_print.h

[...]

Quoted 6 lines

include/drm/drm_print.h __printf(2, 0) · line 107

Quoted 3 lines

static inline void

include/drm/drm_print.h +1 -1
-drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list * va)

Checkpatch is just confused here. Look at all the other params, why would you add an extra space here?

Joe, can you help me out here please, I can't figure out why checkpatch is complaining here:

include/drm/drm_print.h:106: CHECK:SPACING: spaces preferred around that '*' (ctx:WxV) #106: FILE: include/drm/drm_print.h:106:
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)

BR,
Jani.

Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
#3 lore raw
Quoted 13 lines · Jani Nikula
Quoted 2 lines · Jani Nikula
Quoted 1 line · Jingyu Wang

Fix everything checkpatch.pl complained about in drm_print.h

[...]

Quoted 6 lines

include/drm/drm_print.h __printf(2, 0) · line 107

Quoted 3 lines

static inline void

include/drm/drm_print.h +1 -1
-drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list * va)

Checkpatch is just confused here. Look at all the other params, why would you add an extra space here?

Quoted 6 lines

Joe, can you help me out here please, I can't figure out why checkpatch is complaining here:

include/drm/drm_print.h:106: CHECK:SPACING: spaces preferred around that '*' (ctx:WxV) #106: FILE: include/drm/drm_print.h:106:
+drm_vprintf(struct drm_printer *p, const char *fmt, va_list *va)

checkpatch doesn't know what a va_list is.

It's similar to the FILE typedef that also causes this output.

A recent link to add an exception for 'FILE' to checkpatch:

https://lore.kernel.org/all/[email protected]/