hc
2024-01-31 f9004dbfff8a3fbbd7e2a88c8a4327c7f2f8e5b2
kernel/drivers/net/phy/phy_led_triggers.c
....@@ -1,15 +1,5 @@
1
-/* Copyright (C) 2016 National Instruments Corp.
2
- *
3
- * This program is free software; you can redistribute it and/or modify
4
- * it under the terms of the GNU General Public License as published by
5
- * the Free Software Foundation; either version 2 of the License, or
6
- * (at your option) any later version.
7
- *
8
- * This program is distributed in the hope that it will be useful,
9
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
10
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
12
- */
1
+// SPDX-License-Identifier: GPL-2.0+
2
+/* Copyright (C) 2016 National Instruments Corp. */
133 #include <linux/leds.h>
144 #include <linux/phy.h>
155 #include <linux/phy_led_triggers.h>
....@@ -68,7 +58,7 @@
6858 EXPORT_SYMBOL_GPL(phy_led_trigger_change_speed);
6959
7060 static void phy_led_trigger_format_name(struct phy_device *phy, char *buf,
71
- size_t size, char *suffix)
61
+ size_t size, const char *suffix)
7262 {
7363 snprintf(buf, size, PHY_ID_FMT ":%s",
7464 phy->mdio.bus->id, phy->mdio.addr, suffix);
....@@ -78,20 +68,9 @@
7868 struct phy_led_trigger *plt,
7969 unsigned int speed)
8070 {
81
- char name_suffix[PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE];
82
-
8371 plt->speed = speed;
84
-
85
- if (speed < SPEED_1000)
86
- snprintf(name_suffix, sizeof(name_suffix), "%dMbps", speed);
87
- else if (speed == SPEED_2500)
88
- snprintf(name_suffix, sizeof(name_suffix), "2.5Gbps");
89
- else
90
- snprintf(name_suffix, sizeof(name_suffix), "%dGbps",
91
- DIV_ROUND_CLOSEST(speed, 1000));
92
-
9372 phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
94
- name_suffix);
73
+ phy_speed_to_str(speed));
9574 plt->trigger.name = plt->name;
9675
9776 return led_trigger_register(&plt->trigger);