Re: [PATCH v1 3/5] can: netlink: move '=' operators back to previous line (checkpatch fix)

From
Vincent MAILHOL <hidden>
Date
2021-02-24 01:07:19
Reply to
Marc Kleine-Budde, 2021-02-23
Hi Marc,

On Wed. 24 Feb 2021 at 04:47, Marc Kleine-Budde [off-list ref] wrote:
On 24.02.2021 01:28:50, Vincent Mailhol wrote:
quoted
Fix the warning triggered by having an '=' at the beginning of the
line and add one indentation to fix the alignment.

Extract of ./scripts/checkpatch.pl -f drivers/net/can/dev/netlink.c:

CHECK: Assignment operator '=' should be on the previous line
+       [IFLA_CAN_BITTIMING_CONST]
+                               = { .len = sizeof(struct can_bittiming_const) },

CHECK: Assignment operator '=' should be on the previous line
+       [IFLA_CAN_DATA_BITTIMING]
+                               = { .len = sizeof(struct can_bittiming) },

CHECK: Assignment operator '=' should be on the previous line
+       [IFLA_CAN_DATA_BITTIMING_CONST]
+                               = { .len = sizeof(struct can_bittiming_const) },

Signed-off-by: Vincent Mailhol <redacted>
---
 drivers/net/can/dev/netlink.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/drivers/net/can/dev/netlink.c b/drivers/net/can/dev/netlink.c
index 867f6be31230..75851fab7ff5 100644
--- a/drivers/net/can/dev/netlink.c
+++ b/drivers/net/can/dev/netlink.c
@@ -8,20 +8,18 @@
 #include <net/rtnetlink.h>

 static const struct nla_policy can_policy[IFLA_CAN_MAX + 1] = {
-     [IFLA_CAN_STATE]        = { .type = NLA_U32 },
-     [IFLA_CAN_CTRLMODE]     = { .len = sizeof(struct can_ctrlmode) },
-     [IFLA_CAN_RESTART_MS]   = { .type = NLA_U32 },
-     [IFLA_CAN_RESTART]      = { .type = NLA_U32 },
-     [IFLA_CAN_BITTIMING]    = { .len = sizeof(struct can_bittiming) },
-     [IFLA_CAN_BITTIMING_CONST]
-                             = { .len = sizeof(struct can_bittiming_const) },
-     [IFLA_CAN_CLOCK]        = { .len = sizeof(struct can_clock) },
-     [IFLA_CAN_BERR_COUNTER] = { .len = sizeof(struct can_berr_counter) },
-     [IFLA_CAN_DATA_BITTIMING]
-                             = { .len = sizeof(struct can_bittiming) },
-     [IFLA_CAN_DATA_BITTIMING_CONST]
-                             = { .len = sizeof(struct can_bittiming_const) },
-     [IFLA_CAN_TERMINATION]  = { .type = NLA_U16 },
What about having only one space before and after the "="? Otherwise if
another entry is added wich is longer, the aligning would be broken again...
Yes sir!

I do not have a strong preference between one style or the
other. Will resend the patch with a single space instead of
tabulations.
quoted
+     [IFLA_CAN_STATE]                = { .type = NLA_U32 },
+     [IFLA_CAN_CTRLMODE]             = { .len = sizeof(struct can_ctrlmode) },
+     [IFLA_CAN_RESTART_MS]           = { .type = NLA_U32 },
+     [IFLA_CAN_RESTART]              = { .type = NLA_U32 },
+     [IFLA_CAN_BITTIMING]            = { .len = sizeof(struct can_bittiming) },
+     [IFLA_CAN_BITTIMING_CONST]      = { .len = sizeof(struct can_bittiming_const) },
+     [IFLA_CAN_CLOCK]                = { .len = sizeof(struct can_clock) },
+     [IFLA_CAN_BERR_COUNTER]         = { .len = sizeof(struct can_berr_counter) },
+     [IFLA_CAN_DATA_BITTIMING]       = { .len = sizeof(struct can_bittiming) },
+     [IFLA_CAN_DATA_BITTIMING_CONST] = { .len = sizeof(struct can_bittiming_const) },
+     [IFLA_CAN_TERMINATION]          = { .type = NLA_U16 },
+     [IFLA_CAN_TERMINATION]          = { .type = NLA_U16 },
 };
Marc

--
Pengutronix e.K.                 | Marc Kleine-Budde           |
Embedded Linux                   | https://www.pengutronix.de  |
Vertretung West/Dortmund         | Phone: +49-231-2826-924     |
Amtsgericht Hildesheim, HRA 2686 | Fax:   +49-5121-206917-5555 |
Thread (11 messages) 11 messages, 2 authors, last reply 2021-02-24
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help