Re: [PATCH v4 04/14] cxl: Introduce parent_port_of() helper

From: Dan Williams
Date: Thu Mar 06 2025 - 13:57:32 EST


Robert Richter wrote:
> Often a parent port must be determined. Introduce the parent_port_of()
> helper function for this.
>
> Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
> Reviewed-by: Dave Jiang <dave.jiang@xxxxxxxxx>
> Tested-by: Gregory Price <gourry@xxxxxxxxxx>
> ---
> drivers/cxl/core/port.c | 15 +++++++++------
> drivers/cxl/core/region.c | 11 ++---------
> drivers/cxl/cxl.h | 1 +
> 3 files changed, 12 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
> index 6a44b6dad3c7..25eecb591496 100644
> --- a/drivers/cxl/core/port.c
> +++ b/drivers/cxl/core/port.c
> @@ -602,17 +602,20 @@ struct cxl_port *to_cxl_port(const struct device *dev)
> }
> EXPORT_SYMBOL_NS_GPL(to_cxl_port, "CXL");
>
> +struct cxl_port *parent_port_of(struct cxl_port *port)
> +{
> + if (!port || !port->parent_dport)
> + return NULL;
> + return port->parent_dport->port;
> +}
> +EXPORT_SYMBOL_NS_GPL(parent_port_of, "CXL");

Why is this exported? All of the callers are within this patch are
within the core.

Also, if it is going to be exported for modular callers it should have
"cxl" in the name like all the other CXL exports. Save exporting it to
the patch that needs that.