Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4668043rdh; Wed, 29 Nov 2023 07:33:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4pUJM5lqTdnwaT7EThIu6z+bqFLHOfryFA0PORcmGcAWgMSZIFlySg1teGpss92+f+REK X-Received: by 2002:a05:6a21:6d98:b0:18c:376d:fbe8 with SMTP id wl24-20020a056a216d9800b0018c376dfbe8mr17058027pzb.41.1701271991583; Wed, 29 Nov 2023 07:33:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701271991; cv=none; d=google.com; s=arc-20160816; b=apvC8D/vhGYjmWGYm3auw7Iece7bCej3DAB80ZvUQBgdenOJwl3HcfYzEJwxmByE7U T6TCNXJnsptrZ6cKmpjHtcNbX+DkVgfGP+c/VWEqHczlerdZHQ6M/Ql32GkdSKpFysfw 83keWdiJG14pbXRmtnXMllSA1jbcy+JeWPVFmVm2Da/Wmd6pc7Ic0jN9uh2lLFORsYg8 RXze2i/qcuDa98aEvJHjMKgjUHfVxkBlKKZoD06TR33gkHcQymTDqX6tbm1G/sE+NR/8 40EAemld1E9YgWf/ZfUH7pAWHDSCAhVjlILFKkl81SSJd/wPI6V0kR/T3WGtMs7HezAA Q+dA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=pi9QHu1A1Ej9/jel2EpQIrIFAh0IMY+L6UjFudKshbQ=; fh=IEuBX9TfWMzD4mfUcJhPrvfRITX3xBdNRbcivcwj2gA=; b=EEUpyZlQ+eDeYa5xzU6HGCI+dChoJbS1BSrbg4vRlwPUG8PHj+/vFsJ2GTzTa/XMui nD/t1OoMDhhjERCCGl61q0BXX0zFLrJ/25gNXJbDky/n/QMEhhrsKa/wBWnUsm2mHtIH XrqGlz5IfvuuKUaTfNoSDkN3Pu+4BTspFI1UFUX5wJgOfZ6C8FsdU8fLTvWC5EW6Sy9r pHUdYfYmzTFN8IGgTatSpgFtJ6ieRUHRMcQD9YKCKS/EoJk5wSfOr+eh3rSaH7XS4j3J aHNePBSMixpXCibupe/gFEztp3mF01X+Fuz8IUb1izlxxSppxPl97/PUoCUN8rsnaMw9 2smg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jombYPbi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id x16-20020a62fb10000000b006cc01aa0480si10151392pfm.370.2023.11.29.07.33.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 07:33:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jombYPbi; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id E8A988043027; Wed, 29 Nov 2023 07:33:08 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343532AbjK2Pcv (ORCPT + 99 others); Wed, 29 Nov 2023 10:32:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234907AbjK2Pct (ORCPT ); Wed, 29 Nov 2023 10:32:49 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C534D43 for ; Wed, 29 Nov 2023 07:32:56 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD688C433C8; Wed, 29 Nov 2023 15:32:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701271975; bh=IMG9YxIDr+Fl0aVREHwJe3Kp/N91o8sNpnhBkBL/3ec=; h=From:To:Cc:Subject:Date:From; b=jombYPbint8xcSYE63U6Vb+r6J/OhHwSHDwRI4LUYDP6Zo3RBxoekRSiAD2Vr9pPL snrYkeva4AjB/vBkxVGudlG12nPSCb4QX8uUa4Mv6ALz/svtS2Gt487tt0PSwOZB2F g8WmEh24o2EjEzx0/uaJkYK9r/XXOfRz9jNTNmbcfN/s5R5v8UyUu+j3oNIXj0eBF5 yI4VSAZ099/hS5Y3rHH/DIZgDTyIUB+QcO6XW6sTEMTr+/voOzaFgPHqc6Qyw/hJL+ /vWi5E5hFlvKgpAPQO/07ou8SaoTDJ860pl+ANdneOZP7i78EHjggJ/vps5dJra2xG 2k8koekovXphA== From: Arnd Bergmann To: Paolo Bonzini , Yu Zhang , Isaku Yamahata , Chao Peng , "Kirill A. Shutemov" Cc: Arnd Bergmann , Sean Christopherson , kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] KVM: guest-memfd: fix unused-function warning Date: Wed, 29 Nov 2023 16:32:40 +0100 Message-Id: <20231129153250.3105359-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 07:33:09 -0800 (PST) From: Arnd Bergmann With migration disabled, one function becomes unused: virt/kvm/guest_memfd.c:262:12: error: 'kvm_gmem_migrate_folio' defined but not used [-Werror=unused-function] 262 | static int kvm_gmem_migrate_folio(struct address_space *mapping, | ^~~~~~~~~~~~~~~~~~~~~~ Replace the #ifdef around the reference with a corresponding PTR_IF() check that lets the compiler know how it is otherwise used. Fixes: a7800aa80ea4 ("KVM: Add KVM_CREATE_GUEST_MEMFD ioctl() for guest-specific backing memory") Signed-off-by: Arnd Bergmann --- virt/kvm/guest_memfd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/virt/kvm/guest_memfd.c b/virt/kvm/guest_memfd.c index 16d58806e913..1a0355b95379 100644 --- a/virt/kvm/guest_memfd.c +++ b/virt/kvm/guest_memfd.c @@ -301,9 +301,8 @@ static int kvm_gmem_error_folio(struct address_space *mapping, static const struct address_space_operations kvm_gmem_aops = { .dirty_folio = noop_dirty_folio, -#ifdef CONFIG_MIGRATION - .migrate_folio = kvm_gmem_migrate_folio, -#endif + .migrate_folio = PTR_IF(IS_ENABLED(CONFIG_MIGRATION), + kvm_gmem_migrate_folio), .error_remove_folio = kvm_gmem_error_folio, }; -- 2.39.2