Skip to contentSkip to conversation

virtio additions

PATCH RESEND In review Dor Laor 3 participants 3 messages Dec 21, 2007 – Jan 24, 2008 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Dor Laor

author
#0 lore raw

PATCH RESEND 12/13 virtio additions

From 20a01e0c24f47e9805a88bebc9310163f99b5e99 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/[email protected]>
Date: Sun, 16 Dec 2007 23:35:35 +0200
Subject: [PATCH] Handle module unload Add the device release function.

---
 drivers/virtio/virtio.c     |    7 +++++++
 drivers/virtio/virtio_pci.c |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/virtio/virtio.c +0 -0
index 303cb6f..212f4e3 100644
@@ -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);
drivers/virtio/virtio_pci.c +5 -0
index 7118215..60f2b1f 100644
@@ -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);

}

Signature · 7 lines
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/

A message that is not in the archive (sent off-list or not yet received): 476BDB48.80700-atKUWr5tajBWk0Htik3J/[email protected]

#2 lore raw
Quoted 4 lines · 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/[email protected]>
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.

Quoted 58 lines
---
 drivers/virtio/virtio.c     |    7 +++++++
 drivers/virtio/virtio_pci.c |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/virtio/virtio.c +5 -0
index 303cb6f..212f4e3 100644
@@ -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;
drivers/virtio/virtio.c +2 -0
@@ -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);
drivers/virtio/virtio_pci.c +5 -0
index 7118215..60f2b1f 100644
@@ -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",

drivers/virtio/virtio_pci.c +1 -0
+    .release    = virtio_pci_root_release,
 };
 
 /* Unique numbering for devices under the kvm root */

drivers/virtio/virtio_pci.c static void __devexit virtio_pci_remove(struct · line 370

Quoted 7 lines
drivers/virtio/virtio_pci.c +1 -0
@@ -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/

#3 lore raw
In reply to Dor Laor
Quoted 4 lines · On Saturday 22 December 2007 02:27:04 Dor Laor wrote:

From 20a01e0c24f47e9805a88bebc9310163f99b5e99 Mon Sep 17 00:00:00 2001
From: Dor Laor <[email protected]>
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.

Quoted 65 lines
---
 drivers/virtio/virtio.c     |    7 +++++++
 drivers/virtio/virtio_pci.c |    7 +++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
drivers/virtio/virtio.c +5 -0
index 303cb6f..212f4e3 100644
@@ -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;
drivers/virtio/virtio.c +2 -0
@@ -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);
drivers/virtio/virtio_pci.c +5 -0
index 7118215..60f2b1f 100644
@@ -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",

drivers/virtio/virtio_pci.c +2 -0
+    .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);
 }