aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/iseries_veth.c
diff options
context:
space:
mode:
authorMichael Ellerman <michael@ellerman.id.au>2005-08-31 21:29:05 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-08-31 22:37:57 -0400
commitd7893ddd1b2110a54a5b1773a405748172ba1fe5 (patch)
tree29e6558fcc6156bdbf97507e631d37d34e4c1a22 /drivers/net/iseries_veth.c
parent2a5391a12297d1759b1c736634acb95793d43fb3 (diff)
[PATCH] iseries_veth: Remove redundant message stack lock
The iseries_veth driver keeps a stack of messages for each connection and a lock to protect the stack. However there is also a per-connection lock which makes the message stack lock redundant. Remove the message stack lock and document the fact that callers of the stack-manipulation functions must hold the connection's lock. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers/net/iseries_veth.c')
-rw-r--r--drivers/net/iseries_veth.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c
index 74ee937c4606..231b2d2d3264 100644
--- a/drivers/net/iseries_veth.c
+++ b/drivers/net/iseries_veth.c
@@ -143,7 +143,6 @@ struct veth_lpar_connection {
143 struct VethCapData remote_caps; 143 struct VethCapData remote_caps;
144 u32 ack_timeout; 144 u32 ack_timeout;
145 145
146 spinlock_t msg_stack_lock;
147 struct veth_msg *msg_stack_head; 146 struct veth_msg *msg_stack_head;
148}; 147};
149 148
@@ -190,27 +189,23 @@ static void veth_timed_ack(unsigned long connectionPtr);
190#define veth_debug(fmt, args...) do {} while (0) 189#define veth_debug(fmt, args...) do {} while (0)
191#endif 190#endif
192 191
192/* You must hold the connection's lock when you call this function. */
193static inline void veth_stack_push(struct veth_lpar_connection *cnx, 193static inline void veth_stack_push(struct veth_lpar_connection *cnx,
194 struct veth_msg *msg) 194 struct veth_msg *msg)
195{ 195{
196 unsigned long flags;
197
198 spin_lock_irqsave(&cnx->msg_stack_lock, flags);
199 msg->next = cnx->msg_stack_head; 196 msg->next = cnx->msg_stack_head;
200 cnx->msg_stack_head = msg; 197 cnx->msg_stack_head = msg;
201 spin_unlock_irqrestore(&cnx->msg_stack_lock, flags);
202} 198}
203 199
200/* You must hold the connection's lock when you call this function. */
204static inline struct veth_msg *veth_stack_pop(struct veth_lpar_connection *cnx) 201static inline struct veth_msg *veth_stack_pop(struct veth_lpar_connection *cnx)
205{ 202{
206 unsigned long flags;
207 struct veth_msg *msg; 203 struct veth_msg *msg;
208 204
209 spin_lock_irqsave(&cnx->msg_stack_lock, flags);
210 msg = cnx->msg_stack_head; 205 msg = cnx->msg_stack_head;
211 if (msg) 206 if (msg)
212 cnx->msg_stack_head = cnx->msg_stack_head->next; 207 cnx->msg_stack_head = cnx->msg_stack_head->next;
213 spin_unlock_irqrestore(&cnx->msg_stack_lock, flags); 208
214 return msg; 209 return msg;
215} 210}
216 211
@@ -645,7 +640,6 @@ static int veth_init_connection(u8 rlp)
645 640
646 cnx->msgs = msgs; 641 cnx->msgs = msgs;
647 memset(msgs, 0, VETH_NUMBUFFERS * sizeof(struct veth_msg)); 642 memset(msgs, 0, VETH_NUMBUFFERS * sizeof(struct veth_msg));
648 spin_lock_init(&cnx->msg_stack_lock);
649 643
650 for (i = 0; i < VETH_NUMBUFFERS; i++) { 644 for (i = 0; i < VETH_NUMBUFFERS; i++) {
651 msgs[i].token = i; 645 msgs[i].token = i;