From: Benoit Goby Date: Fri, 16 Dec 2011 02:40:37 +0000 (-0800) Subject: Revert "usb: gadget: rndis: don't use dev_get_stats" X-Git-Tag: firefly_0821_release~7613^2~199 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f16e6fb3e3bbbc279579b3c3def7951787c88a0a;p=firefly-linux-kernel-4.4.55.git Revert "usb: gadget: rndis: don't use dev_get_stats" This reverts commit ffdab0c0c40bab6de78b1952bb07aed221994b73. Not needed anymore in 2.6.39 and 3.0, dev_get_stats has been fixed and may be called from atomic context. See: 1ac9ad1 net: remove dev_txq_stats_fold() --- diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 6cea2e17b32b..d3cdffea9c8a 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -159,25 +159,6 @@ static const u32 oid_supported_list[] = #endif /* RNDIS_PM */ }; -/* HACK: copied from net/core/dev.c to replace dev_get_stats since - * dev_get_stats cannot be called from atomic context */ -static void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64, - const struct net_device_stats *netdev_stats) -{ -#if BITS_PER_LONG == 64 - BUILD_BUG_ON(sizeof(*stats64) != sizeof(*netdev_stats)); - memcpy(stats64, netdev_stats, sizeof(*stats64)); -#else - size_t i, n = sizeof(*stats64) / sizeof(u64); - const unsigned long *src = (const unsigned long *)netdev_stats; - u64 *dst = (u64 *)stats64; - - BUILD_BUG_ON(sizeof(*netdev_stats) / sizeof(unsigned long) != - sizeof(*stats64) / sizeof(u64)); - for (i = 0; i < n; i++) - dst[i] = src[i]; -#endif -} /* NDIS Functions */ static int gen_ndis_query_resp(int configNr, u32 OID, u8 *buf, @@ -190,7 +171,7 @@ static int gen_ndis_query_resp(int configNr, u32 OID, u8 *buf, rndis_query_cmplt_type *resp; struct net_device *net; struct rtnl_link_stats64 temp; - struct rtnl_link_stats64 *stats = &temp; + const struct rtnl_link_stats64 *stats; if (!r) return -ENOMEM; resp = (rndis_query_cmplt_type *)r->buf; @@ -213,7 +194,7 @@ static int gen_ndis_query_resp(int configNr, u32 OID, u8 *buf, resp->InformationBufferOffset = cpu_to_le32(16); net = rndis_per_dev_params[configNr].dev; - netdev_stats_to_stats64(stats, &net->stats); + stats = dev_get_stats(net, &temp); switch (OID) {