Re: [PATCH v5 7/8] cxl/edac: Add CXL memory device memory sparing control feature

Dave Jiang
2025-05-19T21:15:54Z

On 5/19/25 2:01 PM, Alison Schofield wrote:
> On Thu, May 15, 2025 at 12:59:23PM +0100, shiju.jose@huawei.com wrote:
>> From: Shiju Jose <shiju.jose@huawei.com>
>>
>
> snip
>
>> diff --git a/drivers/cxl/core/edac.c b/drivers/cxl/core/edac.c
>> index 489c9996bfbc..395d56457931 100644
>> --- a/drivers/cxl/core/edac.c
>> +++ b/drivers/cxl/core/edac.c
>> @@ -21,7 +21,17 @@
>> #include "core.h"
>> #include "trace.h"
>>
>> -#define CXL_NR_EDAC_DEV_FEATURES 2
>> +#define CXL_NR_EDAC_DEV_FEATURES 6
>> +
>> +static bool cxl_is_memdev_memory_online(const struct cxl_memdev *cxlmd)
>> +{
>> + struct cxl_port *port = cxlmd->endpoint;
>> +
>> + if (port && cxl_num_decoders_committed(port))
>> + return true;
>> +
>> + return false;
>> +}
>>
>
> Looks like above fcn needs to be inside the below #ifdef.
> Smatch is warning this when EDAC_SCRUB is off
>
> drivers/cxl/core/edac.c:27:13: warning: ‘cxl_is_memdev_memory_online’ defined but not used [-Wunused-function]
> 27 | static bool cxl_is_memdev_memory_online(const struct cxl_memdev *cxlmd)
>
>
>> #ifdef CONFIG_CXL_EDAC_SCRUB

I think the function can be moved to above cxl_mem_perform_sparing() as that is the only function that calls it. I'll do that when I apply if there's nothing else major need to be changed.

DJ

>
> snip to end.
>