linux/drivers/isdn/hardware/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
..
Kconfig isdn: hardware: mISDN: Remove reference to CONFIG_8xx 2017-03-16 11:15:14 -07:00
Makefile mISDN: Add support for Traverse Technologies NETJet PCI cards 2009-07-25 20:22:36 +02:00
avmfritz.c mISDN: mark symbols static where possible 2016-09-01 23:36:17 -07:00
hfc_multi.h mISDN: Added support for fragmentation of E1 interfaces of hfcmulti driver. 2012-04-26 05:21:03 -04:00
hfc_multi_8xx.h isdn: hardware: mISDN: Remove reference to CONFIG_8xx 2017-03-16 11:15:14 -07:00
hfc_pci.h isdn: whitespace coding style cleanup 2012-02-21 09:04:01 -08:00
hfcmulti.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hfcpci.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
hfcsusb.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
hfcsusb.h mISDN: Add X-Tensions USB ISDN TA XC-525 2012-05-22 15:19:01 -04:00
iohelper.h isdn: whitespace coding style cleanup 2012-02-21 09:04:01 -08:00
ipac.h mISDN: Support DR6 indication in mISDNipac driver 2016-03-14 15:51:29 -04:00
isar.h isdn: whitespace coding style cleanup 2012-02-21 09:04:01 -08:00
mISDNinfineon.c treewide: Fix typo in printk messages 2015-03-06 23:05:39 +01:00
mISDNipac.c mISDN: remove unnecessary variable assignments 2017-06-08 11:32:53 -04:00
mISDNisar.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
netjet.c mISDN: prevent possible NULL pointer dereference 2016-02-18 14:59:35 -05:00
netjet.h isdn: whitespace coding style cleanup 2012-02-21 09:04:01 -08:00
speedfax.c Drivers: isdn: remove __dev* attributes. 2013-01-03 15:57:02 -08:00
w6692.c isdn: use setup_timer 2017-03-24 12:33:42 -07:00
w6692.h mISDN: Add driver for Winbond cards 2009-07-25 20:21:28 +02:00