mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-09 04:39:34 +00:00
hv: vpci: fix MISRA-C violations related to variable declarations
78D: Global variable should be declared const. Global variables should be declared constant wherever possible to avoid unintentional modification. 27D: Variable should be declared static pci_ops_vdev_msi is not accessed by other files. Remove the declaration from the header and define it with the static qualifier; Because it's referenced by populate_msi_struct(), so move the define statements forward. 33D: No real declaration for external variable certain variables are available in sharing mode or partition mode only, so that the declarations in header files must be enclosed with CONFIG_PARTITION_MODE Tracked-On: #861 Signed-off-by: Zide Chen <zide.chen@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
@@ -98,7 +98,7 @@ struct pci_vdev {
|
||||
struct pci_vdev_ops ops[MAX_VPCI_DEV_OPS];
|
||||
uint32_t nr_ops;
|
||||
#else
|
||||
struct pci_vdev_ops *ops;
|
||||
const struct pci_vdev_ops *ops;
|
||||
#endif
|
||||
|
||||
struct acrn_vpci *vpci;
|
||||
@@ -137,11 +137,13 @@ struct vpci_ops {
|
||||
struct acrn_vpci {
|
||||
struct acrn_vm *vm;
|
||||
struct pci_addr_info addr_info;
|
||||
struct vpci_ops *ops;
|
||||
const struct vpci_ops *ops;
|
||||
};
|
||||
|
||||
extern struct pci_vdev_ops pci_ops_vdev_hostbridge;
|
||||
extern struct pci_vdev_ops pci_ops_vdev_pt;
|
||||
#ifdef CONFIG_PARTITION_MODE
|
||||
extern const struct pci_vdev_ops pci_ops_vdev_hostbridge;
|
||||
extern const struct pci_vdev_ops pci_ops_vdev_pt;
|
||||
#endif
|
||||
|
||||
void vpci_init(struct acrn_vm *vm);
|
||||
void vpci_cleanup(struct acrn_vm *vm);
|
||||
|
Reference in New Issue
Block a user