[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20241002164143.74ba2820@kernel.org>
Date: Wed, 2 Oct 2024 16:41:43 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Al Viro <viro@...iv.linux.org.uk>
Cc: Conor Dooley <conor@...nel.org>, Shuah Khan <skhan@...uxfoundation.org>,
Okan Tumuklu <okantumukluu@...il.com>, shuah@...nel.org,
linux-kernel@...r.kernel.org, krzk@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] Update core.c
On Wed, 2 Oct 2024 23:21:45 +0100 Al Viro wrote:
> > 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
>
> Bravo. Mind if that gets stolen for VFS as well?
Not at all. Slight preference towards not mentioning that you got it
from us, tho, lest we attract unwanted attention :)
Powered by blists - more mailing lists