* [PATCH v2] net: phy: leds: Don't make our own link speed names
@ 2018-11-08 21:03 Kyle Roeschley
2018-11-09 7:44 ` kbuild test robot
2018-11-09 23:08 ` kbuild test robot
0 siblings, 2 replies; 3+ messages in thread
From: Kyle Roeschley @ 2018-11-08 21:03 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli
Cc: David S . Miller, netdev, linux-kernel, Kyle Roeschley
The phy core provides a handy phy_speed_to_str() helper, so use that
instead of doing our own formatting of the different known link speeds.
To do this, increase PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE to 11 so we can fit
'Unsupported' if necessary.
Signed-off-by: Kyle Roeschley <kyle.roeschley@ni.com>
---
v2: Increase PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE to fit 'Unsupported'.
drivers/net/phy/phy_led_triggers.c | 13 +------------
include/linux/phy_led_triggers.h | 2 +-
2 files changed, 2 insertions(+), 13 deletions(-)
diff --git a/drivers/net/phy/phy_led_triggers.c b/drivers/net/phy/phy_led_triggers.c
index 491efc1bf5c4..2827eb413c9c 100644
--- a/drivers/net/phy/phy_led_triggers.c
+++ b/drivers/net/phy/phy_led_triggers.c
@@ -77,20 +77,9 @@ static int phy_led_trigger_register(struct phy_device *phy,
struct phy_led_trigger *plt,
unsigned int speed)
{
- char name_suffix[PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE];
-
plt->speed = speed;
-
- if (speed < SPEED_1000)
- snprintf(name_suffix, sizeof(name_suffix), "%dMbps", speed);
- else if (speed == SPEED_2500)
- snprintf(name_suffix, sizeof(name_suffix), "2.5Gbps");
- else
- snprintf(name_suffix, sizeof(name_suffix), "%dGbps",
- DIV_ROUND_CLOSEST(speed, 1000));
-
phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
- name_suffix);
+ phy_speed_to_str(speed));
plt->trigger.name = plt->name;
return led_trigger_register(&plt->trigger);
diff --git a/include/linux/phy_led_triggers.h b/include/linux/phy_led_triggers.h
index b37b05bfd1a6..4587ce362535 100644
--- a/include/linux/phy_led_triggers.h
+++ b/include/linux/phy_led_triggers.h
@@ -20,7 +20,7 @@ struct phy_device;
#include <linux/leds.h>
#include <linux/phy.h>
-#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 10
+#define PHY_LED_TRIGGER_SPEED_SUFFIX_SIZE 11
#define PHY_LINK_LED_TRIGGER_NAME_SIZE (MII_BUS_ID_SIZE + \
FIELD_SIZEOF(struct mdio_device, addr)+\
--
2.19.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: phy: leds: Don't make our own link speed names
2018-11-08 21:03 [PATCH v2] net: phy: leds: Don't make our own link speed names Kyle Roeschley
@ 2018-11-09 7:44 ` kbuild test robot
2018-11-09 23:08 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-09 7:44 UTC (permalink / raw)
To: Kyle Roeschley
Cc: kbuild-all, Andrew Lunn, Florian Fainelli, David S . Miller,
netdev, linux-kernel, Kyle Roeschley
[-- Attachment #1: Type: text/plain, Size: 1924 bytes --]
Hi Kyle,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on v4.20-rc1 next-20181109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyle-Roeschley/net-phy-leds-Don-t-make-our-own-link-speed-names/20181109-143344
config: xtensa-allyesconfig (attached as .config)
compiler: xtensa-linux-gcc (GCC) 8.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=xtensa
All warnings (new ones prefixed by >>):
drivers/net//phy/phy_led_triggers.c: In function 'phy_led_trigger_register':
>> drivers/net//phy/phy_led_triggers.c:82:9: warning: passing argument 4 of 'phy_led_trigger_format_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
phy_speed_to_str(speed));
^~~~~~~~~~~~~~~~~~~~~~~
drivers/net//phy/phy_led_triggers.c:70:25: note: expected 'char *' but argument is of type 'const char *'
size_t size, char *suffix)
~~~~~~^~~~~~
vim +82 drivers/net//phy/phy_led_triggers.c
75
76 static int phy_led_trigger_register(struct phy_device *phy,
77 struct phy_led_trigger *plt,
78 unsigned int speed)
79 {
80 plt->speed = speed;
81 phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
> 82 phy_speed_to_str(speed));
83 plt->trigger.name = plt->name;
84
85 return led_trigger_register(&plt->trigger);
86 }
87
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 55729 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: phy: leds: Don't make our own link speed names
2018-11-08 21:03 [PATCH v2] net: phy: leds: Don't make our own link speed names Kyle Roeschley
2018-11-09 7:44 ` kbuild test robot
@ 2018-11-09 23:08 ` kbuild test robot
1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2018-11-09 23:08 UTC (permalink / raw)
To: Kyle Roeschley
Cc: kbuild-all, Andrew Lunn, Florian Fainelli, David S . Miller,
netdev, linux-kernel, Kyle Roeschley
[-- Attachment #1: Type: text/plain, Size: 2041 bytes --]
Hi Kyle,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on net-next/master]
[also build test WARNING on v4.20-rc1 next-20181109]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Kyle-Roeschley/net-phy-leds-Don-t-make-our-own-link-speed-names/20181109-143344
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
>> drivers/net/phy/phy_led_triggers.c:82:53: warning: incorrect type in argument 4 (different modifiers)
drivers/net/phy/phy_led_triggers.c:82:53: expected char *suffix
drivers/net/phy/phy_led_triggers.c:82:53: got char const *
drivers/net/phy/phy_led_triggers.c: In function 'phy_led_trigger_register':
drivers/net/phy/phy_led_triggers.c:82:9: warning: passing argument 4 of 'phy_led_trigger_format_name' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
phy_speed_to_str(speed));
^~~~~~~~~~~~~~~~
drivers/net/phy/phy_led_triggers.c:69:13: note: expected 'char *' but argument is of type 'const char *'
static void phy_led_trigger_format_name(struct phy_device *phy, char *buf,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
vim +82 drivers/net/phy/phy_led_triggers.c
75
76 static int phy_led_trigger_register(struct phy_device *phy,
77 struct phy_led_trigger *plt,
78 unsigned int speed)
79 {
80 plt->speed = speed;
81 phy_led_trigger_format_name(phy, plt->name, sizeof(plt->name),
> 82 phy_speed_to_str(speed));
83 plt->trigger.name = plt->name;
84
85 return led_trigger_register(&plt->trigger);
86 }
87
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 66569 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-11-09 23:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-08 21:03 [PATCH v2] net: phy: leds: Don't make our own link speed names Kyle Roeschley
2018-11-09 7:44 ` kbuild test robot
2018-11-09 23:08 ` kbuild test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).