Revert "usb: gadget: rndis: don't use dev_get_stats"
authorBenoit Goby <benoit@android.com>
Fri, 16 Dec 2011 02:40:37 +0000 (18:40 -0800)
committerBenoit Goby <benoit@android.com>
Mon, 19 Dec 2011 22:00:21 +0000 (14:00 -0800)
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()

drivers/usb/gadget/rndis.c

index 6cea2e17b32b2d56adb32d4a8ddfde025d9a1f75..d3cdffea9c8a33e71dd8fb5bacaf41c7aaf240cd 100644 (file)
@@ -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) {