kernel_optimize_test/drivers/isdn/hisax
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
..
amd7930_fn.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
amd7930_fn.h
arcofi.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
arcofi.h
asuscom.c
avm_a1.c
avm_a1p.c
avm_pci.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
avma1_cs.c
bkm_a4t.c
bkm_a8.c
bkm_ax.h
callc.c
config.c Annotate hardware config module parameters in drivers/isdn/ 2017-04-20 12:02:32 +01:00
diva.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
elsa_cs.c
elsa_ser.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
elsa.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
enternow_pci.c
fsm.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
fsm.h
gazel.c
hfc_2bds0.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hfc_2bds0.h
hfc_2bs0.c
hfc_2bs0.h
hfc_pci.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hfc_pci.h
hfc_sx.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hfc_sx.h
hfc_usb.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hfc_usb.h
hfc4s8s_l1.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hfc4s8s_l1.h
hfcscard.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hisax_cfg.h
hisax_debug.h
hisax_fcpcipnp.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hisax_fcpcipnp.h
hisax_if.h
hisax_isac.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hisax_isac.h
hisax.h isdn: Constify some function parameters 2016-12-17 21:46:35 -05:00
hscx_irq.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hscx.c
hscx.h
icc.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
icc.h
ipac.h
ipacx.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ipacx.h
isac.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
isac.h
isar.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
isar.h
isdnl1.c
isdnl1.h
isdnl2.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
isdnl2.h
isdnl3.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
isdnl3.h
isurf.c
ix1_micro.c
jade_irq.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
jade.c
jade.h
Kconfig
l3_1tr6.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
l3_1tr6.h
l3dss1.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
l3dss1.h
l3ni1.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
l3ni1.h
lmgr.c
Makefile
mic.c
netjet.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
netjet.h
niccy.c
nj_s.c
nj_u.c
q931.c
s0box.c
saphir.c
sedlbauer_cs.c
sedlbauer.c
sportster.c
st5481_b.c scripts/spelling.txt: add "disble(d)" pattern and fix typo instances 2017-03-09 17:01:09 -08:00
st5481_d.c
st5481_init.c
st5481_usb.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
st5481.h
tei.c
teleint.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
teles_cs.c
teles3.c
teles0.c
telespci.c
w6692.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
w6692.h