[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4adcfebd-3489-4b41-b5b2-09ed89d6e0d7@zohomail.com>
Date: Sun, 8 Feb 2026 20:05:29 +0800
From: Li Ming <ming.li@...omail.com>
To: dan.j.williams@...el.com
Cc: linux-cxl@...r.kernel.org, linux-kernel@...r.kernel.org,
dave@...olabs.net, jonathan.cameron@...wei.com, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com, ira.weiny@...el.com
Subject: Re: [PATCH v2 1/2] cxl/port: Hold port host lock while dport adding.
在 2026/2/8 01:28, dan.j.williams@...el.com 写道:
> Li Ming wrote:
[...]
>>
>> diff --git a/drivers/cxl/core/port.c b/drivers/cxl/core/port.c
>> index 5c82e6f32572..6f0d9fe439db 100644
>> --- a/drivers/cxl/core/port.c
>> +++ b/drivers/cxl/core/port.c
>> @@ -612,6 +612,23 @@ struct cxl_port *parent_port_of(struct cxl_port *port)
>> return port->parent_dport->port;
>> }
>>
>> +static struct device *to_port_host(struct cxl_port *port)
>> +{
>> + struct cxl_port *parent = parent_port_of(port);
>> +
>> + /*
>> + * The host of CXL root port and the first level of ports is
>> + * the platform firmware device, the host of all other ports
>> + * is their parent port.
>> + */
>> + if (!parent)
>> + return port->uport_dev;
> This helper looks good and this case is theoretically correct, but I
> assume that find_or_add_dport() never hits this case, right?
Right. This case is only for finding cxl root's host,
find_or_add_dport() is
only used for cxl host bridge ports and cxl switch ports.
> How about move the introduction of this helper to its own lead-in patch
> and use it to replace the open coded version of this pattern in
> unregister_port(), __devm_cxl_add_dport(), and endpoint_host().
Sure, will do it in next version, thanks for that.
Ming
> I do notice you caught the one in unregister_port(), but there are more.
>
> With that change you can add:
>
> Reviewed-by: Dan Williams <dan.j.williams@...el.com>
>
Powered by blists - more mailing lists