Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Drivers: hv: vmbus: Simplify allocation of vmbus_evt

The per-cpu variable vmbus_evt is currently dynamically allocated. It's
only 8 bytes, so just allocate it statically to simplify and save a few
lines of code.

Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Reviewed-by: Long Li <longli@microsoft.com>
Signed-off-by: Wei Liu <wei.liu@kernel.org>

authored by

Michael Kelley and committed by
Wei Liu
30d25a8f 36d6cbb6

+8 -14
+8 -14
drivers/hv/vmbus_drv.c
··· 52 52 53 53 static int hyperv_cpuhp_online; 54 54 55 - static long __percpu *vmbus_evt; 55 + static DEFINE_PER_CPU(long, vmbus_evt); 56 56 57 57 /* Values parsed from ACPI DSDT */ 58 58 int vmbus_irq; ··· 1520 1520 if (vmbus_irq == -1) { 1521 1521 hv_setup_vmbus_handler(vmbus_isr); 1522 1522 } else { 1523 - vmbus_evt = alloc_percpu(long); 1524 1523 ret = request_percpu_irq(vmbus_irq, vmbus_percpu_isr, 1525 - "Hyper-V VMbus", vmbus_evt); 1524 + "Hyper-V VMbus", &vmbus_evt); 1526 1525 if (ret) { 1527 1526 pr_err("Can't request Hyper-V VMbus IRQ %d, Err %d", 1528 1527 vmbus_irq, ret); 1529 - free_percpu(vmbus_evt); 1530 1528 goto err_setup; 1531 1529 } 1532 1530 } ··· 1553 1555 return 0; 1554 1556 1555 1557 err_connect: 1556 - if (vmbus_irq == -1) { 1558 + if (vmbus_irq == -1) 1557 1559 hv_remove_vmbus_handler(); 1558 - } else { 1559 - free_percpu_irq(vmbus_irq, vmbus_evt); 1560 - free_percpu(vmbus_evt); 1561 - } 1560 + else 1561 + free_percpu_irq(vmbus_irq, &vmbus_evt); 1562 1562 err_setup: 1563 1563 if (IS_ENABLED(CONFIG_PREEMPT_RT) && vmbus_irq_initialized) { 1564 1564 smpboot_unregister_percpu_thread(&vmbus_irq_threads); ··· 3026 3030 vmbus_connection.conn_state = DISCONNECTED; 3027 3031 hv_stimer_global_cleanup(); 3028 3032 vmbus_disconnect(); 3029 - if (vmbus_irq == -1) { 3033 + if (vmbus_irq == -1) 3030 3034 hv_remove_vmbus_handler(); 3031 - } else { 3032 - free_percpu_irq(vmbus_irq, vmbus_evt); 3033 - free_percpu(vmbus_evt); 3034 - } 3035 + else 3036 + free_percpu_irq(vmbus_irq, &vmbus_evt); 3035 3037 if (IS_ENABLED(CONFIG_PREEMPT_RT) && vmbus_irq_initialized) { 3036 3038 smpboot_unregister_percpu_thread(&vmbus_irq_threads); 3037 3039 vmbus_irq_initialized = false;