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:20:55 +0800 [thread overview]
Message-ID: <dd172105-e152-4973-ad7f-0ed37ed0b18e@zohomail.com> (raw)
In-Reply-To: <6987763fea2ab_125f100f5@dwillia2-mobl4.notmuch>
在 2026/2/8 01:28, dan.j.williams@intel.com 写道:
> Li Ming wrote:
[...]
> +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?
>
> 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().
BTW, after taking a look into __devm_cxl_add_dport(), this helper is not
suitable for this case,
the host in __devm_cxl_add_dport() means the new dport's host, it is the
device of the cxl port which
the cxl port belongs(or the uport_dev of the cxl port if the port is cxl
root).
So I will update unregister_port() and endpoint_host(), and check if
there are other
places needed to be cleanup.
Ming
next prev parent reply other threads:[~2026-02-08 12:21 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
2026-02-08 12:20 ` Li Ming [this message]
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=dd172105-e152-4973-ad7f-0ed37ed0b18e@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