From: K. Y. Srinivasan Date: Fri, 15 Jul 2011 20:38:56 +0000 (-0700) Subject: Staging: hv: vmbus: Don't wait indefinitely for IRQ resouces X-Git-Url: https://openfabrics.org/gitweb/?a=commitdiff_plain;h=2dda95f80b2afa4bf85c6419f40e11b545cda422;p=~shefty%2Frdma-dev.git Staging: hv: vmbus: Don't wait indefinitely for IRQ resouces If an attempt is made to load the vmbus driver on a non-Hyper-V platform, the load operation will hang since we currently wait indefinitely to retrieve the IRQ information. This is done in the context of an acpi callback context (which will obviously not happen when this driver is loaded on a non-Hyper-V platform). This patch fixes the problem. Signed-off-by: K. Y. Srinivasan Signed-off-by: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/hv/vmbus_drv.c b/drivers/staging/hv/vmbus_drv.c index 1c949f5fb71..67a4f336df9 100644 --- a/drivers/staging/hv/vmbus_drv.c +++ b/drivers/staging/hv/vmbus_drv.c @@ -768,7 +768,7 @@ MODULE_DEVICE_TABLE(pci, microsoft_hv_pci_table); static int __init hv_acpi_init(void) { - int ret; + int ret, t; init_completion(&probe_event); @@ -781,16 +781,25 @@ static int __init hv_acpi_init(void) if (ret) return ret; - wait_for_completion(&probe_event); + t = wait_for_completion_timeout(&probe_event, 5*HZ); + if (t == 0) { + ret = -ETIMEDOUT; + goto cleanup; + } if (irq <= 0) { - acpi_bus_unregister_driver(&vmbus_acpi_driver); - return -ENODEV; + ret = -ENODEV; + goto cleanup; } ret = vmbus_bus_init(irq); if (ret) - acpi_bus_unregister_driver(&vmbus_acpi_driver); + goto cleanup; + + return 0; + +cleanup: + acpi_bus_unregister_driver(&vmbus_acpi_driver); return ret; }