Re: [PATCH v2 05/18] cxl: Introduce parent_port_of() helper

From: Robert Richter
Date: Mon Feb 10 2025 - 06:38:44 EST


On 07.02.25 15:08:11, Alison Schofield wrote:
> On Fri, Feb 07, 2025 at 04:37:40PM +0100, Robert Richter wrote:
> > Often a parent port must be determined. Introduce the parent_port_of()
> > helper function for this.
>
> Would this be simpler with less touchpoints:
>
> Make next_port() available to the port driver by moving it from
> region.c to port.c. Note that simply exporting from the region
> driver is not an option since region driver is not guaranteed
> to be configured.
>
> (Basically I'm suggesting keep the name and touch region.c less)

As long as next_port() is used in a local context the function name
works well as its direct use is visible. But when exporting it, the
name "next_port()" is not very specific. So I renamed it to better
describe the function similar to other helpers like this. Changes for
the rename are just 2 lines in region.c.

The helper is only used in the core module, there is no strict need to
export it from there. Anyway, I implemented it the same way as the
to_cxl_port() helper and it can be used outside of core too. This does
not introduce more code (except for the EXPORT_SYMBOL_NS_GPL line).

Thus, I rather would like to keep the patch as it is.

Thanks for review,

-Robert

>
> >
> > Signed-off-by: Robert Richter <rrichter@xxxxxxx>
> > Reviewed-by: Gregory Price <gourry@xxxxxxxxxx>
> > Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>