All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] media: Document coding style requirements
@ 2021-10-13  9:20 Jacopo Mondi
  2021-10-19  9:24 ` Sakari Ailus
  2021-10-21 14:00 ` Hans Verkuil
  0 siblings, 2 replies; 14+ messages in thread
From: Jacopo Mondi @ 2021-10-13  9:20 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Sean Young, Hans Verkuil,
	Laurent Pinchart, Sakari Ailus
  Cc: Jacopo Mondi, linux-media

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 <jacopo@jmondi.org>
---

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(+)

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
 ---------------

--
2.33.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-10-22  5:24 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13  9:20 [PATCH] media: Document coding style requirements Jacopo Mondi
2021-10-19  9:24 ` Sakari Ailus
2021-10-19 10:01   ` Jacopo Mondi
2021-10-21 15:45   ` Laurent Pinchart
2021-10-21 14:00 ` Hans Verkuil
2021-10-21 14:10   ` Hans Verkuil
2021-10-21 14:58     ` Mauro Carvalho Chehab
2021-10-21 14:55   ` Mauro Carvalho Chehab
2021-10-21 15:31     ` Laurent Pinchart
2021-10-21 16:17       ` Mauro Carvalho Chehab
2021-10-21 18:20         ` Jacopo Mondi
2021-10-22  5:24           ` Laurent Pinchart
2021-10-21 18:09     ` Jacopo Mondi
2021-10-21 15:14   ` Laurent Pinchart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.