From patchwork Wed Oct 13 09:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 12555199 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BF21C433EF for ; Wed, 13 Oct 2021 09:19:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7785C60EB4 for ; Wed, 13 Oct 2021 09:19:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237139AbhJMJVd (ORCPT ); Wed, 13 Oct 2021 05:21:33 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:48535 "EHLO relay10.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230150AbhJMJVc (ORCPT ); Wed, 13 Oct 2021 05:21:32 -0400 Received: (Authenticated sender: jacopo@jmondi.org) by relay10.mail.gandi.net (Postfix) with ESMTPSA id 4CE06240009; Wed, 13 Oct 2021 09:19:22 +0000 (UTC) From: Jacopo Mondi To: Mauro Carvalho Chehab , Sean Young , Hans Verkuil , Laurent Pinchart , Sakari Ailus Cc: Jacopo Mondi , linux-media@vger.kernel.org Subject: [PATCH] media: Document coding style requirements Date: Wed, 13 Oct 2021 11:20:05 +0200 Message-Id: <20211013092005.14268-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There are a few additional coding style conventions in place in the media subsystem. If they do not get documented, it's hard to enforce them during review as well as it is hard for developers to follow them without having previously contributed to the subsystem. Add them to the subsystem profile documentation. Signed-off-by: Jacopo Mondi --- All points are up for discussion ofc. But the idea is to get to have more requirement defined, as otherwise it's very hard to enforce them during review. Thanks j --- .../media/maintainer-entry-profile.rst | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) -- 2.33.0 diff --git a/Documentation/driver-api/media/maintainer-entry-profile.rst b/Documentation/driver-api/media/maintainer-entry-profile.rst index eb1cdfd280ba..9c376f843e1c 100644 --- a/Documentation/driver-api/media/maintainer-entry-profile.rst +++ b/Documentation/driver-api/media/maintainer-entry-profile.rst @@ -180,6 +180,30 @@ In particular, we accept lines with more than 80 columns: - when they avoid a line to end with an open parenthesis or an open bracket. +There are a few additional requirements which are not enforced by tooling +but mostly during the review process: + + - C++ style comments are not allowed, if not for SPDX headers; + - hexadecimal values should be spelled using lowercase letters; + - one structure/enum member declaration per line; + - one variable declaration per line; + - prefer variable declaration order in reverse-x-mas-tree over + initialization at variable declare time; + + As an example, the following style is preferred:: + + struct priv_struct *priv = container_of(....) + struct foo_struct *foo = priv->foo; + int b; + + b = a_very_long_operation_name(foo, s->bar) + + over the following one:: + + struct priv_struct *priv = container_of(....) + struct foo_struct *foo = priv->foo; + int b = a_very_long_operation_name(foo, s->bar) + Key Cycle Dates ---------------