diff options
author | Eric Van Hensbergen <ericvh@ericvh-desktop.(none)> | 2008-02-06 20:25:04 -0500 |
---|---|---|
committer | Eric Van Hensbergen <ericvh@opteron.homeip.net> | 2008-02-06 20:25:04 -0500 |
commit | f39335453fe79f4e12e263e7c6387dc9fb86bfff (patch) | |
tree | ba28cdf9097527437086d2197e515a78d6359ff1 /net | |
parent | dea7bbb603735ceceb07bb370eca17198faf7c8d (diff) |
9p: add remove function to trans_virtio
Request from rusty:
Just cleaning up patches for 2.6.25 merge, and noticed that
net/9p/trans_virtio.c doesn't have a remove function. This will crash when
removing the module (console doesn't have one because it can't really be
removed).
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/trans_virtio.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c index 7853c31bd690..c957080966b4 100644 --- a/net/9p/trans_virtio.c +++ b/net/9p/trans_virtio.c | |||
@@ -385,6 +385,18 @@ static struct p9_trans *p9_virtio_create(const char *devname, char *args) | |||
385 | return trans; | 385 | return trans; |
386 | } | 386 | } |
387 | 387 | ||
388 | static void p9_virtio_remove(struct virtio_device *vdev) | ||
389 | { | ||
390 | struct virtio_chan *chan = vdev->priv; | ||
391 | |||
392 | BUG_ON(chan->inuse); | ||
393 | |||
394 | if (chan->initialized) { | ||
395 | vdev->config->del_vq(chan->vq); | ||
396 | chan->initialized = false; | ||
397 | } | ||
398 | } | ||
399 | |||
388 | #define VIRTIO_ID_9P 9 | 400 | #define VIRTIO_ID_9P 9 |
389 | 401 | ||
390 | static struct virtio_device_id id_table[] = { | 402 | static struct virtio_device_id id_table[] = { |
@@ -398,6 +410,7 @@ static struct virtio_driver p9_virtio_drv = { | |||
398 | .driver.owner = THIS_MODULE, | 410 | .driver.owner = THIS_MODULE, |
399 | .id_table = id_table, | 411 | .id_table = id_table, |
400 | .probe = p9_virtio_probe, | 412 | .probe = p9_virtio_probe, |
413 | .remove = p9_virtio_remove, | ||
401 | }; | 414 | }; |
402 | 415 | ||
403 | static struct p9_trans_module p9_virtio_trans = { | 416 | static struct p9_trans_module p9_virtio_trans = { |
@@ -419,7 +432,13 @@ static int __init p9_virtio_init(void) | |||
419 | return register_virtio_driver(&p9_virtio_drv); | 432 | return register_virtio_driver(&p9_virtio_drv); |
420 | } | 433 | } |
421 | 434 | ||
435 | static void __exit p9_virtio_cleanup(void) | ||
436 | { | ||
437 | unregister_virtio_driver(&p9_virtio_drv); | ||
438 | } | ||
439 | |||
422 | module_init(p9_virtio_init); | 440 | module_init(p9_virtio_init); |
441 | module_exit(p9_virtio_cleanup); | ||
423 | 442 | ||
424 | MODULE_DEVICE_TABLE(virtio, id_table); | 443 | MODULE_DEVICE_TABLE(virtio, id_table); |
425 | MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>"); | 444 | MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>"); |