From: Li Ming <ming.li@zohomail.com>
To: dan.j.williams@intel.com
Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
dave@stgolabs.net, jonathan.cameron@huawei.com,
dave.jiang@intel.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, ira.weiny@intel.com
Subject: Re: [PATCH v2 1/2] cxl/port: Hold port host lock while dport adding.
Date: Sun, 8 Feb 2026 20:05:29 +0800 [thread overview]
Message-ID: <4adcfebd-3489-4b41-b5b2-09ed89d6e0d7@zohomail.com> (raw)
In-Reply-To: <6987763fea2ab_125f100f5@dwillia2-mobl4.notmuch>
在 2026/2/8 01:28, dan.j.williams@intel.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@intel.com>
>
next prev parent reply other threads:[~2026-02-08 12:07 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-07 13:35 [PATCH v2 0/2] Fix port enumeration failure Li Ming
2026-02-07 13:35 ` [PATCH v2 1/2] cxl/port: Hold port host lock while dport adding Li Ming
2026-02-07 17:28 ` dan.j.williams
2026-02-08 12:05 ` Li Ming [this message]
2026-02-08 12:20 ` Li Ming
2026-02-07 13:35 ` [PATCH v2 2/2] cxl/port: unregister_port() cleanup Li Ming
2026-02-10 3:04 ` [PATCH v2 0/2] Fix port enumeration failure Alison Schofield
2026-02-10 11:56 ` Li Ming
2026-02-10 15:00 ` Dave Jiang
2026-02-11 11:49 ` Li Ming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4adcfebd-3489-4b41-b5b2-09ed89d6e0d7@zohomail.com \
--to=ming.li@zohomail.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®