Skip to content

RFC Introduce devm_xa_init

[email protected] linux-cxl linux-fsdevel linux-pci lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest3 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3xarray: Introduce devm_xa_init()drivers/base/core.c include/linux/device.h+23 -07 replies
2/3pci/doe: Use devm_xa_init()drivers/pci/doe.c+2 -126 replies
3/3CXL/doe: Use devm_xa_init()drivers/cxl/pci.c+1 -70 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC PATCH 0/3] Introduce devm_xa_init

From: Ira Weiny <[email protected]>

This is submitted RFC for 2 reasons. First I'm not quite sure where to place the call in the headers. Second the use of the new call is dependent on some CXL code which was just been submitted.[0] I want to get opinions on if this new call seems useful or just more confusing to the XArray interface. If useful I'll respin after the CXL stuff lands and perhaps it can go through Dan's tree.

While converting some CXL code to XArray a pattern emerged which seemed useful to codify.

In two different situations[1][2] an XArray was initialized in such a way that using devm_add_action() could be used to call xa_destroy() automatically.

In the first situation[1] the XArray was storing long values directly and in the other situation the pointers were allocated using device managed functions (devm_*).

In these situations it seems that a device managed xa_init() would be useful.

[0] https://lore.kernel.org/linux-cxl/[email protected]/
[1] https://lore.kernel.org/linux-cxl/[email protected]/
[2] https://lore.kernel.org/linux-cxl/[email protected]/

Ira Weiny (3):
xarray: Introduce devm_xa_init()
pci/doe: Use devm_xa_init()
CXL/doe: Use devm_xa_init()

 drivers/base/core.c    | 20 ++++++++++++++++++++
 drivers/cxl/pci.c      |  8 +-------
 drivers/pci/doe.c      | 14 ++------------
 include/linux/device.h |  3 +++
 4 files changed, 26 insertions(+), 19 deletions(-)
Signature · 1 line
2.35.3