mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 00:33:55 -06:00
vfio/pci: Make vfio_intx_enable() return bool
This is to follow the coding standand in qapi/error.h to return bool for bool-valued functions. Suggested-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
e942d8f08d
commit
c32bab074e
1 changed files with 8 additions and 11 deletions
|
@ -261,7 +261,7 @@ static void vfio_irqchip_change(Notifier *notify, void *data)
|
||||||
vfio_intx_update(vdev, &vdev->intx.route);
|
vfio_intx_update(vdev, &vdev->intx.route);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
static bool vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
{
|
{
|
||||||
uint8_t pin = vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1);
|
uint8_t pin = vfio_pci_read_config(&vdev->pdev, PCI_INTERRUPT_PIN, 1);
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
|
@ -270,7 +270,7 @@ static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
|
|
||||||
|
|
||||||
if (!pin) {
|
if (!pin) {
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
vfio_disable_interrupts(vdev);
|
vfio_disable_interrupts(vdev);
|
||||||
|
@ -292,7 +292,7 @@ static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
ret = event_notifier_init(&vdev->intx.interrupt, 0);
|
ret = event_notifier_init(&vdev->intx.interrupt, 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
error_setg_errno(errp, -ret, "event_notifier_init failed");
|
error_setg_errno(errp, -ret, "event_notifier_init failed");
|
||||||
return ret;
|
return false;
|
||||||
}
|
}
|
||||||
fd = event_notifier_get_fd(&vdev->intx.interrupt);
|
fd = event_notifier_get_fd(&vdev->intx.interrupt);
|
||||||
qemu_set_fd_handler(fd, vfio_intx_interrupt, NULL, vdev);
|
qemu_set_fd_handler(fd, vfio_intx_interrupt, NULL, vdev);
|
||||||
|
@ -301,7 +301,7 @@ static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
|
VFIO_IRQ_SET_ACTION_TRIGGER, fd, errp)) {
|
||||||
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
qemu_set_fd_handler(fd, NULL, NULL, vdev);
|
||||||
event_notifier_cleanup(&vdev->intx.interrupt);
|
event_notifier_cleanup(&vdev->intx.interrupt);
|
||||||
return -errno;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vfio_intx_enable_kvm(vdev, &err)) {
|
if (!vfio_intx_enable_kvm(vdev, &err)) {
|
||||||
|
@ -311,7 +311,7 @@ static int vfio_intx_enable(VFIOPCIDevice *vdev, Error **errp)
|
||||||
vdev->interrupt = VFIO_INT_INTx;
|
vdev->interrupt = VFIO_INT_INTx;
|
||||||
|
|
||||||
trace_vfio_intx_enable(vdev->vbasedev.name);
|
trace_vfio_intx_enable(vdev->vbasedev.name);
|
||||||
return 0;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void vfio_intx_disable(VFIOPCIDevice *vdev)
|
static void vfio_intx_disable(VFIOPCIDevice *vdev)
|
||||||
|
@ -836,8 +836,7 @@ static void vfio_msix_disable(VFIOPCIDevice *vdev)
|
||||||
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX);
|
vfio_disable_irqindex(&vdev->vbasedev, VFIO_PCI_MSIX_IRQ_INDEX);
|
||||||
|
|
||||||
vfio_msi_disable_common(vdev);
|
vfio_msi_disable_common(vdev);
|
||||||
vfio_intx_enable(vdev, &err);
|
if (!vfio_intx_enable(vdev, &err)) {
|
||||||
if (err) {
|
|
||||||
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2450,8 +2449,7 @@ void vfio_pci_post_reset(VFIOPCIDevice *vdev)
|
||||||
Error *err = NULL;
|
Error *err = NULL;
|
||||||
int nr;
|
int nr;
|
||||||
|
|
||||||
vfio_intx_enable(vdev, &err);
|
if (!vfio_intx_enable(vdev, &err)) {
|
||||||
if (err) {
|
|
||||||
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
error_reportf_err(err, VFIO_MSG_PREFIX, vdev->vbasedev.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3194,8 +3192,7 @@ static void vfio_realize(PCIDevice *pdev, Error **errp)
|
||||||
vfio_intx_routing_notifier);
|
vfio_intx_routing_notifier);
|
||||||
vdev->irqchip_change_notifier.notify = vfio_irqchip_change;
|
vdev->irqchip_change_notifier.notify = vfio_irqchip_change;
|
||||||
kvm_irqchip_add_change_notifier(&vdev->irqchip_change_notifier);
|
kvm_irqchip_add_change_notifier(&vdev->irqchip_change_notifier);
|
||||||
ret = vfio_intx_enable(vdev, errp);
|
if (!vfio_intx_enable(vdev, errp)) {
|
||||||
if (ret) {
|
|
||||||
goto out_deregister;
|
goto out_deregister;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue