Lines Matching +full:trigger +full:- +full:name
1 // SPDX-License-Identifier: GPL-2.0+
13 for (i = 0; i < phy->phy_num_led_triggers; i++) { in phy_speed_to_led_trigger()
14 if (phy->phy_led_triggers[i].speed == speed) in phy_speed_to_led_trigger()
15 return &phy->phy_led_triggers[i]; in phy_speed_to_led_trigger()
22 if (phy->last_triggered) { in phy_led_trigger_no_link()
23 led_trigger_event(&phy->last_triggered->trigger, LED_OFF); in phy_led_trigger_no_link()
24 led_trigger_event(&phy->led_link_trigger->trigger, LED_OFF); in phy_led_trigger_no_link()
25 phy->last_triggered = NULL; in phy_led_trigger_no_link()
33 if (!phy->link) in phy_led_trigger_change_speed()
36 if (phy->speed == 0) in phy_led_trigger_change_speed()
39 plt = phy_speed_to_led_trigger(phy, phy->speed); in phy_led_trigger_change_speed()
41 netdev_alert(phy->attached_dev, in phy_led_trigger_change_speed()
42 "No phy led trigger registered for speed(%d)\n", in phy_led_trigger_change_speed()
43 phy->speed); in phy_led_trigger_change_speed()
47 if (plt != phy->last_triggered) { in phy_led_trigger_change_speed()
48 if (!phy->last_triggered) in phy_led_trigger_change_speed()
49 led_trigger_event(&phy->led_link_trigger->trigger, in phy_led_trigger_change_speed()
52 led_trigger_event(&phy->last_triggered->trigger, LED_OFF); in phy_led_trigger_change_speed()
54 led_trigger_event(&plt->trigger, LED_FULL); in phy_led_trigger_change_speed()
55 phy->last_triggered = plt; in phy_led_trigger_change_speed()
64 phy->mdio.bus->id, phy->mdio.addr, suffix); in phy_led_trigger_format_name()
72 plt->speed = speed; in phy_led_trigger_register()
73 phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name), suffix); in phy_led_trigger_register()
74 plt->trigger.name = plt->name; in phy_led_trigger_register()
76 return led_trigger_register(&plt->trigger); in phy_led_trigger_register()
81 led_trigger_unregister(&plt->trigger); in phy_led_trigger_unregister()
89 phy->phy_num_led_triggers = phy_supported_speeds(phy, speeds, in phy_led_triggers_register()
91 if (!phy->phy_num_led_triggers) in phy_led_triggers_register()
94 phy->led_link_trigger = devm_kzalloc(&phy->mdio.dev, in phy_led_triggers_register()
95 sizeof(*phy->led_link_trigger), in phy_led_triggers_register()
97 if (!phy->led_link_trigger) { in phy_led_triggers_register()
98 err = -ENOMEM; in phy_led_triggers_register()
102 err = phy_led_trigger_register(phy, phy->led_link_trigger, 0, "link"); in phy_led_triggers_register()
106 phy->phy_led_triggers = devm_kcalloc(&phy->mdio.dev, in phy_led_triggers_register()
107 phy->phy_num_led_triggers, in phy_led_triggers_register()
110 if (!phy->phy_led_triggers) { in phy_led_triggers_register()
111 err = -ENOMEM; in phy_led_triggers_register()
115 for (i = 0; i < phy->phy_num_led_triggers; i++) { in phy_led_triggers_register()
116 err = phy_led_trigger_register(phy, &phy->phy_led_triggers[i], in phy_led_triggers_register()
123 phy->last_triggered = NULL; in phy_led_triggers_register()
128 while (i--) in phy_led_triggers_register()
129 phy_led_trigger_unregister(&phy->phy_led_triggers[i]); in phy_led_triggers_register()
130 devm_kfree(&phy->mdio.dev, phy->phy_led_triggers); in phy_led_triggers_register()
132 phy_led_trigger_unregister(phy->led_link_trigger); in phy_led_triggers_register()
134 devm_kfree(&phy->mdio.dev, phy->led_link_trigger); in phy_led_triggers_register()
135 phy->led_link_trigger = NULL; in phy_led_triggers_register()
137 phy->phy_num_led_triggers = 0; in phy_led_triggers_register()
146 for (i = 0; i < phy->phy_num_led_triggers; i++) in phy_led_triggers_unregister()
147 phy_led_trigger_unregister(&phy->phy_led_triggers[i]); in phy_led_triggers_unregister()
149 if (phy->led_link_trigger) in phy_led_triggers_unregister()
150 phy_led_trigger_unregister(phy->led_link_trigger); in phy_led_triggers_unregister()