Commit be6528b2 authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Rusty Russell

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: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarRusty Russell <rusty@rustcorp.com.au>
parent 22e132ff
...@@ -9,19 +9,19 @@ static ssize_t device_show(struct device *_d, ...@@ -9,19 +9,19 @@ static ssize_t device_show(struct device *_d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct virtio_device *dev = container_of(_d,struct virtio_device,dev); struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
return sprintf(buf, "%hu", dev->id.device); return sprintf(buf, "0x%04x\n", dev->id.device);
} }
static ssize_t vendor_show(struct device *_d, static ssize_t vendor_show(struct device *_d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct virtio_device *dev = container_of(_d,struct virtio_device,dev); struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
return sprintf(buf, "%hu", dev->id.vendor); return sprintf(buf, "0x%04x\n", dev->id.vendor);
} }
static ssize_t status_show(struct device *_d, static ssize_t status_show(struct device *_d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct virtio_device *dev = container_of(_d,struct virtio_device,dev); struct virtio_device *dev = container_of(_d,struct virtio_device,dev);
return sprintf(buf, "0x%08x", dev->config->get_status(dev)); return sprintf(buf, "0x%08x\n", dev->config->get_status(dev));
} }
static ssize_t modalias_show(struct device *_d, static ssize_t modalias_show(struct device *_d,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment