diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-30 13:20:03 -0400 |
| commit | ab8cd81830fef799177740d5ab709c0341e9ba5c (patch) | |
| tree | 40c27d1cd27a436ec195174a105fa27c223ed6dd /drivers/virtio/virtio.c | |
| parent | f8356ed00ebcdc2f209504c02b4ab8ba9a8a7ebe (diff) | |
| parent | 20887611523e749d99cc7d64ff6c97d27529fbae (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus
* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
lguest: notify on empty
virtio: force callback on empty.
virtio_blk: fix endianess annotations
virtio_config: fix len calculation of config elements
virtio_net: another race with virtio_net and enable_cb
virtio: An entropy device, as suggested by hpa.
virtio_blk: allow read-only disks
lguest: fix ugly <NULL> in /proc/interrupts
virtio: set device index in common code.
virtio: virtio_pci should not set bus_id.
virtio: bus_id for devices should contain 'virtio'
Fix crash in virtio_blk during modprobe ; rmmod ; modprobe
lguest: use ioremap_cache, not ioremap
Diffstat (limited to 'drivers/virtio/virtio.c')
| -rw-r--r-- | drivers/virtio/virtio.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 13866789b356..0f3c2bb7bf35 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
| @@ -2,6 +2,9 @@ | |||
| 2 | #include <linux/spinlock.h> | 2 | #include <linux/spinlock.h> |
| 3 | #include <linux/virtio_config.h> | 3 | #include <linux/virtio_config.h> |
| 4 | 4 | ||
| 5 | /* Unique numbering for virtio devices. */ | ||
| 6 | static unsigned int dev_index; | ||
| 7 | |||
| 5 | static ssize_t device_show(struct device *_d, | 8 | static ssize_t device_show(struct device *_d, |
| 6 | struct device_attribute *attr, char *buf) | 9 | struct device_attribute *attr, char *buf) |
| 7 | { | 10 | { |
| @@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev) | |||
| 166 | int err; | 169 | int err; |
| 167 | 170 | ||
| 168 | dev->dev.bus = &virtio_bus; | 171 | dev->dev.bus = &virtio_bus; |
| 169 | sprintf(dev->dev.bus_id, "%u", dev->index); | 172 | |
| 173 | /* Assign a unique device index and hence name. */ | ||
| 174 | dev->index = dev_index++; | ||
| 175 | sprintf(dev->dev.bus_id, "virtio%u", dev->index); | ||
| 170 | 176 | ||
| 171 | /* We always start by resetting the device, in case a previous | 177 | /* We always start by resetting the device, in case a previous |
| 172 | * driver messed it up. This also tests that code path a little. */ | 178 | * driver messed it up. This also tests that code path a little. */ |
