From patchwork Wed Feb 28 13:33:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 129988 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp1030835lja; Wed, 28 Feb 2018 05:34:20 -0800 (PST) X-Google-Smtp-Source: AH8x224iR0hJ330Y7vDyN4d3JcX4CJ1zdzOcX6UelXx8RZeMcB3d6cU5p/9EzUwffC2zAVbZEuiX X-Received: by 10.98.17.86 with SMTP id z83mr17773899pfi.207.1519824860217; Wed, 28 Feb 2018 05:34:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519824860; cv=none; d=google.com; s=arc-20160816; b=UggLLnHEV4/3AmZCM23Cpy/cZUOTczocibTIPJ8kgaE99Z2fvQcKDRybap9uRmsXF/ bW2gKw2jJvyRfbO9SIuQfRT+NKAzfNfdHcY3jboThY7RlZqcuJ4bKdA/xB01Rep9vOzx holdSMfNZ6JafzIVKlP4qpMNAzljRg8VkwJvzcxkbcqqB5D6dgKOIn2OXkRWjWsKEpb+ 6xIPaJNVXLwSIMcj8KE7v1Zr7YeZP3nidUSk9T1pqKLG61/26/0aVAwrio16L8LuGoX1 d9/B7NgvILwtk4QUW3Zo0qrcR2Vl3sgNhqCpL7Xt8hrUOpZE8lx3dHxGUac3gIsOA3ya dv4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=B1r8CWbhV6YY46sZKNiBIt3bxlqIFsRtLSB/33hhRBs=; b=O0Iq/Nbk/hb5sE8AAaRS1sVPdGBy7ohMYHgHKykZtRJVmWJNHpE3wEbGtwmlkID0Tx SmtcwePMh4tiY34Dl7Cs/1wtPwNSQXxMmJmH+eCiK4wmPYugFetVNUb+1dbNWo5RkNx5 EI7W4h9QDux3x6QbNd14EkDYBzwGUUH9ywLBmF0ze+hXw3orU/oxIU7LSz40TqhVFLAF OMdejEvt/xHbSeFkaknHeJmLP8n7M1xnQYZW/jLlDR5+j0OkS05kGvIdJ8FIzWxIl/Te py5+7zB9sTfGPq/ct/6xX7OfO5MXkBGvAGA/8paHZfy2CCKr9VP128I1OH3fyhv6XVbz 82ng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o7si1042341pgs.314.2018.02.28.05.34.19; Wed, 28 Feb 2018 05:34:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932247AbeB1NeP (ORCPT + 28 others); Wed, 28 Feb 2018 08:34:15 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:57295 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932185AbeB1NeN (ORCPT ); Wed, 28 Feb 2018 08:34:13 -0500 Received: from wuerfel.lan ([95.208.111.237]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MKdqV-1epe9g40wR-001yQe; Wed, 28 Feb 2018 14:34:00 +0100 From: Arnd Bergmann To: Gabriel Somlo , "Michael S. Tsirkin" Cc: Arnd Bergmann , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Vasyl Gomonovych , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org Subject: [PATCH] fw_cfg: avoid unused function warning Date: Wed, 28 Feb 2018 14:33:49 +0100 Message-Id: <20180228133357.1848600-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:BrHYVvR3dpn9WUCBjSId6/kWQbpReZhJFSRN6/W1vAwWdFj76zf 0aElZkGPffnu3N+WdN4/K27U3gE5DD50GbKfuZXosBlL1mJh+eIMEw+OzoCmSIq6rxFT1Kd 0TS5xO1d6IAGalcczNwhjq88bPjQU1xbyn1uBHTthejnU1p0sMQpUVlFs7XIE7Upzh8dasj 3h/vYKieFX6sypHruofAQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:TFXL65DSNA8=:RDj2BYfaHk0THwxjYA6rC7 GpxdJ1T2QWo3fI65tPK5kdT+boEf95NNi8sF6QRpSf06yV8SX6uxSjyvMM/gv9zNw/xnNFOTD US68SrF9Dy0rzxyfmRMx8M8i9l394DpC0a34fhS0f8Bq2ttLcdiBj6TaDzYVh4mf6qd5ndKst OvqTyC4Iy9tymhp8EwNxn/3tlwc7NQWb/gCLldw/JvkAcdHwwpz6cG8cfaBC45RhJrfi7w+aD vIz+odm2J/5L/zKtRpafcV1J8nFWqHimcwa19gVRr9k8CoZecjxcGqUGe1azXgiQ8uAZ8FBDX nr3L2jxUAkHRBRDmXI4HrM3rHThvsnQnF6Ya1mR9tnvhAR+kGw5JL3fWvgNb7ni1ONDWz/HLk EIalgFH59yzbyrBO7PGUFsuEhIVKofnI9mPtSyAj38L8syoNLHXYnbu9A+8/5udahqw5om0zM 9DeIEOYg63xQNPRCToHaLwSo6Igik4203cNSHwHhjUKTFqiEgO749bxcG1mpCcclQ+ikW07+T NWwlHGxycua2J9BJND95eIpP03Q2H7jfDVWVxU4u8YQYfYdaZgt1z+r1V25eg2caliKXOBNsR b2excilWmXNgYW07QkUwnuGhNnsugvp12y8I52xu3FWa1wQ+8kvYXSE/vmfT6Ck0A16ta++Kf eKqpcCbrbcfKA0QlMFL81y1eDFpocCPZFxqL2i49u4kG7aEUw6hNc0CFSdyWRQ9Zn9lGDvl9c +Ls6wTPqx8Jw3haVxlwc2EHGr3+dtgMWxOWmDg== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newly introduced fw_cfg_dma_transfer() function is unused when CONFIG_CRASH_CORE is disabled: drivers/firmware/qemu_fw_cfg.c:89:16: error: 'fw_cfg_dma_transfer' defined but not used [-Werror=unused-function] static ssize_t fw_cfg_dma_transfer(void *address, u32 length, u32 control) This moves it into the #ifdef section that hides its caller to avoid the warning. Fixes: 47e78bfb5426 ("fw_cfg: write vmcoreinfo details") Signed-off-by: Arnd Bergmann --- drivers/firmware/qemu_fw_cfg.c | 60 +++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 30 deletions(-) -- 2.9.0 diff --git a/drivers/firmware/qemu_fw_cfg.c b/drivers/firmware/qemu_fw_cfg.c index 3015e77aebca..f002bb40519b 100644 --- a/drivers/firmware/qemu_fw_cfg.c +++ b/drivers/firmware/qemu_fw_cfg.c @@ -66,6 +66,36 @@ static void fw_cfg_sel_endianness(u16 key) iowrite16(key, fw_cfg_reg_ctrl); } +/* read chunk of given fw_cfg blob (caller responsible for sanity-check) */ +static ssize_t fw_cfg_read_blob(u16 key, + void *buf, loff_t pos, size_t count) +{ + u32 glk = -1U; + acpi_status status; + + /* If we have ACPI, ensure mutual exclusion against any potential + * device access by the firmware, e.g. via AML methods: + */ + status = acpi_acquire_global_lock(ACPI_WAIT_FOREVER, &glk); + if (ACPI_FAILURE(status) && status != AE_NOT_CONFIGURED) { + /* Should never get here */ + WARN(1, "fw_cfg_read_blob: Failed to lock ACPI!\n"); + memset(buf, 0, count); + return -EINVAL; + } + + mutex_lock(&fw_cfg_dev_lock); + fw_cfg_sel_endianness(key); + while (pos-- > 0) + ioread8(fw_cfg_reg_data); + ioread8_rep(fw_cfg_reg_data, buf, count); + mutex_unlock(&fw_cfg_dev_lock); + + acpi_release_global_lock(glk); + return count; +} + +#ifdef CONFIG_CRASH_CORE static inline bool fw_cfg_dma_enabled(void) { return (fw_cfg_rev & FW_CFG_VERSION_DMA) && fw_cfg_reg_dma; @@ -124,36 +154,6 @@ static ssize_t fw_cfg_dma_transfer(void *address, u32 length, u32 control) return ret; } -/* read chunk of given fw_cfg blob (caller responsible for sanity-check) */ -static ssize_t fw_cfg_read_blob(u16 key, - void *buf, loff_t pos, size_t count) -{ - u32 glk = -1U; - acpi_status status; - - /* If we have ACPI, ensure mutual exclusion against any potential - * device access by the firmware, e.g. via AML methods: - */ - status = acpi_acquire_global_lock(ACPI_WAIT_FOREVER, &glk); - if (ACPI_FAILURE(status) && status != AE_NOT_CONFIGURED) { - /* Should never get here */ - WARN(1, "fw_cfg_read_blob: Failed to lock ACPI!\n"); - memset(buf, 0, count); - return -EINVAL; - } - - mutex_lock(&fw_cfg_dev_lock); - fw_cfg_sel_endianness(key); - while (pos-- > 0) - ioread8(fw_cfg_reg_data); - ioread8_rep(fw_cfg_reg_data, buf, count); - mutex_unlock(&fw_cfg_dev_lock); - - acpi_release_global_lock(glk); - return count; -} - -#ifdef CONFIG_CRASH_CORE /* write chunk of given fw_cfg blob (caller responsible for sanity-check) */ static ssize_t fw_cfg_write_blob(u16 key, void *buf, loff_t pos, size_t count)