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

Function rt_regulator_unregister

components/drivers/regulator/regulator.c:66–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64}
65
66rt_err_t rt_regulator_unregister(struct rt_regulator_node *reg_np)
67{
68 rt_err_t err = RT_EOK;
69
70 if (!reg_np)
71 {
72 return -RT_EINVAL;
73 }
74
75 rt_hw_spin_lock(&_regulator_lock.lock);
76
77 if (rt_atomic_load(&reg_np->enabled_count) != 0)
78 {
79 err = -RT_EBUSY;
80
81 LOG_E("%s was enabled by consumer", reg_np->supply_name);
82
83 goto _unlock;
84 }
85
86 if (!(reg_np->param->boot_on || reg_np->param->always_on))
87 {
88 regulator_disable(reg_np);
89 }
90
91 if (!rt_list_isempty(&reg_np->children_nodes) || rt_ref_read(&reg_np->ref) > 1)
92 {
93 err = -RT_EBUSY;
94
95 goto _unlock;
96 }
97
98 reg_np->parent = RT_NULL;
99 rt_list_remove(&reg_np->list);
100
101_unlock:
102 rt_hw_spin_unlock(&_regulator_lock.lock);
103
104 return err;
105}
106
107rt_err_t rt_regulator_notifier_register(struct rt_regulator *reg,
108 struct rt_regulator_notifier *notifier)

Callers 1

regulator_releaseFunction · 0.85

Calls 6

rt_list_isemptyFunction · 0.85
rt_ref_readFunction · 0.85
rt_list_removeFunction · 0.85
regulator_disableFunction · 0.70
rt_hw_spin_lockFunction · 0.50
rt_hw_spin_unlockFunction · 0.50

Tested by

no test coverage detected