Skip to content

RFC add type-safer list_head wrapper

Barnabás Pőcze lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest2 patches 8 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2list: add type-safer list_head wrapperinclude/linux/tlist.h+75 -08 replies
2/2platform/x86: wmi: use tlist for WMI blocksdrivers/platform/x86/wmi.c+20 -330 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 v1 0/2] add type-safer list_head wrapper

As there have been various discussions[1][2] about improving the current list_head facilities, I would like to propose a type-safe(r), lightweight wrapper: tlist.

The first commit goes into details as to how it works, lists some of its advantages and disadvantages.

The second commit showcases it in the existing WMI platform driver.

NOTE: these changes are mostly untested! They are purely for showcasing a possible implementation and API. And they depend on the switch to gnu11.

I would like to get some feedback as to whether/how acceptable this approach is before going further: writing documentation, tests, and adding more wrappers around existing list_head facilities (e.g. reverse iteration is not implemented).

If this idea has already been proposed, I apologize, I must have missed it when I searched for similar patches.

PS. I have tried to select those who may be interested in this discussion, I may have missed people or added people who aren't interested. Sorry.

[1]: https://lore.kernel.org/all/[email protected]/
[2]: https://lore.kernel.org/all/[email protected]/
And see https://lwn.net/Articles/887097/ for a summary.

Barnabás Pőcze (2):
list: add type-safer list_head wrapper
platform/x86: wmi: use tlist for WMI blocks

 drivers/platform/x86/wmi.c | 54 ++++++++++---------------
 include/linux/tlist.h      | 81 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 102 insertions(+), 33 deletions(-)
 create mode 100644 include/linux/tlist.h

--
2.35.1