Skip to content

batman-adv: cleanup variable declarations

Sven Eckelmann batman 1 version New

Get series with b4
b4 am [email protected] change-id 20260608-reverse-xmas-6109a777ef8a

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2batman-adv: split multiple declarations per linenet/batman-adv/bat_algo.c net/batman-adv/bat_iv_ogm.c net/batman-adv/bat_v.c +17 more+294 -1400 replies
2/2batman-adv: switch var declarations to reverse x-mas tree ordernet/batman-adv/bat_algo.c net/batman-adv/bat_iv_ogm.c net/batman-adv/bat_v.c +21 more+482 -4700 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH batadv 0/2] batman-adv: cleanup variable declarations

The Linux coding style suggests to use single variable declarations per line. This suggestion turned out to make reviewing patches easier when single variable declarations are modified. Instead of having to search for the modified variable, it is directly visible as a line change in the diff.

Most functions are already using this style. The remaining ones are just adjusted by splitting the lines without ensuring the reverse x-mas tree order because this makes it easier to check the modification. The latter is handled in a second patch.

The network related code should use for local variable declarations an ordering scheme which orders lines longest to shortest. Initializations should only be kept in the declarations when the dependencies between them are not preventing the reverse x-mas tree order.

Many functions are already using this order. The remaining ones were supposed to slowly convert to the x-mas tree order when working on them. But this never happened because the patches tried to only modify the relevant lines. Instead of getting better, the order often just became worse.

Just fix the remaining offending functions to finally solve this coding style (minor) problem.

---
Sven Eckelmann (2):
batman-adv: split multiple declarations per line
batman-adv: switch var declarations to reverse x-mas tree order

 net/batman-adv/bat_algo.c              |   6 +-
 net/batman-adv/bat_iv_ogm.c            | 145 +++++++++++++----------
 net/batman-adv/bat_v.c                 |  39 +++---
 net/batman-adv/bat_v_elp.c             |  19 +--
 net/batman-adv/bat_v_ogm.c             |  34 +++---
 net/batman-adv/bridge_loop_avoidance.c |  98 ++++++++-------
 net/batman-adv/distributed-arp-table.c | 105 ++++++++++-------
 net/batman-adv/fragmentation.c         |  34 +++---
 net/batman-adv/gateway_client.c        |  29 +++--
 net/batman-adv/gateway_common.c        |   6 +-
 net/batman-adv/hard-interface.c        |  12 +-
 net/batman-adv/hash.h                  |   8 +-
 net/batman-adv/log.h                   |  16 ++-
 net/batman-adv/main.c                  |  18 +--
 net/batman-adv/mesh-interface.c        |  45 +++----
 net/batman-adv/multicast.c             |  33 +++---
 net/batman-adv/multicast_forw.c        |  15 ++-
 net/batman-adv/netlink.c               |   8 +-
 net/batman-adv/originator.c            |  53 +++++----
 net/batman-adv/routing.c               |  63 ++++++----
 net/batman-adv/send.c                  |   7 +-
 net/batman-adv/tp_meter.c              |  49 +++++---
 net/batman-adv/translation-table.c     | 210 +++++++++++++++++++--------------
 net/batman-adv/tvlv.c                  |  24 ++--
 24 files changed, 621 insertions(+), 455 deletions(-)

---
base-commit: 385b248dd4e46c4ce022adeb1b13e547d1954901
change-id: 20260608-reverse-xmas-6109a777ef8a

Best regards,

Signature · 1 line
Sven Eckelmann <[email protected]>