2022-06-20 08:46:09

by Bagas Sanjaya

[permalink] [raw]
Subject: [PATCH v3] Documentation: highmem: Use literal block for code example in highmem.h comment

When building htmldocs on Linus' tree, there are inline emphasis warnings
on include/linux/highmem.h:

Documentation/vm/highmem:166: ./include/linux/highmem.h:154: WARNING: Inline emphasis start-string without end-string.
Documentation/vm/highmem:166: ./include/linux/highmem.h:157: WARNING: Inline emphasis start-string without end-string.

These warnings above are due to comments in code example at the
mentioned lines above are enclosed by double dash (--), which confuses
Sphinx as inline markup delimiters instead.

Fix these warnings by indenting the code example with literal block
indentation and prefixing comments inside the example with C comment
symbol (#).

Fixes: 85a85e7601263f ("Documentation/vm: move "Using kmap-atomic" to highmem.h")
Cc: Andrew Morton <[email protected]>
Cc: Ira Weiny <[email protected]>
Cc: "Matthew Wilcox (Oracle)" <[email protected]>
Cc: "Fabio M. De Francesco" <[email protected]>
Cc: Sebastian Andrzej Siewior <[email protected]>
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Bagas Sanjaya <[email protected]>
---
Changes since v2 [1]:
- Rebase on v5.19-rc3
- Don't mention any functions

[1]: https://lore.kernel.org/linux-doc/[email protected]/
include/linux/highmem.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/include/linux/highmem.h b/include/linux/highmem.h
index 3af34de54330cb..56d6a019653489 100644
--- a/include/linux/highmem.h
+++ b/include/linux/highmem.h
@@ -149,19 +149,19 @@ static inline void *kmap_local_folio(struct folio *folio, size_t offset);
* It is used in atomic context when code wants to access the contents of a
* page that might be allocated from high memory (see __GFP_HIGHMEM), for
* example a page in the pagecache. The API has two functions, and they
- * can be used in a manner similar to the following:
+ * can be used in a manner similar to the following::
*
- * -- Find the page of interest. --
- * struct page *page = find_get_page(mapping, offset);
+ * // Find the page of interest.
+ * struct page *page = find_get_page(mapping, offset);
*
- * -- Gain access to the contents of that page. --
- * void *vaddr = kmap_atomic(page);
+ * // Gain access to the contents of that page.
+ * void *vaddr = kmap_atomic(page);
*
- * -- Do something to the contents of that page. --
- * memset(vaddr, 0, PAGE_SIZE);
+ * // Do something to the contents of that page.
+ * memset(vaddr, 0, PAGE_SIZE);
*
- * -- Unmap that page. --
- * kunmap_atomic(vaddr);
+ * // Unmap that page.
+ * kunmap_atomic(vaddr);
*
* Note that the kunmap_atomic() call takes the result of the kmap_atomic()
* call, not the argument.

base-commit: a111daf0c53ae91e71fd2bfe7497862d14132e3e
--
An old man doll... just what I always wanted! - Clara


2022-06-20 22:19:30

by Ira Weiny

[permalink] [raw]
Subject: Re: [PATCH v3] Documentation: highmem: Use literal block for code example in highmem.h comment

On Mon, Jun 20, 2022 at 03:36:49PM +0700, Bagas Sanjaya wrote:
> When building htmldocs on Linus' tree, there are inline emphasis warnings
> on include/linux/highmem.h:
>
> Documentation/vm/highmem:166: ./include/linux/highmem.h:154: WARNING: Inline emphasis start-string without end-string.
> Documentation/vm/highmem:166: ./include/linux/highmem.h:157: WARNING: Inline emphasis start-string without end-string.
>
> These warnings above are due to comments in code example at the
> mentioned lines above are enclosed by double dash (--), which confuses
> Sphinx as inline markup delimiters instead.
>
> Fix these warnings by indenting the code example with literal block
> indentation and prefixing comments inside the example with C comment
> symbol (#).

"//"?

Frankly I'd just drop "(#)".

Perhaps:

... indentation and making the comments C comments.

Ira

>
> Fixes: 85a85e7601263f ("Documentation/vm: move "Using kmap-atomic" to highmem.h")
> Cc: Andrew Morton <[email protected]>
> Cc: Ira Weiny <[email protected]>
> Cc: "Matthew Wilcox (Oracle)" <[email protected]>
> Cc: "Fabio M. De Francesco" <[email protected]>
> Cc: Sebastian Andrzej Siewior <[email protected]>
> Cc: [email protected]
> Cc: [email protected]
> Signed-off-by: Bagas Sanjaya <[email protected]>
> ---
> Changes since v2 [1]:
> - Rebase on v5.19-rc3
> - Don't mention any functions
>
> [1]: https://lore.kernel.org/linux-doc/[email protected]/
> include/linux/highmem.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/include/linux/highmem.h b/include/linux/highmem.h
> index 3af34de54330cb..56d6a019653489 100644
> --- a/include/linux/highmem.h
> +++ b/include/linux/highmem.h
> @@ -149,19 +149,19 @@ static inline void *kmap_local_folio(struct folio *folio, size_t offset);
> * It is used in atomic context when code wants to access the contents of a
> * page that might be allocated from high memory (see __GFP_HIGHMEM), for
> * example a page in the pagecache. The API has two functions, and they
> - * can be used in a manner similar to the following:
> + * can be used in a manner similar to the following::
> *
> - * -- Find the page of interest. --
> - * struct page *page = find_get_page(mapping, offset);
> + * // Find the page of interest.
> + * struct page *page = find_get_page(mapping, offset);
> *
> - * -- Gain access to the contents of that page. --
> - * void *vaddr = kmap_atomic(page);
> + * // Gain access to the contents of that page.
> + * void *vaddr = kmap_atomic(page);
> *
> - * -- Do something to the contents of that page. --
> - * memset(vaddr, 0, PAGE_SIZE);
> + * // Do something to the contents of that page.
> + * memset(vaddr, 0, PAGE_SIZE);
> *
> - * -- Unmap that page. --
> - * kunmap_atomic(vaddr);
> + * // Unmap that page.
> + * kunmap_atomic(vaddr);
> *
> * Note that the kunmap_atomic() call takes the result of the kmap_atomic()
> * call, not the argument.
>
> base-commit: a111daf0c53ae91e71fd2bfe7497862d14132e3e
> --
> An old man doll... just what I always wanted! - Clara
>
>

2022-06-22 08:57:54

by Bagas Sanjaya

[permalink] [raw]
Subject: Re: [PATCH v3] Documentation: highmem: Use literal block for code example in highmem.h comment

On 6/21/22 04:44, Ira Weiny wrote:

>> Fix these warnings by indenting the code example with literal block
>> indentation and prefixing comments inside the example with C comment
>> symbol (#).
>
> "//"?
>
> Frankly I'd just drop "(#)".
>
> Perhaps:
>
> ... indentation and making the comments C comments.
>

Ah! I had overlooked that. Thanks.

--
An old man doll... just what I always wanted! - Clara