* Re: [PATCH v2] cleanup: Add usage and style documentation
[not found] <171140738438.1574931.15717256954707430472.stgit@dwillia2-xfh.jf.intel.com>
@ 2024-03-26 12:06 ` Markus Elfring
0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2024-03-26 12:06 UTC (permalink / raw
To: Dan Williams, Peter Zijlstra, Linus Torvalds, Jonathan Corbet,
linux-doc, linux-kernel, linux-pci, kernel-janitors
Cc: Bjorn Helgaas, Greg Kroah-Hartman, Ilpo Järvinen, Ira Weiny,
Jesse Brandeburg, Jonathan Cameron, Julia Lawall, Kevin Tian,
Lukas Wunner, Matthew Wilcox
…
> +++ b/include/linux/cleanup.h
> @@ -4,6 +4,157 @@
>
> #include <linux/compiler.h>
>
> +/**
> + * DOC: scope-based cleanup helpers
> + *
> + * The "goto error" pattern is notorious for introducing …
Will any other label become more helpful for this description approach?
> + * this tedium …
Would an other wording be more appropriate here?
> + * … maintaining FILO (first in last out)
How does this text fit to your response from yesterday?
https://lore.kernel.org/all/6601c7f7369d4_2690d29490@dwillia2-mobl3.amr.corp.intel.com.notmuch/
> + * … If a function
> + * wants to invoke pci_dev_put() on error, but return @dev (i.e. without
> + * freeing it) on success, it can do:
> + *
> + * ::
> + *
> + * return no_free_ptr(dev);
> + *
> + * ...or:
> + *
> + * ::
> + *
> + * return_ptr(dev);
…
Would this macro call be preferred as a succinct specification
(so that only the shorter one should be mentioned here)?
https://elixir.bootlin.com/linux/v6.8.1/source/include/linux/cleanup.h#L78
> + * Observe the lock is held for the remainder of the "if ()" block not
> + * the remainder of "func()".
I suggest to add a word in this sentence.
* Observe the lock is held for the remainder of the "if ()" block
* (and not the remainder of "func()").
> + * the top of the function poses this potential interdependency problem
I suggest to add a comma at the end of this line.
> + * the recommendation is to always define and assign variables in one
> + * statement and not group variable definitions at the top of the
> + * function when __free() is used.
I became curious how code layout guidance will evolve further also
according to such an advice.
Would you like to increase the collaboration with the macros “DEFINE_CLASS” and “CLASS”?
https://elixir.bootlin.com/linux/v6.8.1/source/include/linux/cleanup.h#L82
Regards,
Markus
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2024-03-26 12:06 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <171140738438.1574931.15717256954707430472.stgit@dwillia2-xfh.jf.intel.com>
2024-03-26 12:06 ` [PATCH v2] cleanup: Add usage and style documentation Markus Elfring
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 read-only IMAP folder(s) and NNTP newsgroup(s).