Re: [PATCH v1 08/29] cxl/region: Split region registration into an initialization and adding part
From: Gregory Price
Date: Tue Jan 07 2025 - 13:29:19 EST
On Tue, Jan 07, 2025 at 03:09:54PM +0100, Robert Richter wrote:
> Before adding an endpoint to a region, the endpoint is initialized
> first. Move that part to a new function cxl_endpoint_initialize().
> The function is in preparation of adding more parameters that need to
> be determined in a setup.
>
> The split also helps better separating the code. After initialization
> the addition of an endpoint may fail with an error code and all the
> data would need to be reverted to not leave the endpoint in an
> undefined state. With separate functions the init part can succeed
> even if the endpoint cannot be added.
>
> Function naming follows the style of device_register() etc. Thus,
> rename function cxl_add_to_region() to cxl_endpoint_register().
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
Little bit difficult to read mixing style and functionality, but I like
this update and I understand why. One inline question
Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
> ---
> drivers/cxl/core/region.c | 36 ++++++++++++++++++++++++++++--------
> drivers/cxl/cxl.h | 5 +++--
> drivers/cxl/port.c | 9 +++++----
> 3 files changed, 36 insertions(+), 14 deletions(-)
>
... snip ...
> + rc = cxl_endpoint_register(cxled);
> if (rc)
> - dev_dbg(dev, "failed to add to region: %#llx-%#llx\n",
> - cxled->cxld.hpa_range.start, cxled->cxld.hpa_range.end);
> + dev_warn(cxled->cxld.dev.parent,
> + "failed to register %s: %d\n",
> + dev_name(&cxled->cxld.dev), rc);
Is it worth differentiating obvious failures here for a better warning?
I'm fine either way.
~Gregory