@@ -58,8 +58,6 @@ struct sam_oneshot_lowerhalf_s
5858 /* Private lower half data follows */
5959
6060 struct sam_oneshot_s oneshot ; /* SAM-specific oneshot state */
61- oneshot_callback_t callback ; /* internal handler that receives callback */
62- void * arg ; /* Argument that is passed to the handler */
6361};
6462
6563/****************************************************************************
@@ -112,30 +110,14 @@ static void sam_oneshot_handler(void *arg)
112110{
113111 struct sam_oneshot_lowerhalf_s * priv =
114112 (struct sam_oneshot_lowerhalf_s * )arg ;
115- oneshot_callback_t callback ;
116- void * cbarg ;
117113
118114 DEBUGASSERT (priv != NULL );
119115
120116 /* Perhaps the callback was nullified in a race condition with
121117 * sam_cancel?
122118 */
123119
124- if (priv -> callback )
125- {
126- /* Sample and nullify BEFORE executing callback (in case the callback
127- * restarts the oneshot).
128- */
129-
130- callback = priv -> callback ;
131- cbarg = priv -> arg ;
132- priv -> callback = NULL ;
133- priv -> arg = NULL ;
134-
135- /* Then perform the callback */
136-
137- callback (& priv -> lh , cbarg );
138- }
120+ oneshot_process_callback (& priv -> lh );
139121}
140122
141123/****************************************************************************
@@ -211,11 +193,9 @@ static int sam_start(struct oneshot_lowerhalf_s *lower,
211193
212194 /* Save the callback information and start the timer */
213195
214- flags = enter_critical_section ();
215- priv -> callback = callback ;
216- priv -> arg = arg ;
217- ret = sam_oneshot_start (& priv -> oneshot , NULL ,
218- sam_oneshot_handler , priv , ts );
196+ flags = enter_critical_section ();
197+ ret = sam_oneshot_start (& priv -> oneshot , NULL ,
198+ sam_oneshot_handler , priv , ts );
219199 leave_critical_section (flags );
220200
221201 if (ret < 0 )
@@ -262,10 +242,8 @@ static int sam_cancel(struct oneshot_lowerhalf_s *lower,
262242
263243 /* Cancel the timer */
264244
265- flags = enter_critical_section ();
266- ret = sam_oneshot_cancel (& priv -> oneshot , NULL , ts );
267- priv -> callback = NULL ;
268- priv -> arg = NULL ;
245+ flags = enter_critical_section ();
246+ ret = sam_oneshot_cancel (& priv -> oneshot , NULL , ts );
269247 leave_critical_section (flags );
270248
271249 if (ret < 0 )
0 commit comments