diff mbox series

[XEN,10/13] x86/viridian: address violations of MISRA C:2012 Rule 7.3

Message ID 63f0d6385f302517244604af5536ffebd74ba589.1691053438.git.simone.ballarin@bugseng.com (mailing list archive)
State New, archived
Headers show
Series xen: address violations of MISRA C:2012 Rule 7.3 | expand

Commit Message

Simone Ballarin Aug. 3, 2023, 10:22 a.m. UTC
From: Gianluca Luparini <gianluca.luparini@bugseng.com>

The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
states:
"The lowercase character 'l' shall not be used in a literal suffix".

Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.

The changes in this patch are mechanical.

Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
---
 xen/arch/x86/hvm/viridian/synic.c |  2 +-
 xen/arch/x86/hvm/viridian/time.c  | 10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Stefano Stabellini Aug. 4, 2023, 12:54 a.m. UTC | #1
On Thu, 3 Aug 2023, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@bugseng.com>
> 
> The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
> states:
> "The lowercase character 'l' shall not be used in a literal suffix".
> 
> Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
> If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.
> 
> The changes in this patch are mechanical.
> 
> Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>

Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Paul Durrant Sept. 12, 2023, 6:23 a.m. UTC | #2
On 03/08/2023 11:22, Simone Ballarin wrote:
> From: Gianluca Luparini <gianluca.luparini@bugseng.com>
> 
> The xen sources contain violations of MISRA C:2012 Rule 7.3 whose headline
> states:
> "The lowercase character 'l' shall not be used in a literal suffix".
> 
> Use the "L" suffix instead of the "l" suffix, to avoid potential ambiguity.
> If the "u" suffix is used near "L", use the "U" suffix instead, for consistency.
> 
> The changes in this patch are mechanical.
> 
> Signed-off-by: Gianluca Luparini <gianluca.luparini@bugseng.com>
> Signed-off-by: Simone Ballarin <simone.ballarin@bugseng.com>
> ---
>   xen/arch/x86/hvm/viridian/synic.c |  2 +-
>   xen/arch/x86/hvm/viridian/time.c  | 10 +++++-----
>   2 files changed, 6 insertions(+), 6 deletions(-)
> 

Reviewed-by: Paul Durrant <paul@xen.org>
diff mbox series

Patch

diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/synic.c
index 83d7addfc3..8cf600cec6 100644
--- a/xen/arch/x86/hvm/viridian/synic.c
+++ b/xen/arch/x86/hvm/viridian/synic.c
@@ -233,7 +233,7 @@  int viridian_synic_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val)
          * should be set to. Assume everything but the bottom bit
          * should be zero.
          */
-        *val = 1ul;
+        *val = 1UL;
         break;
 
     case HV_X64_MSR_SIEFP:
diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/time.c
index a3ea3fa067..137577384f 100644
--- a/xen/arch/x86/hvm/viridian/time.c
+++ b/xen/arch/x86/hvm/viridian/time.c
@@ -66,7 +66,7 @@  static void update_reference_tsc(const struct domain *d, bool initialize)
      * The offset value is calculated on restore after migration and
      * ensures that Windows will not see a large jump in ReferenceTime.
      */
-    p->tsc_scale = ((10000ul << 32) / d->arch.tsc_khz) << 32;
+    p->tsc_scale = ((10000UL << 32) / d->arch.tsc_khz) << 32;
     p->tsc_offset = trc->off;
     smp_wmb();
 
@@ -79,7 +79,7 @@  static uint64_t trc_val(const struct domain *d, int64_t offset)
     uint64_t tsc, scale;
 
     tsc = hvm_get_guest_tsc(pt_global_vcpu_target(d));
-    scale = ((10000ul << 32) / d->arch.tsc_khz) << 32;
+    scale = ((10000UL << 32) / d->arch.tsc_khz) << 32;
 
     return hv_scale_tsc(tsc, scale, offset);
 }
@@ -201,7 +201,7 @@  static void start_stimer(struct viridian_stimer *vs)
     ASSERT(expiration - now > 0);
 
     vs->expiration = expiration;
-    timeout = (expiration - now) * 100ull;
+    timeout = (expiration - now) * 100ULL;
 
     vs->started = true;
     clear_bit(stimerx, &vv->stimer_pending);
@@ -413,14 +413,14 @@  int viridian_time_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val)
         if ( viridian_feature_mask(d) & HVMPV_no_freq )
             return X86EMUL_EXCEPTION;
 
-        *val = (uint64_t)d->arch.tsc_khz * 1000ull;
+        *val = (uint64_t)d->arch.tsc_khz * 1000ULL;
         break;
 
     case HV_X64_MSR_APIC_FREQUENCY:
         if ( viridian_feature_mask(d) & HVMPV_no_freq )
             return X86EMUL_EXCEPTION;
 
-        *val = 1000000000ull / APIC_BUS_CYCLE_NS;
+        *val = 1000000000ULL / APIC_BUS_CYCLE_NS;
         break;
 
     case HV_X64_MSR_REFERENCE_TSC: