On Fri, 17 Jul 2026 17:26:57 -0500 Terry Bowman <[email protected]> wrote:
> From: Dan Williams <[email protected]> > > find_cxl_port() and find_cxl_port_by_uport() are internal port lookup > functions that search the CXL bus by dport and uport respectively, but > their names do not make the lookup method clear. > > Rename find_cxl_port() to find_cxl_port_by_dport() to make the lookup > method explicit and consistent with find_cxl_port_by_uport(). Both > functions remain static to port.c; the upcoming patch that adds the > first cross-file caller will widen their scope. Could have mentioned the __ one, but it is fairly obvious why you did that even without saying it. Nice improvement Reviewed-by: Jonathan Cameron <[email protected]> > > Co-developed-by: Terry Bowman <[email protected]> > Signed-off-by: Terry Bowman <[email protected]> > Signed-off-by: Dan Williams <[email protected]> > > --- > > Changes in v17 -> v18: > - New commit > --- > drivers/cxl/core/port.c | 20 ++++++++++++++------ > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c > index f90f899c31d07..cadb51f70f854 100644 > --- a/drivers/cxl/core/port.c > +++ b/drivers/cxl/core/port.c > @@ -1379,7 +1379,7 @@ static int match_port_by_dport(struct device *dev, > const void *data) > return dport != NULL; > } > > -static struct cxl_port *__find_cxl_port(struct cxl_find_port_ctx *ctx) > +static struct cxl_port *__find_cxl_port_by_dport(struct cxl_find_port_ctx > *ctx) > { > struct device *dev; > > @@ -1392,8 +1392,16 @@ static struct cxl_port *__find_cxl_port(struct > cxl_find_port_ctx *ctx) > return NULL; > } > > -static struct cxl_port *find_cxl_port(struct device *dport_dev, > - struct cxl_dport **dport) > +/** > + * find_cxl_port_by_dport - find a cxl_port by one of its targets > + * @dport_dev: device representing the dport target > + * @dport: optional output of the 'struct cxl_dport' companion of the > @dport_dev > + * > + * Return a 'struct cxl_port' with an elevated reference if found. Use > + * __free(put_cxl_port) to release. > + */ > +static struct cxl_port *find_cxl_port_by_dport(struct device *dport_dev, > + struct cxl_dport **dport) > { > struct cxl_find_port_ctx ctx = { > .dport_dev = dport_dev, > @@ -1401,7 +1409,7 @@ static struct cxl_port *find_cxl_port(struct device > *dport_dev, > }; > struct cxl_port *port; > > - port = __find_cxl_port(&ctx); > + port = __find_cxl_port_by_dport(&ctx); > return port; > } > > @@ -1895,14 +1903,14 @@ EXPORT_SYMBOL_NS_GPL(devm_cxl_enumerate_ports, "CXL"); > struct cxl_port *cxl_pci_find_port(struct pci_dev *pdev, > struct cxl_dport **dport) > { > - return find_cxl_port(pdev->dev.parent, dport); > + return find_cxl_port_by_dport(pdev->dev.parent, dport); > } > EXPORT_SYMBOL_NS_GPL(cxl_pci_find_port, "CXL"); > > struct cxl_port *cxl_mem_find_port(struct cxl_memdev *cxlmd, > struct cxl_dport **dport) > { > - return find_cxl_port(grandparent(&cxlmd->dev), dport); > + return find_cxl_port_by_dport(grandparent(&cxlmd->dev), dport); > } > EXPORT_SYMBOL_NS_GPL(cxl_mem_find_port, "CXL"); >
