[PATCH] use msleep instead of mdelay in AR6k
Werner Almesberger
werner at openmoko.org
Sat Jan 17 22:17:50 CET 2009
The AR6000 driver uses A_MDELAY with sometimes long delays at several
places. A_MDELAY is just another name for "mdelay", which is a busy
loop. All these delays appear to occur in a context where we can sleep,
so it's better to use "msleep" instead.
This includes the "big fat mdelay(2000)" Balaji found in the suspend
path:
http://lists.openmoko.org/pipermail/openmoko-kernel/2008-December/007171.html
Note that only the ones in DevPollMboxMsgRecv and ar6000_reset_device
are actually invoked in normal use, and only during initialization and
shutdown, respectively. So the impact on overall system performance is
small.
Signed-off-by: Werner Almesberger <werner at openmoko.org>
---
Index: ktrack/drivers/ar6000/htc/ar6k.c
===================================================================
--- ktrack.orig/drivers/ar6000/htc/ar6k.c 2009-01-17 18:31:58.000000000 -0200
+++ ktrack/drivers/ar6000/htc/ar6k.c 2009-01-17 18:58:29.000000000 -0200
@@ -723,7 +723,7 @@
}
/* delay a little, target may not be ready */
- A_MDELAY(1000);
+ msleep(1000);
}
Index: ktrack/drivers/ar6000/htc/ar6k_events.c
===================================================================
--- ktrack.orig/drivers/ar6000/htc/ar6k_events.c 2009-01-17 18:31:58.000000000 -0200
+++ ktrack/drivers/ar6000/htc/ar6k_events.c 2009-01-17 18:59:09.000000000 -0200
@@ -131,7 +131,7 @@
}
/* delay a little */
- A_MDELAY(DELAY_PER_INTERVAL_MS);
+ msleep(DELAY_PER_INTERVAL_MS);
AR_DEBUG_PRINTF(ATH_DEBUG_RECV,(" Retry Mbox Poll : %d \n",timeout));
}
Index: ktrack/drivers/ar6000/miscdrv/common_drv.c
===================================================================
--- ktrack.orig/drivers/ar6000/miscdrv/common_drv.c 2009-01-17 18:31:58.000000000 -0200
+++ ktrack/drivers/ar6000/miscdrv/common_drv.c 2009-01-17 18:58:46.000000000 -0200
@@ -311,7 +311,7 @@
}
}
- A_MDELAY(50); /* delay to allow dragon to come to BMI phase */
+ msleep(50); /* delay to allow dragon to come to BMI phase */
return A_OK;
}
@@ -350,7 +350,7 @@
* Read back the RESET CAUSE register to ensure that the cold reset
* went through.
*/
- A_MDELAY(2000); /* 2 second delay to allow things to settle down */
+ msleep(2000); /* 2 second delay to allow things to settle down */
// address = RESET_CAUSE_ADDRESS;
More information about the openmoko-kernel
mailing list