linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask
@ 2020-11-10 14:41 Geert Uytterhoeven
  2020-11-11 15:29 ` Petr Mladek
  2020-11-13 22:04 ` Jonathan Corbet
  0 siblings, 2 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2020-11-10 14:41 UTC (permalink / raw)
  To: Jonathan Corbet, Petr Mladek, Steven Rostedt, Sergey Senozhatsky
  Cc: Andy Shevchenko, Rasmus Villemoes, linux-doc, linux-kernel,
	Geert Uytterhoeven

Clarify how to pass the field width for bitmaps, and mention the helper
macros that are available to ease printing cpumask and nodemask.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 Documentation/core-api/printk-formats.rst | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
index 6d26c5c6ac485cec..160e710d992f3a36 100644
--- a/Documentation/core-api/printk-formats.rst
+++ b/Documentation/core-api/printk-formats.rst
@@ -531,7 +531,9 @@ For printing bitmap and its derivatives such as cpumask and nodemask,
 %*pb outputs the bitmap with field width as the number of bits and %*pbl
 output the bitmap as range list with field width as the number of bits.
 
-Passed by reference.
+The field width is passed by value, the bitmap is passed by reference.
+Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease
+printing cpumask and nodemask.
 
 Flags bitfields such as page flags, gfp_flags
 ---------------------------------------------
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask
  2020-11-10 14:41 [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask Geert Uytterhoeven
@ 2020-11-11 15:29 ` Petr Mladek
  2020-11-11 16:48   ` Andy Shevchenko
  2020-11-13 22:04 ` Jonathan Corbet
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Mladek @ 2020-11-11 15:29 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Jonathan Corbet, Steven Rostedt, Sergey Senozhatsky,
	Andy Shevchenko, Rasmus Villemoes, linux-doc, linux-kernel

On Tue 2020-11-10 15:41:21, Geert Uytterhoeven wrote:
> Clarify how to pass the field width for bitmaps, and mention the helper
> macros that are available to ease printing cpumask and nodemask.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  Documentation/core-api/printk-formats.rst | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
> index 6d26c5c6ac485cec..160e710d992f3a36 100644
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst
> @@ -531,7 +531,9 @@ For printing bitmap and its derivatives such as cpumask and nodemask,
>  %*pb outputs the bitmap with field width as the number of bits and %*pbl
>  output the bitmap as range list with field width as the number of bits.
>  
> -Passed by reference.
> +The field width is passed by value, the bitmap is passed by reference.
> +Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease
> +printing cpumask and nodemask.

I like it and I would go even further. I have never used these modifiers
and was really confused by the entire description.

IMHO, it is just an implementation detail that the number of bits is
passed via width in struct printf_spec. It is the asterisk '*' that
defines that one more argument is needed. And it is up to the
documentation to define what the argument is for.

The following text shows the idea. I am not a native speaker.
I am sure that the working might get improved.

<cut>
	%*pb	0779
	%*pbl	0,3-6,8-10

For printing bitmap and its derivatives such as cpumask and nodemask.

It takes two arguments, see '*'. The first argument defines the number
of bits in the mask. The second argument points to the mask.

%*pb outputs the bitmap as a hex number. If the size is bigger than 32-bit
then 32-bit values are separated by a comma.

%*pbl outputs the bitmap as a range list.

The number of bits is passed by value. The mask is passed by reference.
Helper macros cpumask_pr_args() and nodemask_pr_args() are available to
ease printing cpumask and nodemask.
</cut>

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask
  2020-11-11 15:29 ` Petr Mladek
@ 2020-11-11 16:48   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2020-11-11 16:48 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Geert Uytterhoeven, Jonathan Corbet, Steven Rostedt,
	Sergey Senozhatsky, Rasmus Villemoes, linux-doc, linux-kernel

On Wed, Nov 11, 2020 at 04:29:33PM +0100, Petr Mladek wrote:
> On Tue 2020-11-10 15:41:21, Geert Uytterhoeven wrote:
> > Clarify how to pass the field width for bitmaps, and mention the helper
> > macros that are available to ease printing cpumask and nodemask.

...

> 	%*pb	0779
> 	%*pbl	0,3-6,8-10
> 
> For printing bitmap and its derivatives such as cpumask and nodemask.
> 
> It takes two arguments, see '*'. The first argument defines the number
> of bits in the mask. The second argument points to the mask.
> 
> %*pb outputs the bitmap as a hex number. If the size is bigger than 32-bit
> then 32-bit values are separated by a comma.
> 
> %*pbl outputs the bitmap as a range list.
> 
> The number of bits is passed by value. The mask is passed by reference.

It can be improved at least by replacing mask with bitmap here.

> Helper macros cpumask_pr_args() and nodemask_pr_args() are available to
> ease printing cpumask and nodemask.

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask
  2020-11-10 14:41 [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask Geert Uytterhoeven
  2020-11-11 15:29 ` Petr Mladek
@ 2020-11-13 22:04 ` Jonathan Corbet
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Corbet @ 2020-11-13 22:04 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Petr Mladek, Steven Rostedt, Sergey Senozhatsky, Andy Shevchenko,
	Rasmus Villemoes, linux-doc, linux-kernel

On Tue, 10 Nov 2020 15:41:21 +0100
Geert Uytterhoeven <geert+renesas@glider.be> wrote:

> Clarify how to pass the field width for bitmaps, and mention the helper
> macros that are available to ease printing cpumask and nodemask.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
>  Documentation/core-api/printk-formats.rst | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/core-api/printk-formats.rst b/Documentation/core-api/printk-formats.rst
> index 6d26c5c6ac485cec..160e710d992f3a36 100644
> --- a/Documentation/core-api/printk-formats.rst
> +++ b/Documentation/core-api/printk-formats.rst
> @@ -531,7 +531,9 @@ For printing bitmap and its derivatives such as cpumask and nodemask,
>  %*pb outputs the bitmap with field width as the number of bits and %*pbl
>  output the bitmap as range list with field width as the number of bits.
>  
> -Passed by reference.
> +The field width is passed by value, the bitmap is passed by reference.
> +Helper macros cpumask_pr_args() and nodemask_pr_args() are available to ease
> +printing cpumask and nodemask.

Applied, thanks.

jon

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-13 22:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-10 14:41 [PATCH] docs: core-api/printk-formats.rst: Clarify formatting {cpu,node}mask Geert Uytterhoeven
2020-11-11 15:29 ` Petr Mladek
2020-11-11 16:48   ` Andy Shevchenko
2020-11-13 22:04 ` Jonathan Corbet

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).