2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-27 06:34:11 +08:00
linux-next/drivers/media
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
..
cec [media] cec: race fix: don't return -ENONET in cec_receive() 2017-06-08 07:36:36 -03:00
common [media] b2c2: constify nxt200x_config structure 2017-04-17 12:18:18 -03:00
dvb-core networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
dvb-frontends treewide: spelling: correct diffrent[iate] and banlance typos 2017-05-08 17:15:13 -07:00
firewire [media] firewire: don't break long lines 2016-10-21 10:06:00 -02:00
i2c [media] tc358743: fix register i2c_rd/wr function fix 2017-06-06 07:09:23 -03:00
mmc [media] siano: register media controller earlier 2015-02-26 09:10:39 -03:00
pci Annotation of module parameters that specify device settings 2017-05-10 19:13:03 -07:00
platform media fixes for v4.12-rc4 2017-06-06 09:37:44 -07:00
radio networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
rc [media] sir_ir: infinite loop in interrupt handler 2017-06-06 07:19:10 -03:00
spi [media] gs1662: drop kfree for memory allocated with devm_kzalloc 2016-10-24 17:59:08 -02:00
tuners [media] xc5000: fix spelling mistake: "calibration" 2017-04-19 08:29:21 -03:00
usb [media] rainshadow-cec: Fix missing spin_lock_init() 2017-06-06 07:10:01 -03:00
v4l2-core [media] vb2: Fix an off by one error in 'vb2_plane_vaddr' 2017-06-06 07:10:39 -03:00
Kconfig [media] cec: rename MEDIA_CEC_NOTIFIER to CEC_NOTIFIER 2017-06-04 15:23:35 -03:00
Makefile [media] cec: select CEC_CORE instead of depend on it 2017-06-04 15:23:33 -03:00
media-device.c [media] media: Rename graph and pipeline structs and functions 2017-01-27 16:13:24 -02:00
media-devnode.c media: utilize new cdev_device_add helper function 2017-03-21 06:44:33 +01:00
media-entity.c [media] media-entity: only call dev_dbg_obj if mdev is not NULL 2017-04-19 08:15:51 -03:00