mbox series

[v2,0/3] cxl/port: Cleanup add_port_attach_ep() "cleanup" confusion

Message ID 172921380683.2133624.1708770961640157143.stgit@dwillia2-xfh.jf.intel.com
Headers show
Series cxl/port: Cleanup add_port_attach_ep() "cleanup" confusion | expand

Message

Dan Williams Oct. 18, 2024, 1:10 a.m. UTC
Changes since v1 [1]:
- there is no bug fixed by these changes (Jonathan)
- lets take the time to improve the subtlety (Jonathan)

Dan's recent smatch report [2] highlighted that add_port_attach_ep() is
unreasonably subtle, aka ugly. The recent cleanup conversions did not
improve the situation and instead actively contributed to the poor
readability.

Given that this routine is core to CXL port enumeration it is worth
investing readability improvements. So, first, back out the
scope-based-cleanup helper conversions that were built on an ugly
foundation. Then, refactor add_port_attach_ep() with a new
find_add_dport() helper that clarifies the flow.

This is cxl-next material, not cxl-fixes.

[1]: http://lore.kernel.org/172912104335.1414627.1377616790909088415.stgit@dwillia2-xfh.jf.intel.com
[2]: http://lore.kernel.org/2a19289b-0bcf-42c4-82a9-268a922535f2@stanley.mountain

---

Dan Williams (3):
      cxl/port: Revert usage of scoped_guard()
      cxl/port: Revert __free() conversion of add_port_attach_ep()
      cxl/port: Clarify add_port_attach_ep()


 drivers/cxl/core/port.c   |  121 ++++++++++++++++++++++++++-------------------
 drivers/cxl/core/region.c |   25 ++++-----
 drivers/cxl/cxl.h         |    1 
 drivers/cxl/mem.c         |   22 ++++----
 drivers/cxl/pmem.c        |   16 +++---
 5 files changed, 105 insertions(+), 80 deletions(-)