[tyndur-devel] [PATCH 2/4] ata: cdi_wait_irq() benuzten und nicht selbst warten
Antoine Kaufmann ·
* ata: cdi_wait_irq() benuzten und nicht selbst warten Signed-off-by: Antoine Kaufmann <toni at tyndur.org> --- src/modules/cdi/ata/device.c | 22 +++++++--------------- src/modules/cdi/ata/request.c | 2 +- 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/src/modules/cdi/ata/device.c b/src/modules/cdi/ata/device.c index 4bf4a14..7c896b8 100644 --- a/src/modules/cdi/ata/device.c +++ b/src/modules/cdi/ata/device.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007 The tyndur Project. All rights reserved. + * Copyright (c) 2007-2009 The tyndur Project. All rights reserved. * * This code is derived from software contributed to the tyndur Project * by Antoine Kaufmann. @@ -142,10 +142,10 @@ static int ata_bus_responsive_drv(struct ata_controller* controller) */ static void ata_controller_irq(struct cdi_device* dev) { - struct ata_device* ata_dev = (struct ata_device*) dev; - struct ata_controller* ctrl = ata_dev->controller; - - ctrl->irq_cnt++; + // Hier muessen wir eigentlich garnichts tun, da wir immer nur auf IRQs + // warten wollen, und dafuer stellt CDI Funktionen zur Verfuegung. Doch + // registriert muss der IRQ dennoch werden, und dort muessen wir einen + // Handler angeben, sonst fliegt uns das beim ersten IRQ um die Ohren. } /** @@ -157,16 +157,8 @@ static void ata_controller_irq(struct cdi_device* dev) */ int ata_wait_irq(struct ata_controller* controller, uint32_t timeout) { - uint32_t time = 0; - - // Warten bis der IRQ-Zaehler vom Handler erhoeht wird - while (controller->irq_cnt == 0) { - cdi_sleep_ms(20); - time += 20; - - if (timeout <= time) { - return 0; - } + if (cdi_wait_irq(controller->irq, timeout)) { + return 0; } return 1; diff --git a/src/modules/cdi/ata/request.c b/src/modules/cdi/ata/request.c index 3d506df..1d5f4fb 100644 --- a/src/modules/cdi/ata/request.c +++ b/src/modules/cdi/ata/request.c @@ -96,7 +96,7 @@ static int ata_request_command(struct ata_request* request) // IRQ-Zaehler zuruecksetzen, egal ob er gebraucht wird oder nicht, stoert // ja niemanden - ctrl->irq_cnt = 0; + cdi_reset_wait_irq(ctrl->irq); ata_drv_select(dev); -- 1.6.0.6