batman-adv: convert bat_priv->tt_crc from atomic_t to uint16_t
authorAntonio Quartulli <ordex@autistici.org>
Sat, 14 Apr 2012 11:15:26 +0000 (13:15 +0200)
committerAntonio Quartulli <ordex@autistici.org>
Mon, 18 Jun 2012 16:00:58 +0000 (18:00 +0200)
In the code we neever need to atomically check and set the bat_priv->tt_crc
field value. It is simply set and read once in different pieces of the code.
Therefore this field can be safely be converted from atomic_t to uint16_t.

Reported-by: Al Viro <viro@ZenIV.linux.org.uk>
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/send.c
net/batman-adv/types.h

index dc53798ebb47aef0c104cd014be4b3a590a622c2..ec351199c652aa3f8eaaa4b4086031fd9b005349 100644 (file)
@@ -575,8 +575,7 @@ static void bat_iv_ogm_schedule(struct hard_iface *hard_iface,
                        htonl((uint32_t)atomic_read(&hard_iface->seqno));
 
        batman_ogm_packet->ttvn = atomic_read(&bat_priv->ttvn);
-       batman_ogm_packet->tt_crc = htons((uint16_t)
-                                               atomic_read(&bat_priv->tt_crc));
+       batman_ogm_packet->tt_crc = htons(bat_priv->tt_crc);
        if (tt_num_changes >= 0)
                batman_ogm_packet->tt_num_changes = tt_num_changes;
 
index f47299f22c68f70ae76e92ac893f6df5c67f089f..f5ff36492b2fd2db46bfb788e060579c8e98f4f9 100644 (file)
@@ -111,7 +111,7 @@ static int prepare_packet_buffer(struct bat_priv *bat_priv,
 
        realloc_packet_buffer(hard_iface, new_len);
 
-       atomic_set(&bat_priv->tt_crc, tt_local_crc(bat_priv));
+       bat_priv->tt_crc = tt_local_crc(bat_priv);
 
        /* reset the sending counter */
        atomic_set(&bat_priv->tt_ogm_append_cnt, TT_OGM_APPEND_MAX);
index 61308e8016ff85d201d68143d7760ae3c4437294..547dc339f33db565e6e800bac5db9f8499ab7080 100644 (file)
@@ -210,7 +210,7 @@ struct bat_priv {
        spinlock_t vis_list_lock; /* protects vis_info::recv_list */
        atomic_t num_local_tt;
        /* Checksum of the local table, recomputed before sending a new OGM */
-       atomic_t tt_crc;
+       uint16_t tt_crc;
        unsigned char *tt_buff;
        int16_t tt_buff_len;
        spinlock_t tt_buff_lock; /* protects tt_buff */