diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2007-03-27 17:55:52 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-04-26 01:28:23 -0400 |
commit | d626f62b11e00c16e81e4308ab93d3f13551812a (patch) | |
tree | fac4af6ced853755e12fc709d55f0c2bec51265d /drivers/isdn | |
parent | 2a123b86e2b242a4a6db990d2851d45e192f88e5 (diff) |
[SK_BUFF]: Introduce skb_copy_from_linear_data{_offset}
To clearly state the intent of copying from linear sk_buffs, _offset being a
overly long variant but interesting for the sake of saving some bytes.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/act2000/module.c | 2 | ||||
-rw-r--r-- | drivers/isdn/gigaset/usb-gigaset.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/b1dma.c | 3 | ||||
-rw-r--r-- | drivers/isdn/hardware/avm/c4.c | 3 | ||||
-rw-r--r-- | drivers/isdn/hisax/elsa_ser.c | 6 | ||||
-rw-r--r-- | drivers/isdn/hisax/isdnl2.c | 3 | ||||
-rw-r--r-- | drivers/isdn/hysdn/hycapi.c | 2 | ||||
-rw-r--r-- | drivers/isdn/hysdn/hysdn_sched.c | 5 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_common.c | 2 | ||||
-rw-r--r-- | drivers/isdn/i4l/isdn_ppp.c | 7 | ||||
-rw-r--r-- | drivers/isdn/isdnloop/isdnloop.c | 3 | ||||
-rw-r--r-- | drivers/isdn/pcbit/capi.c | 12 |
12 files changed, 31 insertions, 19 deletions
diff --git a/drivers/isdn/act2000/module.c b/drivers/isdn/act2000/module.c index e3e5c1399076..ee2b0b9f8f46 100644 --- a/drivers/isdn/act2000/module.c +++ b/drivers/isdn/act2000/module.c | |||
@@ -442,7 +442,7 @@ act2000_sendbuf(act2000_card *card, int channel, int ack, struct sk_buff *skb) | |||
442 | return 0; | 442 | return 0; |
443 | } | 443 | } |
444 | skb_reserve(xmit_skb, 19); | 444 | skb_reserve(xmit_skb, 19); |
445 | memcpy(skb_put(xmit_skb, len), skb->data, len); | 445 | skb_copy_from_linear_data(skb, skb_put(xmit_skb, len), len); |
446 | } else { | 446 | } else { |
447 | xmit_skb = skb_clone(skb, GFP_ATOMIC); | 447 | xmit_skb = skb_clone(skb, GFP_ATOMIC); |
448 | if (!xmit_skb) { | 448 | if (!xmit_skb) { |
diff --git a/drivers/isdn/gigaset/usb-gigaset.c b/drivers/isdn/gigaset/usb-gigaset.c index 2baef349c12d..c8e1c357cec8 100644 --- a/drivers/isdn/gigaset/usb-gigaset.c +++ b/drivers/isdn/gigaset/usb-gigaset.c | |||
@@ -652,7 +652,7 @@ static int write_modem(struct cardstate *cs) | |||
652 | * transmit data | 652 | * transmit data |
653 | */ | 653 | */ |
654 | count = min(bcs->tx_skb->len, (unsigned) ucs->bulk_out_size); | 654 | count = min(bcs->tx_skb->len, (unsigned) ucs->bulk_out_size); |
655 | memcpy(ucs->bulk_out_buffer, bcs->tx_skb->data, count); | 655 | skb_copy_from_linear_data(bcs->tx_skb, ucs->bulk_out_buffer, count); |
656 | skb_pull(bcs->tx_skb, count); | 656 | skb_pull(bcs->tx_skb, count); |
657 | atomic_set(&ucs->busy, 1); | 657 | atomic_set(&ucs->busy, 1); |
658 | gig_dbg(DEBUG_OUTPUT, "write_modem: send %d bytes", count); | 658 | gig_dbg(DEBUG_OUTPUT, "write_modem: send %d bytes", count); |
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 1e2d38e3d68c..428872b653e9 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -404,7 +404,8 @@ static void b1dma_dispatch_tx(avmcard *card) | |||
404 | printk(KERN_DEBUG "tx: put 0x%x len=%d\n", | 404 | printk(KERN_DEBUG "tx: put 0x%x len=%d\n", |
405 | skb->data[2], txlen); | 405 | skb->data[2], txlen); |
406 | #endif | 406 | #endif |
407 | memcpy(dma->sendbuf.dmabuf, skb->data+2, skb->len-2); | 407 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, |
408 | skb->len - 2); | ||
408 | } | 409 | } |
409 | txlen = (txlen + 3) & ~3; | 410 | txlen = (txlen + 3) & ~3; |
410 | 411 | ||
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 6f5efa8d78cb..d58f927e766a 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -457,7 +457,8 @@ static void c4_dispatch_tx(avmcard *card) | |||
457 | printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", | 457 | printk(KERN_DEBUG "%s: tx put 0x%x len=%d\n", |
458 | card->name, skb->data[2], txlen); | 458 | card->name, skb->data[2], txlen); |
459 | #endif | 459 | #endif |
460 | memcpy(dma->sendbuf.dmabuf, skb->data+2, skb->len-2); | 460 | skb_copy_from_linear_data_offset(skb, 2, dma->sendbuf.dmabuf, |
461 | skb->len - 2); | ||
461 | } | 462 | } |
462 | txlen = (txlen + 3) & ~3; | 463 | txlen = (txlen + 3) & ~3; |
463 | 464 | ||
diff --git a/drivers/isdn/hisax/elsa_ser.c b/drivers/isdn/hisax/elsa_ser.c index ae377e812775..1642dca988a1 100644 --- a/drivers/isdn/hisax/elsa_ser.c +++ b/drivers/isdn/hisax/elsa_ser.c | |||
@@ -254,14 +254,16 @@ write_modem(struct BCState *bcs) { | |||
254 | count = len; | 254 | count = len; |
255 | if (count > MAX_MODEM_BUF - fp) { | 255 | if (count > MAX_MODEM_BUF - fp) { |
256 | count = MAX_MODEM_BUF - fp; | 256 | count = MAX_MODEM_BUF - fp; |
257 | memcpy(cs->hw.elsa.transbuf + fp, bcs->tx_skb->data, count); | 257 | skb_copy_from_linear_data(bcs->tx_skb, |
258 | cs->hw.elsa.transbuf + fp, count); | ||
258 | skb_pull(bcs->tx_skb, count); | 259 | skb_pull(bcs->tx_skb, count); |
259 | cs->hw.elsa.transcnt += count; | 260 | cs->hw.elsa.transcnt += count; |
260 | ret = count; | 261 | ret = count; |
261 | count = len - count; | 262 | count = len - count; |
262 | fp = 0; | 263 | fp = 0; |
263 | } | 264 | } |
264 | memcpy((cs->hw.elsa.transbuf + fp), bcs->tx_skb->data, count); | 265 | skb_copy_from_linear_data(bcs->tx_skb, |
266 | cs->hw.elsa.transbuf + fp, count); | ||
265 | skb_pull(bcs->tx_skb, count); | 267 | skb_pull(bcs->tx_skb, count); |
266 | cs->hw.elsa.transcnt += count; | 268 | cs->hw.elsa.transcnt += count; |
267 | ret += count; | 269 | ret += count; |
diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c index cd3b5ad53491..3446f249d675 100644 --- a/drivers/isdn/hisax/isdnl2.c +++ b/drivers/isdn/hisax/isdnl2.c | |||
@@ -1293,7 +1293,8 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg) | |||
1293 | oskb = skb; | 1293 | oskb = skb; |
1294 | skb = alloc_skb(oskb->len + i, GFP_ATOMIC); | 1294 | skb = alloc_skb(oskb->len + i, GFP_ATOMIC); |
1295 | memcpy(skb_put(skb, i), header, i); | 1295 | memcpy(skb_put(skb, i), header, i); |
1296 | memcpy(skb_put(skb, oskb->len), oskb->data, oskb->len); | 1296 | skb_copy_from_linear_data(oskb, |
1297 | skb_put(skb, oskb->len), oskb->len); | ||
1297 | dev_kfree_skb(oskb); | 1298 | dev_kfree_skb(oskb); |
1298 | } | 1299 | } |
1299 | st->l2.l2l1(st, PH_PULL | INDICATION, skb); | 1300 | st->l2.l2l1(st, PH_PULL | INDICATION, skb); |
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index b2ae4ec1e49e..4433ce0fca55 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -398,7 +398,7 @@ static u16 hycapi_send_message(struct capi_ctr *ctrl, struct sk_buff *skb) | |||
398 | _len = CAPIMSG_LEN(skb->data); | 398 | _len = CAPIMSG_LEN(skb->data); |
399 | if (_len > 22) { | 399 | if (_len > 22) { |
400 | _len2 = _len - 22; | 400 | _len2 = _len - 22; |
401 | memcpy(msghead, skb->data, 22); | 401 | skb_copy_from_linear_data(skb, msghead, 22); |
402 | memcpy(skb->data + _len2, msghead, 22); | 402 | memcpy(skb->data + _len2, msghead, 22); |
403 | skb_pull(skb, _len2); | 403 | skb_pull(skb, _len2); |
404 | CAPIMSG_SETLEN(skb->data, 22); | 404 | CAPIMSG_SETLEN(skb->data, 22); |
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c index b7b5aa4748a0..81db4a190d41 100644 --- a/drivers/isdn/hysdn/hysdn_sched.c +++ b/drivers/isdn/hysdn/hysdn_sched.c | |||
@@ -113,7 +113,8 @@ hysdn_sched_tx(hysdn_card *card, unsigned char *buf, | |||
113 | (skb = hysdn_tx_netget(card)) != NULL) | 113 | (skb = hysdn_tx_netget(card)) != NULL) |
114 | { | 114 | { |
115 | if (skb->len <= maxlen) { | 115 | if (skb->len <= maxlen) { |
116 | memcpy(buf, skb->data, skb->len); /* copy the packet to the buffer */ | 116 | /* copy the packet to the buffer */ |
117 | skb_copy_from_linear_data(skb, buf, skb->len); | ||
117 | *len = skb->len; | 118 | *len = skb->len; |
118 | *chan = CHAN_NDIS_DATA; | 119 | *chan = CHAN_NDIS_DATA; |
119 | card->net_tx_busy = 1; /* we are busy sending network data */ | 120 | card->net_tx_busy = 1; /* we are busy sending network data */ |
@@ -126,7 +127,7 @@ hysdn_sched_tx(hysdn_card *card, unsigned char *buf, | |||
126 | ((skb = hycapi_tx_capiget(card)) != NULL) ) | 127 | ((skb = hycapi_tx_capiget(card)) != NULL) ) |
127 | { | 128 | { |
128 | if (skb->len <= maxlen) { | 129 | if (skb->len <= maxlen) { |
129 | memcpy(buf, skb->data, skb->len); | 130 | skb_copy_from_linear_data(skb, buf, skb->len); |
130 | *len = skb->len; | 131 | *len = skb->len; |
131 | *chan = CHAN_CAPI; | 132 | *chan = CHAN_CAPI; |
132 | hycapi_tx_capiack(card); | 133 | hycapi_tx_capiack(card); |
diff --git a/drivers/isdn/i4l/isdn_common.c b/drivers/isdn/i4l/isdn_common.c index 9c926e41b114..c97330b19877 100644 --- a/drivers/isdn/i4l/isdn_common.c +++ b/drivers/isdn/i4l/isdn_common.c | |||
@@ -829,7 +829,7 @@ isdn_readbchan(int di, int channel, u_char * buf, u_char * fp, int len, wait_que | |||
829 | dflag = 0; | 829 | dflag = 0; |
830 | } | 830 | } |
831 | count_put = count_pull; | 831 | count_put = count_pull; |
832 | memcpy(cp, skb->data, count_put); | 832 | skb_copy_from_linear_data(skb, cp, count_put); |
833 | cp += count_put; | 833 | cp += count_put; |
834 | len -= count_put; | 834 | len -= count_put; |
835 | #ifdef CONFIG_ISDN_AUDIO | 835 | #ifdef CONFIG_ISDN_AUDIO |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index be915051cb2e..387392cb3d68 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -1100,7 +1100,8 @@ isdn_ppp_push_higher(isdn_net_dev * net_dev, isdn_net_local * lp, struct sk_buff | |||
1100 | goto drop_packet; | 1100 | goto drop_packet; |
1101 | } | 1101 | } |
1102 | skb_put(skb, skb_old->len + 128); | 1102 | skb_put(skb, skb_old->len + 128); |
1103 | memcpy(skb->data, skb_old->data, skb_old->len); | 1103 | skb_copy_from_linear_data(skb_old, skb->data, |
1104 | skb_old->len); | ||
1104 | if (net_dev->local->ppp_slot < 0) { | 1105 | if (net_dev->local->ppp_slot < 0) { |
1105 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", | 1106 | printk(KERN_ERR "%s: net_dev->local->ppp_slot(%d) out of range\n", |
1106 | __FUNCTION__, net_dev->local->ppp_slot); | 1107 | __FUNCTION__, net_dev->local->ppp_slot); |
@@ -1902,7 +1903,9 @@ void isdn_ppp_mp_reassembly( isdn_net_dev * net_dev, isdn_net_local * lp, | |||
1902 | while( from != to ) { | 1903 | while( from != to ) { |
1903 | unsigned int len = from->len - MP_HEADER_LEN; | 1904 | unsigned int len = from->len - MP_HEADER_LEN; |
1904 | 1905 | ||
1905 | memcpy(skb_put(skb,len), from->data+MP_HEADER_LEN, len); | 1906 | skb_copy_from_linear_data_offset(from, MP_HEADER_LEN, |
1907 | skb_put(skb,len), | ||
1908 | len); | ||
1906 | frag = from->next; | 1909 | frag = from->next; |
1907 | isdn_ppp_mp_free_skb(mp, from); | 1910 | isdn_ppp_mp_free_skb(mp, from); |
1908 | from = frag; | 1911 | from = frag; |
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index e3add27dd0e1..e93ad59f60bf 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -415,7 +415,8 @@ isdnloop_sendbuf(int channel, struct sk_buff *skb, isdnloop_card * card) | |||
415 | spin_lock_irqsave(&card->isdnloop_lock, flags); | 415 | spin_lock_irqsave(&card->isdnloop_lock, flags); |
416 | nskb = dev_alloc_skb(skb->len); | 416 | nskb = dev_alloc_skb(skb->len); |
417 | if (nskb) { | 417 | if (nskb) { |
418 | memcpy(skb_put(nskb, len), skb->data, len); | 418 | skb_copy_from_linear_data(skb, |
419 | skb_put(nskb, len), len); | ||
419 | skb_queue_tail(&card->bqueue[channel], nskb); | 420 | skb_queue_tail(&card->bqueue[channel], nskb); |
420 | dev_kfree_skb(skb); | 421 | dev_kfree_skb(skb); |
421 | } else | 422 | } else |
diff --git a/drivers/isdn/pcbit/capi.c b/drivers/isdn/pcbit/capi.c index 47c59e95898d..7b55e151f1b0 100644 --- a/drivers/isdn/pcbit/capi.c +++ b/drivers/isdn/pcbit/capi.c | |||
@@ -429,8 +429,9 @@ int capi_decode_conn_ind(struct pcbit_chan * chan, | |||
429 | if (!(info->data.setup.CallingPN = kmalloc(len - count + 1, GFP_ATOMIC))) | 429 | if (!(info->data.setup.CallingPN = kmalloc(len - count + 1, GFP_ATOMIC))) |
430 | return -1; | 430 | return -1; |
431 | 431 | ||
432 | memcpy(info->data.setup.CallingPN, skb->data + count + 1, | 432 | skb_copy_from_linear_data_offset(skb, count + 1, |
433 | len - count); | 433 | info->data.setup.CallingPN, |
434 | len - count); | ||
434 | info->data.setup.CallingPN[len - count] = 0; | 435 | info->data.setup.CallingPN[len - count] = 0; |
435 | 436 | ||
436 | } | 437 | } |
@@ -457,8 +458,9 @@ int capi_decode_conn_ind(struct pcbit_chan * chan, | |||
457 | if (!(info->data.setup.CalledPN = kmalloc(len - count + 1, GFP_ATOMIC))) | 458 | if (!(info->data.setup.CalledPN = kmalloc(len - count + 1, GFP_ATOMIC))) |
458 | return -1; | 459 | return -1; |
459 | 460 | ||
460 | memcpy(info->data.setup.CalledPN, skb->data + count + 1, | 461 | skb_copy_from_linear_data_offset(skb, count + 1, |
461 | len - count); | 462 | info->data.setup.CalledPN, |
463 | len - count); | ||
462 | info->data.setup.CalledPN[len - count] = 0; | 464 | info->data.setup.CalledPN[len - count] = 0; |
463 | 465 | ||
464 | } | 466 | } |
@@ -539,7 +541,7 @@ int capi_decode_conn_actv_ind(struct pcbit_chan * chan, struct sk_buff *skb) | |||
539 | 541 | ||
540 | #ifdef DEBUG | 542 | #ifdef DEBUG |
541 | if (len > 1 && len < 31) { | 543 | if (len > 1 && len < 31) { |
542 | memcpy(str, skb->data + 2, len - 1); | 544 | skb_copy_from_linear_data_offset(skb, 2, str, len - 1); |
543 | str[len] = 0; | 545 | str[len] = 0; |
544 | printk(KERN_DEBUG "Connected Party Number: %s\n", str); | 546 | printk(KERN_DEBUG "Connected Party Number: %s\n", str); |
545 | } | 547 | } |