Re: [PATCH v17 05/11] cxl: Limit CXL-CPER kfifo registration functions scope
From: Jonathan Cameron
Date: Thu May 07 2026 - 14:15:31 EST
On Tue, 5 May 2026 12:30:23 -0500
Terry Bowman <terry.bowman@xxxxxxx> wrote:
> From: Dan Williams <djbw@xxxxxxxxxx>
>
> Some CPER functions used by CXL drivers are exported using the
> EXPORT_SYMBOL_NS_GPL(fn, ns) macro. This doesn't provide compile time
> enforcement or visibility of the consumers.
>
> This can be improved by using EXPORT_SYMBOL_FOR_MODULES() instead.
> EXPORT_SYMBOL_FOR_MODULES() explicitly names the modules that can access
> the function. This provides more precise control and visibility of symbol
> exposure than the namespace macro. It also provides compile time checking.
>
> To improve control and clarity, update cxl_cper_register_prot_err_work(),
> cxl_cper_unregister_prot_err_work(), and cxl_cper_prot_err_kfifo_get()
> to use EXPORT_SYMBOL_FOR_MODULES(). Also, update the register and unregister
> functions to return void type.
>
> Update the CPER kfifo unregister to cancel work while using
> synchronization.
>
> Co-developed-by: Terry Bowman <terry.bowman@xxxxxxx>
> Signed-off-by: Terry Bowman <terry.bowman@xxxxxxx>
> Signed-off-by: Dan Williams <djbw@xxxxxxxxxx>
One suggestion on simplifying the code by removing any assumption that
cxl_ras_init() can fail.
> diff --git a/drivers/cxl/core/ras.c b/drivers/cxl/core/ras.c
> index 56611da8357a..9193dac4e507 100644
> --- a/drivers/cxl/core/ras.c
> +++ b/drivers/cxl/core/ras.c
> @@ -68,13 +68,13 @@ static DECLARE_WORK(cxl_cper_prot_err_work, cxl_cper_prot_err_work_fn);
>
> int cxl_ras_init(void)
> {
> - return cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
> + cxl_cper_register_prot_err_work(&cxl_cper_prot_err_work);
> + return 0;
I'm lazy and haven't read on, but if this never gains a failure
path can we change the signature whilst we are here to stop
pretending it does?
> }