diff options
author | Jan Kiszka <jan.kiszka@web.de> | 2010-02-08 05:12:41 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-16 19:01:34 -0500 |
commit | 2b72b5bd65f00bce786ca080aca27e91e90af6df (patch) | |
tree | 729f94d53626579f37b89279a72f3bfd8f0ceb71 /drivers/isdn/capi | |
parent | dfbb84ffe94e75e2d56250fa948db40f6c62093f (diff) |
CAPI: Clean up capiminor_*_ack
No need for irqsave acquisition of acklock, bh-safe is sufficient.
Moverover, move kfree out of the lock and do not take acklock at all
in capiminor_del_all_ack as we are the last user of the list here.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/isdn/capi')
-rw-r--r-- | drivers/isdn/capi/capi.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c index 074496fae8da..40b81b460e81 100644 --- a/drivers/isdn/capi/capi.c +++ b/drivers/isdn/capi/capi.c | |||
@@ -149,7 +149,6 @@ static struct tty_driver *capinc_tty_driver; | |||
149 | static int capiminor_add_ack(struct capiminor *mp, u16 datahandle) | 149 | static int capiminor_add_ack(struct capiminor *mp, u16 datahandle) |
150 | { | 150 | { |
151 | struct ackqueue_entry *n; | 151 | struct ackqueue_entry *n; |
152 | unsigned long flags; | ||
153 | 152 | ||
154 | n = kmalloc(sizeof(*n), GFP_ATOMIC); | 153 | n = kmalloc(sizeof(*n), GFP_ATOMIC); |
155 | if (unlikely(!n)) { | 154 | if (unlikely(!n)) { |
@@ -158,44 +157,40 @@ static int capiminor_add_ack(struct capiminor *mp, u16 datahandle) | |||
158 | } | 157 | } |
159 | n->datahandle = datahandle; | 158 | n->datahandle = datahandle; |
160 | INIT_LIST_HEAD(&n->list); | 159 | INIT_LIST_HEAD(&n->list); |
161 | spin_lock_irqsave(&mp->ackqlock, flags); | 160 | spin_lock_bh(&mp->ackqlock); |
162 | list_add_tail(&n->list, &mp->ackqueue); | 161 | list_add_tail(&n->list, &mp->ackqueue); |
163 | mp->nack++; | 162 | mp->nack++; |
164 | spin_unlock_irqrestore(&mp->ackqlock, flags); | 163 | spin_unlock_bh(&mp->ackqlock); |
165 | return 0; | 164 | return 0; |
166 | } | 165 | } |
167 | 166 | ||
168 | static int capiminor_del_ack(struct capiminor *mp, u16 datahandle) | 167 | static int capiminor_del_ack(struct capiminor *mp, u16 datahandle) |
169 | { | 168 | { |
170 | struct ackqueue_entry *p, *tmp; | 169 | struct ackqueue_entry *p, *tmp; |
171 | unsigned long flags; | ||
172 | 170 | ||
173 | spin_lock_irqsave(&mp->ackqlock, flags); | 171 | spin_lock_bh(&mp->ackqlock); |
174 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { | 172 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { |
175 | if (p->datahandle == datahandle) { | 173 | if (p->datahandle == datahandle) { |
176 | list_del(&p->list); | 174 | list_del(&p->list); |
177 | kfree(p); | ||
178 | mp->nack--; | 175 | mp->nack--; |
179 | spin_unlock_irqrestore(&mp->ackqlock, flags); | 176 | spin_unlock_bh(&mp->ackqlock); |
177 | kfree(p); | ||
180 | return 0; | 178 | return 0; |
181 | } | 179 | } |
182 | } | 180 | } |
183 | spin_unlock_irqrestore(&mp->ackqlock, flags); | 181 | spin_unlock_bh(&mp->ackqlock); |
184 | return -1; | 182 | return -1; |
185 | } | 183 | } |
186 | 184 | ||
187 | static void capiminor_del_all_ack(struct capiminor *mp) | 185 | static void capiminor_del_all_ack(struct capiminor *mp) |
188 | { | 186 | { |
189 | struct ackqueue_entry *p, *tmp; | 187 | struct ackqueue_entry *p, *tmp; |
190 | unsigned long flags; | ||
191 | 188 | ||
192 | spin_lock_irqsave(&mp->ackqlock, flags); | ||
193 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { | 189 | list_for_each_entry_safe(p, tmp, &mp->ackqueue, list) { |
194 | list_del(&p->list); | 190 | list_del(&p->list); |
195 | kfree(p); | 191 | kfree(p); |
196 | mp->nack--; | 192 | mp->nack--; |
197 | } | 193 | } |
198 | spin_unlock_irqrestore(&mp->ackqlock, flags); | ||
199 | } | 194 | } |
200 | 195 | ||
201 | 196 | ||
@@ -676,7 +671,7 @@ static void capi_recv_message(struct capi20_appl *ap, struct sk_buff *skb) | |||
676 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2)); | 671 | CAPIMSG_U16(skb->data, CAPIMSG_BASELEN+4+2)); |
677 | #endif | 672 | #endif |
678 | kfree_skb(skb); | 673 | kfree_skb(skb); |
679 | (void)capiminor_del_ack(mp, datahandle); | 674 | capiminor_del_ack(mp, datahandle); |
680 | tty = tty_port_tty_get(&mp->port); | 675 | tty = tty_port_tty_get(&mp->port); |
681 | if (tty) { | 676 | if (tty) { |
682 | tty_wakeup(tty); | 677 | tty_wakeup(tty); |