summaryrefslogtreecommitdiff
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
authorRobert P. J. Day <rpjday@crashcourse.ca>2008-04-12 18:54:24 -0700
committerDavid S. Miller <davem@davemloft.net>2008-04-12 18:54:24 -0700
commit9dbc15f055f05393ace4f1733f160ec3d188cf9b (patch)
treec3aca36fdb57d7b64aa5d5fdea0b7cf048c88dc7 /net/sctp/associola.c
parent30e935600776b45db38238355f0de2b8f72b3847 (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.c34
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(
const union sctp_addr *address)
{
struct sctp_transport *t;
- struct list_head *pos;
/* Cycle through all transports searching for a peer address. */
- 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 (sctp_cmp_addr_exact(address, &t->ipaddr))
return t;
}
@@ -762,7 +761,6 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
struct sctp_transport *second;
struct sctp_ulpevent *event;
struct sockaddr_storage addr;
- struct list_head *pos;
int spc_state = 0;
/* Record the transition on the transport. */
@@ -814,8 +812,8 @@ void sctp_assoc_control_transport(struct sctp_association *asoc,
*/
first = NULL; second = NULL;
- 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 ((t->state == SCTP_INACTIVE) ||
(t->state == SCTP_UNCONFIRMED))
@@ -932,7 +930,6 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
{
struct sctp_transport *active;
struct sctp_transport *match;
- struct list_head *entry, *pos;
struct sctp_transport *transport;
struct sctp_chunk *chunk;
__be32 key = htonl(tsn);
@@ -956,8 +953,8 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
active = asoc->peer.active_path;
- list_for_each(entry, &active->transmitted) {
- chunk = list_entry(entry, struct sctp_chunk, transmitted_list);
+ list_for_each_entry(chunk, &active->transmitted,
+ transmitted_list) {
if (key == chunk->subh.data_hdr->tsn) {
match = active;
@@ -966,14 +963,13 @@ struct sctp_transport *sctp_assoc_lookup_tsn(struct sctp_association *asoc,
}
/* If not found, go search all the other transports. */
- list_for_each(pos, &asoc->peer.transport_addr_list) {
- transport = list_entry(pos, struct sctp_transport, transports);
+ list_for_each_entry(transport, &asoc->peer.transport_addr_list,
+ transports) {
if (transport == active)
break;
- list_for_each(entry, &transport->transmitted) {
- chunk = list_entry(entry, struct sctp_chunk,
- transmitted_list);
+ list_for_each_entry(chunk, &transport->transmitted,
+ transmitted_list) {
if (key == chunk->subh.data_hdr->tsn) {
match = transport;
goto out;
@@ -1154,9 +1150,8 @@ void sctp_assoc_update(struct sctp_association *asoc,
} else {
/* Add any peer addresses from the new association. */
- list_for_each(pos, &new->peer.transport_addr_list) {
- trans = list_entry(pos, struct sctp_transport,
- transports);
+ list_for_each_entry(trans, &new->peer.transport_addr_list,
+ transports) {
if (!sctp_assoc_lookup_paddr(asoc, &trans->ipaddr))
sctp_assoc_add_peer(asoc, &trans->ipaddr,
GFP_ATOMIC, trans->state);
@@ -1306,15 +1301,14 @@ struct sctp_transport *sctp_assoc_choose_shutdown_transport(
void sctp_assoc_sync_pmtu(struct sctp_association *asoc)
{
struct sctp_transport *t;
- struct list_head *pos;
__u32 pmtu = 0;
if (!asoc)
return;
/* Get the lowest pmtu of all the transports. */
- 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 (t->pmtu_pending && t->dst) {
sctp_transport_update_pmtu(t, dst_mtu(t->dst));
t->pmtu_pending = 0;