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=-4.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 AE608C28CC5 for ; Wed, 5 Jun 2019 17:03:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E44B20874 for ; Wed, 5 Jun 2019 17:03:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728850AbfFERD0 (ORCPT ); Wed, 5 Jun 2019 13:03:26 -0400 Received: from smtprelay0024.hostedemail.com ([216.40.44.24]:37504 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728794AbfFERD0 (ORCPT ); Wed, 5 Jun 2019 13:03:26 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 8554E8368EE9; Wed, 5 Jun 2019 17:03:24 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: snail30_1d61b4fc2bc61 X-Filterd-Recvd-Size: 5807 Received: from XPS-9350 (cpe-23-242-196-136.socal.res.rr.com [23.242.196.136]) (Authenticated sender: joe@perches.com) by omf19.hostedemail.com (Postfix) with ESMTPA; Wed, 5 Jun 2019 17:03:21 +0000 (UTC) Message-ID: Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers From: Joe Perches To: Mauro Carvalho Chehab Cc: Greg KH , Masahiro Yamada , Arnd Bergmann , Linux Media Mailing List , Thomas Gleixner , Randy Dunlap , Linux Kernel Mailing List Date: Wed, 05 Jun 2019 10:03:19 -0700 In-Reply-To: <20190605071413.779bd821@coco.lan> References: <20190604111334.22182-1-yamada.masahiro@socionext.com> <8cf48e20064eabdfe150795365e6ca6f36032e9f.camel@perches.com> <20190604134213.GA26263@kroah.com> <20190605051040.GA22760@kroah.com> <20190605071413.779bd821@coco.lan> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.5-0ubuntu0.18.10.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-06-05 at 07:14 -0300, Mauro Carvalho Chehab wrote: > Em Tue, 04 Jun 2019 22:22:05 -0700 > Joe Perches escreveu: > > > On Wed, 2019-06-05 at 07:10 +0200, Greg KH wrote: > > > On Wed, Jun 05, 2019 at 01:10:41PM +0900, Masahiro Yamada wrote: > > > > On Wed, Jun 5, 2019 at 3:21 AM Arnd Bergmann wrote: > > [] > > > > This means we cannot reliably use uint{8,16,32,64}_t in UAPI headers. > > > > > > We should not be doing that as they are in the userspace "namespace" of > > > variables, not in the kernel namespace. We've been over this many times > > > in the past :( > > > > Just not very successfully... > > > > $ git grep -w -P 'u?_?int(?:8|16|32|64)_t' include/uapi | wc -l > > 342 > > $ git grep -w -P --name-only 'u?_?int(?:8|16|32|64)_t' include/uapi | wc -l > > 13 > > Out of curiosity, I decided to check those occurrences... > > About half of those 13 files are false-positives: > > - bpf.h, pps.h and amdgpu_drm.h use those int types only inside comments; > - drm.h and coda.h have their own typedefs for those int types; > - vmwgfx_drm.h includes drm.h (which has the typedefs). > > So, only 6 headers actually use posix types in a way that it seems that > it would require including stdint.h: > > - include/uapi/linux/fuse.h > > This one explicitly includes stdint.h if !__KERNEL__ > > - include/uapi/linux/netfilter_bridge/ebtables.h, > include/uapi/linux/sctp.h, > include/uapi/scsi/scsi_netlink.h and > include/uapi/scsi/scsi_netlink_fc.h > > They include linux/types.h unconditionally, relying on > scripts/headers_install.sh to remove it; > > - include/uapi/scsi/scsi_bsg_fc.h > > It doesn't include anything. In other words, it assumes that the c file > would include either linux/types.h or stdint.h. > > --- > > Not saying that this is a good idea, but, as we have already a script that > it is meant to sanitize uAPI header files when installing them > (scripts/headers_install.sh), one could modify it (or convert to perl/python) > in a way that it would be doing something like[1]: > > sed -E > ... > -e 's,//(.*),/* \1 */,' > > [1] the actual rule should be more complex than that, in order to avoid > replacing // inside /**/ comments. Perhaps a checkpatch change too: The first block updates unsigned only bitfields The second tests uapi definitions and suggests "__, otherwise use like s8, u32, etc... + if ($realfile !~ m@\btools/@ && + $line =~ /\b($Declare)\s*$Ident\s*[=,;:\[]/) { my $type = $1; if ($type =~ /\b($typeC99Typedefs)\b/) { $type = $1; @@ -5916,6 +5916,9 @@ sub process { $kernel_type = 's' if ($type =~ /^_*[si]/); $type =~ /(\d+)/; $kernel_type .= $1; + if ($realfile =~ m@\binclude/uapi/@) { + $kernel_type = "__" . $kernel_type; + } if (CHK("PREFER_KERNEL_TYPES", "Prefer kernel type '$kernel_type' over '$type'\n" . $herecurr) && $fix) {