diff options
author | Colin Cross <ccross@android.com> | 2010-11-22 13:23:31 -0800 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2010-11-22 13:23:31 -0800 |
commit | 1f2e04a35d3568d1b31ddeee41fd5549f16f471e (patch) | |
tree | ff35a075fc78a2954f108b6e656515d26672b80c | |
parent | f80c849e73f023912a19ed0e9c3336561efad717 (diff) | |
parent | fa43ad045250d900f079ad4f8c6a51014143ae3a (diff) |
Merge branch 'android-2.6.36' into android-tegra-2.6.36
-rw-r--r-- | drivers/usb/gadget/rndis.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 972d5ddd1e18..116347b0bf13 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c @@ -159,6 +159,25 @@ 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 @@ -172,7 +191,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, rndis_query_cmplt_type *resp; struct net_device *net; struct rtnl_link_stats64 temp; - const struct rtnl_link_stats64 *stats; + struct rtnl_link_stats64 *stats = &temp; if (!r) return -ENOMEM; resp = (rndis_query_cmplt_type *) r->buf; @@ -195,7 +214,7 @@ gen_ndis_query_resp (int configNr, u32 OID, u8 *buf, unsigned buf_len, resp->InformationBufferOffset = cpu_to_le32 (16); net = rndis_per_dev_params[configNr].dev; - stats = dev_get_stats(net, &temp); + netdev_stats_to_stats64(stats, &net->stats); switch (OID) { |