Fix some bugs in the oneshot driver logic

This commit is contained in:
Gregory Nutt
2016-08-12 14:19:11 -06:00
parent 046acf6b54
commit ab16ad7530
2 changed files with 6 additions and 7 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ struct sim_oneshot_lowerhalf_s
* Private Function Prototypes
****************************************************************************/
static void sim_oneshot_handler(void *arg);
static void sim_oneshot_handler(int argc, wdparm_t arg1, ...);
static int sim_max_delay(FAR struct oneshot_lowerhalf_s *lower,
FAR struct timespec *ts);
@@ -119,14 +119,14 @@ static const struct oneshot_operations_s g_oneshot_ops =
*
****************************************************************************/
static void sim_oneshot_handler(void *arg)
static void sim_oneshot_handler(int argc, wdparm_t arg1, ...)
{
FAR struct sim_oneshot_lowerhalf_s *priv =
(FAR struct sim_oneshot_lowerhalf_s *)arg;
(FAR struct sim_oneshot_lowerhalf_s *)arg1;
oneshot_callback_t callback;
FAR void *cbarg;
DEBUGASSERT(priv != NULL);
DEBUGASSERT(argc == 1 && priv != NULL);
/* Perhaps the callback was nullified in a race condition with
* sim_cancel?
+2 -3
View File
@@ -239,9 +239,8 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
return ret;
}
/* Handle built-in ioctl commands */
/* Handle oneshot timer ioctl commands */
ret = -EINVAL;
switch (cmd)
{
/* OSIOC_MAXDELAY - Return the maximum delay that can be supported
@@ -286,7 +285,7 @@ static int oneshot_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
/* Start the oneshot timer */
ret = ONESHOT_START(priv->od_lower, oneshot_callback, start->arg,
ret = ONESHOT_START(priv->od_lower, oneshot_callback, priv,
&start->ts);
}
break;