Skip to content

Commit be6528b

Browse files
Stephen Hemmingerrustyrussell
authored andcommitted
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>
1 parent 22e132f commit be6528b

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎drivers/virtio/virtio.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ static ssize_t device_show(struct device *_d,
99
struct device_attribute *attr, char *buf)
1010
{
1111
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);
1313
}
1414
static ssize_t vendor_show(struct device *_d,
1515
struct device_attribute *attr, char *buf)
1616
{
1717
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);
1919
}
2020
static ssize_t status_show(struct device *_d,
2121
struct device_attribute *attr, char *buf)
2222
{
2323
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));
2525
}
2626
static ssize_t modalias_show(struct device *_d,
2727
struct device_attribute *attr, char *buf)

0 commit comments

Comments
 (0)