Skip to contentSkip to conversation

batman-adv: Minor cleanups

PATCH In review Sven Eckelmann 2 participants 6 messages Jul 7, 2018 – Jul 17, 2018 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

cover batman-adv: Minor cleanups

Hi,

this mini patchset contains some minor cleanups which are on my HDD since a longer time but were never submitted. They still didn't reach a critical mass - but they will not get better with age.

Kind regards,
Sven

Sven Eckelmann (3):
batman-adv: Unify include guards style
batman-adv: Join batadv_purge_orig_ref and _batadv_purge_orig
batman-adv: Convert batadv_dat_addr_t to proper type

 net/batman-adv/bat_iv_ogm.h |  6 +++---
 net/batman-adv/bat_v_ogm.h  |  6 +++---
 net/batman-adv/originator.c | 17 ++++++-----------
 net/batman-adv/types.h      |  7 ++++---
 4 files changed, 16 insertions(+), 20 deletions(-)
Signature · 1 line
2.18.0
author maintainer
#1 lore raw

PATCH 1/3 batman-adv: Unify include guards style

All other include guards in batman-adv use the style:

* _NET_BATMAN_ADV_$(FILENAME)_
* uppercase only
* "." & "-" replaced with "_"

Use this also in the B.A.T.M.A.N. IV/V OGM implementation headers.

---
 net/batman-adv/bat_iv_ogm.h | 6 +++---
 net/batman-adv/bat_v_ogm.h  | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
net/batman-adv/bat_iv_ogm.h +3 -3
index 317cafd3..3dc6a7a4 100644
@@ -16,11 +16,11 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _BATMAN_ADV_BATADV_IV_OGM_H_
-#define _BATMAN_ADV_BATADV_IV_OGM_H_
+#ifndef _NET_BATMAN_ADV_BAT_IV_OGM_H_
+#define _NET_BATMAN_ADV_BAT_IV_OGM_H_
 
 #include "main.h"
 
 int batadv_iv_init(void);
 
-#endif /* _BATMAN_ADV_BATADV_IV_OGM_H_ */
+#endif /* _NET_BATMAN_ADV_BAT_IV_OGM_H_ */
net/batman-adv/bat_v_ogm.h +3 -3
index ed36c5e7..e5be14c9 100644
@@ -16,8 +16,8 @@
  * along with this program; if not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef _BATMAN_ADV_BATADV_V_OGM_H_
-#define _BATMAN_ADV_BATADV_V_OGM_H_
+#ifndef _NET_BATMAN_ADV_BAT_V_OGM_H_
+#define _NET_BATMAN_ADV_BAT_V_OGM_H_
 
 #include "main.h"
 
@@ -34,4 +34,4 @@ void batadv_v_ogm_primary_iface_set(struct batadv_hard_iface *primary_iface);
 int batadv_v_ogm_packet_recv(struct sk_buff *skb,
 			     struct batadv_hard_iface *if_incoming);
 
-#endif /* _BATMAN_ADV_BATADV_V_OGM_H_ */
+#endif /* _NET_BATMAN_ADV_BAT_V_OGM_H_ */
Signature · 1 line
2.18.0
author maintainer
#2 lore raw

PATCH 2/3 batman-adv: Join batadv_purge_orig_ref and _batadv_purge_orig

In reply to Sven Eckelmann

The single line function batadv_purge_orig_ref has no function beside providing the name used by other source files. This can also be done simpler by just renaming _batadv_purge_orig to batadv_purge_orig_ref.

---
 net/batman-adv/originator.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
net/batman-adv/originator.c +6 -11
index 716e5b43..1d295da3 100644
@@ -1339,7 +1339,11 @@ static bool batadv_purge_orig_node(struct batadv_priv *bat_priv,
 	return false;
 }
 
-static void _batadv_purge_orig(struct batadv_priv *bat_priv)
+/**
+ * batadv_purge_orig_ref() - Purge all outdated originators
+ * @bat_priv: the bat priv with all the soft interface information
+ */
+void batadv_purge_orig_ref(struct batadv_priv *bat_priv)
 {
 	struct batadv_hashtable *hash = bat_priv->orig_hash;
 	struct hlist_node *node_tmp;
@@ -1385,21 +1389,12 @@ static void batadv_purge_orig(struct work_struct *work)
 
 	delayed_work = to_delayed_work(work);
 	bat_priv = container_of(delayed_work, struct batadv_priv, orig_work);
-	_batadv_purge_orig(bat_priv);
+	batadv_purge_orig_ref(bat_priv);
 	queue_delayed_work(batadv_event_workqueue,
 			   &bat_priv->orig_work,
 			   msecs_to_jiffies(BATADV_ORIG_WORK_PERIOD));
 }
 
-/**
- * batadv_purge_orig_ref() - Purge all outdated originators
- * @bat_priv: the bat priv with all the soft interface information
- */
-void batadv_purge_orig_ref(struct batadv_priv *bat_priv)
-{
-	_batadv_purge_orig(bat_priv);
-}
-
 #ifdef CONFIG_BATMAN_ADV_DEBUGFS
 
 /**
Signature · 1 line
2.18.0
author maintainer
#3 lore raw

PATCH 3/3 batman-adv: Convert batadv_dat_addr_t to proper type

In reply to Sven Eckelmann

The #define for batadv_dat_addr_t is doing nothing else than giving u16 a new typename. But C already has the special keyword "typedef" which is also better supported by kernel-doc.

---
 net/batman-adv/types.h | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
net/batman-adv/types.h +4 -3
index 360357f8..343d3048 100644
@@ -43,12 +43,13 @@ struct seq_file;
 #ifdef CONFIG_BATMAN_ADV_DAT
 
 /**
- * batadv_dat_addr_t - it is the type used for all DHT addresses. If it is
- *  changed, BATADV_DAT_ADDR_MAX is changed as well.
+ * typedef batadv_dat_addr_t - type used for all DHT addresses
+ *
+ * If it is changed, BATADV_DAT_ADDR_MAX is changed as well.
  *
  * *Please be careful: batadv_dat_addr_t must be UNSIGNED*
  */
-#define batadv_dat_addr_t u16
+typedef u16 batadv_dat_addr_t;
 
 #endif /* CONFIG_BATMAN_ADV_DAT */
 
Signature · 1 line
2.18.0
Acked-by on v1 3/3
#4 lore raw

Re: [B.A.T.M.A.N.] [PATCH 3/3] batman-adv: Convert batadv_dat_addr_t to proper type

Hi,

Quoted 5 lines · Sven Eckelmann

The #define for batadv_dat_addr_t is doing nothing else than giving u16 a new typename. But C already has the special keyword "typedef" which is also better supported by kernel-doc.

Signature · 1 line
Antonio Quartulli
author maintainer
#5 lore raw
In reply to Sven Eckelmann
Quoted 5 lines · On Samstag, 7. Juli 2018 22:01:18 CEST Sven Eckelmann wrote:

Hi,

this mini patchset contains some minor cleanups which are on my HDD since a longer time but were never submitted. They still didn't reach a critical mass - but they will not get better with age.

Added patches as e59198c15f6a [1], e17162880d63 [2] and faf49a350b0b [3]

Kind regards,
Sven

[1] https://git.open-mesh.org/batman-adv.git/commit/e59198c15f6a092f5064cba4bb7d1642b5015af0
[2] https://git.open-mesh.org/batman-adv.git/commit/e17162880d636e7185bfb14980fb3529f90ae5c6
[3] https://git.open-mesh.org/batman-adv.git/commit/faf49a350b0b6f803840307028e3084d4bf78a51