linux/drivers/staging/octeon
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
..
ethernet-defines.h staging: octeon: Add space around '+' 2015-11-15 20:02:47 -08:00
ethernet-mdio.c Staging: octeon: Add missing of_node_put after calling of_parse_phandle. 2016-09-20 13:51:24 +02:00
ethernet-mdio.h
ethernet-mem.c staging: octeon: Remove comparison to NULL 2016-03-11 22:09:09 -08:00
ethernet-mem.h
ethernet-rgmii.c staging: octeon: stop using cvmx_helper_link_autoconf() 2016-09-12 13:21:48 +02:00
ethernet-rx.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ethernet-rx.h staging: octeon: Fix alignment with open parenthesis 2016-03-28 07:30:36 -07:00
ethernet-sgmii.c
ethernet-spi.c staging: octeon: Remove blank lines after open brace 2016-03-11 22:09:09 -08:00
ethernet-tx.c staging/iio driver patches for 4.11-rc1 2017-02-22 12:14:01 -08:00
ethernet-tx.h
ethernet-util.h staging: octeon: check for pow0 before calling interface helper 2016-08-21 18:02:32 +02:00
ethernet.c staging: octeon: Use net_device_stats from struct net_device 2017-02-16 10:44:58 -08:00
Kconfig
Makefile staging: octeon-ethernet: move cvm_oct_xaui_open() 2015-10-17 20:56:10 -07:00
octeon-ethernet.h staging: octeon: Use net_device_stats from struct net_device 2017-02-16 10:44:58 -08:00