* [PATCH v2 1/1] net sysfs: Print link speed as signed integer
@ 2015-09-28 13:05 Alexander Stein
2015-09-29 15:13 ` Jeremy Harris
2015-09-29 21:56 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Alexander Stein @ 2015-09-28 13:05 UTC (permalink / raw)
To: David S. Miller; +Cc: Alexander Stein, netdev, linux-kernel
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: Alexander Stein <alexander.stein@systec-electronic.com>
---
Changes in v2:
* Switch the format specifier instead of changing it
* Remove the now unused variable
net/core/net-sysfs.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 805a95a..830f8a7 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -31,7 +31,6 @@
static const char fmt_hex[] = "%#x\n";
static const char fmt_long_hex[] = "%#lx\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_u64[] = "%llu\n";
@@ -202,7 +201,7 @@ static ssize_t speed_show(struct device *dev,
if (netif_running(netdev)) {
struct ethtool_cmd 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();
return ret;
--
2.4.9
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] net sysfs: Print link speed as signed integer
2015-09-28 13:05 [PATCH v2 1/1] net sysfs: Print link speed as signed integer Alexander Stein
@ 2015-09-29 15:13 ` Jeremy Harris
2015-09-29 21:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Jeremy Harris @ 2015-09-29 15:13 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel
On 28/09/15 14:05, Alexander Stein wrote:
> 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.
[...]
> - ret = sprintf(buf, fmt_udec, ethtool_cmd_speed(&cmd));
> + ret = sprintf(buf, fmt_dec, ethtool_cmd_speed(&cmd));
If we print anything numeric, why is zero not appropriate
(which would still be unsigned)?
--
Cheers,
Jeremy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/1] net sysfs: Print link speed as signed integer
2015-09-28 13:05 [PATCH v2 1/1] net sysfs: Print link speed as signed integer Alexander Stein
2015-09-29 15:13 ` Jeremy Harris
@ 2015-09-29 21:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-09-29 21:56 UTC (permalink / raw)
To: alexander.stein; +Cc: netdev, linux-kernel
From: Alexander Stein <alexander.stein@systec-electronic.com>
Date: Mon, 28 Sep 2015 15:05:33 +0200
> 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: Alexander Stein <alexander.stein@systec-electronic.com>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-09-29 21:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-28 13:05 [PATCH v2 1/1] net sysfs: Print link speed as signed integer Alexander Stein
2015-09-29 15:13 ` Jeremy Harris
2015-09-29 21:56 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).