Commit be6528b2e58d92ef2ffed6f130e2d42bb85dbf29

Authored by Stephen Hemminger
Committed by Rusty Russell
1 parent 22e132ff26

virtio: fix format of sysfs driver/vendor files

The sysfs files for virtio produce the wrong format and are missing
the required newline. The output for virtio bus vendor/device should
have the same format as the corresponding entries for PCI devices.

Although this technically changes the ABI for sysfs, these files were
broken to start with!

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

drivers/virtio/virtio.c
... ... @@ -9,19 +9,19 @@
9 9 struct device_attribute *attr, char *buf)
10 10 {
11 11 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
12   - return sprintf(buf, "%hu", dev->id.device);
  12 + return sprintf(buf, "0x%04x\n", dev->id.device);
13 13 }
14 14 static ssize_t vendor_show(struct device *_d,
15 15 struct device_attribute *attr, char *buf)
16 16 {
17 17 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
18   - return sprintf(buf, "%hu", dev->id.vendor);
  18 + return sprintf(buf, "0x%04x\n", dev->id.vendor);
19 19 }
20 20 static ssize_t status_show(struct device *_d,
21 21 struct device_attribute *attr, char *buf)
22 22 {
23 23 struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
24   - return sprintf(buf, "0x%08x", dev->config->get_status(dev));
  24 + return sprintf(buf, "0x%08x\n", dev->config->get_status(dev));
25 25 }
26 26 static ssize_t modalias_show(struct device *_d,
27 27 struct device_attribute *attr, char *buf)