Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3043350imm; Mon, 24 Sep 2018 14:45:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV61mFeNDA27PT7X3qi2gLEZVtdAnguQC2PT3QjqWcjhs4ujf+uzi8lHqVEYacbtUBQlzkqGJ X-Received: by 2002:a62:c218:: with SMTP id l24-v6mr567777pfg.185.1537825501501; Mon, 24 Sep 2018 14:45:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537825501; cv=none; d=google.com; s=arc-20160816; b=MQi9VtumJg6Q2mp10jebRcjWR1+H2gxLbsU/VvdBasLkHmqp1JEaU+7bgEUOsp5Pba 6cBjvRpBta767rzhsBuvmXIelmAUp8KX6aKPwEbtUTbhtB9uob1ZU7CWTtygmkOYVUhr ceRorragLLB5GFHdXBhwUg+K38nHOVLuC2o1YScRgfZa/MLqqVRX3AqJiFrJMUDqiudR iFLHagy1hFu7MVOivM27JowjITS6gIa5z8Fvjm6t1JsCks2T+v6Y25FT5mr9sP+xkVhq 2cz5P8VwCo0DGhqQdqHpBQcgKS/CkaoXss8/4Y3Z95es5+ZLcYw9VmGkXagGzVBB7BeM 5+6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=grA2cicWCG5l4/SBt01ynilvSGTJ06kX8fsbGHrd7ss=; b=XILHjcREENtSMqhySwaZL0u5h1/5JJpihkukZGf9Ifo4ajZWCR3EaZu1TZpb83DBOI UzW8sPFJhC8MYHsIgVfwGRoophbT+ND4/M+zBnOze9pam9//NlZKUeKZVU87Gspwu1x3 e8K8i/xtkQd6N0Ns2WlWpUG8XNRdr9y6e8QocMePmbw6oiWNiDvZfL5rcIN/L470MqAM VQxkWKFNR55qqyQyvLFnAZaitMvYRWGJkVDHTp3dS+fqF7YR/+KIsxOE8HlWyUABnP74 RqYGfh574fGMACyNLPO1774X30VyIwLxI5eqkiFbO8XoSs1gYIbUOjbY6uaVxOuW4Yoj ga/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=D4MR43tJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c4-v6si384699pfa.285.2018.09.24.14.44.45; Mon, 24 Sep 2018 14:45:01 -0700 (PDT) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=D4MR43tJ; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728713AbeIYDst (ORCPT + 99 others); Mon, 24 Sep 2018 23:48:49 -0400 Received: from mail-pg1-f193.google.com ([209.85.215.193]:45406 "EHLO mail-pg1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728684AbeIYDss (ORCPT ); Mon, 24 Sep 2018 23:48:48 -0400 Received: by mail-pg1-f193.google.com with SMTP id t70-v6so5076220pgd.12 for ; Mon, 24 Sep 2018 14:44:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=grA2cicWCG5l4/SBt01ynilvSGTJ06kX8fsbGHrd7ss=; b=D4MR43tJfgO4kh/JXIyTUmLBIaKvBtk9y/aFlzSLa7ZYy8VAo9MDxrYmHkSwZG7Dm3 BVTY8968F5iQW2GqzrnzCrv4Wa05n5aw511wLrDXUOkTdzDweNHl/Dfs8G0cHqpDSDYb 5zDJNOOxqY7p6NqrNKXAC28xAWexlRVkFcR3eZODj5GFmoBfrsVPzonviN11+vQ87yR0 L59buxi1E202K10k23R4hkRf/vl26tIXY8aiqTBMytlN/Zpq6WOx28+7XJnJbJgHY3Gv 2nHx5tEqldECMecxz4xxdKRv5E9QY0UDjaT9tT3sD7yMBTWhmQaNl4wKjTqstajc6mVC LfCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=grA2cicWCG5l4/SBt01ynilvSGTJ06kX8fsbGHrd7ss=; b=q5D89/gOjfliSSPbWqX4+wbwDZiL4skNoceO4HvY8Qnw/khyb0X1l0fqLHnpW7uRwj IBGLHUVy2F5CbkEr1RoAZeAfpGBhPYVQlev13uxZlX38LX2yZ1o9uDKfp8ipcSt6VI22 ++Ke9fIVg9aMsAocl9LXwQPzUva4EzPFhtjIjRi/HjwwuzBx4clKDOtQoWXApGt6DSai HzoXpeAM1P9UbbfcWzH27sBJzhXw3Epleabr6kLKlFVkvFv7NaHetYaRfPiI0CcNxw5H ITttpewHxMVveAwVvIBa/RrcXzZf2Xj+tedjFpr790zZTE7UNXeON/T5jjIOn/td6d34 Kg4Q== X-Gm-Message-State: ABuFfoi8HbMDAbE+qP3+6GLFcQj6dxqiDcNRgZokTLgvmB9VtBosW3QC uo+LojQLA7GaWMli+coZeHXzBeHwcKpb2lG8ckRDXw== X-Received: by 2002:a17:902:561:: with SMTP id 88-v6mr576897plf.320.1537825471615; Mon, 24 Sep 2018 14:44:31 -0700 (PDT) MIME-Version: 1.0 References: <20180924172615.25591-1-natechancellor@gmail.com> <33c9afa7-ea62-1248-1da4-381f93238627@amd.com> In-Reply-To: From: Nick Desaulniers Date: Mon, 24 Sep 2018 14:44:20 -0700 Message-ID: Subject: Re: [PATCH] crypto: ccp: Remove forward declaration To: ghook@amd.com Cc: Nathan Chancellor , Thomas.Lendacky@amd.com, Gary.Hook@amd.com, Herbert Xu , linux-crypto@vger.kernel.org, LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 24, 2018 at 2:27 PM Gary R Hook wrote: > > On 09/24/2018 03:24 PM, Nick Desaulniers wrote: > > On Mon, Sep 24, 2018 at 12:18 PM Gary R Hook wrote: > >> > >> On 09/24/2018 12:26 PM, Nathan Chancellor wrote: > >>> Clang emits a warning about this construct: > >>> > >>> drivers/crypto/ccp/sp-platform.c:36:36: warning: tentative array > >>> definition assumed to have one element > >>> static const struct acpi_device_id sp_acpi_match[]; > >>> ^ > >>> 1 warning generated. > >>> > >>> Just remove the forward declarations and move the initializations up > >>> so that they can be used in sp_get_of_version and sp_get_acpi_version. > >> > >> I'm not going to out and out object to this just yet. > > > > Tentative array definitions need to have the correct length specified; > > it should either be forward declared as the correct length, or as this > > patch does, skip the forward declare and move up the definition. > > Thanks for this patch Nathan. > > Reviewed-by: Nick Desaulniers > > > Checked my C99, and using both static and [] to create a declaration Note that the kernel uses gnu89, which is ISO C90 + gnu extensions (IIUC). > (because it's really a definition) apparently isn't valid. I should have > known that. Since I'm old school... > > Acked-by: Gary R Hook > > > > > >> > >> I am not a clang expert. Can you please provide a make command that > >> would explain how you precipitated this complaint? > >> > >> > >>> Reported-by: Nick Desaulniers > >>> Signed-off-by: Nathan Chancellor > >>> --- > >>> drivers/crypto/ccp/sp-platform.c | 53 +++++++++++++++----------------- > >>> 1 file changed, 25 insertions(+), 28 deletions(-) > >>> > >>> diff --git a/drivers/crypto/ccp/sp-platform.c b/drivers/crypto/ccp/sp-platform.c > >>> index 71734f254fd1..b75dc7db2d4a 100644 > >>> --- a/drivers/crypto/ccp/sp-platform.c > >>> +++ b/drivers/crypto/ccp/sp-platform.c > >>> @@ -33,8 +33,31 @@ struct sp_platform { > >>> unsigned int irq_count; > >>> }; > >>> > >>> -static const struct acpi_device_id sp_acpi_match[]; > >>> -static const struct of_device_id sp_of_match[]; > >>> +static const struct sp_dev_vdata dev_vdata[] = { > >>> + { > >>> + .bar = 0, > >>> +#ifdef CONFIG_CRYPTO_DEV_SP_CCP > >>> + .ccp_vdata = &ccpv3_platform, > >>> +#endif > >>> + }, > >>> +}; > >>> + > >>> +#ifdef CONFIG_ACPI > >>> +static const struct acpi_device_id sp_acpi_match[] = { > >>> + { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, > >>> + { }, > >>> +}; > >>> +MODULE_DEVICE_TABLE(acpi, sp_acpi_match); > >>> +#endif > >>> + > >>> +#ifdef CONFIG_OF > >>> +static const struct of_device_id sp_of_match[] = { > >>> + { .compatible = "amd,ccp-seattle-v1a", > >>> + .data = (const void *)&dev_vdata[0] }, > >>> + { }, > >>> +}; > >>> +MODULE_DEVICE_TABLE(of, sp_of_match); > >>> +#endif > >>> > >>> static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) > >>> { > >>> @@ -201,32 +224,6 @@ static int sp_platform_resume(struct platform_device *pdev) > >>> } > >>> #endif > >>> > >>> -static const struct sp_dev_vdata dev_vdata[] = { > >>> - { > >>> - .bar = 0, > >>> -#ifdef CONFIG_CRYPTO_DEV_SP_CCP > >>> - .ccp_vdata = &ccpv3_platform, > >>> -#endif > >>> - }, > >>> -}; > >>> - > >>> -#ifdef CONFIG_ACPI > >>> -static const struct acpi_device_id sp_acpi_match[] = { > >>> - { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, > >>> - { }, > >>> -}; > >>> -MODULE_DEVICE_TABLE(acpi, sp_acpi_match); > >>> -#endif > >>> - > >>> -#ifdef CONFIG_OF > >>> -static const struct of_device_id sp_of_match[] = { > >>> - { .compatible = "amd,ccp-seattle-v1a", > >>> - .data = (const void *)&dev_vdata[0] }, > >>> - { }, > >>> -}; > >>> -MODULE_DEVICE_TABLE(of, sp_of_match); > >>> -#endif > >>> - > >>> static struct platform_driver sp_platform_driver = { > >>> .driver = { > >>> .name = "ccp", > >>> > >> > > > > > -- Thanks, ~Nick Desaulniers