From: Al Viro <viro@zeniv.linux.org.uk>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Conor Dooley <conor@kernel.org>,
Shuah Khan <skhan@linuxfoundation.org>,
Okan Tumuklu <okantumukluu@gmail.com>,
shuah@kernel.org, linux-kernel@vger.kernel.org, krzk@kernel.org,
netdev@vger.kernel.org
Subject: Re: [PATCH] Update core.c
Date: Wed, 2 Oct 2024 23:21:45 +0100 [thread overview]
Message-ID: <20241002222145.GJ4017910@ZenIV> (raw)
In-Reply-To: <20241002062751.1b08e89a@kernel.org>
On Wed, Oct 02, 2024 at 06:27:51AM -0700, 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
Bravo. Mind if that gets stolen for VFS as well?
next prev parent reply other threads:[~2024-10-02 22:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240930220649.6954-1-okantumukluu@gmail.com>
[not found] ` <7dcaa550-4c12-4c2e-9ae2-794c87048ea9@linuxfoundation.org>
2024-09-30 22:20 ` [PATCH] Update core.c Conor Dooley
2024-10-02 13:27 ` Jakub Kicinski
2024-10-02 15:26 ` Shuah Khan
2024-10-02 22:21 ` Al Viro [this message]
2024-10-02 23:41 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241002222145.GJ4017910@ZenIV \
--to=viro@zeniv.linux.org.uk \
--cc=conor@kernel.org \
--cc=krzk@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=okantumukluu@gmail.com \
--cc=shuah@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).