[XEN PATCH] x86/cpu-policy: address violations of MISRA C:2012 Rule 8.3 on parameter names

Federico Serafini posted 1 patch 9 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/912cfe8f5b043bddc80cbf9f75cc0b35e02a6ecd.1689929894.git.federico.serafini@bugseng.com
xen/include/xen/lib/x86/cpu-policy.h | 29 ++++++++++++++--------------
1 file changed, 15 insertions(+), 14 deletions(-)
[XEN PATCH] x86/cpu-policy: address violations of MISRA C:2012 Rule 8.3 on parameter names
Posted by Federico Serafini 9 months, 1 week ago
Change parameter names in function declarations to be consistent with
the ones used in the correponding definitions, thus addressing
violations of MISRA C:2012 Rule 8.3: "All declarations of an object or
function shall use the same names and type qualifiers".

No functional changes.

Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
---
 xen/include/xen/lib/x86/cpu-policy.h | 29 ++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/xen/include/xen/lib/x86/cpu-policy.h b/xen/include/xen/lib/x86/cpu-policy.h
index 6d5e9edd26..bab3eecda6 100644
--- a/xen/include/xen/lib/x86/cpu-policy.h
+++ b/xen/include/xen/lib/x86/cpu-policy.h
@@ -451,23 +451,24 @@ typedef xen_msr_entry_t msr_entry_buffer_t[];
  * Serialise the CPUID leaves of a cpu_policy object into an array of cpuid
  * leaves.
  *
- * @param policy     The cpu_policy to serialise.
- * @param leaves     The array of leaves to serialise into.
- * @param nr_entries The number of entries in 'leaves'.
+ * @param p            The cpu_policy to serialise.
+ * @param leaves       The array of leaves to serialise into.
+ * @param nr_entries_p The number of entries in 'leaves'.
  * @returns -errno
  *
  * Writes at most CPUID_MAX_SERIALISED_LEAVES.  May fail with -ENOBUFS if the
  * leaves array is too short.  On success, nr_entries is updated with the
  * actual number of leaves written.
  */
-int x86_cpuid_copy_to_buffer(const struct cpu_policy *policy,
-                             cpuid_leaf_buffer_t leaves, uint32_t *nr_entries);
+int x86_cpuid_copy_to_buffer(const struct cpu_policy *p,
+                             cpuid_leaf_buffer_t leaves,
+                             uint32_t *nr_entries_p);
 
 /**
  * Unserialise the CPUID leaves of a cpu_policy object into an array of cpuid
  * leaves.
  *
- * @param policy      The cpu_policy to unserialise into.
+ * @param p           The cpu_policy to unserialise into.
  * @param leaves      The array of leaves to unserialise from.
  * @param nr_entries  The number of entries in 'leaves'.
  * @param err_leaf    Optional hint for error diagnostics.
@@ -481,7 +482,7 @@ int x86_cpuid_copy_to_buffer(const struct cpu_policy *policy,
  * No content validation of in-range leaves is performed.  Synthesised data is
  * recalculated.
  */
-int x86_cpuid_copy_from_buffer(struct cpu_policy *policy,
+int x86_cpuid_copy_from_buffer(struct cpu_policy *p,
                                const cpuid_leaf_buffer_t leaves,
                                uint32_t nr_entries, uint32_t *err_leaf,
                                uint32_t *err_subleaf);
@@ -489,22 +490,22 @@ int x86_cpuid_copy_from_buffer(struct cpu_policy *policy,
 /**
  * Serialise the MSRs of a cpu_policy object into an array.
  *
- * @param policy     The cpu_policy to serialise.
- * @param msrs       The array of msrs to serialise into.
- * @param nr_entries The number of entries in 'msrs'.
+ * @param p            The cpu_policy to serialise.
+ * @param msrs         The array of msrs to serialise into.
+ * @param nr_entries_p The number of entries in 'msrs'.
  * @returns -errno
  *
  * Writes at most MSR_MAX_SERIALISED_ENTRIES.  May fail with -ENOBUFS if the
  * buffer array is too short.  On success, nr_entries is updated with the
  * actual number of msrs written.
  */
-int x86_msr_copy_to_buffer(const struct cpu_policy *policy,
-                           msr_entry_buffer_t msrs, uint32_t *nr_entries);
+int x86_msr_copy_to_buffer(const struct cpu_policy *p,
+                           msr_entry_buffer_t msrs, uint32_t *nr_entries_p);
 
 /**
  * Unserialise the MSRs of a cpu_policy object from an array of msrs.
  *
- * @param policy     The cpu_policy object to unserialise into.
+ * @param p          The cpu_policy object to unserialise into.
  * @param msrs       The array of msrs to unserialise from.
  * @param nr_entries The number of entries in 'msrs'.
  * @param err_msr    Optional hint for error diagnostics.
@@ -518,7 +519,7 @@ int x86_msr_copy_to_buffer(const struct cpu_policy *policy,
  *
  * No content validation is performed on the data stored in the policy object.
  */
-int x86_msr_copy_from_buffer(struct cpu_policy *policy,
+int x86_msr_copy_from_buffer(struct cpu_policy *p,
                              const msr_entry_buffer_t msrs, uint32_t nr_entries,
                              uint32_t *err_msr);
 
-- 
2.34.1
Re: [XEN PATCH] x86/cpu-policy: address violations of MISRA C:2012 Rule 8.3 on parameter names
Posted by Stefano Stabellini 9 months, 1 week ago
On Fri, 21 Jul 2023, Federico Serafini wrote:
> Change parameter names in function declarations to be consistent with
> the ones used in the correponding definitions, thus addressing
> violations of MISRA C:2012 Rule 8.3: "All declarations of an object or
> function shall use the same names and type qualifiers".
> 
> No functional changes.
> 
> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>


> ---
>  xen/include/xen/lib/x86/cpu-policy.h | 29 ++++++++++++++--------------
>  1 file changed, 15 insertions(+), 14 deletions(-)
> 
> diff --git a/xen/include/xen/lib/x86/cpu-policy.h b/xen/include/xen/lib/x86/cpu-policy.h
> index 6d5e9edd26..bab3eecda6 100644
> --- a/xen/include/xen/lib/x86/cpu-policy.h
> +++ b/xen/include/xen/lib/x86/cpu-policy.h
> @@ -451,23 +451,24 @@ typedef xen_msr_entry_t msr_entry_buffer_t[];
>   * Serialise the CPUID leaves of a cpu_policy object into an array of cpuid
>   * leaves.
>   *
> - * @param policy     The cpu_policy to serialise.
> - * @param leaves     The array of leaves to serialise into.
> - * @param nr_entries The number of entries in 'leaves'.
> + * @param p            The cpu_policy to serialise.
> + * @param leaves       The array of leaves to serialise into.
> + * @param nr_entries_p The number of entries in 'leaves'.
>   * @returns -errno
>   *
>   * Writes at most CPUID_MAX_SERIALISED_LEAVES.  May fail with -ENOBUFS if the
>   * leaves array is too short.  On success, nr_entries is updated with the
>   * actual number of leaves written.
>   */
> -int x86_cpuid_copy_to_buffer(const struct cpu_policy *policy,
> -                             cpuid_leaf_buffer_t leaves, uint32_t *nr_entries);
> +int x86_cpuid_copy_to_buffer(const struct cpu_policy *p,
> +                             cpuid_leaf_buffer_t leaves,
> +                             uint32_t *nr_entries_p);
>  
>  /**
>   * Unserialise the CPUID leaves of a cpu_policy object into an array of cpuid
>   * leaves.
>   *
> - * @param policy      The cpu_policy to unserialise into.
> + * @param p           The cpu_policy to unserialise into.
>   * @param leaves      The array of leaves to unserialise from.
>   * @param nr_entries  The number of entries in 'leaves'.
>   * @param err_leaf    Optional hint for error diagnostics.
> @@ -481,7 +482,7 @@ int x86_cpuid_copy_to_buffer(const struct cpu_policy *policy,
>   * No content validation of in-range leaves is performed.  Synthesised data is
>   * recalculated.
>   */
> -int x86_cpuid_copy_from_buffer(struct cpu_policy *policy,
> +int x86_cpuid_copy_from_buffer(struct cpu_policy *p,
>                                 const cpuid_leaf_buffer_t leaves,
>                                 uint32_t nr_entries, uint32_t *err_leaf,
>                                 uint32_t *err_subleaf);
> @@ -489,22 +490,22 @@ int x86_cpuid_copy_from_buffer(struct cpu_policy *policy,
>  /**
>   * Serialise the MSRs of a cpu_policy object into an array.
>   *
> - * @param policy     The cpu_policy to serialise.
> - * @param msrs       The array of msrs to serialise into.
> - * @param nr_entries The number of entries in 'msrs'.
> + * @param p            The cpu_policy to serialise.
> + * @param msrs         The array of msrs to serialise into.
> + * @param nr_entries_p The number of entries in 'msrs'.
>   * @returns -errno
>   *
>   * Writes at most MSR_MAX_SERIALISED_ENTRIES.  May fail with -ENOBUFS if the
>   * buffer array is too short.  On success, nr_entries is updated with the
>   * actual number of msrs written.
>   */
> -int x86_msr_copy_to_buffer(const struct cpu_policy *policy,
> -                           msr_entry_buffer_t msrs, uint32_t *nr_entries);
> +int x86_msr_copy_to_buffer(const struct cpu_policy *p,
> +                           msr_entry_buffer_t msrs, uint32_t *nr_entries_p);
>  
>  /**
>   * Unserialise the MSRs of a cpu_policy object from an array of msrs.
>   *
> - * @param policy     The cpu_policy object to unserialise into.
> + * @param p          The cpu_policy object to unserialise into.
>   * @param msrs       The array of msrs to unserialise from.
>   * @param nr_entries The number of entries in 'msrs'.
>   * @param err_msr    Optional hint for error diagnostics.
> @@ -518,7 +519,7 @@ int x86_msr_copy_to_buffer(const struct cpu_policy *policy,
>   *
>   * No content validation is performed on the data stored in the policy object.
>   */
> -int x86_msr_copy_from_buffer(struct cpu_policy *policy,
> +int x86_msr_copy_from_buffer(struct cpu_policy *p,
>                               const msr_entry_buffer_t msrs, uint32_t nr_entries,
>                               uint32_t *err_msr);
>  
> -- 
> 2.34.1
>
Re: [XEN PATCH] x86/cpu-policy: address violations of MISRA C:2012 Rule 8.3 on parameter names
Posted by Jan Beulich 9 months, 1 week ago
On 22.07.2023 00:39, Stefano Stabellini wrote:
> On Fri, 21 Jul 2023, Federico Serafini wrote:
>> Change parameter names in function declarations to be consistent with
>> the ones used in the correponding definitions, thus addressing
>> violations of MISRA C:2012 Rule 8.3: "All declarations of an object or
>> function shall use the same names and type qualifiers".
>>
>> No functional changes.
>>
>> Signed-off-by: Federico Serafini <federico.serafini@bugseng.com>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

Acked-by: Jan Beulich <jbeulich@suse.com>