From eb4f46987a815b1e034f798c0753199ee67ec03b Mon Sep 17 00:00:00 2001 From: dongshen Date: Thu, 14 Mar 2019 14:42:56 -0700 Subject: [PATCH] HV: add const qualifier for the deinit vdev op functions This is to fix the following misra c violation: Pointer param should be declared pointer to const. : vdev Tracked-On: #2534 Signed-off-by: dongshen Acked-by: Eddie Dong --- hypervisor/dm/vpci/hostbridge.c | 2 +- hypervisor/dm/vpci/msi.c | 2 +- hypervisor/dm/vpci/msix.c | 2 +- hypervisor/dm/vpci/pci_priv.h | 8 ++++---- hypervisor/dm/vpci/pci_pt.c | 2 +- hypervisor/include/dm/vpci.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/hypervisor/dm/vpci/hostbridge.c b/hypervisor/dm/vpci/hostbridge.c index e0030543b..d4bb58cd1 100644 --- a/hypervisor/dm/vpci/hostbridge.c +++ b/hypervisor/dm/vpci/hostbridge.c @@ -86,7 +86,7 @@ int32_t vdev_hostbridge_init(struct pci_vdev *vdev) return 0; } -int32_t vdev_hostbridge_deinit(__unused struct pci_vdev *vdev) +int32_t vdev_hostbridge_deinit(__unused const struct pci_vdev *vdev) { return 0; } diff --git a/hypervisor/dm/vpci/msi.c b/hypervisor/dm/vpci/msi.c index 1a48dcb9c..44580222c 100644 --- a/hypervisor/dm/vpci/msi.c +++ b/hypervisor/dm/vpci/msi.c @@ -167,7 +167,7 @@ int32_t vmsi_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, ui return ret; } -int32_t vmsi_deinit(struct pci_vdev *vdev) +int32_t vmsi_deinit(const struct pci_vdev *vdev) { if (has_msi_cap(vdev)) { ptirq_remove_msix_remapping(vdev->vpci->vm, vdev->vbdf.value, 1U); diff --git a/hypervisor/dm/vpci/msix.c b/hypervisor/dm/vpci/msix.c index 27a39bea4..2fe38351d 100644 --- a/hypervisor/dm/vpci/msix.c +++ b/hypervisor/dm/vpci/msix.c @@ -415,7 +415,7 @@ int32_t vmsix_init(struct pci_vdev *vdev) * @pre vdev->vpci != NULL * @pre vdev->vpci->vm != NULL */ -int32_t vmsix_deinit(struct pci_vdev *vdev) +int32_t vmsix_deinit(const struct pci_vdev *vdev) { if (has_msix_cap(vdev)) { if (vdev->msix.table_count != 0U) { diff --git a/hypervisor/dm/vpci/pci_priv.h b/hypervisor/dm/vpci/pci_priv.h index 29ecb0c22..e2f03bc6e 100644 --- a/hypervisor/dm/vpci/pci_priv.h +++ b/hypervisor/dm/vpci/pci_priv.h @@ -72,12 +72,12 @@ extern const struct vpci_ops partition_mode_vpci_ops; int32_t vdev_hostbridge_init(struct pci_vdev *vdev); int32_t vdev_hostbridge_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val); int32_t vdev_hostbridge_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val); -int32_t vdev_hostbridge_deinit(__unused struct pci_vdev *vdev); +int32_t vdev_hostbridge_deinit(__unused const struct pci_vdev *vdev); int32_t vdev_pt_init(struct pci_vdev *vdev); int32_t vdev_pt_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val); int32_t vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val); -int32_t vdev_pt_deinit(struct pci_vdev *vdev); +int32_t vdev_pt_deinit(const struct pci_vdev *vdev); #else extern const struct vpci_ops sharing_mode_vpci_ops; @@ -87,12 +87,12 @@ extern const struct pci_vdev_ops pci_ops_vdev_msix; int32_t vmsi_init(struct pci_vdev *vdev); int32_t vmsi_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val); int32_t vmsi_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val); -int32_t vmsi_deinit(struct pci_vdev *vdev); +int32_t vmsi_deinit(const struct pci_vdev *vdev); int32_t vmsix_init(struct pci_vdev *vdev); int32_t vmsix_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val); int32_t vmsix_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val); -int32_t vmsix_deinit(struct pci_vdev *vdev); +int32_t vmsix_deinit(const struct pci_vdev *vdev); #endif uint32_t pci_vdev_read_cfg(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes); diff --git a/hypervisor/dm/vpci/pci_pt.c b/hypervisor/dm/vpci/pci_pt.c index 809fa9d31..fdbdb3a94 100644 --- a/hypervisor/dm/vpci/pci_pt.c +++ b/hypervisor/dm/vpci/pci_pt.c @@ -91,7 +91,7 @@ int32_t vdev_pt_init(struct pci_vdev *vdev) return ret; } -int32_t vdev_pt_deinit(struct pci_vdev *vdev) +int32_t vdev_pt_deinit(const struct pci_vdev *vdev) { int32_t ret; struct acrn_vm *vm = vdev->vpci->vm; diff --git a/hypervisor/include/dm/vpci.h b/hypervisor/include/dm/vpci.h index 5c6bb4f1e..ad7677a4d 100644 --- a/hypervisor/include/dm/vpci.h +++ b/hypervisor/include/dm/vpci.h @@ -36,7 +36,7 @@ struct pci_vdev; struct pci_vdev_ops { int32_t (*init)(struct pci_vdev *vdev); - int32_t (*deinit)(struct pci_vdev *vdev); + int32_t (*deinit)(const struct pci_vdev *vdev); int32_t (*cfgwrite)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);