* [Virtio-for-kvm] [PATCH 12/13] [Mostly resend] virtio additions
@ 2007-12-21 15:27 Dor Laor
[not found] ` <476BDB48.80700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Dor Laor @ 2007-12-21 15:27 UTC (permalink / raw)
To: kvm-devel, virtualization, Rusty Russell, Anthony Liguori
From 20a01e0c24f47e9805a88bebc9310163f99b5e99 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Date: Sun, 16 Dec 2007 23:35:35 +0200
Subject: [PATCH] Handle module unload Add the device release function.
Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
---
drivers/virtio/virtio.c | 7 +++++++
drivers/virtio/virtio_pci.c | 7 +++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index 303cb6f..212f4e3 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -123,6 +123,11 @@ void unregister_virtio_driver(struct virtio_driver
*driver)
}
EXPORT_SYMBOL_GPL(unregister_virtio_driver);
+static void virtio_device_release(struct device *_d)
+{
+ pr_debug("%s\n" , __FUNCTION__);
+}
+
int register_virtio_device(struct virtio_device *dev)
{
int err;
@@ -133,6 +138,8 @@ int register_virtio_device(struct virtio_device *dev)
/* Acknowledge that we've seen the device. */
add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
+
+ dev->dev.release = virtio_device_release;
/* device_register() causes the bus infrastructure to look for a
* matching driver. */
err = device_register(&dev->dev);
diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
index 7118215..60f2b1f 100644
--- a/drivers/virtio/virtio_pci.c
+++ b/drivers/virtio/virtio_pci.c
@@ -72,12 +72,18 @@ static struct pci_device_id virtio_pci_id_table[] = {
MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
+static void virtio_pci_root_release(struct device *d)
+{
+ pr_debug("%s\n", __FUNCTION__);
+}
+
/* A PCI device has it's own struct device and so does a virtio device so
* we create a place for the virtio devices to show up in sysfs. I
think it
* would make more sense for virtio to not insist on having it's own
device. */
static struct device virtio_pci_root = {
.parent = NULL,
.bus_id = "virtio-pci",
+ .release = virtio_pci_root_release,
};
/* Unique numbering for devices under the kvm root */
@@ -358,6 +364,7 @@ static void __devexit virtio_pci_remove(struct
pci_dev *pci_dev)
pci_iounmap(pci_dev, vp_dev->ioaddr);
pci_release_regions(pci_dev);
pci_disable_device(pci_dev);
+ unregister_virtio_device(&vp_dev->vdev);
kfree(vp_dev);
}
--
1.5.3.3
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Virtio-for-kvm] [PATCH 12/13] [Mostly resend] virtio additions
[not found] ` <476BDB48.80700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2008-01-24 0:59 ` Rusty Russell
0 siblings, 0 replies; 2+ messages in thread
From: Rusty Russell @ 2008-01-24 0:59 UTC (permalink / raw)
To: dor.laor-atKUWr5tajBWk0Htik3J/w; +Cc: kvm-devel, Avi Kivity, virtualization
On Saturday 22 December 2007 02:27:04 Dor Laor wrote:
> From 20a01e0c24f47e9805a88bebc9310163f99b5e99 Mon Sep 17 00:00:00 2001
> From: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> Date: Sun, 16 Dec 2007 23:35:35 +0200
> Subject: [PATCH] Handle module unload Add the device release function.
Hi Dor,
It looks like this isn't needed in my latest queue, so I've dropped it.
Cheers,
Rusty.
> Signed-off-by: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
> ---
> drivers/virtio/virtio.c | 7 +++++++
> drivers/virtio/virtio_pci.c | 7 +++++++
> 2 files changed, 14 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index 303cb6f..212f4e3 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -123,6 +123,11 @@ void unregister_virtio_driver(struct virtio_driver
> *driver)
> }
> EXPORT_SYMBOL_GPL(unregister_virtio_driver);
>
> +static void virtio_device_release(struct device *_d)
> +{
> + pr_debug("%s\n" , __FUNCTION__);
> +}
> +
> int register_virtio_device(struct virtio_device *dev)
> {
> int err;
> @@ -133,6 +138,8 @@ int register_virtio_device(struct virtio_device *dev)
> /* Acknowledge that we've seen the device. */
> add_status(dev, VIRTIO_CONFIG_S_ACKNOWLEDGE);
>
> +
> + dev->dev.release = virtio_device_release;
> /* device_register() causes the bus infrastructure to look for a
> * matching driver. */
> err = device_register(&dev->dev);
> diff --git a/drivers/virtio/virtio_pci.c b/drivers/virtio/virtio_pci.c
> index 7118215..60f2b1f 100644
> --- a/drivers/virtio/virtio_pci.c
> +++ b/drivers/virtio/virtio_pci.c
> @@ -72,12 +72,18 @@ static struct pci_device_id virtio_pci_id_table[] = {
>
> MODULE_DEVICE_TABLE(pci, virtio_pci_id_table);
>
> +static void virtio_pci_root_release(struct device *d)
> +{
> + pr_debug("%s\n", __FUNCTION__);
> +}
> +
> /* A PCI device has it's own struct device and so does a virtio device so
> * we create a place for the virtio devices to show up in sysfs. I
> think it
> * would make more sense for virtio to not insist on having it's own
> device. */
> static struct device virtio_pci_root = {
> .parent = NULL,
> .bus_id = "virtio-pci",
> + .release = virtio_pci_root_release,
> };
>
> /* Unique numbering for devices under the kvm root */
> @@ -358,6 +364,7 @@ static void __devexit virtio_pci_remove(struct
> pci_dev *pci_dev)
> pci_iounmap(pci_dev, vp_dev->ioaddr);
> pci_release_regions(pci_dev);
> pci_disable_device(pci_dev);
> + unregister_virtio_device(&vp_dev->vdev);
> kfree(vp_dev);
> }
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-01-24 0:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 15:27 [Virtio-for-kvm] [PATCH 12/13] [Mostly resend] virtio additions Dor Laor
[not found] ` <476BDB48.80700-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-24 0:59 ` Rusty Russell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox