Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2198327pxm; Fri, 4 Mar 2022 11:10:52 -0800 (PST) X-Google-Smtp-Source: ABdhPJyih/CG31UDXGOKPZamdIO/fAFOSEPCNVgOuqCYQZ5fAi8aYZpMQrAuWrREBQEjnWNWIs99 X-Received: by 2002:a17:903:2284:b0:151:9670:9012 with SMTP id b4-20020a170903228400b0015196709012mr15181134plh.110.1646421052129; Fri, 04 Mar 2022 11:10:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646421052; cv=none; d=google.com; s=arc-20160816; b=fqaSQgOUawlj5EiWEAziTm654970/IkDJoyMXIFTLOilM6IM01u937ABdZerx4F+Si k0/LNgFoLuqeM9DgpFfYbQi2T89R+23j1hjQIg0MpbfRjb0bjcRpplFZ8rZXKZuhNsw5 KfoOfBWez+i/nB9N4GGkewHHp2prQ3d+uBICOZQVuCUPHxK5yQxk7HwkrmcI8nH7Or0H eD1X5XAkiZliNz7Ie3ZYlu6AkWwcJOA8QP4Wz0qMEn148kQdL3TYjk0RFc9HNQrolmde myyltQbyy/EPoYmkUXwtlE9FpwRWskIJUvyhgkBzOje+a20idYE6XFsTismZDTzIxLqa nSVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=NZVqR2IXuPYi/CmafDbS5W6yfPjJBN8Q1wn/cKiQemY=; b=0jBnpDU8QZXgvWGqVYLmbn7JxHFoS3zfjTTDwZ+PnS9jxTliI5llRpFz6bqDff9xvz ERnFd5kTzaCA/VNYhXIfpLCsPe+9O8TzNCJwR8chwA1+a8XKoBZF6Pvi4hYN+xhOSP4G A3YhAUZoUHsnC7+UIBzF0XKf5c281s7iR3lEeSRD5fCS0EUBm5dx0JUXgrr788ATqSl7 O9YPq/t9zrAkftJdReoUg1XlRYucpxz5gEszXzGJgU0IphezpGLahQEr9+MQNHcFOj4i ioqWull8yTQFvq+dMv2eENgztwSopT8DVe9Z9/ti7GHz7VTS9HUK3ZVtdvC8Me8ou858 pDQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fR7l0zn8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s14-20020a17090302ce00b0014f87065940si5133187plk.565.2022.03.04.11.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 11:10:52 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=fR7l0zn8; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5EA7211B5E3; Fri, 4 Mar 2022 11:04:44 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241829AbiCDSt2 (ORCPT + 99 others); Fri, 4 Mar 2022 13:49:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbiCDSt0 (ORCPT ); Fri, 4 Mar 2022 13:49:26 -0500 Received: from mail-io1-xd2d.google.com (mail-io1-xd2d.google.com [IPv6:2607:f8b0:4864:20::d2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 774A91C1EF1; Fri, 4 Mar 2022 10:48:37 -0800 (PST) Received: by mail-io1-xd2d.google.com with SMTP id u2so8512177ioc.11; Fri, 04 Mar 2022 10:48:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NZVqR2IXuPYi/CmafDbS5W6yfPjJBN8Q1wn/cKiQemY=; b=fR7l0zn8xJNMq3ZimB+MotJrfmWksw5FUbuKX8xZ0KrU81Er3UcSQr8Xz4fO32Vwbg Nu2Js1VOxv0PA6FZIG279vnxnytdo6BMI0fUwdBcYrZWEpTR0zhmzVWQU8rQGcquEg/Y d22VOQF6SO2u2GzyC6roO8Le49UQBMgxQaxX1xT3xNKRB57pbnU2e1r2R1nik0ynqq2g dJWfq0S7irxYaPdbuugyp2Q7aYuhjL4y8y7815ItnrHQiBvG1qteJNAOdfvHNdNz68r6 4VSxq37S4cm8QehTxMrQiWGYhtaUE0h5th6ntso3uMwaC0yK0kJJ5MsJHxb7gMZR+9b8 axng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NZVqR2IXuPYi/CmafDbS5W6yfPjJBN8Q1wn/cKiQemY=; b=n7ekN0xOb6gIkiV5pGXH1Awvpskq02MSRf73ntQ1z8w+CrMtqrr+W4u8Kp8kMmjYBY 9o44DcddssT12FfgtEN5rjREw8qUCn+2MAzd/BZL0QFgDSJgZJ8i3JvIYTjIfZykLS4w hXaluo907TsCw1gk5NcnvXrkryqozeS8mS3PfLEGELp6ag+PKLNQrcphWTXnW9Vud18i balgJ3Ci0amWAMkgx136od15BqT4BdyJ3WYKIBue+I+7jY4119DEeqrjmyKj59MFiVdt wLLOwyzlz//CzOOQ3lm1XaSeKPAnofC4JF2BZH3cs9cZEQEhyHinZqjDHz1z26W23kqu XzPg== X-Gm-Message-State: AOAM533QhIgRp/p7R7oNuleymN4vN7bw3FI586JhGwV8fIFocXs9H+9e hxdkYtBt4rE+uiqCVg/5pHQKkTpjmnpD5ve8FpI= X-Received: by 2002:a05:6602:15c6:b0:611:591d:1d9a with SMTP id f6-20020a05660215c600b00611591d1d9amr31562359iow.177.1646419716803; Fri, 04 Mar 2022 10:48:36 -0800 (PST) MIME-Version: 1.0 References: <20220127151945.1244439-1-trix@redhat.com> <0adde369-3fd7-3608-594c-d199cce3c936@redhat.com> <46441b86-1d19-5eb4-0013-db1c63a9b0a5@redhat.com> <8dd05afd-0bb9-c91b-6393-aff69f1363e1@redhat.com> <233660d0-1dee-7d80-1581-2e6845bf7689@linux-m68k.org> <95f5be1d-f5f3-478-5ccb-76556a41de78@linux-m68k.org> <7368bc3ea6dece01004c3e0c194abb0d26d4932b.camel@perches.com> <9dc86e74-7741-bb8e-bbad-ae96cebaaebc@redhat.com> In-Reply-To: From: Miguel Ojeda Date: Fri, 4 Mar 2022 19:48:25 +0100 Message-ID: Subject: Re: [PATCH] scsi: megaraid: cleanup formatting of megaraid To: Joe Perches Cc: Tom Rix , Finn Thain , Konrad Wilhelm Kleine , Bart Van Assche , kashyap.desai@broadcom.com, sumit.saxena@broadcom.com, shivasharan.srikanteshwara@broadcom.com, jejb@linux.ibm.com, martin.petersen@oracle.com, Nathan Chancellor , Nick Desaulniers , megaraidlinux.pdl@broadcom.com, scsi , linux-kernel , llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 4, 2022 at 6:37 PM Joe Perches wrote: > > I rather doubt clang-format will ever be 'close enough'. > > A human's sense of 'taste' for reading code is very different than > what an automated tool produces. Maybe, but it is a trade-off. If it is close enough, the benefits of automatic formatting may overcome the downsides. > Also, try looking at the changes clang-format does on a file chosen > at random: > > o columnarized definitions -> not columnarized > o odd line continuation placement using spaces and not tabs before \ > o odd array definition layouts > o per line definitions with comments poorly laid out > o individual line definitions rewrapped > o enum definitions on multiple lines compressed to single lines > o u8 array definition layouts where the first element has a separate > meaning than the subsequent elements are compressed and made > difficult to understand I am not sure what you are trying to show here -- some of these are precisely the things that the tool could improve or have already improved, and we may just need to use the new option. For instance, for the columnarized macros case, it is possible to align them since clang-format 9. For array of structures, there is also a new alignment option since clang-format 13. Etc. For the wrapping and related bits, now that the limit on 80 is a bit more fuzzy, we could perhaps tweak the penalties to improve the decision making. In summary, what we should be trying to do is improve the tool configuration and tool itself to see if we can get it to be close enough to the kernel style to make it more widely used. > I think _some_ clang-format output is ok, but the concept of > enabling/disabling specific reformatting bits would be quite useful. > > And sprinkling "clang-format on/off" lines in the code is not good. Definitely, but it is fine in some exceptional cases. > Any control codes that determine when source code layout might be > immutable or allowed to be modified could be should be tool name > agnostic. I don't see why would that be a problem, and I don't understand why we would use several different formatting tools (the point is to be consistent, after all); but sure, we could propose an alternative spelling. Cheers, Miguel