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

[cdi-devel] [PATCH] floppy: Fix initialisation



Commit 10f8c755 broke the floppy driver by initialising the drives
before the controller. This fix restores the right order.

Additionally, floppy must assign the device's driver after 10f8c755
because it calls the device init function before generic CDI code can do
the job. This could clearly need some cleanup so that CDI calls the
device init functions again, but for now let's just fix the breakage.

Signed-off-by: Kevin Wolf <kevin@xxxxxxxxxx>
---
 floppy/main.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/floppy/main.c b/floppy/main.c
index c516a23..4e62e9f 100644
--- a/floppy/main.c
+++ b/floppy/main.c
@@ -68,7 +68,7 @@ static int floppy_driver_init(void)
 
         // Geraet nur eintragen wenn es existiert
         if (floppy_device_probe(device) != 0) {
-            floppy_init_device((struct cdi_device*) device);
+            device->dev.dev.driver = &floppy_driver.drv;
             cdi_list_push(floppy_driver.drv.devices, device);
         } else {
             free(device);
@@ -86,6 +86,10 @@ static int floppy_driver_init(void)
         return -1;
     }
 
+    for (i = 0; (device = cdi_list_get(floppy_driver.drv.devices, i)); i++) {
+        floppy_init_device(&device->dev.dev);
+    }
+
     return 0;
 }
 
-- 
1.7.7