]> www.infradead.org Git - users/jedix/linux-maple.git/commit
cxl/region: Factor out code to find the root decoder
authorRobert Richter <rrichter@amd.com>
Fri, 9 May 2025 15:06:54 +0000 (17:06 +0200)
committerDave Jiang <dave.jiang@intel.com>
Fri, 9 May 2025 16:54:21 +0000 (09:54 -0700)
commit9466ee981647a8655e7f8312ae89aba665d78918
tree796662861efbb2c612b2621eb5803a120dd51945
parent74bf125abd87297b559eb72043e4677550d3a790
cxl/region: Factor out code to find the root decoder

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 has the benefit of reducing cxl_add_to_region()'s
function complexity.

The reference count must be decremented after using the root decoder.
cxl_find_root_decoder() is paired with the put_cxl_root_decoder
cleanup helper that can be used for this.

[dj: Fixed up "obj __free(...) = NULL" pattern]

Signed-off-by: Robert Richter <rrichter@amd.com>
Reviewed-by: Gregory Price <gourry@gourry.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: "Fabio M. De Francesco" <fabio.m.de.francesco@linux.intel.com>
Tested-by: Gregory Price <gourry@gourry.net>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Link: https://patch.msgid.link/20250509150700.2817697-10-rrichter@amd.com
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
drivers/cxl/core/region.c
drivers/cxl/cxl.h