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

[tyndur-devel] [PATCH v3 1/5] cdi/storage: Initialisierungsfunktion fuer Geraete



+ cdi/storage: Initialisierungsfunktion fuer Geraete
* floppy, ata: Initialisierungsfunktion aufrufen
---
 src/modules/cdi/ata/device.c          |    2 ++
 src/modules/cdi/floppy/device.c       |    2 ++
 src/modules/cdi/include/cdi/storage.h |    6 ++++++
 src/modules/cdi/lib/storage.c         |   14 +++++++++-----
 4 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/src/modules/cdi/ata/device.c b/src/modules/cdi/ata/device.c
index 9c443e9..fcedeae 100644
--- a/src/modules/cdi/ata/device.c
+++ b/src/modules/cdi/ata/device.c
@@ -323,6 +323,8 @@ void ata_remove_controller(struct ata_controller* controller)
 
 void ata_init_device(struct cdi_device* device)
 {
+    struct ata_device* dev = (struct ata_device*) device;
+    cdi_storage_device_init(&dev->storage);
 }
 
 void ata_remove_device(struct cdi_device* device)
diff --git a/src/modules/cdi/floppy/device.c b/src/modules/cdi/floppy/device.c
index 6614e1e..2262c23 100644
--- a/src/modules/cdi/floppy/device.c
+++ b/src/modules/cdi/floppy/device.c
@@ -796,6 +796,8 @@ void floppy_init_device(struct cdi_device* device)
 
     dev->dev.block_size = FLOPPY_SECTOR_SIZE(dev);
     dev->dev.block_count = FLOPPY_SECTOR_COUNT(dev);
+
+    cdi_storage_device_init(&dev->dev);
 }
 
 /**
diff --git a/src/modules/cdi/include/cdi/storage.h b/src/modules/cdi/include/cdi/storage.h
index 73ae245..d19fc6f 100644
--- a/src/modules/cdi/include/cdi/storage.h
+++ b/src/modules/cdi/include/cdi/storage.h
@@ -75,6 +75,12 @@ void cdi_storage_driver_destroy(struct cdi_storage_driver* driver);
  */
 void cdi_storage_driver_register(struct cdi_storage_driver* driver);
 
+/**
+ * Initialisiert einen Massenspeicher
+ */
+void cdi_storage_device_init(struct cdi_storage_device* device);
+
+
 #endif
 
 /*\@}*/
diff --git a/src/modules/cdi/lib/storage.c b/src/modules/cdi/lib/storage.c
index 9dd9746..df84be1 100644
--- a/src/modules/cdi/lib/storage.c
+++ b/src/modules/cdi/lib/storage.c
@@ -63,8 +63,6 @@ void cdi_storage_driver_destroy(struct cdi_storage_driver* driver)
 void cdi_storage_driver_register(struct cdi_storage_driver* driver)
 {
     static int initialized = 0;
-    int i;
-    struct cdi_storage_device* device;
 
     cdi_driver_register((struct cdi_driver*) driver);
 
@@ -72,11 +70,17 @@ void cdi_storage_driver_register(struct cdi_storage_driver* driver)
         lostio_mst_if_init();
         initialized = 1;
     }
+}
+
+/**
+ * Initialisiert einen Massenspeicher
+ */
+void cdi_storage_device_init(struct cdi_storage_device* device)
+{
+    device->dev.type = CDI_STORAGE;
 
     // Geraeteknoten fuer LostIO erstellen
-    for (i = 0; (device = cdi_list_get(driver->drv.devices, i)); i++) {
-        lostio_mst_if_newdev(device);
-    }
+    lostio_mst_if_newdev(device);
 }
 
 /**
-- 
1.5.4.5