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

Function gpio_led_probe

components/drivers/led/led-gpio.c:148–185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

146}
147
148static rt_err_t gpio_led_probe(struct rt_platform_device *pdev)
149{
150 rt_bool_t pinctrl_apply = RT_FALSE;
151 struct rt_ofw_node *led_np, *np = pdev->parent.ofw_node;
152
153 if (rt_ofw_prop_read_bool(np, "pinctrl-0"))
154 {
155 pinctrl_apply = RT_TRUE;
156 rt_pin_ctrl_confs_apply_by_name(&pdev->parent, RT_NULL);
157 }
158
159 rt_ofw_foreach_available_child_node(np, led_np)
160 {
161 rt_err_t err = ofw_append_gpio_led(led_np);
162
163 if (err == -RT_ENOMEM)
164 {
165 rt_ofw_node_put(led_np);
166
167 return err;
168 }
169 else if (err)
170 {
171 LOG_E("%s: create LED fail", rt_ofw_node_full_name(led_np));
172 continue;
173 }
174
175 if (!pinctrl_apply)
176 {
177 struct rt_device dev_tmp;
178
179 dev_tmp.ofw_node = led_np;
180 rt_pin_ctrl_confs_apply_by_name(&dev_tmp, RT_NULL);
181 }
182 }
183
184 return RT_EOK;
185}
186
187static rt_err_t gpio_led_remove(struct rt_platform_device *pdev)
188{

Callers

nothing calls this directly

Calls 5

rt_ofw_prop_read_boolFunction · 0.85
ofw_append_gpio_ledFunction · 0.85
rt_ofw_node_putFunction · 0.85
rt_ofw_node_full_nameFunction · 0.85

Tested by

no test coverage detected