Commit a6fe0438 authored by Kameron Carr's avatar Kameron Carr Committed by Wei Liu
Browse files

Drivers: hv: Change hv_free_hyperv_page() to take void * argument



Currently hv_free_hyperv_page() takes an unsigned long argument, which
is inconsistent with the void * return value from the corresponding
hv_alloc_hyperv_page() function and variants. This creates unnecessary
extra casting.

Change the hv_free_hyperv_page() argument type to void *.
Also remove redundant casts from invocations of
hv_alloc_hyperv_page() and variants.

Signed-off-by: default avatarKameron Carr <kameroncarr@linux.microsoft.com>
Reviewed-by: default avatarNuno Das Neves <nunodasneves@linux.microsoft.com>
Reviewed-by: default avatarDexuan Cui <decui@microsoft.com>
Link: https://lore.kernel.org/r/1687558189-19734-1-git-send-email-kameroncarr@linux.microsoft.com


Signed-off-by: default avatarWei Liu <wei.liu@kernel.org>
parent 6995e2de
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -209,8 +209,7 @@ int vmbus_connect(void)
	 * Setup the vmbus event connection for channel interrupt
	 * abstraction stuff
	 */
	vmbus_connection.int_page =
	(void *)hv_alloc_hyperv_zeroed_page();
	vmbus_connection.int_page = hv_alloc_hyperv_zeroed_page();
	if (vmbus_connection.int_page == NULL) {
		ret = -ENOMEM;
		goto cleanup;
@@ -225,8 +224,8 @@ int vmbus_connect(void)
	 * Setup the monitor notification facility. The 1st page for
	 * parent->child and the 2nd page for child->parent
	 */
	vmbus_connection.monitor_pages[0] = (void *)hv_alloc_hyperv_page();
	vmbus_connection.monitor_pages[1] = (void *)hv_alloc_hyperv_page();
	vmbus_connection.monitor_pages[0] = hv_alloc_hyperv_page();
	vmbus_connection.monitor_pages[1] = hv_alloc_hyperv_page();
	if ((vmbus_connection.monitor_pages[0] == NULL) ||
	    (vmbus_connection.monitor_pages[1] == NULL)) {
		ret = -ENOMEM;
@@ -333,15 +332,15 @@ void vmbus_disconnect(void)
		destroy_workqueue(vmbus_connection.work_queue);

	if (vmbus_connection.int_page) {
		hv_free_hyperv_page((unsigned long)vmbus_connection.int_page);
		hv_free_hyperv_page(vmbus_connection.int_page);
		vmbus_connection.int_page = NULL;
	}

	set_memory_encrypted((unsigned long)vmbus_connection.monitor_pages[0], 1);
	set_memory_encrypted((unsigned long)vmbus_connection.monitor_pages[1], 1);

	hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[0]);
	hv_free_hyperv_page((unsigned long)vmbus_connection.monitor_pages[1]);
	hv_free_hyperv_page(vmbus_connection.monitor_pages[0]);
	hv_free_hyperv_page(vmbus_connection.monitor_pages[1]);
	vmbus_connection.monitor_pages[0] = NULL;
	vmbus_connection.monitor_pages[1] = NULL;
}
+5 −5
Original line number Diff line number Diff line
@@ -115,12 +115,12 @@ void *hv_alloc_hyperv_zeroed_page(void)
}
EXPORT_SYMBOL_GPL(hv_alloc_hyperv_zeroed_page);

void hv_free_hyperv_page(unsigned long addr)
void hv_free_hyperv_page(void *addr)
{
	if (PAGE_SIZE == HV_HYP_PAGE_SIZE)
		free_page(addr);
		free_page((unsigned long)addr);
	else
		kfree((void *)addr);
		kfree(addr);
}
EXPORT_SYMBOL_GPL(hv_free_hyperv_page);

@@ -253,7 +253,7 @@ static void hv_kmsg_dump_unregister(void)
	atomic_notifier_chain_unregister(&panic_notifier_list,
					 &hyperv_panic_report_block);

	hv_free_hyperv_page((unsigned long)hv_panic_page);
	hv_free_hyperv_page(hv_panic_page);
	hv_panic_page = NULL;
}

@@ -270,7 +270,7 @@ static void hv_kmsg_dump_register(void)
	ret = kmsg_dump_register(&hv_kmsg_dumper);
	if (ret) {
		pr_err("Hyper-V: kmsg dump register error 0x%x\n", ret);
		hv_free_hyperv_page((unsigned long)hv_panic_page);
		hv_free_hyperv_page(hv_panic_page);
		hv_panic_page = NULL;
	}
}
+1 −1
Original line number Diff line number Diff line
@@ -190,7 +190,7 @@ int hv_common_cpu_die(unsigned int cpu);

void *hv_alloc_hyperv_page(void);
void *hv_alloc_hyperv_zeroed_page(void);
void hv_free_hyperv_page(unsigned long addr);
void hv_free_hyperv_page(void *addr);

/**
 * hv_cpu_number_to_vp_number() - Map CPU to VP.