Skip to contentSkip to conversation

console: const-ify the arguments for __warn() and __bug()

PATCH In review Mihai Donțu 2 participants 3 messages Dec 8, 2014 – Dec 9, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console: const-ify the arguments for __warn() and __bug()

Both __warn() and __bug() take as first parameter the file name of the current compilation unit (__FILE__). Mark that parameter as constant to better reflect that.

---
 xen/drivers/char/console.c | 4 ++--
 xen/include/xen/lib.h      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
xen/drivers/char/console.c +2 -2
index 2f03259..7807cf2 100644
@@ -1138,7 +1138,7 @@ void panic(const char *fmt, ...)
         machine_restart(5000);
 }
 
-void __bug(char *file, int line)
+void __bug(const char *file, int line)
 {
     console_start_sync();
     printk("Xen BUG at %s:%d\n", file, line);
@@ -1146,7 +1146,7 @@ void __bug(char *file, int line)
     panic("Xen BUG at %s:%d", file, line);
 }
 
-void __warn(char *file, int line)
+void __warn(const char *file, int line)
 {
     printk("Xen WARN at %s:%d\n", file, line);
     dump_execution_state();
xen/include/xen/lib.h +2 -2
index f11b49e..8f9cadb 100644
@@ -8,8 +8,8 @@
 #include <xen/string.h>
 #include <asm/bug.h>
 
-void noreturn __bug(char *file, int line);
-void __warn(char *file, int line);
+void noreturn __bug(const char *file, int line);
+void __warn(const char *file, int line);
 
 #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
 #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)

--
2.2.0

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Mihai Donțu

Both __warn() and __bug() take as first parameter the file name of the current compilation unit (__FILE__). Mark that parameter as constant to better reflect that.

This seems reasonable, but for 4.6 at this point.

In future, please CC the relevant maintainers (scrips/get_maintainer.pl should help)

Quoted 46 lines
---
 xen/drivers/char/console.c | 4 ++--
 xen/include/xen/lib.h      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
xen/drivers/char/console.c +2 -2
index 2f03259..7807cf2 100644
@@ -1138,7 +1138,7 @@ void panic(const char *fmt, ...)
         machine_restart(5000);
 }
 
-void __bug(char *file, int line)
+void __bug(const char *file, int line)
 {
     console_start_sync();
     printk("Xen BUG at %s:%d\n", file, line);
@@ -1146,7 +1146,7 @@ void __bug(char *file, int line)
     panic("Xen BUG at %s:%d", file, line);
 }
 
-void __warn(char *file, int line)
+void __warn(const char *file, int line)
 {
     printk("Xen WARN at %s:%d\n", file, line);
     dump_execution_state();
xen/include/xen/lib.h +2 -3
index f11b49e..8f9cadb 100644
@@ -8,8 +8,8 @@
 #include <xen/string.h>
 #include <asm/bug.h>
 
-void noreturn __bug(char *file, int line);
-void __warn(char *file, int line);
+void noreturn __bug(const char *file, int line);
+void __warn(const char *file, int line);
 
 #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
 #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
--

2.2.0

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#2 lore raw
Quoted 5 lines · On Monday 08 December 2014 10:28:41 Andrew Cooper wrote:
Quoted 4 lines · Mihai Donțu

Both __warn() and __bug() take as first parameter the file name of the current compilation unit (__FILE__). Mark that parameter as constant to better reflect that.

Quoted 8 lines
Quoted 1 line

This seems reasonable, but for 4.6 at this point.

In future, please CC the relevant maintainers (scrips/get_maintainer.pl should help)

Thank you Andrew.

Should I resend the patch with your Reviewed-by and the proper people in CC?

Quoted 42 lines
Quoted 42 lines
---
 xen/drivers/char/console.c | 4 ++--
 xen/include/xen/lib.h      | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
xen/drivers/char/console.c +2 -2
index 2f03259..7807cf2 100644
@@ -1138,7 +1138,7 @@ void panic(const char *fmt, ...)
         machine_restart(5000);
 }
 
-void __bug(char *file, int line)
+void __bug(const char *file, int line)
 {
     console_start_sync();
     printk("Xen BUG at %s:%d\n", file, line);
@@ -1146,7 +1146,7 @@ void __bug(char *file, int line)
     panic("Xen BUG at %s:%d", file, line);
 }
 
-void __warn(char *file, int line)
+void __warn(const char *file, int line)
 {
     printk("Xen WARN at %s:%d\n", file, line);
     dump_execution_state();
xen/include/xen/lib.h +2 -2
index f11b49e..8f9cadb 100644
@@ -8,8 +8,8 @@
 #include <xen/string.h>
 #include <asm/bug.h>
 
-void noreturn __bug(char *file, int line);
-void __warn(char *file, int line);
+void noreturn __bug(const char *file, int line);
+void __warn(const char *file, int line);
 
 #define BUG_ON(p)  do { if (unlikely(p)) BUG();  } while (0)
 #define WARN_ON(p) do { if (unlikely(p)) WARN(); } while (0)
Signature · 6 lines
Mihai DONȚU

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel