linux/drivers/staging/ks7010
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 staging: ks7010: remove custom firmware loader 2016-06-07 22:42:53 -07:00
Makefile staging: ks7010: remove cfg file handling 2016-06-18 19:45:55 -07:00
TODO staging: ks7010: add task to TODO file 2017-04-11 16:05:51 +02:00
eap_packet.h staging: ks7010: remove magic numbers 2017-04-28 11:45:49 +02:00
ks7010_sdio.c staging: ks7010: make abbreviation mgmt uniform 2017-04-28 11:47:26 +02:00
ks7010_sdio.h staging: ks7010: add struct comment to ks_sdio_card 2017-04-18 13:47:31 +02:00
ks_hostif.c networking: introduce and use skb_put_data() 2017-06-16 11:48:37 -04:00
ks_hostif.h staging: ks7010: fix enumeration tags 2017-04-28 11:47:26 +02:00
ks_wlan.h staging: ks7010: make abbreviation mgmt uniform 2017-04-28 11:47:26 +02:00
ks_wlan_ioctl.h staging: ks7010: add parentheses to complex macro 2017-03-14 06:20:57 +08:00
ks_wlan_net.c staging: ks7010: remove cast from netdev_priv() 2017-04-28 11:47:26 +02:00
michael_mic.c staging: ks7010: fix checkpatch SPACING 2017-03-21 08:52:33 +01:00
michael_mic.h staging: ks7010: fix spelling of Michael MIC 2017-03-14 08:04:51 +08:00