Skip to content

Commit c6fd470

Browse files
committed
virtio: Allow virtio to be modular and used by modules
This is needed for the virtio PCI device to be compiled as a module. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
1 parent 15f9c89 commit c6fd470

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎drivers/virtio/Kconfig‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Virtio always gets selected by whoever wants it.
22
config VIRTIO
3-
bool
3+
tristate
44

55
# Similarly the virtio ring implementation.
66
config VIRTIO_RING
7-
bool
7+
tristate
88
depends on VIRTIO

‎drivers/virtio/virtio.c‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,4 +162,12 @@ static int virtio_init(void)
162162
panic("virtio bus registration failed");
163163
return 0;
164164
}
165+
166+
static void __exit virtio_exit(void)
167+
{
168+
bus_unregister(&virtio_bus);
169+
}
165170
core_initcall(virtio_init);
171+
module_exit(virtio_exit);
172+
173+
MODULE_LICENSE("GPL");

‎drivers/virtio/virtio_ring.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,6 +266,7 @@ irqreturn_t vring_interrupt(int irq, void *_vq)
266266

267267
return IRQ_HANDLED;
268268
}
269+
EXPORT_SYMBOL_GPL(vring_interrupt);
269270

270271
static struct virtqueue_ops vring_vq_ops = {
271272
.add_buf = vring_add_buf,
@@ -318,9 +319,12 @@ struct virtqueue *vring_new_virtqueue(unsigned int num,
318319

319320
return &vq->vq;
320321
}
322+
EXPORT_SYMBOL_GPL(vring_new_virtqueue);
321323

322324
void vring_del_virtqueue(struct virtqueue *vq)
323325
{
324326
kfree(to_vvq(vq));
325327
}
328+
EXPORT_SYMBOL_GPL(vring_del_virtqueue);
326329

330+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)