提交 75c261b5 编写于 作者: A Alexander Stein 提交者: David S. Miller

net sysfs: Print link speed as signed integer

Otherwise 4294967295 (MBit/s) (-1) will be printed when there is no link.
Documentation/ABI/testing/sysfs-class-net does not state if this shall be
signed or unsigned.
Also remove the now unused variable fmt_udec.
Signed-off-by: NAlexander Stein <alexander.stein@systec-electronic.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4c52b1da
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
static const char fmt_hex[] = "%#x\n"; static const char fmt_hex[] = "%#x\n";
static const char fmt_long_hex[] = "%#lx\n"; static const char fmt_long_hex[] = "%#lx\n";
static const char fmt_dec[] = "%d\n"; static const char fmt_dec[] = "%d\n";
static const char fmt_udec[] = "%u\n";
static const char fmt_ulong[] = "%lu\n"; static const char fmt_ulong[] = "%lu\n";
static const char fmt_u64[] = "%llu\n"; static const char fmt_u64[] = "%llu\n";
...@@ -202,7 +201,7 @@ static ssize_t speed_show(struct device *dev, ...@@ -202,7 +201,7 @@ static ssize_t speed_show(struct device *dev,
if (netif_running(netdev)) { if (netif_running(netdev)) {
struct ethtool_cmd cmd; struct ethtool_cmd cmd;
if (!__ethtool_get_settings(netdev, &cmd)) if (!__ethtool_get_settings(netdev, &cmd))
ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd)); ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd));
} }
rtnl_unlock(); rtnl_unlock();
return ret; return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册