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=DKIM_SIGNED,DKIM_VALID, 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 44C3FC28EBD for ; Sun, 9 Jun 2019 17:20:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D4E8F20652 for ; Sun, 9 Jun 2019 17:20:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=nifty.com header.i=@nifty.com header.b="GZ0tzeWl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732002AbfFIRUj (ORCPT ); Sun, 9 Jun 2019 13:20:39 -0400 Received: from conssluserg-06.nifty.com ([210.131.2.91]:20540 "EHLO conssluserg-06.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730139AbfFIRUg (ORCPT ); Sun, 9 Jun 2019 13:20:36 -0400 Received: from mail-vs1-f47.google.com (mail-vs1-f47.google.com [209.85.217.47]) (authenticated) by conssluserg-06.nifty.com with ESMTP id x59HKQ00009606; Mon, 10 Jun 2019 02:20:26 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-06.nifty.com x59HKQ00009606 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1560100827; bh=1ySK9wzh5EoMbwrJ8cJodwxCbTXiTLYsNbdKaL1fqtI=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GZ0tzeWlAtCiiyKxspCt0mUF0VDxbXBDzbXup66dIyNRwF29xHu6y3v0d8yGc7Vga BiKpv0OmeIeE0Y66CjkuCM+0BAPuHv1VpltpWJ4TF2i5DXqa1Pe+p7jpFy8qe6vWrH qBKhpSVH6QPz0zbLAxA1LLigJy1pWtotzKV1RzrmcBb7aDdctBwTyz4mnj31ujvRA1 boAROXP/k2UEiz83ZrBY9a5jhxoBe8lagGWMj1GA2PXUweoWWtBmC9iCaWNUWsIsGk qq/MlfQvpU/KtLxzhFdbF+0aQq3JMcHX5lESVHkQegw3Bsmay3vomR7TkWbL8a/zpl M5zJ8+cvafWLg== X-Nifty-SrcIP: [209.85.217.47] Received: by mail-vs1-f47.google.com with SMTP id q64so4012902vsd.1; Sun, 09 Jun 2019 10:20:26 -0700 (PDT) X-Gm-Message-State: APjAAAWd/57RmiEDymoUbAULTiOP+z18XgVSkE+NoyC2mDkH8V8D7OvI MMB7n8q/BCIbDLMW9NoM/M5tAN+KMD/oQpARyF0= X-Google-Smtp-Source: APXvYqyVekfcVCyZGa1ldLjCcfToCDvlg8U4tDLhnKcPBhGAs7CzTNxomvXqVEzZuvlWy2C4qxXT+i4Fa5So7679jEA= X-Received: by 2002:a67:cd1a:: with SMTP id u26mr14566333vsl.155.1560100825584; Sun, 09 Jun 2019 10:20:25 -0700 (PDT) MIME-Version: 1.0 References: <20190604111334.22182-1-yamada.masahiro@socionext.com> <8cf48e20064eabdfe150795365e6ca6f36032e9f.camel@perches.com> <20190604134213.GA26263@kroah.com> <20190605051040.GA22760@kroah.com> <20190605071413.779bd821@coco.lan> In-Reply-To: From: Masahiro Yamada Date: Mon, 10 Jun 2019 02:19:49 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] media: do not use C++ style comments in uapi headers To: Joe Perches Cc: Julia Lawall , Mauro Carvalho Chehab , Greg KH , Arnd Bergmann , Linux Media Mailing List , Thomas Gleixner , Randy Dunlap , Linux Kernel Mailing List 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 Sun, Jun 9, 2019 at 10:40 PM Joe Perches wrote: > > On Sun, 2019-06-09 at 22:08 +0900, Masahiro Yamada wrote: > > On Sun, Jun 9, 2019 at 8:57 PM Joe Perches wrote: > > > On Sun, 2019-06-09 at 16:14 +0900, Masahiro Yamada wrote: > > > > Hi Joe, > > > > > > > > On Thu, Jun 6, 2019 at 2:06 AM Joe Perches wrote: > > > > > Perhaps a checkpatch change too: > > > > > > > > > > The first block updates unsigned only bitfields > > > > > The second tests uapi definitions and suggests "__ > > > > > > > Good. > > > > > > > > In addition, > > > > > > > > "warn if __u8, __u16, __u32, __u64 are used outside of uapi/" > > > > > > > > Lots of kernel-space headers use __u{8,16,32,64} instead of u{8,16,32,64} > > > > just because developers often miss to understand when to use > > > > the underscore-prefixed types. > > > > > > The problem there is that checkpatch can't know if the > > > __ being used is for an actual uapi use or not. > > > > > > coccinelle could be much better at that. > > > > Why? > > > Perhaps it's (somewhat) bad form to have a __uapi type in a > structure, include that structure in a driver for something > like a copy_to/from_user, and map the __ to a non > underscore prefixed Linus Torvalds wrote 'sparse' to check this. Any attempt to distinguish the address-space by the presence of double-underscore-prefixes is pointless. This is already checked by __kernel / __user. It is absolutely correct to assign __u32 to u32, and vice versa. If you think the following patch is wrong, please tell me why: diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 748ac489ef7e..24c1b73d9fbd 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -1132,7 +1132,7 @@ static struct binder_node *binder_init_node_ilocked( struct binder_node *node; binder_uintptr_t ptr = fp ? fp->binder : 0; binder_uintptr_t cookie = fp ? fp->cookie : 0; - __u32 flags = fp ? fp->flags : 0; + u32 flags = fp ? fp->flags : 0; assert_spin_locked(&proc->inner_lock); @@ -4918,7 +4918,7 @@ static int binder_ioctl_get_node_info_for_ref(struct binder_proc *proc, { struct binder_node *node; struct binder_context *context = proc->context; - __u32 handle = info->handle; + u32 handle = info->handle; if (info->strong_count || info->weak_count || info->reserved1 || info->reserved2 || info->reserved3) { > > For instance > > struct flat_binder_object in drivers/android/binder.c > > How is checkpatch supposed to know that __u32 flags is > inappropriate? > > -- Best Regards Masahiro Yamada