From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FCE1C3A5A2 for ; Tue, 3 Sep 2019 10:21:34 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id AD3BF22CF8 for ; Tue, 3 Sep 2019 10:21:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD3BF22CF8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=vt.edu Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92) (envelope-from ) id 1i55w7-0004Ka-OA; Tue, 03 Sep 2019 06:21:19 -0400 Received: from omr1.cc.ipv6.vt.edu ([2607:b400:92:8300:0:c6:2117:b0e] helo=omr1.cc.vt.edu) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92) (envelope-from ) id 1i55w3-0004KU-W3 for kernelnewbies@kernelnewbies.org; Tue, 03 Sep 2019 06:21:16 -0400 Received: from mr5.cc.vt.edu (mr5.cc.ipv6.vt.edu [IPv6:2607:b400:92:8400:0:72:232:758b]) by omr1.cc.vt.edu (8.14.4/8.14.4) with ESMTP id x83ALEu4010549 for ; Tue, 3 Sep 2019 06:21:14 -0400 Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by mr5.cc.vt.edu (8.14.7/8.14.7) with ESMTP id x83AL9Rp026732 for ; Tue, 3 Sep 2019 06:21:14 -0400 Received: by mail-qk1-f197.google.com with SMTP id d9so18535217qko.8 for ; Tue, 03 Sep 2019 03:21:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:in-reply-to:references :mime-version:content-transfer-encoding:date:message-id; bh=ZgynfwFQg/7Jnk2q2oT9ZN8s3Dp3wjzDb66+9Hhx3H4=; b=gtVcDu+zGGBY11TE23CORIITDDAK9jp4IuB3cBnH/3RiIdQVGXddG/MGvp1ZfBXgNK DXPZP6aJf+hqpBLkKpmM+I2BDfsPKCUsUMI5BUWjwAmcrjjDqCTI5FhwNjGJ0guCpwNr iuPb88N0QDPEvwCccI/Yi/NMwbO0VA0L2z7pnGoL1aUPQe65R5tTdcPb7S+dcYWsot+f 76P3ZWyR6xGuHe7VcuxvlVCPID76ZS8vg4KOJO2gJL1O2XyTHfPUCbQQmSHPDdP9gX9y ddwtijJ5H8DEIfGb32hMk3fKLZXVxWIRH4zHK9RCpiZiBsT3Cwe/45yBu79geJKcWYqR 1T1A== X-Gm-Message-State: APjAAAVQ3cETcrW6WJ71u76UJJIgKCP5wkg9pooXHjXTRFhG3kzp4xjv d4wXI4oYexsEj8CtcZu/lEjtOJIPuhhYsRDotetmLYou87HO+RsRMwlMI+YGyjCYe5WtY26OI9A LQLJz22eIXGr+f3fvTHc61+UD4jfxhmsJGiM8ZJA= X-Received: by 2002:a0c:b490:: with SMTP id c16mr17413373qve.208.1567506069434; Tue, 03 Sep 2019 03:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqwaPTIBT4eaFGdCNIlpSEWA4AVIcNYfTXkTZMVi+bVFMfiTVIf2AHErQzhFEc4bM/Q7YfEUqw== X-Received: by 2002:a0c:b490:: with SMTP id c16mr17413362qve.208.1567506069084; Tue, 03 Sep 2019 03:21:09 -0700 (PDT) Received: from turing-police ([2601:5c0:c001:4341::359]) by smtp.gmail.com with ESMTPSA id f144sm7974822qke.132.2019.09.03.03.21.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2019 03:21:07 -0700 (PDT) From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Google-Original-From: "Valdis Kl=?utf-8?Q?=c4=93?=tnieks" X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7+dev To: Pablo Pellecchia Subject: Re: Staging/netlogic coding style issues with struct In-Reply-To: References: Mime-Version: 1.0 Date: Tue, 03 Sep 2019 06:21:07 -0400 Message-ID: <542004.1567506067@turing-police> Cc: kernelnewbies@kernelnewbies.org X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: multipart/mixed; boundary="===============2878472550727932065==" Errors-To: kernelnewbies-bounces@kernelnewbies.org --===============2878472550727932065== Content-Type: multipart/signed; boundary="==_Exmh_1567506066_4251P"; micalg=pgp-sha1; protocol="application/pgp-signature" Content-Transfer-Encoding: 7bit --==_Exmh_1567506066_4251P Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, 03 Sep 2019 01:26:17 -0300, Pablo Pellecchia said: > *WARNING: struct should normally be const=239: FILE: > platform_net.h:9:+struct xlr_net_data =7B* > > A similar issue is reported when we declare a variable of type struct > , but in this case warning is reported on the struct definit= ion > itself. > > How can we fix this? And in today's =22How to debug checkpatch=22 lesson.. :) First, figure out if checkpatch is in fact correct. It' just a Perl scrip= t, and has no real idea of what the code is. And double-checking, there's very few 'const struct' declarations in include/linux/*.h. So what's going on? Good question. Actually looking at checkpatch.pl, we find: =23 check for various structs that are normally const (ops, kgdb, device_= tree) =23 and avoid what seem like struct definitions 'struct foo =7B' if (=24line =21=7E /=5Cbconst=5Cb/ && =24line =3D=7E /=5Cbstruct=5Cs+(=24const_structs)=5Cb= (?=21=5Cs*=5C=7B)/) =7B WARN(=22CONST_STRUCT=22, =22struct =241 should normally be const=5Cn= =22 . =24herecurr); =7D and =24const_structs is initialized from scripts/const_structs.checkpatch= =20 And that tells us 2 things: First, this should only be triggering for st= ructures that are listed in that file, and the message *should* say something like 'struct foo should normally be const', with =241 filling in the stru= ct name. So why is =241 not showing up? Damned good question. And the file checks just fine for me. =5B/usr/src/linux-next=5D2 scripts/checkpatch.pl -f drivers/staging/netlo= gic/platform_net.h total: 0 errors, 0 warnings, 0 checks, 21 lines checked drivers/staging/netlogic/platform_net.h has no obvious style problems and= is ready for submission. Bingo=21 This is what happens if the permissions on the file are messed = up and it can't read the file: =5B/usr/src/linux-next=5D scripts/checkpatch.pl -f drivers/staging/netlog= ic/platform_net.h No structs that should be const will be found - file '/usr/src/linux-next= /scripts/const_structs.checkpatch': Permission denied WARNING: struct should normally be const =239: FILE: drivers/staging/netlogic/platform_net.h:9: +struct xlr_net_data =7B So... you probably need to check the permissions, or if the file is missi= ng from your tree or empty or something. The version in my tree is 64 lines = long. Meanwhile, I'm going to go cook up a patch for this.... --==_Exmh_1567506066_4251P Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Comment: Exmh version 2.9.0 11/07/2018 iQIVAwUBXW4+kgdmEQWDXROgAQIZcw/+Ib8tIC7aGqAIp0MM2B6XGfpMe5BobqW5 xH/KwcRU6hbltVby4k+MVud1odTMr/PYDBFZ3YY+51SD8b0+Kj539QrMOWKmpZLU Upj2ePiSVdQZTlEbYzMXfk+IoCfnfgOWEFh3fHuF3kXJz08YNWQFDGfD3JjISFay r0PfsO6jXGWG0ObvxvYP5akL5pDfJZrGCQbf5QyAdnA/DHNlt70J9BC9onDxRNzt KQLN7hxBDtYBxzLveRaYj0O41bwoBn4FR4ezca2paSsEMxl1Q1VOvMhYaHqWzynu GSFgpYmMd/j7DO8dshvvAW+HayCHOBVXSOT3aKQa35971xwVXO/MyDFIneCe1q8w wkAFgK9e7u3nkPlVv9aM0E//kTGK6eysBSSUO53d7cM8dp96PTiTHrYSSJ7QYywV l/OdwWwSnQo9OhIR8s28LlNp6Ai5kVdSsGY1otg1AqEcCU06Ko1yBJZJeaPXlYT1 JrtDb14bCZmfnKvJLqHkYzXkNvVA0Ak+zi54gn0hemUUCbuTC5sPpL/evnNyWy5b i/RWY3asg5wqJI139XnS5KnSpVYE9aD1D0PdPdAG+P0teL2OzmDGKlI4viZO03ox EtxIqUST0Hv9WOj84McP/6eaC0FW/ZJAFmd2Y6yMgOQJEzIYC3Jh7lEQY18q0tJJ 0DRVjzEHQvg= =u+E1 -----END PGP SIGNATURE----- --==_Exmh_1567506066_4251P-- --===============2878472550727932065== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies --===============2878472550727932065==--