[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <570afd53-b1ed-4456-b83e-fca29857f000@web.de>
Date: Tue, 26 Mar 2024 13:06:05 +0100
From: Markus Elfring <Markus.Elfring@....de>
To: Dan Williams <dan.j.williams@...el.com>,
Peter Zijlstra <peterz@...radead.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
kernel-janitors@...r.kernel.org
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Ilpo Järvinen <ilpo.jarvinen@...ux.intel.com>,
Ira Weiny <ira.weiny@...el.com>,
Jesse Brandeburg <jesse.brandeburg@...el.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Julia Lawall <Julia.Lawall@...ia.fr>, Kevin Tian <kevin.tian@...el.com>,
Lukas Wunner <lukas.wunner@...el.com>, Matthew Wilcox <willy@...radead.org>
Subject: Re: [PATCH v2] cleanup: Add usage and style documentation
…
> +++ 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
Powered by blists - more mailing lists