Re: [PATCH v3] xen: Remove dependency between pciback and privcmd

From: Jan Beulich
Date: Fri Oct 11 2024 - 04:54:59 EST


On 11.10.2024 05:42, Jiqian Chen wrote:
> @@ -1757,11 +1756,19 @@ static int __init xen_pcibk_init(void)
> bus_register_notifier(&pci_bus_type, &pci_stub_nb);
> #endif
>
> +#ifdef CONFIG_XEN_ACPI
> + xen_acpi_register_get_gsi_func(pcistub_get_gsi_from_sbdf);
> +#endif
> +
> return err;
> }
>
> static void __exit xen_pcibk_cleanup(void)
> {
> +#ifdef CONFIG_XEN_ACPI
> + xen_acpi_register_get_gsi_func(NULL);
> +#endif

Just wondering - instead of these two #ifdef-s, ...

> --- a/include/xen/acpi.h
> +++ b/include/xen/acpi.h
> @@ -91,13 +91,9 @@ static inline int xen_acpi_get_gsi_info(struct pci_dev *dev,
> }
> #endif
>
> -#ifdef CONFIG_XEN_PCI_STUB
> -int pcistub_get_gsi_from_sbdf(unsigned int sbdf);
> -#else
> -static inline int pcistub_get_gsi_from_sbdf(unsigned int sbdf)
> -{
> - return -1;
> -}
> -#endif
> +typedef int (*get_gsi_from_sbdf_t)(u32 sbdf);
> +
> +void xen_acpi_register_get_gsi_func(get_gsi_from_sbdf_t func);
> +int xen_acpi_get_gsi_from_sbdf(u32 sbdf);

... wouldn't a static inline stub (for the !XEN_ACPI case) aid overall readability?

Jan