On Fri,  9 Jan 2026 18:14:31 +0530
Neeraj Kumar <[email protected]> wrote:

> devm_cxl_pmem_add_region() is used to create cxl region based on region
> information scanned from LSA.
> 
> devm_cxl_add_region() is used to just allocate cxlr and its fields are
> filled later by userspace tool using device attributes (*_store()).
> 
> Inspiration for devm_cxl_pmem_add_region() is taken from these device
> attributes (_store*) calls. It allocates cxlr and fills information
> parsed from LSA and calls device_add(&cxlr->dev) to initiate further
> region creation porbes
> 
> Rename __create_region() to cxl_create_region(), which will be used
> in later patch to create cxl region after fetching region information
> from LSA.
You also add a couple of parameters. At very least say why here.

> 
> Reviewed-by: Dave Jiang <[email protected]>
> Signed-off-by: Neeraj Kumar <[email protected]>

A few things inline.  

> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 26238fb5e8cf..13779aeacd8e 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c


> +static ssize_t alloc_region_dpa(struct cxl_endpoint_decoder *cxled, u64 size)
> +{
> +     int rc;
> +
> +     if (!size)
> +             return -EINVAL;
> +
> +     if (!IS_ALIGNED(size, SZ_256M))
> +             return -EINVAL;
> +
> +     rc = cxl_dpa_free(cxled);

Add a comment on why this make sense.  What already allocated dpa that we need
to clean up?

> +     if (rc)
> +             return rc;
> +
> +     return cxl_dpa_alloc(cxled, size);
> +}


> -static struct cxl_region *__create_region(struct cxl_root_decoder *cxlrd,
> -                                       enum cxl_partition_mode mode, int id)
> +struct cxl_region *cxl_create_region(struct cxl_root_decoder *cxlrd,
> +                                  enum cxl_partition_mode mode, int id,
> +                                  struct cxl_pmem_region_params *pmem_params,
> +                                  struct cxl_endpoint_decoder *cxled)

I'm a little dubious that the extra parameters are buried in this patch rather 
than
where we first need them or a separate patch that makes it clear what they are 
for.

>  {


Reply via email to