From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38AACC433EF for ; Fri, 11 Mar 2022 01:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345361AbiCKBd6 (ORCPT ); Thu, 10 Mar 2022 20:33:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345360AbiCKBd5 (ORCPT ); Thu, 10 Mar 2022 20:33:57 -0500 Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BB069972E3 for ; Thu, 10 Mar 2022 17:32:52 -0800 (PST) Date: Fri, 11 Mar 2022 01:32:44 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1646962369; bh=QwZDFWa+hj+czammg/GqJUDVTdjcC7UxItWq97HZnpU=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID; b=jLuFrzSniJy7x/BjbxJ7amVd2cSnyzFYiZ0IkOG7FaxP+YWmV+7tHkj447i7HVC18 qCbBIN0+MxBDZWEMDwu/SyyUH6RN4FSFvYCavOE1SExo8vqtyRH6zdSXn4LbtU2sqb 3v+YKkNUenXdiIldxfHKnLIXMxqYk3VIWEUI5sRu4W9Gfp2/QTxHt+rE7Cb8kb8r5R 5+3Ot2/H1tGZrhlg314Ymvzi/ZpTkygeUmqeJFwneIS7r4ZXP9rf1WbHQWoEanvq4H mgd1jPRwF4Kn0dqaSomAGdtasx2weG6WIp8LNPtTqrrTJwJNCuWI3C2wOawY6Og3lW R/z+Maa2+NskQ== To: Linus Torvalds , linux-kernel@vger.kernel.org From: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Cc: Greg Kroah-Hartman , Andrew Morton , Xiaomeng Tong , Kees Cook , Jakob Koschel , Arnd Bergmann Reply-To: =?utf-8?Q?Barnab=C3=A1s_P=C5=91cze?= Subject: [RFC PATCH v1 0/2] add type-safer list_head wrapper Message-ID: <20220311013238.3387227-1-pobrn@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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/20220217184829.1991035-1-jakobkoschel@gmai= l.com/ [2]: https://lore.kernel.org/all/20220301075839.4156-1-xiam0nd.tong@gmail.c= om/ And see https://lwn.net/Articles/887097/ for a summary. Barnab=C3=A1s P=C5=91cze (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