aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/kvm/kvm_virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/kvm/kvm_virtio.c')
-rw-r--r--drivers/s390/kvm/kvm_virtio.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index 9f55ce6f3c78..5ab34340919b 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -31,11 +31,6 @@
31 */ 31 */
32static void *kvm_devices; 32static void *kvm_devices;
33 33
34/*
35 * Unique numbering for kvm devices.
36 */
37static unsigned int dev_index;
38
39struct kvm_device { 34struct kvm_device {
40 struct virtio_device vdev; 35 struct virtio_device vdev;
41 struct kvm_device_desc *desc; 36 struct kvm_device_desc *desc;
@@ -250,26 +245,25 @@ static struct device kvm_root = {
250 * adds a new device and register it with virtio 245 * adds a new device and register it with virtio
251 * appropriate drivers are loaded by the device model 246 * appropriate drivers are loaded by the device model
252 */ 247 */
253static void add_kvm_device(struct kvm_device_desc *d) 248static void add_kvm_device(struct kvm_device_desc *d, unsigned int offset)
254{ 249{
255 struct kvm_device *kdev; 250 struct kvm_device *kdev;
256 251
257 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL); 252 kdev = kzalloc(sizeof(*kdev), GFP_KERNEL);
258 if (!kdev) { 253 if (!kdev) {
259 printk(KERN_EMERG "Cannot allocate kvm dev %u\n", 254 printk(KERN_EMERG "Cannot allocate kvm dev %u type %u\n",
260 dev_index++); 255 offset, d->type);
261 return; 256 return;
262 } 257 }
263 258
264 kdev->vdev.dev.parent = &kvm_root; 259 kdev->vdev.dev.parent = &kvm_root;
265 kdev->vdev.index = dev_index++;
266 kdev->vdev.id.device = d->type; 260 kdev->vdev.id.device = d->type;
267 kdev->vdev.config = &kvm_vq_configspace_ops; 261 kdev->vdev.config = &kvm_vq_configspace_ops;
268 kdev->desc = d; 262 kdev->desc = d;
269 263
270 if (register_virtio_device(&kdev->vdev) != 0) { 264 if (register_virtio_device(&kdev->vdev) != 0) {
271 printk(KERN_ERR "Failed to register kvm device %u\n", 265 printk(KERN_ERR "Failed to register kvm device %u type %u\n",
272 kdev->vdev.index); 266 offset, d->type);
273 kfree(kdev); 267 kfree(kdev);
274 } 268 }
275} 269}
@@ -289,7 +283,7 @@ static void scan_devices(void)
289 if (d->type == 0) 283 if (d->type == 0)
290 break; 284 break;
291 285
292 add_kvm_device(d); 286 add_kvm_device(d, i);
293 } 287 }
294} 288}
295 289