Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp11478471rwd; Thu, 22 Jun 2023 13:59:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Qe8NIkPVS8pR1XWaceSlc8czLid5STWO4A+/fr68EQSfyxJXP3flyniNei6UQgZHKENHc X-Received: by 2002:a05:6870:e0cd:b0:19e:d407:a753 with SMTP id a13-20020a056870e0cd00b0019ed407a753mr20259426oab.46.1687467558658; Thu, 22 Jun 2023 13:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687467558; cv=none; d=google.com; s=arc-20160816; b=RFWCYzxoFYCiaKQeCYPyS71G9gd7E602+/xfgJhgmMt+Y0ow+/yISgJ2BEyNS8QAkf 4pzHmRDQy9iRHaKe6TYZKgfXSKhwrtqwBVg4KM6UmLQnS9yy2VfckJuVlDtTwFIrnG3W IHudwz0tk/u6A36iVUl+cScOirLcPncPxmO7xkwSvl1adCim/U8TapCQ0V6q1w5m1KnG RAPdIgpKmB8dFhRRx2HtOGJQJJ1hcKjOlxSjFvGDfXQ3jW5EaHkAPBRZRjA1Lvgwli9s 2HGr4Vmk6n6utNamTv2WqxMkc59FOT7XX3NduVsTbvyoRaAX4R03B5ytIKHi/T2ilvKF vEnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:to:from:dkim-signature :dkim-filter; bh=G/L27QpOPIVcLupzo2qhywZyKrjocR4zy910V2nTJ3Q=; b=n98qfhUz1UQU8pTmEu+n8nd38gkt81vWP2xBCsLAP16PHorOnUXeGdjx1bbC5A6rJ/ cDuvwPK3S3gcKCSPWUDEVUARh52i5u5GDV/bOW3vK+mpKxPucCEIi7ho5GG5Ev7T4JVu 57CX2BtrPVrJNmUKEz8sUDT7XbSpOTM56/kxiYb45GNUc3vfcMqS4dw8gA6bqCPjUcAQ 8H4TtyXwEhM/qyH7P73wOg3Oh77U/PB1LRHVBeDhXNv3ArdL3R6eQ1g9bk3NK2M+nhz1 /gNuWhRQrqPthWbQwzMNPBwE/BnQmXYzWYD1+ygdRBr/ecej+/nqiDt7BeBRNlaaRI41 2X/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CHwBNOAG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bk13-20020a056a02028d00b005538567360csi3250343pgb.60.2023.06.22.13.59.06; Thu, 22 Jun 2023 13:59:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=CHwBNOAG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230042AbjFVUHa (ORCPT + 99 others); Thu, 22 Jun 2023 16:07:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35354 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbjFVUH3 (ORCPT ); Thu, 22 Jun 2023 16:07:29 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4CABD1FF0; Thu, 22 Jun 2023 13:07:26 -0700 (PDT) Received: from linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net (linux.microsoft.com [13.77.154.182]) by linux.microsoft.com (Postfix) with ESMTPSA id B368821C20B1; Thu, 22 Jun 2023 13:07:25 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B368821C20B1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1687464445; bh=G/L27QpOPIVcLupzo2qhywZyKrjocR4zy910V2nTJ3Q=; h=From:To:Subject:Date:From; b=CHwBNOAGtb54sJpZs0trgyKQPSn1QcomzqZfVavEKCk6c383qsZXoKkCBmQqXTgon PL4SJuAZBz7cyuCavNNvjChhWlkcoKJbiuQk+Q5xs261zb11r/1FxlgIgcH09kI5z3 WgnVT1ElRsYbOqgzp9ckzda3IwyTYcBY5ORKDpLk= From: Kameron Carr To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, arnd@arndb.de, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: [PATCH] Drivers: hv: Change hv_free_hyperv_page() to take void * argument Date: Thu, 22 Jun 2023 13:07:07 -0700 Message-Id: <1687464427-4722-1-git-send-email-kameroncarr@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-19.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. --- drivers/hv/connection.c | 13 ++++++------- drivers/hv/hv_common.c | 10 +++++----- include/asm-generic/mshyperv.h | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index 5978e9d..ebf15f3 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -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; } diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 542a1d5..6a2258f 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -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; } } diff --git a/include/asm-generic/mshyperv.h b/include/asm-generic/mshyperv.h index 402a8c1..a8f4b65 100644 --- a/include/asm-generic/mshyperv.h +++ b/include/asm-generic/mshyperv.h @@ -190,7 +190,7 @@ static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) 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. -- 1.8.3.1