[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240306094026.220195-1-lukma@denx.de>
Date: Wed, 6 Mar 2024 10:40:26 +0100
From: Lukasz Majewski <lukma@...x.de>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Eric Dumazet <edumazet@...gle.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
netdev@...r.kernel.org,
Tristram.Ha@...rochip.com,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Paolo Abeni <pabeni@...hat.com>,
Ravi Gunasekaran <r-gunasekaran@...com>,
Nikita Zhandarovich <n.zhandarovich@...tech.ru>,
Murali Karicheri <m-karicheri2@...com>,
Ziyang Xuan <william.xuanziyang@...wei.com>,
Simon Horman <horms@...nel.org>,
Andrew Lunn <andrew@...n.ch>,
Lukasz Majewski <lukma@...x.de>
Subject: [PATCH v2] net: hsr: Use full string description when opening HSR network device
Up till now only single character ('A' or 'B') was used to provide
information of HSR slave network device status.
As it is also possible and valid, that Interlink network device may
be supported as well, the description must be more verbose. As a result
the full string description is now used.
Signed-off-by: Lukasz Majewski <lukma@...x.de>
---
Changes for v2:
- Use const char * instead of char * - to assure that pointed string is
immutable (.rodata allocated).
---
net/hsr/hsr_device.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c
index 9d71b66183da..904cd8f8f830 100644
--- a/net/hsr/hsr_device.c
+++ b/net/hsr/hsr_device.c
@@ -142,30 +142,29 @@ static int hsr_dev_open(struct net_device *dev)
{
struct hsr_priv *hsr;
struct hsr_port *port;
- char designation;
+ const char *designation = NULL;
hsr = netdev_priv(dev);
- designation = '\0';
hsr_for_each_port(hsr, port) {
if (port->type == HSR_PT_MASTER)
continue;
switch (port->type) {
case HSR_PT_SLAVE_A:
- designation = 'A';
+ designation = "Slave A";
break;
case HSR_PT_SLAVE_B:
- designation = 'B';
+ designation = "Slave B";
break;
default:
- designation = '?';
+ designation = "Unknown";
}
if (!is_slave_up(port->dev))
- netdev_warn(dev, "Slave %c (%s) is not up; please bring it up to get a fully working HSR network\n",
+ netdev_warn(dev, "%s (%s) is not up; please bring it up to get a fully working HSR network\n",
designation, port->dev->name);
}
- if (designation == '\0')
+ if (!designation)
netdev_warn(dev, "No slave devices configured\n");
return 0;
--
2.20.1
Powered by blists - more mailing lists