From patchwork Thu Mar 7 10:32:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10842651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53D9E17E4 for ; Thu, 7 Mar 2019 10:33:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D4AF2E5A6 for ; Thu, 7 Mar 2019 10:33:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3058B2E5A8; Thu, 7 Mar 2019 10:33:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B13992E5A6 for ; Thu, 7 Mar 2019 10:33:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=JjrSRPMm+PULkF+wusIeV7Dn1V1WnPJqVhXa7FwGef8=; b=gK4FbRsED7RdnA I97bMpNMgowXHLAJGEinBYzwXiaIJTnrMoh7t/9hSLxtRVwyAjQj7Rv5Bec4B0UvK4tYvM3NcqwVV NBdLbVZluk30eja71DnKS4/8xi4FyK3Q21s19JFIjE6psXCXakTXuHmeyFbIlcF5RvZUMFu55nL8D yV4XR87I2kBo1EQvPupfI7lx50KanW7SDt6+94IjcVVxY4spwgYTnsedGBo+tDFu2pVzaql9GHDby NDnaRK52HDdhX5f0jJXJh7+MDgdK/Q0uXD5TxeHuznMhgLrNt1tnPNlKKzNROMJPT8XkublrnQfFY 3TxZ8ZbY4+4AgSFzpnoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1qL7-0007yA-62; Thu, 07 Mar 2019 10:33:25 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h1qL3-0007xh-60 for linux-arm-kernel@lists.infradead.org; Thu, 07 Mar 2019 10:33:23 +0000 Received: from wuerfel.lan ([109.192.41.194]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.129]) with ESMTPA (Nemesis) id 1MRT6b-1hP8M1035J-00NUFT; Thu, 07 Mar 2019 11:33:12 +0100 From: Arnd Bergmann To: Mathieu Poirier , Alexander Shishkin Subject: [PATCH] coresight: catu: fix clang build warning Date: Thu, 7 Mar 2019 11:32:58 +0100 Message-Id: <20190307103309.1574563-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:c5ju05gEucBB6zZY3P2Gk3MADAkbnTmVeAGJvJqDf5glRpyqIKz SGjkw2CZoQ9rt/Ae524B9YFCtf7CeF18XjAMG9uSa20NT4qfNcFfG2sEgOcCDTgx+mGIRpb U5iM2yS4u0JBP+VOTZMq+KIZ7U2qW/cOAmoC2Ykl1CLPbD64RHGCPAW2Itpvi5m31h8u6Fo +MVEzvx6oO6PWxJ71tNnA== X-UI-Out-Filterresults: notjunk:1;V03:K0:IeNdZLy7GZk=:QA6Nm190tOEmM3iweydNGz /rAw6+PCEAC0pqAqagUcsIu8SJZB5b9Gi7pDNzrdlmPYS93fBPgXLkNZqUIUQ3htO1Vz7y5M7 9q2S5BS++bpQN6iIBh+XwOZqcLLb7cuAN7lpyM9ufu6feJ9eS+YGUaV22Adq+3JHFYSQ9Sz7R esQUUoYgOifiobfBkiuVoAHEy0gRZVGiLzJCbcnC4uLPbnaYOEIiDaRIvTTcEjYVaU/DfF0+O 5LHNMmUmRboBHqVuS+x3Q3op/5lvVBnZjt7R2konLcoNaOXRB2GmuZaXZKmZcI5E/tSuV7j9T FYkp3jylh4CwNnreQHOn+GLQPzWh9lGToeYXpvU0T+k6Uufsp2PkB2bQkvtBcpdrlPmYt9izN 6MfMG0G/iHRCECfoE0keA0qvMsv8vQlgapxm1GbhivaHL8AJFz515cNGppfZEkfPhg761YL8+ vfZ8JPd3M718SeA+GucQ4AkXxZJb20C8dYM61/ujJVOIPSOx5jUHfqhe8UpgtvgNdscF2F40M hCgwdQLMA3SLCk2BzhMsWq2d0aWIhAtr9c71/t6LwTbZqqMkhDmCH0AMJjtJSwZKWP+O/uI90 +KPPLRrQsTV3m1PSzmB1e1UGQDwVLxboRntpV8LGoQiPAmXceZ6TLHSKqoSQzbwTjajTNNa2A OuFPA3VD40rFPxsx780Uu73HQYL5Vc2ga7iTXQvep/yKTXkPA1GNEaOTmWjvCta565qhjdr7G gfaQALgulNQ8X+HbhwT2mjyix7T91aQuCOsrRw== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190307_023321_535142_91A53EB4 X-CRM114-Status: GOOD ( 10.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Suzuki K Poulose , Greg Kroah-Hartman , Nick Desaulniers , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Clang points out a syntax error, as the etr_catu_buf_ops structure is declared 'static' before the type is known: In file included from drivers/hwtracing/coresight/coresight-tmc-etr.c:12: drivers/hwtracing/coresight/coresight-catu.h:116:40: warning: tentative definition of variable with internal linkage has incomplete non-array type 'const struct etr_buf_operations' [-Wtentative-definition-incomplete-type] static const struct etr_buf_operations etr_catu_buf_ops; ^ drivers/hwtracing/coresight/coresight-catu.h:116:21: note: forward declaration of 'struct etr_buf_operations' static const struct etr_buf_operations etr_catu_buf_ops; This seems worth fixing in the code, so replace pointer to the empty constant structure with a NULL pointer. We need an extra NULL pointer check here, but the result should be better object code otherwise, avoiding the silly empty structure. Fixes: 434d611cddef ("coresight: catu: Plug in CATU as a backend for ETR buffer") Signed-off-by: Arnd Bergmann Reviewed-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-catu.h | 5 ----- drivers/hwtracing/coresight/coresight-tmc-etr.c | 4 ++-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-catu.h b/drivers/hwtracing/coresight/coresight-catu.h index 1b281f0dcccc..1d2ad183fd92 100644 --- a/drivers/hwtracing/coresight/coresight-catu.h +++ b/drivers/hwtracing/coresight/coresight-catu.h @@ -109,11 +109,6 @@ static inline bool coresight_is_catu_device(struct coresight_device *csdev) return true; } -#ifdef CONFIG_CORESIGHT_CATU extern const struct etr_buf_operations etr_catu_buf_ops; -#else -/* Dummy declaration for the CATU ops */ -static const struct etr_buf_operations etr_catu_buf_ops; -#endif #endif diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c index f684283890d3..6378c3dece6b 100644 --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c @@ -772,7 +772,7 @@ static inline void tmc_etr_disable_catu(struct tmc_drvdata *drvdata) static const struct etr_buf_operations *etr_buf_ops[] = { [ETR_MODE_FLAT] = &etr_flat_buf_ops, [ETR_MODE_ETR_SG] = &etr_sg_buf_ops, - [ETR_MODE_CATU] = &etr_catu_buf_ops, + [ETR_MODE_CATU] = IS_ENABLED(CONFIG_CORESIGHT_CATU) ? &etr_catu_buf_ops : NULL, }; static inline int tmc_etr_mode_alloc_buf(int mode, @@ -786,7 +786,7 @@ static inline int tmc_etr_mode_alloc_buf(int mode, case ETR_MODE_FLAT: case ETR_MODE_ETR_SG: case ETR_MODE_CATU: - if (etr_buf_ops[mode]->alloc) + if (etr_buf_ops[mode] && etr_buf_ops[mode]->alloc) rc = etr_buf_ops[mode]->alloc(drvdata, etr_buf, node, pages); if (!rc)