Skip to contentSkip to conversation

console: conditionalize console_input_domain()

PATCH In review Jan Beulich 2 participants 2 messages Oct 30, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 console: conditionalize console_input_domain()

The function was introduced for just one piece of code to use; it is dead code in cases where the respective Kconfig option is disabled, thus violating Misra C:2012 rule 2.1 there.

xen/drivers/char/console.c +2 -0
@@ -475,6 +475,7 @@ static unsigned int __read_mostly consol
 
 #define max_console_rx (max_init_domid + 1)
 
+#ifdef CONFIG_SBSA_VUART_CONSOLE
 /* Make sure to rcu_unlock_domain after use */
 struct domain *console_input_domain(void)
 {
@@ -482,6 +483,7 @@ struct domain *console_input_domain(void
             return NULL;
     return rcu_lock_domain_by_id(console_rx - 1);
 }
+#endif
 
 static void switch_serial_input(void)
 {
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jan Beulich

The function was introduced for just one piece of code to use; it is dead code in cases where the respective Kconfig option is disabled, thus violating Misra C:2012 rule 2.1 there.

Quoted 19 lines
xen/drivers/char/console.c +2 -0
@@ -475,6 +475,7 @@ static unsigned int __read_mostly consol
 
 #define max_console_rx (max_init_domid + 1)
 
+#ifdef CONFIG_SBSA_VUART_CONSOLE
 /* Make sure to rcu_unlock_domain after use */
 struct domain *console_input_domain(void)
 {
@@ -482,6 +483,7 @@ struct domain *console_input_domain(void
             return NULL;
     return rcu_lock_domain_by_id(console_rx - 1);
 }
+#endif
 
 static void switch_serial_input(void)
 {