MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_clk_unregister

Function rt_clk_unregister

components/drivers/clk/clk.c:280–309  ·  view source on GitHub ↗

* @brief Unregister clock node from clock list * * @param clk_np point to child node that will be Unregistered node. * * @retval RT_EOK * @retval -RT_EBUSY * @retval -RT_EINVAL */

Source from the content-addressed store, hash-verified

278 * @retval -RT_EINVAL
279 */
280rt_err_t rt_clk_unregister(struct rt_clk_node *clk_np)
281{
282 rt_err_t err = RT_EOK;
283
284 if (clk_np)
285 {
286 err = -RT_EBUSY;
287
288 rt_hw_spin_lock(&_clk_lock.lock);
289
290 if (rt_list_isempty(&clk_np->children_nodes))
291 {
292 if (rt_ref_read(&clk_np->ref) <= 1)
293 {
294 rt_list_remove(&clk_np->list);
295 clk_free(clk_np->clk);
296
297 err = RT_EOK;
298 }
299 }
300
301 rt_hw_spin_unlock(&_clk_lock.lock);
302 }
303 else
304 {
305 err = -RT_EINVAL;
306 }
307
308 return err;
309}
310
311/**
312 * @brief Register clock notifier into notifier list

Callers

nothing calls this directly

Calls 6

rt_list_isemptyFunction · 0.85
rt_ref_readFunction · 0.85
rt_list_removeFunction · 0.85
clk_freeFunction · 0.85
rt_hw_spin_lockFunction · 0.50
rt_hw_spin_unlockFunction · 0.50

Tested by

no test coverage detected