diff mbox series

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

Message ID 20220706175013.675258-1-burzalodowa@gmail.com (mailing list archive)
State New, archived
Headers show
Series xen/char: pv_console: Fix MISRA C 2012 Rule 2.1 violation | expand

Commit Message

Xenia Ragiadakou July 6, 2022, 5:50 p.m. UTC
Remove the definition of the function pv_console_evtchn(),
when CONFIG_XEN_GUEST is not set, because the function is not used.

Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
---
 xen/include/xen/pv_console.h | 5 -----
 1 file changed, 5 deletions(-)

Comments

Stefano Stabellini July 6, 2022, 11:46 p.m. UTC | #1
On Wed, 6 Jul 2022, Xenia Ragiadakou wrote:
> Remove the definition of the function pv_console_evtchn(),
> when CONFIG_XEN_GUEST is not set, because the function is not used.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/include/xen/pv_console.h | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/xen/include/xen/pv_console.h b/xen/include/xen/pv_console.h
> index 4745f46f2d..55b20323fb 100644
> --- a/xen/include/xen/pv_console.h
> +++ b/xen/include/xen/pv_console.h
> @@ -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__ */
> -- 
> 2.34.1
>
Jiamei Xie July 7, 2022, 3:30 a.m. UTC | #2
Hi Xenia,

> -----Original Message-----
> From: Xen-devel <xen-devel-bounces@lists.xenproject.org> On Behalf Of
> Xenia Ragiadakou
> Sent: Thursday, July 7, 2022 1:50 AM
> To: xen-devel@lists.xenproject.org
> Cc: Andrew Cooper <andrew.cooper3@citrix.com>; George Dunlap
> <george.dunlap@citrix.com>; Jan Beulich <jbeulich@suse.com>; Julien Grall
> <julien@xen.org>; Stefano Stabellini <sstabellini@kernel.org>; Wei Liu
> <wl@xen.org>
> 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.
> 
> Signed-off-by: Xenia Ragiadakou <burzalodowa@gmail.com>
> ---
>  xen/include/xen/pv_console.h | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/xen/include/xen/pv_console.h b/xen/include/xen/pv_console.h
> index 4745f46f2d..55b20323fb 100644
> --- a/xen/include/xen/pv_console.h
> +++ b/xen/include/xen/pv_console.h
> @@ -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__ */
> --
> 2.34.1
> 

I have run it on arm64, booting Xen+Dom0 and starting few guests, connecting consoles. It all works fine.
Tested-by: Jiamei Xie <jiamei.xie@arm.com>
diff mbox series

Patch

diff --git a/xen/include/xen/pv_console.h b/xen/include/xen/pv_console.h
index 4745f46f2d..55b20323fb 100644
--- a/xen/include/xen/pv_console.h
+++ b/xen/include/xen/pv_console.h
@@ -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__ */