mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
xen/char: wrap suspend/resume console callbacks with CONFIG_SYSTEM_SUSPEND
This patch wraps the suspend/resume console callbacks and related code within CONFIG_SYSTEM_SUSPEND blocks. This ensures that these functions and their calls are only included in the build when CONFIG_SYSTEM_SUSPEND is enabled. This addresses Misra Rule 2.1 violations. Suggested-by: Jan Beulich <jbeulich@suse.com> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
This commit is contained in:
1 parent
a2602f3a63
commit
3e5f9674c0
7 files changed
+38
No files matched your search
@@ -1365,6 +1365,8 @@ void panic(const char *fmt, ...)
|
||||
machine_restart(5000);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
|
||||
/*
|
||||
* **************************************************************
|
||||
* ****************** Console suspend/resume ********************
|
||||
@@ -1388,6 +1390,8 @@ int console_resume(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_SUSPEND */
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -1419,6 +1419,8 @@ static void __init cf_check ehci_dbgp_endboot(struct serial_port *port)
|
||||
ehci_dbgp_check_release(port->uart);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
|
||||
static void cf_check ehci_dbgp_suspend(struct serial_port *port)
|
||||
{
|
||||
struct ehci_dbgp *dbgp = port->uart;
|
||||
@@ -1452,12 +1454,16 @@ static void cf_check ehci_dbgp_resume(struct serial_port *port)
|
||||
ehci_dbgp_setup_postirq(dbgp);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_SUSPEND */
|
||||
|
||||
static struct uart_driver __read_mostly ehci_dbgp_driver = {
|
||||
.init_preirq = ehci_dbgp_init_preirq,
|
||||
.init_postirq = ehci_dbgp_init_postirq,
|
||||
.endboot = ehci_dbgp_endboot,
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
.suspend = ehci_dbgp_suspend,
|
||||
.resume = ehci_dbgp_resume,
|
||||
#endif
|
||||
.tx_ready = ehci_dbgp_tx_ready,
|
||||
.putc = ehci_dbgp_putc,
|
||||
.flush = ehci_dbgp_flush,
|
||||
|
||||
@@ -57,7 +57,9 @@ static struct ns16550 {
|
||||
#endif
|
||||
/* UART with no IRQ line: periodically-polled I/O. */
|
||||
struct timer timer;
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
struct timer resume_timer;
|
||||
#endif
|
||||
unsigned int timeout_ms;
|
||||
bool intr_works;
|
||||
bool dw_usr_bsy;
|
||||
@@ -113,7 +115,9 @@ struct ns16550_config_param {
|
||||
static void enable_exar_enhanced_bits(const struct ns16550 *uart);
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
static void cf_check ns16550_delayed_resume(void *data);
|
||||
#endif
|
||||
|
||||
static u8 ns_read_reg(const struct ns16550 *uart, unsigned int reg)
|
||||
{
|
||||
@@ -420,7 +424,9 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
|
||||
serial_async_transmit(port);
|
||||
|
||||
init_timer(&uart->timer, ns16550_poll, port, 0);
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
init_timer(&uart->resume_timer, ns16550_delayed_resume, port, 0);
|
||||
#endif
|
||||
|
||||
/* Calculate time to fill RX FIFO and/or empty TX FIFO for polling. */
|
||||
bits = uart->data_bits + uart->stop_bits + !!uart->parity;
|
||||
@@ -506,6 +512,8 @@ static void __init cf_check ns16550_init_postirq(struct serial_port *port)
|
||||
ns16550_setup_postirq(uart);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
|
||||
static void cf_check ns16550_suspend(struct serial_port *port)
|
||||
{
|
||||
struct ns16550 *uart = port->uart;
|
||||
@@ -584,6 +592,8 @@ static void cf_check ns16550_resume(struct serial_port *port)
|
||||
_ns16550_resume(port);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_SUSPEND */
|
||||
|
||||
static void __init cf_check ns16550_endboot(struct serial_port *port)
|
||||
{
|
||||
#ifdef CONFIG_HAS_IOPORTS
|
||||
@@ -638,8 +648,10 @@ static struct uart_driver __read_mostly ns16550_driver = {
|
||||
.init_irq = ns16550_init_irq,
|
||||
.init_postirq = ns16550_init_postirq,
|
||||
.endboot = ns16550_endboot,
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
.suspend = ns16550_suspend,
|
||||
.resume = ns16550_resume,
|
||||
#endif
|
||||
.tx_ready = ns16550_tx_ready,
|
||||
.putc = ns16550_putc,
|
||||
.getc = ns16550_getc,
|
||||
|
||||
@@ -495,6 +495,8 @@ const struct vuart_info *serial_vuart_info(int idx)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
|
||||
void serial_suspend(void)
|
||||
{
|
||||
int i;
|
||||
@@ -511,6 +513,8 @@ void serial_resume(void)
|
||||
com[i].driver->resume(&com[i]);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_SUSPEND */
|
||||
|
||||
void __init serial_register_uart(int idx, struct uart_driver *driver,
|
||||
void *uart)
|
||||
{
|
||||
|
||||
@@ -1271,6 +1271,8 @@ static void cf_check dbc_uart_flush(struct serial_port *port)
|
||||
set_timer(&uart->timer, goal);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
|
||||
static void cf_check dbc_uart_suspend(struct serial_port *port)
|
||||
{
|
||||
struct dbc_uart *uart = port->uart;
|
||||
@@ -1303,6 +1305,8 @@ static void cf_check dbc_uart_resume(struct serial_port *port)
|
||||
set_timer(&uart->timer, NOW() + MICROSECS(DBC_POLL_INTERVAL));
|
||||
}
|
||||
|
||||
#endif /* CONFIG_SYSTEM_SUSPEND */
|
||||
|
||||
static struct uart_driver dbc_uart_driver = {
|
||||
.init_preirq = dbc_uart_init_preirq,
|
||||
.init_postirq = dbc_uart_init_postirq,
|
||||
@@ -1310,8 +1314,10 @@ static struct uart_driver dbc_uart_driver = {
|
||||
.putc = dbc_uart_putc,
|
||||
.getc = dbc_uart_getc,
|
||||
.flush = dbc_uart_flush,
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
.suspend = dbc_uart_suspend,
|
||||
.resume = dbc_uart_resume,
|
||||
#endif
|
||||
};
|
||||
|
||||
/* Those are accessed via DMA. */
|
||||
|
||||
@@ -44,8 +44,10 @@ int console_steal(int handle, void (*fn)(const char *str, size_t nr));
|
||||
/* Give back stolen console. Takes the identifier returned by console_steal. */
|
||||
void console_giveback(int id);
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
int console_suspend(void);
|
||||
int console_resume(void);
|
||||
#endif
|
||||
|
||||
/* Emit a string via the serial console. */
|
||||
void console_serial_puts(const char *s, size_t nr);
|
||||
|
||||
@@ -66,9 +66,11 @@ struct uart_driver {
|
||||
void (*init_postirq)(struct serial_port *port);
|
||||
/* Hook to clean up after Xen bootstrap (before domain 0 runs). */
|
||||
void (*endboot)(struct serial_port *port);
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
/* Driver suspend/resume. */
|
||||
void (*suspend)(struct serial_port *port);
|
||||
void (*resume)(struct serial_port *port);
|
||||
#endif
|
||||
/* Return number of characters the port can hold for transmit,
|
||||
* or -EIO if port is inaccesible */
|
||||
int (*tx_ready)(struct serial_port *port);
|
||||
@@ -131,9 +133,11 @@ int serial_irq(int idx);
|
||||
/* Retrieve basic UART information to emulate it (base address, size...) */
|
||||
const struct vuart_info* serial_vuart_info(int idx);
|
||||
|
||||
#ifdef CONFIG_SYSTEM_SUSPEND
|
||||
/* Serial suspend/resume. */
|
||||
void serial_suspend(void);
|
||||
void serial_resume(void);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Initialisation and helper functions for uart drivers.
|
||||
|
||||