diff options
author | Samuel Ortiz <samuel@sortiz.org> | 2006-09-27 23:06:44 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-09-28 21:02:48 -0400 |
commit | 1b0fee7d68f234be6b270cda51d9fcb71bebd780 (patch) | |
tree | 11e734d80ebaf2f0a053f912bfc59068c33ef4aa /net/irda/irttp.c | |
parent | 778e6398d32590eaf2333706318cbcd04dbe50b7 (diff) |
[IrDA]: Memory allocations cleanups
This patch replaces the bunch of arbitrary 64 and 128 bytes alloc_skb() calls
with more accurate allocation sizes.
Signed-off-by: Samuel Ortiz <samuel@sortiz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/irda/irttp.c')
-rw-r--r-- | net/irda/irttp.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index 42acf1cde737..3c2e70b77df1 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -804,12 +804,12 @@ static inline void irttp_give_credit(struct tsap_cb *self) | |||
804 | self->send_credit, self->avail_credit, self->remote_credit); | 804 | self->send_credit, self->avail_credit, self->remote_credit); |
805 | 805 | ||
806 | /* Give credit to peer */ | 806 | /* Give credit to peer */ |
807 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 807 | tx_skb = alloc_skb(TTP_MAX_HEADER, GFP_ATOMIC); |
808 | if (!tx_skb) | 808 | if (!tx_skb) |
809 | return; | 809 | return; |
810 | 810 | ||
811 | /* Reserve space for LMP, and LAP header */ | 811 | /* Reserve space for LMP, and LAP header */ |
812 | skb_reserve(tx_skb, self->max_header_size); | 812 | skb_reserve(tx_skb, LMP_MAX_HEADER); |
813 | 813 | ||
814 | /* | 814 | /* |
815 | * Since we can transmit and receive frames concurrently, | 815 | * Since we can transmit and receive frames concurrently, |
@@ -1093,7 +1093,8 @@ int irttp_connect_request(struct tsap_cb *self, __u8 dtsap_sel, | |||
1093 | 1093 | ||
1094 | /* Any userdata supplied? */ | 1094 | /* Any userdata supplied? */ |
1095 | if (userdata == NULL) { | 1095 | if (userdata == NULL) { |
1096 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1096 | tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
1097 | GFP_ATOMIC); | ||
1097 | if (!tx_skb) | 1098 | if (!tx_skb) |
1098 | return -ENOMEM; | 1099 | return -ENOMEM; |
1099 | 1100 | ||
@@ -1341,7 +1342,8 @@ int irttp_connect_response(struct tsap_cb *self, __u32 max_sdu_size, | |||
1341 | 1342 | ||
1342 | /* Any userdata supplied? */ | 1343 | /* Any userdata supplied? */ |
1343 | if (userdata == NULL) { | 1344 | if (userdata == NULL) { |
1344 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1345 | tx_skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
1346 | GFP_ATOMIC); | ||
1345 | if (!tx_skb) | 1347 | if (!tx_skb) |
1346 | return -ENOMEM; | 1348 | return -ENOMEM; |
1347 | 1349 | ||
@@ -1540,14 +1542,14 @@ int irttp_disconnect_request(struct tsap_cb *self, struct sk_buff *userdata, | |||
1540 | 1542 | ||
1541 | if (!userdata) { | 1543 | if (!userdata) { |
1542 | struct sk_buff *tx_skb; | 1544 | struct sk_buff *tx_skb; |
1543 | tx_skb = alloc_skb(64, GFP_ATOMIC); | 1545 | tx_skb = alloc_skb(LMP_MAX_HEADER, GFP_ATOMIC); |
1544 | if (!tx_skb) | 1546 | if (!tx_skb) |
1545 | return -ENOMEM; | 1547 | return -ENOMEM; |
1546 | 1548 | ||
1547 | /* | 1549 | /* |
1548 | * Reserve space for MUX and LAP header | 1550 | * Reserve space for MUX and LAP header |
1549 | */ | 1551 | */ |
1550 | skb_reserve(tx_skb, TTP_MAX_HEADER); | 1552 | skb_reserve(tx_skb, LMP_MAX_HEADER); |
1551 | 1553 | ||
1552 | userdata = tx_skb; | 1554 | userdata = tx_skb; |
1553 | } | 1555 | } |