Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dsa: Use str_enable_disable-like helpers

Replace ternary (condition ? "enable" : "disable") syntax with helpers
from string_choices.h because:
1. Simple function call with one argument is easier to read. Ternary
operator has three arguments and with wrapping might lead to quite
long code.
2. Is slightly shorter thus also easier to read.
3. It brings uniformity in the text - same string.
4. Allows deduping by the linker, which results in a smaller binary
file.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Krzysztof Kozlowski and committed by
David S. Miller
544c9394 a12c76a0

+8 -5
+2 -1
drivers/net/dsa/mv88e6xxx/pcs-639x.c
··· 9 9 #include <linux/interrupt.h> 10 10 #include <linux/irqdomain.h> 11 11 #include <linux/mii.h> 12 + #include <linux/string_choices.h> 12 13 13 14 #include "chip.h" 14 15 #include "global2.h" ··· 751 750 if (err) 752 751 dev_err(mpcs->mdio.dev.parent, 753 752 "failed to %s 2500basex fix: %pe\n", 754 - enable ? "enable" : "disable", ERR_PTR(err)); 753 + str_enable_disable(enable), ERR_PTR(err)); 755 754 756 755 return err; 757 756 }
+2 -1
drivers/net/dsa/mv88e6xxx/port.c
··· 13 13 #include <linux/phy.h> 14 14 #include <linux/phylink.h> 15 15 #include <linux/property.h> 16 + #include <linux/string_choices.h> 16 17 17 18 #include "chip.h" 18 19 #include "global2.h" ··· 177 176 178 177 dev_dbg(chip->dev, "p%d: %s link %s\n", port, 179 178 reg & MV88E6XXX_PORT_MAC_CTL_FORCE_LINK ? "Force" : "Unforce", 180 - reg & MV88E6XXX_PORT_MAC_CTL_LINK_UP ? "up" : "down"); 179 + str_up_down(reg & MV88E6XXX_PORT_MAC_CTL_LINK_UP)); 181 180 182 181 return 0; 183 182 }
+4 -3
drivers/net/dsa/realtek/rtl8366rb.c
··· 21 21 #include <linux/irqchip/chained_irq.h> 22 22 #include <linux/of_irq.h> 23 23 #include <linux/regmap.h> 24 + #include <linux/string_choices.h> 24 25 25 26 #include "realtek.h" 26 27 #include "realtek-smi.h" ··· 1523 1522 rb = priv->chip_data; 1524 1523 1525 1524 dev_dbg(priv->dev, "port %d: %s VLAN filtering\n", port, 1526 - vlan_filtering ? "enable" : "disable"); 1525 + str_enable_disable(vlan_filtering)); 1527 1526 1528 1527 /* If the port is not in the member set, the frame will be dropped */ 1529 1528 ret = regmap_update_bits(priv->map, RTL8366RB_VLAN_INGRESS_CTRL2_REG, ··· 1885 1884 1886 1885 static int rtl8366rb_enable_vlan(struct realtek_priv *priv, bool enable) 1887 1886 { 1888 - dev_dbg(priv->dev, "%s VLAN\n", enable ? "enable" : "disable"); 1887 + dev_dbg(priv->dev, "%s VLAN\n", str_enable_disable(enable)); 1889 1888 return regmap_update_bits(priv->map, 1890 1889 RTL8366RB_SGCR, RTL8366RB_SGCR_EN_VLAN, 1891 1890 enable ? RTL8366RB_SGCR_EN_VLAN : 0); ··· 1893 1892 1894 1893 static int rtl8366rb_enable_vlan4k(struct realtek_priv *priv, bool enable) 1895 1894 { 1896 - dev_dbg(priv->dev, "%s VLAN 4k\n", enable ? "enable" : "disable"); 1895 + dev_dbg(priv->dev, "%s VLAN 4k\n", str_enable_disable(enable)); 1897 1896 return regmap_update_bits(priv->map, RTL8366RB_SGCR, 1898 1897 RTL8366RB_SGCR_EN_VLAN_4KTB, 1899 1898 enable ? RTL8366RB_SGCR_EN_VLAN_4KTB : 0);