diff options
Diffstat (limited to 'drivers/virtio/virtio.c')
-rw-r--r-- | drivers/virtio/virtio.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 3f52c767dfe9..bd0745250fd9 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -31,11 +31,27 @@ static ssize_t modalias_show(struct device *_d, | |||
31 | return sprintf(buf, "virtio:d%08Xv%08X\n", | 31 | return sprintf(buf, "virtio:d%08Xv%08X\n", |
32 | dev->id.device, dev->id.vendor); | 32 | dev->id.device, dev->id.vendor); |
33 | } | 33 | } |
34 | static ssize_t features_show(struct device *_d, | ||
35 | struct device_attribute *attr, char *buf) | ||
36 | { | ||
37 | struct virtio_device *dev = container_of(_d, struct virtio_device, dev); | ||
38 | unsigned int i; | ||
39 | ssize_t len = 0; | ||
40 | |||
41 | /* We actually represent this as a bitstring, as it could be | ||
42 | * arbitrary length in future. */ | ||
43 | for (i = 0; i < ARRAY_SIZE(dev->features)*BITS_PER_LONG; i++) | ||
44 | len += sprintf(buf+len, "%c", | ||
45 | test_bit(i, dev->features) ? '1' : '0'); | ||
46 | len += sprintf(buf+len, "\n"); | ||
47 | return len; | ||
48 | } | ||
34 | static struct device_attribute virtio_dev_attrs[] = { | 49 | static struct device_attribute virtio_dev_attrs[] = { |
35 | __ATTR_RO(device), | 50 | __ATTR_RO(device), |
36 | __ATTR_RO(vendor), | 51 | __ATTR_RO(vendor), |
37 | __ATTR_RO(status), | 52 | __ATTR_RO(status), |
38 | __ATTR_RO(modalias), | 53 | __ATTR_RO(modalias), |
54 | __ATTR_RO(features), | ||
39 | __ATTR_NULL | 55 | __ATTR_NULL |
40 | }; | 56 | }; |
41 | 57 | ||