From 155675350d580bf5cdcc022e7f82e9ffda17bc45 Mon Sep 17 00:00:00 2001 From: Shiqing Gao Date: Mon, 12 Nov 2018 12:09:03 +0800 Subject: [PATCH] hv: unify the function pointer assignment Assign function pointer without the unary & operator. Take 'register_io_emulation_handler' as an example: void register_io_emulation_handler(struct acrn_vm *vm, const struct vm_io_range *range, io_read_fn_t io_read_fn_ptr, io_write_fn_t io_write_fn_ptr) The last two parameters are function pointer. Sometimes we use function designator directly, while sometimes with the unary & operator, as shown below. - without & register_io_emulation_handler(vm, &range, vuart_read, vuart_write); - with & register_io_emulation_handler(vm, &pci_cfg_range, &pci_cfg_io_read, &pci_cfg_io_write); To unify the coding style, we will go with the first way. Tracked-On: #861 Signed-off-by: Shiqing Gao Acked-by: Eddie Dong --- hypervisor/dm/vpci/vpci.c | 3 +-- hypervisor/dm/vpic.c | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index cc29339d9..489191d3b 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -131,8 +131,7 @@ void vpci_init(struct acrn_vm *vm) #endif if ((vpci->ops->init != NULL) && (vpci->ops->init(vm) == 0)) { - register_io_emulation_handler(vm, PCI_PIO_IDX, &pci_cfg_range, - &pci_cfg_io_read, &pci_cfg_io_write); + register_io_emulation_handler(vm, PCI_PIO_IDX, &pci_cfg_range, pci_cfg_io_read, pci_cfg_io_write); /* This is a tmp solution to avoid sos reboot failure, it need pass-thru IO port CF9 for Reset Control * register. */ diff --git a/hypervisor/dm/vpic.c b/hypervisor/dm/vpic.c index 6aa94bd2c..709a1af6f 100644 --- a/hypervisor/dm/vpic.c +++ b/hypervisor/dm/vpic.c @@ -867,11 +867,11 @@ static void vpic_register_io_handler(struct acrn_vm *vm) }; register_io_emulation_handler(vm, PIC_MASTER_PIO_IDX, &master_range, - &vpic_master_io_read, &vpic_master_io_write); + vpic_master_io_read, vpic_master_io_write); register_io_emulation_handler(vm, PIC_SLAVE_PIO_IDX, &slave_range, - &vpic_slave_io_read, &vpic_slave_io_write); + vpic_slave_io_read, vpic_slave_io_write); register_io_emulation_handler(vm, PIC_ELC_PIO_IDX, &elcr_range, - &vpic_elc_io_read, &vpic_elc_io_write); + vpic_elc_io_read, vpic_elc_io_write); } void vpic_init(struct acrn_vm *vm)