summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/quantenna
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2017-06-16 14:29:20 +0200
committerDavid S. Miller <davem@davemloft.net>2017-06-16 11:48:37 -0400
commit59ae1d127ac0ae404baf414c434ba2651b793f46 (patch)
tree043e71496aa7a7db86bcc8219a3a51f533aac982 /drivers/net/wireless/quantenna
parentb080db585384b9f037e015c0c28d1ad33be41dfc (diff)
downloadlinux-59ae1d127ac0ae404baf414c434ba2651b793f46.tar.gz
linux-59ae1d127ac0ae404baf414c434ba2651b793f46.tar.bz2
linux-59ae1d127ac0ae404baf414c434ba2651b793f46.zip
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>
Diffstat (limited to 'drivers/net/wireless/quantenna')
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c2
-rw-r--r--drivers/net/wireless/quantenna/qtnfmac/qlink_util.h3
2 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
index 4814d90c8040..f93b27f3a236 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/pearl/pcie.c
@@ -213,7 +213,7 @@ static void qtnf_pcie_control_rx_callback(void *arg, const u8 *buf, size_t len)
return;
}
- memcpy(skb_put(skb, len), buf, len);
+ skb_put_data(skb, buf, len);
qtnf_trans_handle_rx_ctl_packet(bus, skb);
}
diff --git a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h
index d8de484b5995..9844ff0add2b 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h
+++ b/drivers/net/wireless/quantenna/qtnfmac/qlink_util.h
@@ -35,8 +35,7 @@ qtnf_cmd_skb_put_buffer(struct sk_buff *skb, const u8 *buf_src, size_t len)
{
u8 *buf_dst;
- buf_dst = skb_put(skb, len);
- memcpy(buf_dst, buf_src, len);
+ buf_dst = skb_put_data(skb, buf_src, len);
}
static inline void qtnf_cmd_skb_put_tlv_arr(struct sk_buff *skb,