Skip to content

Commit

Permalink
cxl/port: Keep port->uport valid for the entire life of a port
Browse files Browse the repository at this point in the history
The upcoming region provisioning implementation has a need to
dereference port->uport during the port unregister flow. Specifically,
endpoint decoders need to be able to lookup their corresponding memdev
via port->uport.

The existing ->dead flag was added for cases where the core was
committed to tearing down the port, but needed to drop locks before
calling device_unregister(). Reuse that flag to indicate to
delete_endpoint() that it has no "release action" work to do as
unregister_port() will handle it.

Reviewed-by: Alison Schofield <alison.schofield@intel.com>
Reviewed-by: Adam Manzanares <a.manzanares@samsung.com>
Link: https://lore.kernel.org/r/165603871491.551046.6682199179541194356.stgit@dwillia2-xfh
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
  • Loading branch information
djbw committed Jul 9, 2022
1 parent 863fdcc commit fe80f1a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/cxl/core/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static void unregister_port(void *_port)
lock_dev = &parent->dev;

device_lock_assert(lock_dev);
port->uport = NULL;
port->dead = true;
device_unregister(&port->dev);
}

Expand Down Expand Up @@ -857,7 +857,7 @@ static void delete_endpoint(void *data)
parent = &parent_port->dev;

device_lock(parent);
if (parent->driver && endpoint->uport) {
if (parent->driver && !endpoint->dead) {
devm_release_action(parent, cxl_unlink_uport, endpoint);
devm_release_action(parent, unregister_port, endpoint);
}
Expand Down

0 comments on commit fe80f1a

Please sign in to comment.