diff options
author | Robert P. J. Day <rpjday@crashcourse.ca> | 2008-04-12 21:54:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-04-12 21:54:24 -0400 |
commit | 9dbc15f055f05393ace4f1733f160ec3d188cf9b (patch) | |
tree | c3aca36fdb57d7b64aa5d5fdea0b7cf048c88dc7 /net/sctp/associola.c | |
parent | 30e935600776b45db38238355f0de2b8f72b3847 (diff) |
[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>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r-- | net/sctp/associola.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c index 422c98aa9d5c..b4cd2b71953f 100644 --- a/net/sctp/associola.c +++ b/net/sctp/associola.c | |||
@@ -718,12 +718,11 @@ struct sctp_transport *sctp_assoc_lookup_paddr( | |||
718 | const union sctp_addr *address) | 718 | const union sctp_addr *address) |
719 | { | 719 | { |
720 | struct sctp_transport *t; | 720 | struct sctp_transport *t; |
721 | struct list_head *pos; | ||
722 | 721 | ||
723 | /* Cycle through all transports searching for a peer address. */ | 722 | /* Cycle through all transports searching for a peer address. */ |
724 | 723 | ||
725 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 724 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
726 | t = list_entry(pos, struct sctp_transport, transports); | 725 | transports) { |
727 | if (sctp_cmp_addr_exact(address, &t->ipaddr)) | 726 | if (sctp_cmp_addr_exact(address, &t->ipaddr)) |
728 | return t; | 727 | return t; |
729 | } | 728 | } |
@@ -762,7 +761,6 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
762 | struct sctp_transport *second; | 761 | struct sctp_transport *second; |
763 | struct sctp_ulpevent *event; | 762 | struct sctp_ulpevent *event; |
764 | struct sockaddr_storage addr; | 763 | struct sockaddr_storage addr; |
765 | struct list_head *pos; | ||
766 | int spc_state = 0; | 764 | int spc_state = 0; |
767 | 765 | ||
768 | /* Record the transition on the transport. */ | 766 | /* Record the transition on the transport. */ |
@@ -814,8 +812,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc, | |||
814 | */ | 812 | */ |
815 | first = NULL; second = NULL; | 813 | first = NULL; second = NULL; |
816 | 814 | ||
817 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 815 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
818 | t = list_entry(pos, struct sctp_transport, transports); | 816 | transports) { |
819 | 817 | ||
820 | if ((t->state == SCTP_INACTIVE) || | 818 | if ((t->state == SCTP_INACTIVE) || |
821 | (t->state == SCTP_UNCONFIRMED)) | 819 | (t->state == SCTP_UNCONFIRMED)) |
@@ -932,7 +930,6 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
932 | { | 930 | { |
933 | struct sctp_transport *active; | 931 | struct sctp_transport *active; |
934 | struct sctp_transport *match; | 932 | struct sctp_transport *match; |
935 | struct list_head *entry, *pos; | ||
936 | struct sctp_transport *transport; | 933 | struct sctp_transport *transport; |
937 | struct sctp_chunk *chunk; | 934 | struct sctp_chunk *chunk; |
938 | __be32 key = htonl(tsn); | 935 | __be32 key = htonl(tsn); |
@@ -956,8 +953,8 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
956 | 953 | ||
957 | active = asoc->peer.active_path; | 954 | active = asoc->peer.active_path; |
958 | 955 | ||
959 | list_for_each(entry, &active->transmitted) { | 956 | list_for_each_entry(chunk, &active->transmitted, |
960 | chunk = list_entry(entry, struct sctp_chunk, transmitted_list); | 957 | transmitted_list) { |
961 | 958 | ||
962 | if (key == chunk->subh.data_hdr->tsn) { | 959 | if (key == chunk->subh.data_hdr->tsn) { |
963 | match = active; | 960 | match = active; |
@@ -966,14 +963,13 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc, | |||
966 | } | 963 | } |
967 | 964 | ||
968 | /* If not found, go search all the other transports. */ | 965 | /* If not found, go search all the other transports. */ |
969 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 966 | list_for_each_entry(transport, &asoc->peer.transport_addr_list, |
970 | transport = list_entry(pos, struct sctp_transport, transports); | 967 | transports) { |
971 | 968 | ||
972 | if (transport == active) | 969 | if (transport == active) |
973 | break; | 970 | break; |
974 | list_for_each(entry, &transport->transmitted) { | 971 | list_for_each_entry(chunk, &transport->transmitted, |
975 | chunk = list_entry(entry, struct sctp_chunk, | 972 | transmitted_list) { |
976 | transmitted_list); | ||
977 | if (key == chunk->subh.data_hdr->tsn) { | 973 | if (key == chunk->subh.data_hdr->tsn) { |
978 | match = transport; | 974 | match = transport; |
979 | goto out; | 975 | goto out; |
@@ -1154,9 +1150,8 @@ void sctp_assoc_update(struct sctp_association *asoc, | |||
1154 | 1150 | ||
1155 | } else { | 1151 | } else { |
1156 | /* Add any peer addresses from the new association. */ | 1152 | /* Add any peer addresses from the new association. */ |
1157 | list_for_each(pos, &new->peer.transport_addr_list) { | 1153 | list_for_each_entry(trans, &new->peer.transport_addr_list, |
1158 | trans = list_entry(pos, struct sctp_transport, | 1154 | transports) { |
1159 | transports); | ||
1160 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) | 1155 | if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr)) |
1161 | sctp_assoc_add_peer(asoc, &trans->ipaddr, | 1156 | sctp_assoc_add_peer(asoc, &trans->ipaddr, |
1162 | GFP_ATOMIC, trans->state); | 1157 | GFP_ATOMIC, trans->state); |
@@ -1306,15 +1301,14 @@ struct sctp_transport *sctp_assoc_choose_shutdown_transport( | |||
1306 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc) | 1301 | void sctp_assoc_sync_pmtu(struct sctp_association *asoc) |
1307 | { | 1302 | { |
1308 | struct sctp_transport *t; | 1303 | struct sctp_transport *t; |
1309 | struct list_head *pos; | ||
1310 | __u32 pmtu = 0; | 1304 | __u32 pmtu = 0; |
1311 | 1305 | ||
1312 | if (!asoc) | 1306 | if (!asoc) |
1313 | return; | 1307 | return; |
1314 | 1308 | ||
1315 | /* Get the lowest pmtu of all the transports. */ | 1309 | /* Get the lowest pmtu of all the transports. */ |
1316 | list_for_each(pos, &asoc->peer.transport_addr_list) { | 1310 | list_for_each_entry(t, &asoc->peer.transport_addr_list, |
1317 | t = list_entry(pos, struct sctp_transport, transports); | 1311 | transports) { |
1318 | if (t->pmtu_pending && t->dst) { | 1312 | if (t->pmtu_pending && t->dst) { |
1319 | sctp_transport_update_pmtu(t, dst_mtu(t->dst)); | 1313 | sctp_transport_update_pmtu(t, dst_mtu(t->dst)); |
1320 | t->pmtu_pending = 0; | 1314 | t->pmtu_pending = 0; |