aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorGustavo Padovan <gustavo@padovan.org>2012-05-09 17:28:00 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-05-16 15:13:06 -0400
commitf522ae363d5f20de172ea6f9973ba4cc44801f2b (patch)
treeee225e4107fb57fb1737bd97de9de2371c7b8cc0 /net
parent2d0ed3d5879edae4bf1c98eb3163466c30d41789 (diff)
Bluetooth: improve readability of l2cap_seq_list code
Removes one indentation level. Signed-off-by: Gustavo Padovan <gustavo@padovan.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/l2cap_core.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index b3907a3b5236..1e12d6d58e84 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -310,14 +310,16 @@ static inline u16 l2cap_seq_list_pop(struct l2cap_seq_list *seq_list)
310 310
311static void l2cap_seq_list_clear(struct l2cap_seq_list *seq_list) 311static void l2cap_seq_list_clear(struct l2cap_seq_list *seq_list)
312{ 312{
313 if (seq_list->head != L2CAP_SEQ_LIST_CLEAR) { 313 u16 i;
314 u16 i;
315 for (i = 0; i <= seq_list->mask; i++)
316 seq_list->list[i] = L2CAP_SEQ_LIST_CLEAR;
317 314
318 seq_list->head = L2CAP_SEQ_LIST_CLEAR; 315 if (seq_list->head == L2CAP_SEQ_LIST_CLEAR)
319 seq_list->tail = L2CAP_SEQ_LIST_CLEAR; 316 return;
320 } 317
318 for (i = 0; i <= seq_list->mask; i++)
319 seq_list->list[i] = L2CAP_SEQ_LIST_CLEAR;
320
321 seq_list->head = L2CAP_SEQ_LIST_CLEAR;
322 seq_list->tail = L2CAP_SEQ_LIST_CLEAR;
321} 323}
322 324
323static void l2cap_seq_list_append(struct l2cap_seq_list *seq_list, u16 seq) 325static void l2cap_seq_list_append(struct l2cap_seq_list *seq_list, u16 seq)
@@ -326,15 +328,16 @@ static void l2cap_seq_list_append(struct l2cap_seq_list *seq_list, u16 seq)
326 328
327 /* All appends happen in constant time */ 329 /* All appends happen in constant time */
328 330
329 if (seq_list->list[seq & mask] == L2CAP_SEQ_LIST_CLEAR) { 331 if (seq_list->list[seq & mask] != L2CAP_SEQ_LIST_CLEAR)
330 if (seq_list->tail == L2CAP_SEQ_LIST_CLEAR) 332 return;
331 seq_list->head = seq;
332 else
333 seq_list->list[seq_list->tail & mask] = seq;
334 333
335 seq_list->tail = seq; 334 if (seq_list->tail == L2CAP_SEQ_LIST_CLEAR)
336 seq_list->list[seq & mask] = L2CAP_SEQ_LIST_TAIL; 335 seq_list->head = seq;
337 } 336 else
337 seq_list->list[seq_list->tail & mask] = seq;
338
339 seq_list->tail = seq;
340 seq_list->list[seq & mask] = L2CAP_SEQ_LIST_TAIL;
338} 341}
339 342
340static void l2cap_chan_timeout(struct work_struct *work) 343static void l2cap_chan_timeout(struct work_struct *work)