linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Documentation: CodingStyle: add alignment rule for breaking statements
@ 2012-05-07 10:51 Arend van Spriel
  0 siblings, 0 replies; only message in thread
From: Arend van Spriel @ 2012-05-07 10:51 UTC (permalink / raw)
  To: Rob Landley
  Cc: linux-doc, Arend van Spriel, David S. Miller, Gustavo Padovan,
	linux-bluetooth, linux-wireless

The coding style document does cover breaking lines that are hitting
the 80 column boundary. However, how to format the portions is not
in the document. The submitted patches mostly align them on the same
column so that seems the consensus on it and in recent thread [1] this
lead to push-back on patches by David Miller. As the script checkpatch
already validate patches against this alignment rule it seems time to
add the rule to the coding style so people can not use the argument
that it is not there.

[1] http://article.gmane.org/gmane.linux.bluez.kernel/24759

Cc: David S. Miller <davem@davemloft.net>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org
Cc: linux-wireless@vger.kernel.org
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 Documentation/CodingStyle |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Documentation/CodingStyle b/Documentation/CodingStyle
index c58b236..bfb9008 100644
--- a/Documentation/CodingStyle
+++ b/Documentation/CodingStyle
@@ -87,6 +87,18 @@ are placed substantially to the right. The same applies to function headers
 with a long argument list. However, never break user-visible strings such as
 printk messages, because that breaks the ability to grep for them.
 
+When breaking statements you should align the sensible chunks to the same
+column. This may involve adding a couple of spaces behind the tabs of the
+next line(s), eg.:
+
+static inline const struct device *chunk_device(struct device *parent,
+						bool sensible_device_chunks)
+{
+	if (parent)
+		if (somewhat_lengthy_global_logical_condition &&
+		    sensible_device_chunks)
+			perform_the_jobs(parent);
+}
 
 		Chapter 3: Placing Braces and Spaces
 
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-05-07 10:51 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 10:51 [PATCH] Documentation: CodingStyle: add alignment rule for breaking statements Arend van Spriel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).