On 25.05.2025 16:15, Marek Marczykowski-Górecki wrote:
> Make it safe to call also if xhci console is not enabled. And make it
> non-static, to require one less modification when actually using it.
> When using it, one still needs to add its declaration in some header
> (or just next to the call site).
>
> Signed-off-by: Marek Marczykowski-Górecki <[email protected]>
> ---
> IIUC Misra would not be happy about a declaration of an usused function.
> And I'd rather avoid extending DBC_DEBUG scope beyond that single file.
It's not going to be happy about a non-static one without declaration
either. Misra-wise this is pretty much a no-go.
Jan
> --- a/xen/drivers/char/xhci-dbc.c
> +++ b/xen/drivers/char/xhci-dbc.c
> @@ -1498,11 +1498,14 @@ static void dbc_dump(struct dbc *dbc)
> readq(&r->cp) == virt_to_maddr(dbc->dbc_ctx));
> }
>
> -static void dbc_uart_dump(void)
> +void dbc_uart_dump(void)
> {
> struct dbc_uart *uart = &dbc_uart;
> struct dbc *dbc = &uart->dbc;
>
> + if ( !dbc->enable )
> + return;
> +
> dbc_dump(dbc);
> }
> #endif