Skip to content

Commit ce4d71e

Browse files
fyin1wenlingz
authored andcommitted
vpci: fix coding style issue
This is a followup patch to fix the coding style issue introduced in by commit "c2d25aafb889ade954af8795df2405a94024d860": The unmodified pointer should be defined as const Also addressed one comments from Fei to use reversed function call in vpci_init_pt_dev and vpci_deinit_pt_dev. Tracked-On: #3241 Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent a27ce27 commit ce4d71e

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

hypervisor/dm/vpci/vhostbridge.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static void deinit_vhostbridge(__unused struct pci_vdev *vdev)
100100
* @pre vdev->vpci != NULL
101101
* @pre vdev->vpci->vm != NULL
102102
*/
103-
static int32_t vhostbridge_read_cfg(struct pci_vdev *vdev, uint32_t offset,
103+
static int32_t vhostbridge_read_cfg(const struct pci_vdev *vdev, uint32_t offset,
104104
uint32_t bytes, uint32_t *val)
105105
{
106106
*val = pci_vdev_read_cfg(vdev, offset, bytes);
@@ -122,14 +122,14 @@ static int32_t vhostbridge_write_cfg(struct pci_vdev *vdev, uint32_t offset,
122122
return 0;
123123
}
124124

125-
static struct pci_vdev_ops vhostbridge_ops = {
125+
static const struct pci_vdev_ops vhostbridge_ops = {
126126
.init_vdev = init_vhostbridge,
127127
.deinit_vdev = deinit_vhostbridge,
128128
.write_vdev_cfg = vhostbridge_write_cfg,
129129
.read_vdev_cfg = vhostbridge_read_cfg,
130130
};
131131

132-
struct pci_vdev_ops *get_vhostbridge_ops(void)
132+
const struct pci_vdev_ops *get_vhostbridge_ops(void)
133133
{
134134
return &vhostbridge_ops;
135135
}

hypervisor/dm/vpci/vpci.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,9 +346,9 @@ static void vpci_init_pt_dev(struct pci_vdev *vdev)
346346

347347
static void vpci_deinit_pt_dev(struct pci_vdev *vdev)
348348
{
349-
deinit_vmsi(vdev);
350-
deinit_vmsix(vdev);
351349
remove_vdev_pt_iommu_domain(vdev);
350+
deinit_vmsix(vdev);
351+
deinit_vmsi(vdev);
352352
}
353353

354354
static int32_t vpci_write_pt_dev_cfg(struct pci_vdev *vdev, uint32_t offset,
@@ -368,7 +368,7 @@ static int32_t vpci_write_pt_dev_cfg(struct pci_vdev *vdev, uint32_t offset,
368368
return 0;
369369
}
370370

371-
static int32_t vpci_read_pt_dev_cfg(struct pci_vdev *vdev, uint32_t offset,
371+
static int32_t vpci_read_pt_dev_cfg(const struct pci_vdev *vdev, uint32_t offset,
372372
uint32_t bytes, uint32_t *val)
373373
{
374374
if (vbar_access(vdev, offset, bytes)) {
@@ -385,7 +385,7 @@ static int32_t vpci_read_pt_dev_cfg(struct pci_vdev *vdev, uint32_t offset,
385385
return 0;
386386
}
387387

388-
static struct pci_vdev_ops pci_pt_dev_ops = {
388+
static const struct pci_vdev_ops pci_pt_dev_ops = {
389389
.init_vdev = vpci_init_pt_dev,
390390
.deinit_vdev = vpci_deinit_pt_dev,
391391
.write_vdev_cfg = vpci_write_pt_dev_cfg,

hypervisor/include/dm/vpci.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct pci_vdev_ops {
6969
void (*init_vdev)(struct pci_vdev *vdev);
7070
void (*deinit_vdev)(struct pci_vdev *vdev);
7171
int32_t (*write_vdev_cfg)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
72-
int32_t (*read_vdev_cfg)(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
72+
int32_t (*read_vdev_cfg)(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
7373
};
7474

7575
struct pci_vdev {
@@ -95,7 +95,7 @@ struct pci_vdev {
9595
struct acrn_vm_pci_ptdev_config *ptdev_config;
9696

9797
/* Pointer to corressponding operations */
98-
struct pci_vdev_ops *vdev_ops;
98+
const struct pci_vdev_ops *vdev_ops;
9999
};
100100

101101
struct pci_addr_info {
@@ -116,6 +116,6 @@ void vpci_cleanup(const struct acrn_vm *vm);
116116
void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf);
117117
void vpci_reset_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf);
118118

119-
struct pci_vdev_ops *get_vhostbridge_ops(void);
119+
const struct pci_vdev_ops *get_vhostbridge_ops(void);
120120

121121
#endif /* VPCI_H_ */

0 commit comments

Comments
 (0)