timers/oneshot: Remove all private callback.

This commit removed all private callback and handle it on the upperhalf
of oneshot.

Signed-off-by: ouyangxiangzhen <ouyangxiangzhen@xiaomi.com>
This commit is contained in:
ouyangxiangzhen
2025-09-10 15:33:27 +08:00
committed by Alin Jerpelea
parent f70ec7384b
commit 5c113f79b7
32 changed files with 144 additions and 606 deletions
@@ -60,8 +60,6 @@ struct bm3803_oneshot_lowerhalf_s
/* STM32-specific oneshot state */
struct bm3803_oneshot_s oneshot;
oneshot_callback_t callback; /* internal handler that receives callback */
void *arg; /* Argument that is passed to the handler */
};
/****************************************************************************
@@ -114,8 +112,6 @@ static void bm3803_oneshot_handler(void *arg)
{
struct bm3803_oneshot_lowerhalf_s *priv =
(struct bm3803_oneshot_lowerhalf_s *)arg;
oneshot_callback_t callback;
void *cbarg;
DEBUGASSERT(priv != NULL);
@@ -123,21 +119,7 @@ static void bm3803_oneshot_handler(void *arg)
* bm3803_cancel?
*/
if (priv->callback)
{
/* Sample and nullify BEFORE executing callback (in case the callback
* restarts the oneshot).
*/
callback = priv->callback;
cbarg = priv->arg;
priv->callback = NULL;
priv->arg = NULL;
/* Then perform the callback */
callback(&priv->lh, cbarg);
}
oneshot_process_callback(&priv->lh);
}
/****************************************************************************
@@ -213,11 +195,9 @@ static int bm3803_start(struct oneshot_lowerhalf_s *lower,
/* Save the callback information and start the timer */
flags = enter_critical_section();
priv->callback = callback;
priv->arg = arg;
ret = bm3803_oneshot_start(&priv->oneshot,
bm3803_oneshot_handler, priv, ts);
flags = enter_critical_section();
ret = bm3803_oneshot_start(&priv->oneshot,
bm3803_oneshot_handler, priv, ts);
leave_critical_section(flags);
if (ret < 0)
@@ -264,10 +244,8 @@ static int bm3803_cancel(struct oneshot_lowerhalf_s *lower,
/* Cancel the timer */
flags = enter_critical_section();
ret = bm3803_oneshot_cancel(&priv->oneshot, ts);
priv->callback = NULL;
priv->arg = NULL;
flags = enter_critical_section();
ret = bm3803_oneshot_cancel(&priv->oneshot, ts);
leave_critical_section(flags);
if (ret < 0)