linux/drivers/net/can
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
..
c_can drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00
cc770 Annotate hardware config module parameters in drivers/net/can/ 2017-04-20 12:02:32 +01:00
ifi_canfd can: ifi: use correct register to read rx status 2017-04-04 17:48:22 +02:00
m_can can: m_can: add deep Suspend/Resume support 2017-05-18 10:32:48 +02:00
mscan treewide: replace dev->trans_start update with helper 2016-05-04 14:16:49 -04:00
peak_canfd can: peak_canfd: fix uninitialized symbol warnings 2017-06-09 11:39:23 +02:00
rcar scripts/spelling.txt: add regsiter -> register spelling mistake 2017-05-08 17:15:13 -07:00
sja1000 Annotate hardware config module parameters in drivers/net/can/ 2017-04-20 12:02:32 +01:00
softing 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
spi can: hi311x: Add Holt HI-311x CAN driver 2017-04-04 17:35:59 +02:00
usb can: gs_usb: fix memory leak in gs_cmd_reset() 2017-06-09 11:39:23 +02:00
Kconfig can: add Virtual CAN Tunnel driver (vxcan) 2017-04-25 09:04:30 +02:00
Makefile can: add Virtual CAN Tunnel driver (vxcan) 2017-04-25 09:04:30 +02:00
at91_can.c drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00
bfin_can.c can: remove obsolete assignment for CAN protocol error type 2015-11-23 09:37:38 +01:00
dev.c can: dev: make can_change_state() robust to be called with cf == NULL 2017-06-09 11:39:23 +02:00
flexcan.c can: flexcan: fix typo in comment 2017-03-03 13:00:07 +01:00
grcan.c docs: fix locations of several documents that got moved 2016-10-24 08:12:35 -02:00
janz-ican3.c drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00
led.c can: add combined rx/tx LED trigger support 2015-03-22 23:50:11 +01:00
pch_can.c can: fix assignment of error location in CAN error messages 2015-11-23 09:37:34 +01:00
rx-offload.c can: rx-offload: Add support for timestamp based irq offloading 2017-02-06 15:13:24 +01:00
slcan.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
sun4i_can.c can: remove obsolete assignment for CAN protocol error type 2015-11-23 09:37:38 +01:00
ti_hecc.c can: ti_hecc: fix return value check in ti_hecc_probe() 2017-04-25 10:03:40 +02:00
vcan.c can: enable CAN FD for virtual CAN devices by default 2017-06-09 14:39:02 +02:00
vxcan.c can: enable CAN FD for virtual CAN devices by default 2017-06-09 14:39:02 +02:00
xilinx_can.c drivers: net: generalize napi_complete_done() 2017-01-30 15:10:42 -05:00