Skip to contentSkip to conversation

xen/char: pv_console: Fix MISRA C 2012 Rule 2.1 violation

PATCH In review Xenia Ragiadakou 3 participants 3 messages Jul 6, 2022 – Jul 7, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/char: pv_console: Fix MISRA C 2012 Rule 2.1 violation

Remove the definition of the function pv_console_evtchn(), when CONFIG_XEN_GUEST is not set, because the function is not used.

---
 xen/include/xen/pv_console.h | 5 -----
 1 file changed, 5 deletions(-)
xen/include/xen/pv_console.h +0 -5
index 4745f46f2d..55b20323fb 100644
@@ -19,11 +19,6 @@ static inline void pv_console_set_rx_handler(serial_rx_fn fn) { }
 static inline void pv_console_init_postirq(void) { }
 static inline void pv_console_puts(const char *buf, size_t nr) { }
 static inline size_t pv_console_rx(struct cpu_user_regs *regs) { return 0; }
-evtchn_port_t pv_console_evtchn(void)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-}
 
 #endif /* !CONFIG_XEN_GUEST */
 #endif /* __XEN_PV_CONSOLE_H__ */
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 4 lines · Xenia Ragiadakou

Remove the definition of the function pv_console_evtchn(), when CONFIG_XEN_GUEST is not set, because the function is not used.

Quoted 23 lines
---
 xen/include/xen/pv_console.h | 5 -----
 1 file changed, 5 deletions(-)
xen/include/xen/pv_console.h +0 -5
index 4745f46f2d..55b20323fb 100644
@@ -19,11 +19,6 @@ static inline void pv_console_set_rx_handler(serial_rx_fn fn) { }
 static inline void pv_console_init_postirq(void) { }
 static inline void pv_console_puts(const char *buf, size_t nr) { }
 static inline size_t pv_console_rx(struct cpu_user_regs *regs) { return 0; }
-evtchn_port_t pv_console_evtchn(void)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-}
 
 #endif /* !CONFIG_XEN_GUEST */
 #endif /* __XEN_PV_CONSOLE_H__ */
Signature · 1 line
2.34.1
Tested-by on v1 1/1
#2 lore raw
In reply to Xenia Ragiadakou

Hi Xenia,

Quoted 35 lines

-----Original Message-----
From: Xen-devel <[email protected]> On Behalf Of Xenia Ragiadakou
Sent: Thursday, July 7, 2022 1:50 AM
To: [email protected]
Cc: Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Jan Beulich <[email protected]>; Julien Grall <[email protected]>; Stefano Stabellini <[email protected]>; Wei Liu <[email protected]>
Subject: [PATCH] xen/char: pv_console: Fix MISRA C 2012 Rule 2.1 violation

Remove the definition of the function pv_console_evtchn(), when CONFIG_XEN_GUEST is not set, because the function is not used.

---
 xen/include/xen/pv_console.h | 5 -----
 1 file changed, 5 deletions(-)
xen/include/xen/pv_console.h +0 -5
index 4745f46f2d..55b20323fb 100644
@@ -19,11 +19,6 @@ static inline void
 pv_console_set_rx_handler(serial_rx_fn fn) { }
 static inline void pv_console_init_postirq(void) { }
 static inline void pv_console_puts(const char *buf, size_t nr) { }
 static inline size_t pv_console_rx(struct cpu_user_regs *regs) { return 0; }
-evtchn_port_t pv_console_evtchn(void)
-{
-    ASSERT_UNREACHABLE();
-    return 0;
-}
 
 #endif /* !CONFIG_XEN_GUEST */
Quoted 4 lines

#endif /* __XEN_PV_CONSOLE_H__ */
--
2.34.1

I have run it on arm64, booting Xen+Dom0 and starting few guests, connecting consoles. It all works fine.