diff options
| author | David S. Miller <davem@davemloft.net> | 2008-06-10 02:22:26 -0700 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2008-06-10 02:22:26 -0700 |
| commit | 65b53e4cc90e59936733b3b95b9451d2ca47528d (patch) | |
| tree | 29932718192962671c48c3fd1ea017a6112459e8 /drivers/virtio/virtio.c | |
| parent | 788c0a53164c05c5ccdb1472474372b72ba74644 (diff) | |
| parent | 2e761e0532a784816e7e822dbaaece8c5d4be14d (diff) | |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Conflicts:
drivers/net/tg3.c
drivers/net/wireless/rt2x00/rt2x00dev.c
net/mac80211/ieee80211_i.h
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 @@ #include <linux/spinlock.h> #include <linux/virtio_config.h> +/* Unique numbering for virtio devices. */ +static unsigned int dev_index; + static ssize_t device_show(struct device *_d, struct device_attribute *attr, char *buf) { @@ -166,7 +169,10 @@ int register_virtio_device(struct virtio_device *dev) int err; dev->dev.bus = &virtio_bus; - sprintf(dev->dev.bus_id, "%u", dev->index); + + /* Assign a unique device index and hence name. */ + dev->index = dev_index++; + sprintf(dev->dev.bus_id, "virtio%u", dev->index); /* We always start by resetting the device, in case a previous * driver messed it up. This also tests that code path a little. */ |
