Re: [PATCH v1 06/29] cxl/region: Factor out code to find the root decoder
From: Gregory Price
Date: Tue Jan 07 2025 - 11:57:21 EST
On Tue, Jan 07, 2025 at 03:09:52PM +0100, Robert Richter wrote:
> In function cxl_add_to_region() there is code to determine the root
> decoder associated to an endpoint decoder. Factor out that code for
> later reuse. This also simplifies the function cxl_add_to_region() as
> the change reduces its size and the number of used variables.
>
> The reference of cxlrd_dev can be freed earlier. Since the root
> decoder exists as long as the root port exists and the endpoint
> already holds a reference to the root port, this additional reference
> is not needed. Though it looks obvious to use __free() for the
> reference of cxlrd_dev here too, this is done in a later rework. So
> just move the code.
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> ---
> drivers/cxl/core/region.c | 55 ++++++++++++++++++++++++++-------------
> 1 file changed, 37 insertions(+), 18 deletions(-)
>
Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>