[SCTP]: "list_for_each()" -> "list_for_each_entry()" where appropriate.
Replacing (almost) all invocations of list_for_each() with list_for_each_entry() tightens up the code and allows for the deletion of numerous list iterator variables that are no longer necessary. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
30e9356007
commit
9dbc15f055
@@ -545,14 +545,12 @@ static void sctp_cmd_hb_timers_start(sctp_cmd_seq_t *cmds,
|
||||
struct sctp_association *asoc)
|
||||
{
|
||||
struct sctp_transport *t;
|
||||
struct list_head *pos;
|
||||
|
||||
/* Start a heartbeat timer for each transport on the association.
|
||||
* hold a reference on the transport to make sure none of
|
||||
* the needed data structures go away.
|
||||
*/
|
||||
list_for_each(pos, &asoc->peer.transport_addr_list) {
|
||||
t = list_entry(pos, struct sctp_transport, transports);
|
||||
list_for_each_entry(t, &asoc->peer.transport_addr_list, transports) {
|
||||
|
||||
if (!mod_timer(&t->hb_timer, sctp_transport_timeout(t)))
|
||||
sctp_transport_hold(t);
|
||||
@@ -563,12 +561,11 @@ static void sctp_cmd_hb_timers_stop(sctp_cmd_seq_t *cmds,
|
||||
struct sctp_association *asoc)
|
||||
{
|
||||
struct sctp_transport *t;
|
||||
struct list_head *pos;
|
||||
|
||||
/* Stop all heartbeat timers. */
|
||||
|
||||
list_for_each(pos, &asoc->peer.transport_addr_list) {
|
||||
t = list_entry(pos, struct sctp_transport, transports);
|
||||
list_for_each_entry(t, &asoc->peer.transport_addr_list,
|
||||
transports) {
|
||||
if (del_timer(&t->hb_timer))
|
||||
sctp_transport_put(t);
|
||||
}
|
||||
@@ -579,10 +576,9 @@ static void sctp_cmd_t3_rtx_timers_stop(sctp_cmd_seq_t *cmds,
|
||||
struct sctp_association *asoc)
|
||||
{
|
||||
struct sctp_transport *t;
|
||||
struct list_head *pos;
|
||||
|
||||
list_for_each(pos, &asoc->peer.transport_addr_list) {
|
||||
t = list_entry(pos, struct sctp_transport, transports);
|
||||
list_for_each_entry(t, &asoc->peer.transport_addr_list,
|
||||
transports) {
|
||||
if (timer_pending(&t->T3_rtx_timer) &&
|
||||
del_timer(&t->T3_rtx_timer)) {
|
||||
sctp_transport_put(t);
|
||||
@@ -1065,7 +1061,6 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
|
||||
struct sctp_chunk *new_obj;
|
||||
struct sctp_chunk *chunk = NULL;
|
||||
struct sctp_packet *packet;
|
||||
struct list_head *pos;
|
||||
struct timer_list *timer;
|
||||
unsigned long timeout;
|
||||
struct sctp_transport *t;
|
||||
@@ -1397,9 +1392,8 @@ static int sctp_cmd_interpreter(sctp_event_t event_type,
|
||||
/* If we've sent any data bundled with
|
||||
* COOKIE-ECHO we need to resend.
|
||||
*/
|
||||
list_for_each(pos, &asoc->peer.transport_addr_list) {
|
||||
t = list_entry(pos, struct sctp_transport,
|
||||
transports);
|
||||
list_for_each_entry(t, &asoc->peer.transport_addr_list,
|
||||
transports) {
|
||||
sctp_retransmit_mark(&asoc->outqueue, t,
|
||||
SCTP_RTXR_T1_RTX);
|
||||
}
|
||||
|
Reference in New Issue
Block a user