linux/drivers/isdn/mISDN
Johannes Berg 59ae1d127a networking: introduce and use skb_put_data()
A common pattern with skb_put() is to just want to memcpy()
some data into the new space, introduce skb_put_data() for
this.

An spatch similar to the one for skb_put_zero() converts many
of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

(again, manually post-processed to retain some comments)

Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-06-16 11:48:37 -04:00
..
clock.c isdn: Use ktime_t instead of 'struct timeval' 2016-03-20 16:47:13 -04:00
core.c ISDN: convert class code to use dev_groups 2013-07-26 18:05:17 -07:00
core.h
dsp_audio.c isdn: Remove reverse_bits(), use revbit8() 2015-08-10 14:29:04 -07:00
dsp_biquad.h
dsp_blowfish.c
dsp_cmx.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
dsp_core.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
dsp_dtmf.c mISDN: Fix division by zero 2012-04-26 03:10:45 -04:00
dsp_ecdis.h
dsp_hwec.c
dsp_hwec.h
dsp_pipeline.c mISDN: use kstrdup() in dsp_pipeline_build 2015-10-13 18:29:50 -07:00
dsp_tones.c
dsp.h mISDN: DSP scheduling fix (version 2) 2012-04-26 03:10:45 -04:00
fsm.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
fsm.h
hwchannel.c Merge branch 'for-3.7' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/wq 2012-10-02 09:54:49 -07:00
Kconfig treewide: Fix typo in Kconfig 2013-12-02 14:54:57 +01:00
l1oip_codec.c mISDN: Deletion of unnecessary checks before the function call "vfree" 2014-11-21 12:17:53 -05:00
l1oip_core.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
l1oip.h
layer1.c mISDN: Layer1 statemachine fix 2012-05-04 11:55:39 -04:00
layer1.h
layer2.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
layer2.h
Makefile
socket.c mISDN: Fixing missing validation in base_sock_bind() 2016-04-13 23:00:50 -04:00
stack.c mISDN: Fix a sleep-in-atomic bug 2017-06-01 14:49:47 -04:00
tei.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
timerdev.c sched/headers: Prepare to move signal wakeup & sigpending methods from <linux/sched.h> into <linux/sched/signal.h> 2017-03-02 08:42:32 +01:00