[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cdi-devel] [PATCH 4/4] Simplify driver declarations



* cdi: The destroy function doesn't need to get the driver struct passed
  as an argument. The driver struct is static anyway.
* cdi: Drivers don't need to wrap cdi_{fs,net,storage}_driver if they
  don't extend the struct (and there is no reason to do so).

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 ata/main.c     |   11 +++++++----
 e1000/main.c   |   36 ++++++++++++++++--------------------
 ext2/main.c    |   29 ++++++++++++-----------------
 floppy/main.c  |   40 ++++++++++++++++++----------------------
 include/cdi.h  |    2 +-
 iso9660/main.c |   31 +++++++++++++------------------
 ne2k/main.c    |   34 +++++++++++++++-------------------
 pcnet/main.c   |   40 ++++++++++++++++------------------------
 ramdisk/main.c |   31 +++++++++++++------------------
 rtl8139/main.c |   39 ++++++++++++++++-----------------------
 serial/main.c  |   31 +++++++++++++------------------
 sis900/main.c  |   36 ++++++++++++++++--------------------
 12 files changed, 156 insertions(+), 204 deletions(-)

diff --git a/ata/main.c b/ata/main.c
index 4699c2d..3cc502d 100644
--- a/ata/main.c
+++ b/ata/main.c
@@ -153,11 +153,13 @@ static int ata_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den ata-Treiber
  */
-static void ata_driver_destroy(struct cdi_driver* driver)
+static int ata_driver_destroy(void)
 {
-    cdi_storage_driver_destroy((struct cdi_storage_driver*) driver);
+    cdi_storage_driver_destroy(&driver_storage);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 static int atapi_driver_init(void)
@@ -166,9 +168,10 @@ static int atapi_driver_init(void)
     return 0;
 }
 
-static void atapi_driver_destroy(struct cdi_driver* driver)
+static int atapi_driver_destroy(void)
 {
-    cdi_scsi_driver_destroy((struct cdi_scsi_driver*) driver);
+    cdi_scsi_driver_destroy(&driver_scsi);
+    return 0;
 }
 
 
diff --git a/e1000/main.c b/e1000/main.c
index 4f3bb9d..26ce832 100644
--- a/e1000/main.c
+++ b/e1000/main.c
@@ -39,11 +39,7 @@
 
 #define DRIVER_NAME "e1000"
 
-struct e1000_driver {
-    struct cdi_net_driver net;
-};
-
-static struct e1000_driver driver;
+static struct cdi_net_driver driver;
 
 /**
  * Initialisiert die Datenstrukturen fuer den e1000-Treiber
@@ -51,7 +47,7 @@ static struct e1000_driver driver;
 static int e1000_driver_init(void)
 {
     // Konstruktor der Vaterklasse
-    cdi_net_driver_init((struct cdi_net_driver*) &driver);
+    cdi_net_driver_init(&driver);
 
     // Passende PCI-Geraete suchen
     cdi_list_t pci_devices = cdi_list_create();
@@ -70,14 +66,14 @@ static int e1000_driver_init(void)
 
             device->phys = phys_device;
             device->pci = dev;
-            cdi_list_push(driver.net.drv.devices, device);
+            cdi_list_push(driver.drv.devices, device);
         } else {
             cdi_pci_device_destroy(dev);
         }
     }
 
     printf("e1000: %d Karten gefunden.\n",
-        cdi_list_size(driver.net.drv.devices));
+        cdi_list_size(driver.drv.devices));
 
     cdi_list_destroy(pci_devices);
 
@@ -87,24 +83,24 @@ static int e1000_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den e1000-Treiber
  */
-static void e1000_driver_destroy(struct cdi_driver* driver)
+static int e1000_driver_destroy(void)
 {
-    cdi_net_driver_destroy((struct cdi_net_driver*) driver);
+    cdi_net_driver_destroy(&driver);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 
-static struct e1000_driver driver = {
-    .net =  {
-        .drv = {
-            .type           = CDI_NETWORK,
-            .name           = DRIVER_NAME,
-            .init           = e1000_driver_init,
-            .destroy        = e1000_driver_destroy,
-            .init_device    = e1000_init_device,
-            .remove_device  = e1000_remove_device,
-        },
+static struct cdi_net_driver driver = {
+    .drv = {
+        .type           = CDI_NETWORK,
+        .name           = DRIVER_NAME,
+        .init           = e1000_driver_init,
+        .destroy        = e1000_driver_destroy,
+        .init_device    = e1000_init_device,
+        .remove_device  = e1000_remove_device,
     },
 };
 
diff --git a/ext2/main.c b/ext2/main.c
index bdef05b..a1d597f 100644
--- a/ext2/main.c
+++ b/ext2/main.c
@@ -43,11 +43,7 @@
 
 #define DRIVER_NAME "ext2"
 
-struct ext2_driver {
-    struct cdi_fs_driver fs;
-};
-
-static struct ext2_driver ext2_driver;
+static struct cdi_fs_driver ext2_driver;
 
 /**
  * Initialisiert die Datenstrukturen fuer den ext2-Treiber
@@ -62,23 +58,22 @@ static int ext2_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den sis900-Treiber
  */
-static void ext2_driver_destroy(struct cdi_driver* driver)
+static int ext2_driver_destroy(void)
 {
-    cdi_fs_driver_destroy((struct cdi_fs_driver*) driver);
+    cdi_fs_driver_destroy(&ext2_driver);
+    return 0;
 }
 
 
-static struct ext2_driver ext2_driver = {
-    .fs = {
-        .drv = {
-            .type       = CDI_FILESYSTEM,
-            .name       = DRIVER_NAME,
-            .init       = ext2_driver_init,
-            .destroy    = ext2_driver_destroy,
-        },
-        .fs_init        = ext2_fs_init,
-        .fs_destroy     = ext2_fs_destroy,
+static struct cdi_fs_driver ext2_driver = {
+    .drv = {
+        .type       = CDI_FILESYSTEM,
+        .name       = DRIVER_NAME,
+        .init       = ext2_driver_init,
+        .destroy    = ext2_driver_destroy,
     },
+    .fs_init        = ext2_fs_init,
+    .fs_destroy     = ext2_fs_destroy,
 };
 
 CDI_DRIVER(DRIVER_NAME, ext2_driver)
diff --git a/floppy/main.c b/floppy/main.c
index f888eb0..e6208a6 100644
--- a/floppy/main.c
+++ b/floppy/main.c
@@ -37,11 +37,8 @@
 
 #define DRIVER_NAME "floppy"
 
-struct floppy_driver {
-    struct cdi_storage_driver storage;
-};
+static struct cdi_storage_driver floppy_driver;
 
-static struct floppy_driver floppy_driver;
 static struct floppy_controller floppy_controller = {
     // Standardmaessig DMA benutzen
     .use_dma = 1
@@ -54,10 +51,9 @@ static int floppy_driver_init(void)
 {
     int i;
     struct floppy_device* device;
-    struct floppy_driver* driver = &floppy_driver;
 
     // Konstruktor der Vaterklasse
-    cdi_storage_driver_init((struct cdi_storage_driver*) driver);
+    cdi_storage_driver_init(&floppy_driver);
     
     // Geraete erstellen (TODO: Was wenn eines oder beide nicht vorhanden
     // sind?)
@@ -72,7 +68,7 @@ static int floppy_driver_init(void)
 
         // Geraet nur eintragen wenn es existiert
         if (floppy_device_probe(device) != 0) {
-            cdi_list_push(driver->storage.drv.devices, device);
+            cdi_list_push(floppy_driver.drv.devices, device);
         } else {
             free(device);
         }
@@ -81,7 +77,7 @@ static int floppy_driver_init(void)
     // IRQ fuer FDC registrieren(ist hier egal fuer welches Geraet, da er eh
     // nur in der Controller-Struktur etwas macht).
     cdi_register_irq(6, floppy_handle_interrupt, (struct cdi_device*)
-        cdi_list_get(driver->storage.drv.devices, 0));
+        cdi_list_get(floppy_driver.drv.devices, 0));
 
     // Kontroller initialisieren, falls dabei ein Fehler auftritt kann der
     // Treiber gleich wieder beendet werden
@@ -95,27 +91,27 @@ static int floppy_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den sis900-Treiber
  */
-static void floppy_driver_destroy(struct cdi_driver* driver)
+static int floppy_driver_destroy(void)
 {
-    cdi_storage_driver_destroy((struct cdi_storage_driver*) driver);
+    cdi_storage_driver_destroy(&floppy_driver);
 
     // TODO Alle Laufwerke deinitialisieren
+
+    return 0;
 }
 
 
-static struct floppy_driver floppy_driver = {
-    .storage = {
-        .drv = {
-            .type           = CDI_STORAGE,
-            .name           = DRIVER_NAME,
-            .init           = floppy_driver_init,
-            .destroy        = floppy_driver_destroy,
-            .init_device    = floppy_init_device,
-            .remove_device  = floppy_remove_device,
-        },
-        .read_blocks        = floppy_read_blocks,
-        .write_blocks       = floppy_write_blocks,
+static struct cdi_storage_driver floppy_driver = {
+    .drv = {
+        .type           = CDI_STORAGE,
+        .name           = DRIVER_NAME,
+        .init           = floppy_driver_init,
+        .destroy        = floppy_driver_destroy,
+        .init_device    = floppy_init_device,
+        .remove_device  = floppy_remove_device,
     },
+    .read_blocks        = floppy_read_blocks,
+    .write_blocks       = floppy_write_blocks,
 };
 
 CDI_DRIVER(DRIVER_NAME, floppy_driver)
diff --git a/include/cdi.h b/include/cdi.h
index c3fdf8d..f45181a 100644
--- a/include/cdi.h
+++ b/include/cdi.h
@@ -51,7 +51,7 @@ struct cdi_driver {
     void (*remove_device)(struct cdi_device* device);
 
     int (*init)(void);
-    void (*destroy)(struct cdi_driver* driver);
+    int (*destroy)(void);
 };
 
 /**
diff --git a/iso9660/main.c b/iso9660/main.c
index a935db9..1e81779 100644
--- a/iso9660/main.c
+++ b/iso9660/main.c
@@ -26,18 +26,14 @@
 
 #define DRIVER_NAME "iso9660"
 
-struct iso9660_driver {
-  struct cdi_fs_driver drv;
-};
-
-static struct iso9660_driver iso9660_driver;
+static struct cdi_fs_driver iso9660_driver;
 
 /**
  * Initializes the data structures for the iso9660 driver
  */
 static int iso9660_driver_init(void) {
     // Konstruktor der Vaterklasse
-    cdi_fs_driver_init((struct cdi_fs_driver*) &iso9660_driver);
+    cdi_fs_driver_init(&iso9660_driver);
 
     return 0;
 }
@@ -45,9 +41,10 @@ static int iso9660_driver_init(void) {
 /**
  * Deinitialize the data structures for the iso9660 driver
  */
-static void iso9660_driver_destroy(struct cdi_driver* driver)
+static int iso9660_driver_destroy(void)
 {
-    cdi_fs_driver_destroy((struct cdi_fs_driver*)driver);
+    cdi_fs_driver_destroy(&iso9660_driver);
+    return 0;
 }
 
 /**
@@ -70,17 +67,15 @@ int debug(const char *fmt,...) {
 }
 
 
-static struct iso9660_driver iso9660_driver = {
-    .drv =  {
-        .drv = {
-            .type           = CDI_FILESYSTEM,
-            .name           = DRIVER_NAME,
-            .init           = iso9660_driver_init,
-            .destroy        = iso9660_driver_destroy,
-        },
-        .fs_init            = iso9660_fs_init,
-        .fs_destroy         = iso9660_fs_destroy,
+static struct cdi_fs_driver iso9660_driver = {
+    .drv = {
+        .type           = CDI_FILESYSTEM,
+        .name           = DRIVER_NAME,
+        .init           = iso9660_driver_init,
+        .destroy        = iso9660_driver_destroy,
     },
+    .fs_init            = iso9660_fs_init,
+    .fs_destroy         = iso9660_fs_destroy,
 };
 
 CDI_DRIVER(DRIVER_NAME, iso9660_driver)
diff --git a/ne2k/main.c b/ne2k/main.c
index e1ecd06..229bccb 100644
--- a/ne2k/main.c
+++ b/ne2k/main.c
@@ -37,16 +37,12 @@
 
 #define DRIVER_NAME "ne2k"
 
-struct ne2k_driver {
-    struct cdi_net_driver net;
-};
-
-static struct ne2k_driver driver;
+static struct cdi_net_driver ne2k_driver;
 
 static int ne2k_driver_init(void)
 {
     // Konstruktor der Vaterklasse
-    cdi_net_driver_init((struct cdi_net_driver*) &driver);
+    cdi_net_driver_init(&ne2k_driver);
 
     // Passende PCI-Geraete suchen
     cdi_list_t pci_devices = cdi_list_create();
@@ -65,7 +61,7 @@ static int ne2k_driver_init(void)
 
             device->phys = phys_device;
             device->pci = dev;
-            cdi_list_push(driver.net.drv.devices, device);
+            cdi_list_push(ne2k_driver.drv.devices, device);
         } else {
             cdi_pci_device_destroy(dev);
         }
@@ -79,24 +75,24 @@ static int ne2k_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den ne2k-Treiber
  */
-static void ne2k_driver_destroy(struct cdi_driver* driver)
+static int ne2k_driver_destroy(void)
 {
-    cdi_net_driver_destroy((struct cdi_net_driver*) driver);
+    cdi_net_driver_destroy(&ne2k_driver);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 
-static struct ne2k_driver ne2k_driver = {
-    .net =  {
-        .drv = {
-            .type           = CDI_NETWORK,
-            .name           = DRIVER_NAME,
-            .init           = ne2k_driver_init,
-            .destroy        = ne2k_driver_destroy,
-            .init_device    = ne2k_init_device,
-            .remove_device  = ne2k_remove_device,
-        },
+static struct cdi_net_driver ne2k_driver = {
+    .drv = {
+        .type           = CDI_NETWORK,
+        .name           = DRIVER_NAME,
+        .init           = ne2k_driver_init,
+        .destroy        = ne2k_driver_destroy,
+        .init_device    = ne2k_init_device,
+        .remove_device  = ne2k_remove_device,
     },
 };
 
diff --git a/pcnet/main.c b/pcnet/main.c
index 39f3fe9..342ac39 100644
--- a/pcnet/main.c
+++ b/pcnet/main.c
@@ -38,15 +38,7 @@
 
 #define DRIVER_NAME "pcnet"
 
-struct module_options {
-    uint32_t ip;
-};
-
-struct pcnet_driver {
-    struct cdi_net_driver net;
-};
-
-static struct pcnet_driver driver;
+static struct cdi_net_driver pcnet_driver;
 
 static int pcnet_driver_init(void)
 {
@@ -54,7 +46,7 @@ static int pcnet_driver_init(void)
     // TODO Auf tcpip-Service warten
 
     // Konstruktor der Vaterklasse
-    cdi_net_driver_init((struct cdi_net_driver*) &driver);
+    cdi_net_driver_init(&pcnet_driver);
 
     // Passende PCI-Geraete suchen
     cdi_list_t pci_devices = cdi_list_create();
@@ -70,7 +62,7 @@ static int pcnet_driver_init(void)
             memset(device, 0, sizeof(struct pcnet_device));
 
             device->pci = dev;
-            cdi_list_push(driver.net.drv.devices, device);
+            cdi_list_push(pcnet_driver.drv.devices, device);
         } else {
             cdi_pci_device_destroy(dev);
         }
@@ -84,25 +76,25 @@ static int pcnet_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den pcnet-Treiber
  */
-static void pcnet_driver_destroy(struct cdi_driver* driver)
+static int pcnet_driver_destroy(void)
 {
-    cdi_net_driver_destroy((struct cdi_net_driver*) driver);
+    cdi_net_driver_destroy(&pcnet_driver);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 
-static struct pcnet_driver driver = {
-    .net =  {
-        .drv = {
-            .type           = CDI_NETWORK,
-            .name           = DRIVER_NAME,
-            .init           = pcnet_driver_init,
-            .destroy        = pcnet_driver_destroy,
-            .init_device    = pcnet_init_device,
-            .remove_device  = pcnet_remove_device,
-        },
+static struct cdi_net_driver pcnet_driver = {
+    .drv = {
+        .type           = CDI_NETWORK,
+        .name           = DRIVER_NAME,
+        .init           = pcnet_driver_init,
+        .destroy        = pcnet_driver_destroy,
+        .init_device    = pcnet_init_device,
+        .remove_device  = pcnet_remove_device,
     },
 };
 
-CDI_DRIVER(DRIVER_NAME, driver)
+CDI_DRIVER(DRIVER_NAME, pcnet_driver)
diff --git a/ramdisk/main.c b/ramdisk/main.c
index b4417c8..c0d8b3e 100644
--- a/ramdisk/main.c
+++ b/ramdisk/main.c
@@ -37,11 +37,7 @@
 
 #define DRIVER_NAME "ramdisk"
 
-struct ramdisk_driver {
-    struct cdi_fs_driver fs;
-};
-
-static struct ramdisk_driver ramdisk_driver;
+static struct cdi_fs_driver ramdisk_driver;
 
 /**
  * Initialisiert die Datenstrukturen fuer den ramdisk-Treiber
@@ -49,7 +45,7 @@ static struct ramdisk_driver ramdisk_driver;
 static int ramdisk_driver_init(void)
 {
     // Konstruktor der Vaterklasse
-    cdi_fs_driver_init((struct cdi_fs_driver*) &ramdisk_driver);
+    cdi_fs_driver_init(&ramdisk_driver);
 
     return 0;
 }
@@ -57,23 +53,22 @@ static int ramdisk_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den ramdisk-Treiber
  */
-static void ramdisk_driver_destroy(struct cdi_driver* driver)
+static int ramdisk_driver_destroy(void)
 {
-    cdi_fs_driver_destroy((struct cdi_fs_driver*) driver);
+    cdi_fs_driver_destroy(&ramdisk_driver);
+    return 0;
 }
 
 
-static struct ramdisk_driver ramdisk_driver = {
-    .fs =  {
-        .drv = {
-            .type           = CDI_FILESYSTEM,
-            .name           = DRIVER_NAME,
-            .init           = ramdisk_driver_init,
-            .destroy        = ramdisk_driver_destroy,
-        },
-        .fs_init            = ramdisk_fs_init,
-        .fs_destroy         = ramdisk_fs_destroy,
+static struct cdi_fs_driver ramdisk_driver = {
+    .drv = {
+        .type           = CDI_FILESYSTEM,
+        .name           = DRIVER_NAME,
+        .init           = ramdisk_driver_init,
+        .destroy        = ramdisk_driver_destroy,
     },
+    .fs_init            = ramdisk_fs_init,
+    .fs_destroy         = ramdisk_fs_destroy,
 };
 
 CDI_DRIVER(DRIVER_NAME, ramdisk_driver)
diff --git a/rtl8139/main.c b/rtl8139/main.c
index a9a74b3..131c67b 100644
--- a/rtl8139/main.c
+++ b/rtl8139/main.c
@@ -37,14 +37,7 @@
 
 #define DRIVER_NAME "rtl8139"
 
-struct module_options {
-    uint32_t ip;
-};
-
-static struct rtl8139_driver {
-    struct cdi_net_driver net;
-} driver;
-
+static struct cdi_net_driver rtl8139_driver;
 
 static int rtl8139_driver_init(void)
 {
@@ -52,7 +45,7 @@ static int rtl8139_driver_init(void)
     // TODO Auf tcpip-Service warten
 
     // Konstruktor der Vaterklasse
-    cdi_net_driver_init((struct cdi_net_driver*) &driver);
+    cdi_net_driver_init(&rtl8139_driver);
 
     // Passende PCI-Geraete suchen
     cdi_list_t pci_devices = cdi_list_create();
@@ -71,7 +64,7 @@ static int rtl8139_driver_init(void)
 
             device->phys = phys_device;
             device->pci = dev;
-            cdi_list_push(driver.net.drv.devices, device);
+            cdi_list_push(rtl8139_driver.drv.devices, device);
         } else {
             cdi_pci_device_destroy(dev);
         }
@@ -85,25 +78,25 @@ static int rtl8139_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den rtl8139-Treiber
  */
-static void rtl8139_driver_destroy(struct cdi_driver* driver)
+static int rtl8139_driver_destroy(void)
 {
-    cdi_net_driver_destroy((struct cdi_net_driver*) driver);
+    cdi_net_driver_destroy(&rtl8139_driver);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 
-static struct rtl8139_driver driver = {
-    .net =  {
-        .drv = {
-            .type           = CDI_NETWORK,
-            .name           = DRIVER_NAME,
-            .init           = rtl8139_driver_init,
-            .destroy        = rtl8139_driver_destroy,
-            .init_device    = rtl8139_init_device,
-            .remove_device  = rtl8139_remove_device,
-        },
+static struct cdi_net_driver rtl8139_driver = {
+    .drv = {
+        .type           = CDI_NETWORK,
+        .name           = DRIVER_NAME,
+        .init           = rtl8139_driver_init,
+        .destroy        = rtl8139_driver_destroy,
+        .init_device    = rtl8139_init_device,
+        .remove_device  = rtl8139_remove_device,
     },
 };
 
-CDI_DRIVER(DRIVER_NAME, driver)
+CDI_DRIVER(DRIVER_NAME, rtl8139_driver)
diff --git a/serial/main.c b/serial/main.c
index e498990..890ba3b 100644
--- a/serial/main.c
+++ b/serial/main.c
@@ -37,11 +37,7 @@
 
 #define DRIVER_NAME "serial"
 
-struct serial_driver {
-    struct cdi_fs_driver fs;
-};
-
-static struct serial_driver serial_driver;
+static struct cdi_fs_driver serial_driver;
 
 /**
  * Initialisiert die Datenstrukturen fuer den serial-Treiber
@@ -49,7 +45,7 @@ static struct serial_driver serial_driver;
 static int serial_driver_init(void)
 {
     // Konstruktor der Vaterklasse
-    cdi_fs_driver_init((struct cdi_fs_driver*) &serial_driver);
+    cdi_fs_driver_init(&serial_driver);
 
     return 0;
 }
@@ -57,23 +53,22 @@ static int serial_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den serial-Treiber
  */
-static void serial_driver_destroy(struct cdi_driver* driver)
+static int serial_driver_destroy(void)
 {
-    cdi_fs_driver_destroy((struct cdi_fs_driver*) driver);
+    cdi_fs_driver_destroy(&serial_driver);
+    return 0;
 }
 
 
-static struct serial_driver serial_driver = {
-    .fs = {
-        .drv = {
-            .type       = CDI_FILESYSTEM,
-            .name       = DRIVER_NAME,
-            .init       = serial_driver_init,
-            .destroy    = serial_driver_destroy,
-        },
-        .fs_init        = serial_fs_init,
-        .fs_destroy     = serial_fs_destroy,
+static struct cdi_fs_driver serial_driver = {
+    .drv = {
+        .type       = CDI_FILESYSTEM,
+        .name       = DRIVER_NAME,
+        .init       = serial_driver_init,
+        .destroy    = serial_driver_destroy,
     },
+    .fs_init        = serial_fs_init,
+    .fs_destroy     = serial_fs_destroy,
 };
 
 CDI_DRIVER(DRIVER_NAME, serial_driver)
diff --git a/sis900/main.c b/sis900/main.c
index d4a0d93..b03511c 100644
--- a/sis900/main.c
+++ b/sis900/main.c
@@ -39,11 +39,7 @@
 
 #define DRIVER_NAME "sis900"
 
-struct sis900_driver {
-    struct cdi_net_driver net;
-};
-
-static struct sis900_driver sis900_driver;
+static struct cdi_net_driver sis900_driver;
 
 /**
  * Initialisiert die Datenstrukturen fuer den sis900-Treiber
@@ -51,7 +47,7 @@ static struct sis900_driver sis900_driver;
 static int sis900_driver_init(void)
 {
     // Konstruktor der Vaterklasse
-    cdi_net_driver_init((struct cdi_net_driver*) &sis900_driver);
+    cdi_net_driver_init(&sis900_driver);
 
     // Passende PCI-Geraete suchen
     cdi_list_t pci_devices = cdi_list_create();
@@ -70,14 +66,14 @@ static int sis900_driver_init(void)
 
             device->phys = phys_device;
             device->pci = dev;
-            cdi_list_push(sis900_driver.net.drv.devices, device);
+            cdi_list_push(sis900_driver.drv.devices, device);
         } else {
             cdi_pci_device_destroy(dev);
         }
     }
 
     printf("sis900: %d Karten gefunden.\n",
-        cdi_list_size(sis900_driver.net.drv.devices));
+        cdi_list_size(sis900_driver.drv.devices));
 
     cdi_list_destroy(pci_devices);
 
@@ -87,24 +83,24 @@ static int sis900_driver_init(void)
 /**
  * Deinitialisiert die Datenstrukturen fuer den sis900-Treiber
  */
-static void sis900_driver_destroy(struct cdi_driver* driver)
+static int sis900_driver_destroy(void)
 {
-    cdi_net_driver_destroy((struct cdi_net_driver*) driver);
+    cdi_net_driver_destroy(&sis900_driver);
 
     // TODO Alle Karten deinitialisieren
+
+    return 0;
 }
 
 
-static struct sis900_driver sis900_driver = {
-    .net =  {
-        .drv = {
-            .type           = CDI_NETWORK,
-            .name           = DRIVER_NAME,
-            .init           = sis900_driver_init,
-            .destroy        = sis900_driver_destroy,
-            .init_device    = sis900_init_device,
-            .remove_device  = sis900_remove_device,
-        },
+static struct cdi_net_driver sis900_driver = {
+    .drv = {
+        .type           = CDI_NETWORK,
+        .name           = DRIVER_NAME,
+        .init           = sis900_driver_init,
+        .destroy        = sis900_driver_destroy,
+        .init_device    = sis900_init_device,
+        .remove_device  = sis900_remove_device,
     },
 };
 
-- 
1.6.0.2