[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <241d131b-faed-42f4-a8c6-93cd95b68181@linuxfoundation.org>
Date: Wed, 2 Oct 2024 09:26:33 -0600
From: Shuah Khan <skhan@...uxfoundation.org>
To: Jakub Kicinski <kuba@...nel.org>, Conor Dooley <conor@...nel.org>
Cc: Okan Tumuklu <okantumukluu@...il.com>, shuah@...nel.org,
linux-kernel@...r.kernel.org, krzk@...nel.org, netdev@...r.kernel.org,
Shuah Khan <skhan@...uxfoundation.org>
Subject: Re: [PATCH] Update core.c
On 10/2/24 07:27, Jakub Kicinski wrote:
> On Mon, 30 Sep 2024 23:20:45 +0100 Conor Dooley wrote:
>> (do netdev folks even want scoped cleanup?),
>
> Since I have it handy... :)
>
> Quoting documentation:
>
> Using device-managed and cleanup.h constructs
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> Netdev remains skeptical about promises of all "auto-cleanup" APIs,
> including even ``devm_`` helpers, historically. They are not the preferred
> style of implementation, merely an acceptable one.
>
> Use of ``guard()`` is discouraged within any function longer than 20 lines,
> ``scoped_guard()`` is considered more readable. Using normal lock/unlock is
> still (weakly) preferred.
>
> Low level cleanup constructs (such as ``__free()``) can be used when building
> APIs and helpers, especially scoped iterators. However, direct use of
> ``__free()`` within networking core and drivers is discouraged.
> Similar guidance applies to declaring variables mid-function.
>
> See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#using-device-managed-and-cleanup-h-constructs
Thank you. This will be helpful for new developers such as this
patch submitter to understand the scope of cleanup patches.
thanks,
-- Shuah
Powered by blists - more mailing lists