Skip to contentSkip to conversation

x86: address some violations of MISRA C:2012 Rule 8.2

PATCH In review Federico Serafini 2 participants 17 messages Oct 23, 2023 – Oct 30, 2023

lore
Share & tools
lore
#1 lore raw

PATCH 1/8 x86/hvm: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/drivers/passthrough/x86/hvm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/drivers/passthrough/x86/hvm.c +2 -2
index 8175ba629a..d3627e4af7 100644
@@ -724,8 +724,8 @@ bool pt_pirq_cleanup_check(struct hvm_pirq_dpci *dpci)
 }
 
 int pt_pirq_iterate(struct domain *d,
-                    int (*cb)(struct domain *,
-                              struct hvm_pirq_dpci *, void *),
+                    int (*cb)(struct domain *d,
+                              struct hvm_pirq_dpci *pirq_dpci, void *arg),
                     void *arg)
 {
     int rc = 0;
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/8 x86/mmconfig: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/arch/x86/x86_64/mmconfig.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
xen/arch/x86/x86_64/mmconfig.h +2 -2
index 2d49fc79a0..3da4b21e9b 100644
@@ -70,5 +70,5 @@ int pci_mmcfg_reserved(uint64_t address, unsigned int segment,
                        unsigned int start_bus, unsigned int end_bus,
                        unsigned int flags);
 int pci_mmcfg_arch_init(void);
-int pci_mmcfg_arch_enable(unsigned int);
-void pci_mmcfg_arch_disable(unsigned int);
+int pci_mmcfg_arch_enable(unsigned int idx);
+void pci_mmcfg_arch_disable(unsigned int idx);
Signature · 1 line
2.34.1
#11 lore raw

PATCH 6/8 x86/physdev: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/arch/x86/physdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/physdev.c +3 -3
index 2f1d955a96..47c4da0af7 100644
@@ -18,9 +18,9 @@
 #include <xsm/xsm.h>
 #include <asm/p2m.h>
 
-int physdev_map_pirq(domid_t, int type, int *index, int *pirq_p,
-                     struct msi_info *);
-int physdev_unmap_pirq(domid_t, int pirq);
+int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
+                     struct msi_info *msi);
+int physdev_unmap_pirq(domid_t domid, int pirq);
 
 #include "x86_64/mmconfig.h"
 
Signature · 1 line
2.34.1
#15 lore raw

PATCH 8/8 x86/sysctl: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/arch/x86/sysctl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/sysctl.c +1 -1
index c107f40c62..1d40d82c5a 100644
@@ -118,7 +118,7 @@ long arch_do_sysctl(
         unsigned int cpu = sysctl->u.cpu_hotplug.cpu;
         unsigned int op  = sysctl->u.cpu_hotplug.op;
         bool plug;
-        long (*fn)(void *);
+        long (*fn)(void *data);
         void *hcpu;
 
         switch ( op )
Signature · 1 line
2.34.1
#5 lore raw

PATCH 3/8 x86/vpmu: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/arch/x86/include/asm/vpmu.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/vpmu.h +1 -1
index b165acc6c2..7858aec6ca 100644
@@ -35,7 +35,7 @@ struct arch_vpmu_ops {
     void (*arch_vpmu_destroy)(struct vcpu *v);
     int (*arch_vpmu_save)(struct vcpu *v, bool_t to_guest);
     int (*arch_vpmu_load)(struct vcpu *v, bool_t from_guest);
-    void (*arch_vpmu_dump)(const struct vcpu *);
+    void (*arch_vpmu_dump)(const struct vcpu *v);
 
 #ifdef CONFIG_MEM_SHARING
     int (*allocate_context)(struct vcpu *v);
Signature · 1 line
2.34.1
#9 lore raw

PATCH 5/8 x86/pci: address a violation of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter name. No functional change.

---
 xen/arch/x86/include/asm/pci.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/pci.h +1 -1
index f4a58c8acf..542e284f14 100644
@@ -37,7 +37,7 @@ struct arch_pci_dev {
 int pci_conf_write_intercept(unsigned int seg, unsigned int bdf,
                              unsigned int reg, unsigned int size,
                              uint32_t *data);
-int pci_msi_conf_write_intercept(struct pci_dev *, unsigned int reg,
+int pci_msi_conf_write_intercept(struct pci_dev *pdev, unsigned int reg,
                                  unsigned int size, uint32_t *data);
 bool_t pci_mmcfg_decode(unsigned long mfn, unsigned int *seg,
                         unsigned int *bdf);
Signature · 1 line
2.34.1
#13 lore raw

PATCH 7/8 x86/platform_hypercall: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini

Add missing parameter names. No functional change.

---
 xen/arch/x86/platform_hypercall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
xen/arch/x86/platform_hypercall.c +3 -3
index 9469de9045..c1ab552c57 100644
@@ -46,9 +46,9 @@ struct resource_access {
     xenpf_resource_entry_t *entries;
 };
 
-long cf_check cpu_frequency_change_helper(void *);
-void check_resource_access(struct resource_access *);
-void cf_check resource_access(void *);
+long cf_check cpu_frequency_change_helper(void *data);
+void check_resource_access(struct resource_access *ra);
+void cf_check resource_access(void *info);
 
 #ifndef COMPAT
 typedef long ret_t;
Signature · 1 line
2.34.1
#0 lore raw

cover x86: address some violations of MISRA C:2012 Rule 8.2

This patch series addresses some of the violations of Rule 8.2 adding the missing parameter names.

Federico Serafini (8):
x86/hvm: address violations of MISRA C:2012 Rule 8.2 x86/mmconfig: address violations of MISRA C:2012 Rule 8.2 x86/vpmu: address a violation of MISRA C:2012 Rule 8.2 x86/smp: address a violation of MISRA C:2012 Rule 8.2 x86/pci: address a violation of MISRA C:2012 Rule 8.2 x86/physdev: address violations of MISRA C:2012 Rule 8.2 x86/platform_hypercall: address violations of MISRA C:2012 Rule 8.2 x86/sysctl: address a violation of MISRA C:2012 Rule 8.2

 xen/arch/x86/include/asm/pci.h    | 2 +-
 xen/arch/x86/include/asm/smp.h    | 2 +-
 xen/arch/x86/include/asm/vpmu.h   | 2 +-
 xen/arch/x86/physdev.c            | 6 +++---
 xen/arch/x86/platform_hypercall.c | 6 +++---
 xen/arch/x86/sysctl.c             | 2 +-
 xen/arch/x86/x86_64/mmconfig.h    | 4 ++--
 xen/drivers/passthrough/x86/hvm.c | 4 ++--
 8 files changed, 14 insertions(+), 14 deletions(-)
Signature · 1 line
2.34.1
#7 lore raw

PATCH 4/8 x86/smp: address a violation of MISRA C:2012 Rule 8.2

Add missing parameter name. No functional change.

---
 xen/arch/x86/include/asm/smp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/include/asm/smp.h +1 -1
index 41a3b6a0da..5c2de4920f 100644
@@ -32,7 +32,7 @@ extern bool park_offline_cpus;
 
 void smp_send_nmi_allbutself(void);
 
-void send_IPI_mask(const cpumask_t *, int vector);
+void send_IPI_mask(const cpumask_t *mask, int vector);
 void send_IPI_self(int vector);
 
 extern void (*mtrr_hook) (void);
Signature · 1 line
2.34.1
Acked-by on v1 6/8
#12 lore raw

Re: [XEN PATCH 6/8] x86/physdev: address violations of MISRA C:2012 Rule 8.2

In reply to Federico Serafini
Quoted 3 lines · Federico Serafini

Add missing parameter names. No functional change.

Albeit I can't resist to say that ...

xen/arch/x86/physdev.c line 23

Quoted 12 lines
xen/arch/x86/physdev.c +3 -3
@@ -18,9 +18,9 @@
 #include <xsm/xsm.h>
 #include <asm/p2m.h>
 
-int physdev_map_pirq(domid_t, int type, int *index, int *pirq_p,
-                     struct msi_info *);
-int physdev_unmap_pirq(domid_t, int pirq);
+int physdev_map_pirq(domid_t domid, int type, int *index, int *pirq_p,
+                     struct msi_info *msi);
+int physdev_unmap_pirq(domid_t domid, int pirq);

... this is a good example where adding names to the so far unnamed parameters adds no new useful information at all, as their types were already sufficient to express all that needs expressing here.

Jan