linux/drivers/staging/most
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
..
Documentation staging: most: Documentation: update ABI description 2016-09-12 09:47:15 +02:00
aim-cdev staging: most: destroy cdev when channel gets disconnected 2017-04-08 12:41:39 +02:00
aim-network networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
aim-sound staging: most: aim-sound style fixess 2017-04-25 20:56:15 +02:00
aim-v4l2 Staging: most: aim-v4l2: constify v4l2_file_operations structures 2016-09-27 13:06:55 +02:00
hdm-dim2 staging: most: Using macro DIV_ROUND_UP 2017-03-06 09:17:02 +01:00
hdm-i2c staging:most/hdm-i2c: Replace symbolic permissions with octal permissions 2017-02-05 11:41:38 +01:00
hdm-usb Staging/IIO patches for 4.12-rc1 2017-05-05 18:16:23 -07:00
mostcore format-security: move static strings to const 2017-05-08 17:15:14 -07:00
Kconfig Staging: most: MOST and MOSTCORE should depend on HAS_DMA 2015-09-13 09:24:44 -07:00
Makefile Staging: most: add MOST driver's hdm-usb module 2015-07-24 13:50:43 -07:00
TODO