docs: core-api: Update kernel-api.rst to include cpumask.h
Subsystems (2)
cover docs: core-api: Update kernel-api.rst to include cpumask.h
Hello,
This includes cpumask.h in kernel-api.rst and fixes some kernel-doc formatting warnings/errors.
Viresh Kumar (2):
cpumask: Fix kernel-doc formatting errors in cpumask.h
docs: core-api: Update kernel-api.rst to include cpumask.h
Documentation/core-api/kernel-api.rst | 6 +++ include/linux/cpumask.h | 65 +++++++++++++++------------ 2 files changed, 43 insertions(+), 28 deletions(-)
Signature · 1 line
2.31.1.272.g89b43f80a514
PATCH 1/2 cpumask: Fix kernel-doc formatting errors in cpumask.h
This fixes various kernel-doc formatting errors in cpumask.h:
- WARNING: Inline literal start-string without end-string.
- ERROR: Unexpected indentation.
- ERROR: Unknown target name: "gfp".
--- include/linux/cpumask.h | 65 +++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 28 deletions(-)
include/linux/cpumask.h +37 -28
@@ -20,7 +20,7 @@* cpumask_pr_args - printf args to output a cpumask * @maskp: cpumask to be printed * -* Can be used to provide arguments for '%*pb[l]' when printing a cpumask. +* Can be used to provide arguments for '\%*pb[l]' when printing a cpumask. */ #define cpumask_pr_args (maskp) nr_cpu_ids, cpumask_bits(maskp)
@@ -166,7 +166,7 @@ static __always_inline unsigned int cpumask_first_zero(const struct cpumask *src }/** -* cpumask_first_and - return the first cpu from *srcp1 & *srcp2 +* cpumask_first_and - return the first cpu from \*srcp1 & \*srcp2 * @srcp1: the first input * @srcp2: the second input *
@@ -179,7 +179,7 @@ unsigned int cpumask_first_and(const struct cpumask *srcp1, const struct cpumask }/** -* cpumask_first_and_and - return the first cpu from *srcp1 & *srcp2 & *srcp3 +* cpumask_first_and_and - return the first cpu from \*srcp1 & \*srcp2 & \*srcp3 * @srcp1: the first input * @srcp2: the second input * @srcp3: the third input
@@ -266,7 +266,7 @@ unsigned int cpumask_any_distribute(const struct cpumask *srcp);#endif /* NR_CPUS */ /** -* cpumask_next_and - get the next cpu in *src1p & *src2p +* cpumask_next_and - get the next cpu in \*src1p & \*src2p * @n: the cpu prior to the place to search (i.e. return will be > @n) * @src1p: the first cpumask pointer * @src2p: the second cpumask pointer
@@ -335,6 +335,9 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta* @mask2: the second cpumask pointer * * This saves a temporary CPU mask in many places. It is equivalent to: +* +* .. code-block:: c +* * struct cpumask tmp; * cpumask_and(&tmp, &mask1, &mask2); * for_each_cpu(cpu, &tmp)
@@ -353,6 +356,9 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta* @mask2: the second cpumask pointer * * This saves a temporary CPU mask in many places. It is equivalent to: +* +* .. code-block:: c +* * struct cpumask tmp; * cpumask_andnot(&tmp, &mask1, &mask2); * for_each_cpu(cpu, &tmp)
@@ -370,6 +376,9 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta* @mask2: the second cpumask pointer * * This saves a temporary CPU mask in many places. It is equivalent to: +* +* .. code-block:: c +* * struct cpumask tmp; * cpumask_or(&tmp, &mask1, &mask2); * for_each_cpu(cpu, &tmp)
@@ -411,7 +420,7 @@ unsigned int cpumask_any_but(const struct cpumask *mask, unsigned int cpu) }/** -* cpumask_any_and_but - pick an arbitrary cpu from *mask1 & *mask2, but not this one. +* cpumask_any_and_but - pick an arbitrary cpu from \*mask1 & \*mask2, but not this one. * @mask1: the first input cpumask * @mask2: the second input cpumask * @cpu: the cpu to ignore
@@ -545,7 +554,7 @@ static __always_inline void __cpumask_clear_cpu(int cpu, struct cpumask *dstp)* cpumask_assign_cpu - assign a cpu in a cpumask * @cpu: cpu number (< nr_cpu_ids) * @dstp: the cpumask pointer -* @bool: the value to assign +* @value: the value to assign */ static __always_inline void cpumask_assign_cpu(int cpu, struct cpumask *dstp, bool value) {
@@ -623,7 +632,7 @@ static __always_inline void cpumask_clear(struct cpumask *dstp) }/** -* cpumask_and - *dstp = *src1p & *src2p +* cpumask_and - \*dstp = \*src1p & \*src2p * @dstp: the cpumask result * @src1p: the first input * @src2p: the second input
@@ -639,7 +648,7 @@ bool cpumask_and(struct cpumask *dstp, const struct cpumask *src1p, }/** -* cpumask_or - *dstp = *src1p | *src2p +* cpumask_or - \*dstp = \*src1p | \*src2p * @dstp: the cpumask result * @src1p: the first input * @src2p: the second input
@@ -653,7 +662,7 @@ void cpumask_or(struct cpumask *dstp, const struct cpumask *src1p, }/** -* cpumask_xor - *dstp = *src1p ^ *src2p +* cpumask_xor - \*dstp = \*src1p ^ \*src2p * @dstp: the cpumask result * @src1p: the first input * @src2p: the second input
@@ -667,7 +676,7 @@ void cpumask_xor(struct cpumask *dstp, const struct cpumask *src1p, }/** -* cpumask_andnot - *dstp = *src1p & ~*src2p +* cpumask_andnot - \*dstp = \*src1p & ~\*src2p * @dstp: the cpumask result * @src1p: the first input * @src2p: the second input
@@ -683,7 +692,7 @@ bool cpumask_andnot(struct cpumask *dstp, const struct cpumask *src1p, }/** -* cpumask_equal - *src1p == *src2p +* cpumask_equal - \*src1p == \*src2p * @src1p: the first input * @src2p: the second input *
@@ -697,7 +706,7 @@ bool cpumask_equal(const struct cpumask *src1p, const struct cpumask *src2p) }/** -* cpumask_or_equal - *src1p | *src2p == *src3p +* cpumask_or_equal - \*src1p | \*src2p == \*src3p * @src1p: the first input * @src2p: the second input * @src3p: the third input
@@ -714,7 +723,7 @@ bool cpumask_or_equal(const struct cpumask *src1p, const struct cpumask *src2p, }/** -* cpumask_intersects - (*src1p & *src2p) != 0 +* cpumask_intersects - (\*src1p & \*src2p) != 0 * @src1p: the first input * @src2p: the second input *
@@ -729,7 +738,7 @@ bool cpumask_intersects(const struct cpumask *src1p, const struct cpumask *src2p }/** -* cpumask_subset - (*src1p & ~*src2p) == 0 +* cpumask_subset - (\*src1p & ~\*src2p) == 0 * @src1p: the first input * @src2p: the second input *
@@ -743,7 +752,7 @@ bool cpumask_subset(const struct cpumask *src1p, const struct cpumask *src2p) }/** -* cpumask_empty - *srcp == 0 +* cpumask_empty - \*srcp == 0 * @srcp: the cpumask to that all cpus < nr_cpu_ids are clear. * * Return: true if srcp is empty (has no bits set), else false
@@ -754,7 +763,7 @@ static __always_inline bool cpumask_empty(const struct cpumask *srcp) }/** -* cpumask_full - *srcp == 0xFFFFFFFF... +* cpumask_full - \*srcp == 0xFFFFFFFF... * @srcp: the cpumask to that all cpus < nr_cpu_ids are set. * * Return: true if srcp is full (has all bits set), else false
@@ -765,10 +774,10 @@ static __always_inline bool cpumask_full(const struct cpumask *srcp) }/** -* cpumask_weight - Count of bits in *srcp +* cpumask_weight - Count of bits in \*srcp * @srcp: the cpumask to count bits (< nr_cpu_ids) in. * -* Return: count of bits set in *srcp +* Return: count of bits set in \*srcp */ static __always_inline unsigned int cpumask_weight(const struct cpumask *srcp) {
@@ -776,11 +785,11 @@ static __always_inline unsigned int cpumask_weight(const struct cpumask *srcp) }/** -* cpumask_weight_and - Count of bits in (*srcp1 & *srcp2) +* cpumask_weight_and - Count of bits in (\*srcp1 & \*srcp2) * @srcp1: the cpumask to count bits (< nr_cpu_ids) in. * @srcp2: the cpumask to count bits (< nr_cpu_ids) in. * -* Return: count of bits set in both *srcp1 and *srcp2 +* Return: count of bits set in both \*srcp1 and \*srcp2 */ static __always_inline unsigned int cpumask_weight_and(const struct cpumask *srcp1, const struct cpumask *srcp2)
@@ -789,11 +798,11 @@ unsigned int cpumask_weight_and(const struct cpumask *srcp1, const struct cpumas }/** -* cpumask_weight_andnot - Count of bits in (*srcp1 & ~*srcp2) +* cpumask_weight_andnot - Count of bits in (\*srcp1 & ~\*srcp2) * @srcp1: the cpumask to count bits (< nr_cpu_ids) in. * @srcp2: the cpumask to count bits (< nr_cpu_ids) in. * -* Return: count of bits set in both *srcp1 and *srcp2 +* Return: count of bits set in both \*srcp1 and \*srcp2 */ static __always_inline unsigned int cpumask_weight_andnot(const struct cpumask *srcp1,
@@ -803,7 +812,7 @@ unsigned int cpumask_weight_andnot(const struct cpumask *srcp1, }/** -* cpumask_shift_right - *dstp = *srcp >> n +* cpumask_shift_right - \*dstp = \*srcp >> n * @dstp: the cpumask result * @srcp: the input to shift * @n: the number of bits to shift by
@@ -816,7 +825,7 @@ void cpumask_shift_right(struct cpumask *dstp, const struct cpumask *srcp, int n }/** -* cpumask_shift_left - *dstp = *srcp << n +* cpumask_shift_left - \*dstp = \*srcp << n * @dstp: the cpumask result * @srcp: the input to shift * @n: the number of bits to shift by
@@ -829,7 +838,7 @@ void cpumask_shift_left(struct cpumask *dstp, const struct cpumask *srcp, int n) }/** -* cpumask_copy - *dstp = *srcp +* cpumask_copy - \*dstp = \*srcp * @dstp: the result * @srcp: the input cpumask */
@@ -840,7 +849,7 @@ void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp) }/** -* cpumask_any - pick an arbitrary cpu from *srcp +* cpumask_any - pick an arbitrary cpu from \*srcp * @srcp: the input cpumask * * Return: >= nr_cpu_ids if no cpus set.
@@ -848,7 +857,7 @@ void cpumask_copy(struct cpumask *dstp, const struct cpumask *srcp)#define cpumask_any (srcp) cpumask_first(srcp)/** -* cpumask_any_and - pick an arbitrary cpu from *mask1 & *mask2 +* cpumask_any_and - pick an arbitrary cpu from \*mask1 & \*mask2 * @mask1: the first input cpumask * @mask2: the second input cpumask *
@@ -941,7 +950,7 @@ bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)/** * alloc_cpumask_var - allocate a struct cpumask * @mask: pointer to cpumask_var_t where the cpumask is returned -* @flags: GFP_ flags +* @flags: GFP\_ flags * * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is * a nop returning a constant 1 (in <linux/cpumask.h>).
Signature · 1 line
2.31.1.272.g89b43f80a514
Re: [PATCH 1/2] cpumask: Fix kernel-doc formatting errors in cpumask.h
Hello Viresh,
Quoted 16 lines · Viresh Kumar
This fixes various kernel-doc formatting errors in
cpumask.h:- WARNING: Inline literal start-string without end-string.
- ERROR: Unexpected indentation.
- ERROR: Unknown target name: "gfp".Signed-off-by Viresh Kumar <[email protected]>--- include/linux/cpumask.h | 65 +++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 28 deletions(-)include/linux/cpumask.h +0
-0
include/linux/cpumask.h line 23
Quoted 5 lines
include/linux/cpumask.h +1
-1@@ -20,7 +20,7 @@* cpumask_pr_args - printf args to output a cpumask * @maskp: cpumask to be printed * -* Can be used to provide arguments for '%*pb[l]' when printing a cpumask. +* Can be used to provide arguments for '\%*pb[l]' when printing a cpumask.
kernel-doc (script) can recognize the pattern of %*pb but not %*pb[l]. "%*bp [l]" should work here.
(without quotes and a white space in front of "[").
No need to escape "%".
include/linux/cpumask.h static __always_inline unsigned int cpumask_first_zero(const struct cpumask *src · line 169
Quoted 9 lines
include/linux/cpumask.h +1
-1*/ #define cpumask_pr_args (maskp) nr_cpu_ids, cpumask_bits(maskp)@@ -166,7 +166,7 @@ static __always_inline unsigned int cpumask_first_zero(const struct cpumask *src }/** -* cpumask_first_and - return the first cpu from *srcp1 & *srcp2 +* cpumask_first_and - return the first cpu from \*srcp1 & \*srcp2
kernel-doc (script) understands the pattern of *@srcp1. No need to escape "*".
But it does not (yet) parse the pattern of "*@n+1". You need to say "*@n +1", with a space in front of "+1", for the time being.
[...]
include/linux/cpumask.h unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta · line 343
Quoted 10 lines
include/linux/cpumask.h +3
-0@@ -335,6 +335,9 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta* @mask2: the second cpumask pointer * * This saves a temporary CPU mask in many places. It is equivalent to: +* +* .. code-block:: c +* * struct cpumask tmp; * cpumask_and(&tmp, &mask1, &mask2); * for_each_cpu(cpu, &tmp)
Do you really want those code-blocks to look fancy?
In kernel-doc comments, I'd normally use plain literal blocks instead.
Something like:
* This saves a temporary CPU mask in many places. It is equivalent to::
*
* struct cpumask tmp;
* cpumask_and(&tmp, &mask1, &mask2);
* for_each_cpu(cpu, &tmp)
should work. Note the "::" and the empty line below it.
[...]
include/linux/cpumask.h bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) · line 953
Quoted 6 lines
include/linux/cpumask.h +1
-1@@ -941,7 +950,7 @@ bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)/** * alloc_cpumask_var - allocate a struct cpumask * @mask: pointer to cpumask_var_t where the cpumask is returned -* @flags: GFP_ flags +* @flags: GFP\_ flags
You can say:
* @flags: %GFP_ flags
instead.
include/linux/cpumask.h bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) · line 956
Quoted 3 lines
include/linux/cpumask.h +0
-0* * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is * a nop returning a constant 1 (in <linux/cpumask.h>).
[...]
Side note:
I think 1/2 would be better to be CC'ed linux-doc as well. Please do so in respin.
Thanks, Akira
Yury Norov
maintainerRe: [PATCH 1/2] cpumask: Fix kernel-doc formatting errors in cpumask.h
Quoted 14 lines · Akira Yokosawa
Hello Viresh,
Quoted 11 lines · Viresh Kumar
This fixes various kernel-doc formatting errors in
cpumask.h:- WARNING: Inline literal start-string without end-string.
- ERROR: Unexpected indentation.
- ERROR: Unknown target name: "gfp".Signed-off-by Viresh Kumar <[email protected]>--- include/linux/cpumask.h | 65 +++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 28 deletions(-)
Quoted 14 lines
include/linux/cpumask.h line 23
Quoted 10 lines
include/linux/cpumask.h +1
-1@@ -20,7 +20,7 @@* cpumask_pr_args - printf args to output a cpumask * @maskp: cpumask to be printed * -* Can be used to provide arguments for '%*pb[l]' when printing a cpumask. +* Can be used to provide arguments for '\%*pb[l]' when printing a cpumask. kernel-doc (script) can recognize the pattern of %*pb but not %*pb[l]. "%*bp [l]" should work here.
(without quotes and a white space in front of "[").
So why not fixing kernel-doc instead?
Quoted 8 lines
No need to escape "%".
Quoted 6 lines
include/linux/cpumask.h +0
-0*/ #define cpumask_pr_args (maskp) nr_cpu_ids, cpumask_bits(maskp)@@ -166,7 +166,7 @@ static __always_inline unsigned int cpumask_first_zero(const struct cpumask *src }
Quoted 6 lines
include/linux/cpumask.h static __always_inline unsigned int cpumask_first_zero(const struct cpumask *src · line 169
Quoted 3 lines
include/linux/cpumask.h +1
-1/** -* cpumask_first_and - return the first cpu from *srcp1 & *srcp2 +* cpumask_first_and - return the first cpu from \*srcp1 & \*srcp2 kernel-doc (script) understands the pattern of *@srcp1. No need to escape "*".
Yes, please don't do it. The comments first and foremost should be a human-readable text. If we add C code, it should stay a C code.
Quoted 47 lines
But it does not (yet) parse the pattern of "*@n+1". You need to say "*@n +1", with a space in front of "+1", for the time being.
[...]
include/linux/cpumask.h unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta · line 343
Quoted 10 lines
include/linux/cpumask.h +3
-0@@ -335,6 +335,9 @@ unsigned int __pure cpumask_next_wrap(int n, const struct cpumask *mask, int sta* @mask2: the second cpumask pointer * * This saves a temporary CPU mask in many places. It is equivalent to: +* +* .. code-block:: c +* * struct cpumask tmp; * cpumask_and(&tmp, &mask1, &mask2); * for_each_cpu(cpu, &tmp) Do you really want those code-blocks to look fancy?
In kernel-doc comments, I'd normally use plain literal blocks instead.
Something like:
* This saves a temporary CPU mask in many places. It is equivalent to::
*
* struct cpumask tmp;
*cpumask_and(&tmp, &mask1, &mask2);
*for_each_cpu(cpu, &tmp)should work. Note the "::" and the empty line below it.
[...]
include/linux/cpumask.h bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) · line 953
Quoted 6 lines
include/linux/cpumask.h +1
-1@@ -941,7 +950,7 @@ bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node)/** * alloc_cpumask_var - allocate a struct cpumask * @mask: pointer to cpumask_var_t where the cpumask is returned -* @flags: GFP_ flags +* @flags: GFP\_ flags You can say:
* @flags: %GFP_ flags
instead.
include/linux/cpumask.h bool zalloc_cpumask_var_node(cpumask_var_t *mask, gfp_t flags, int node) · line 956
Quoted 3 lines
include/linux/cpumask.h +0
-0* * Only defined when CONFIG_CPUMASK_OFFSTACK=y, otherwise is * a nop returning a constant 1 (in <linux/cpumask.h>).
Quoted 6 lines
[...]
Side note:
I think 1/2 would be better to be CC'ed linux-doc as well. Please do so in respin.
I agree. I'm all for covering cpumasks documentation with kernel-doc, but it should stay readable after that.
Thanks,
Yury
Re: [PATCH 1/2] cpumask: Fix kernel-doc formatting errors in cpumask.h
Hi,
Quoted 30 lines · Yury Norov
Quoted 14 lines · Akira Yokosawa
Hello Viresh,
Quoted 11 lines · Viresh Kumar
This fixes various kernel-doc formatting errors in
cpumask.h:- WARNING: Inline literal start-string without end-string.
- ERROR: Unexpected indentation.
- ERROR: Unknown target name: "gfp".Signed-off-by Viresh Kumar <[email protected]>--- include/linux/cpumask.h | 65 +++++++++++++++++++++++------------------ 1 file changed, 37 insertions(+), 28 deletions(-)Quoted 14 lines
include/linux/cpumask.h line 23
Quoted 10 lines
include/linux/cpumask.h +1
-1@@ -20,7 +20,7 @@* cpumask_pr_args - printf args to output a cpumask * @maskp: cpumask to be printed * -* Can be used to provide arguments for '%*pb[l]' when printing a cpumask. +* Can be used to provide arguments for '\%*pb[l]' when printing a cpumask. kernel-doc (script) can recognize the pattern of %*pb but not %*pb[l]. "%*bp [l]" should work here.
(without quotes and a white space in front of "[").
Quoted 1 line
So why not fixing kernel-doc instead?
That would be great!
At the moment, re-implementation of kernel-doc into python is under way [1].
[1]: https://lore.kernel.org/[email protected]/
It is a bug compatible porting from perl to python3, but it is likely to be merged during 6.16 merge window.
I think it would be nicer to do the fix on top of python3 kernel-doc after that happens.
Thanks, Akira
Quoted 6 lines
Quoted 6 lines
No need to escape "%".
Quoted 3 lines
include/linux/cpumask.h +0
-0*/ #define cpumask_pr_args (maskp) nr_cpu_ids, cpumask_bits(maskp)
[...]
Re: [PATCH 1/2] cpumask: Fix kernel-doc formatting errors in cpumask.h
In reply to Akira YokosawaQuoted 2 lines · Akira Yokosawa
I think 1/2 would be better to be CC'ed linux-doc as well. Please do so in respin.
Thanks for the feedback Akira. linux-doc is cc'd now for entire series.
Signature · 1 line
viresh
PATCH 2/2 docs: core-api: Update kernel-api.rst to include cpumask.h
In reply to Viresh KumarUpdated Documentation/core-api/kernel-api.rst to include cpumask.h, providing better reference for CPU mask operations in the kernel API.
--- Documentation/core-api/kernel-api.rst | 6 ++++++ 1 file changed, 6 insertions(+)
Documentation/core-api/kernel-api.rst +6 -0
@@ -90,6 +90,12 @@ Bitmap Operations .. kernel-doc:: include/linux/bitmap.h :internal: +Cpumask Operations +------------------ + +.. kernel-doc:: include/linux/cpumask.h + :internal: + Command-line Parsing --------------------
Signature · 1 line
2.31.1.272.g89b43f80a514