[openwrt/openwrt] realtek: Avoid braces around single statement blocks

LEDE Commits lede-commits at lists.infradead.org
Mon Nov 24 15:29:52 PST 2025


hauke pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/c6e0638ed161d5382603b2b1e239f2fa572b18aa

commit c6e0638ed161d5382603b2b1e239f2fa572b18aa
Author: Sven Eckelmann <sven at narfation.org>
AuthorDate: Sun Nov 23 13:17:31 2025 +0100

    realtek: Avoid braces around single statement blocks
    
    The Linux kernel coding style prefers not to use braces around blocks which
    are only one statement long.
    
    Signed-off-by: Sven Eckelmann <sven at narfation.org>
    Link: https://github.com/openwrt/openwrt/pull/20906
    Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 .../realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c      |  8 ++++----
 .../realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c      |  6 +++---
 .../realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c     | 15 ++++++---------
 3 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
index 88dbab8b6a..70ca846af0 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
@@ -2219,9 +2219,9 @@ static int rtl83xx_vlan_del(struct dsa_switch *ds, int port,
 	pvid = priv->ports[port].pvid;
 
 	/* Reset to default if removing the current PVID */
-	if (vlan->vid == pvid) {
+	if (vlan->vid == pvid)
 		rtl83xx_vlan_set_pvid(priv, port, 0);
-	}
+
 	/* Get port memberships of this vlan */
 	priv->r->vlan_tables_read(vlan->vid, &info);
 
@@ -2821,9 +2821,9 @@ static bool rtl83xx_lag_can_offload(struct dsa_switch *ds,
 	if (id < 0 || id >= ds->num_lag_ids)
 		return false;
 
-	if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
+	if (info->tx_type != NETDEV_LAG_TX_TYPE_HASH)
 		return false;
-	}
+
 	if (info->hash_type != NETDEV_LAG_HASH_L2 && info->hash_type != NETDEV_LAG_HASH_L23)
 		return false;
 
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c
index c1e795e80c..3d8a6e9acb 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/qos.c
@@ -323,11 +323,11 @@ static void rtl83xx_setup_prio2queue_cpu_matrix(int *max_queues)
 
 static void rtl83xx_setup_default_prio2queue(void)
 {
-	if (soc_info.family == RTL8380_FAMILY_ID) {
+	if (soc_info.family == RTL8380_FAMILY_ID)
 		rtl838x_setup_prio2queue_matrix(rtldsa_max_available_queue);
-	} else {
+	else
 		rtl839x_setup_prio2queue_matrix(rtldsa_max_available_queue);
-	}
+
 	rtl83xx_setup_prio2queue_cpu_matrix(rtldsa_max_available_queue);
 }
 
diff --git a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
index 3c8ec9043a..c794d21958 100644
--- a/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
+++ b/target/linux/realtek/files-6.12/drivers/net/pcs/pcs-rtl-otto.c
@@ -622,9 +622,8 @@ static void rtpcs_930x_sds_mode_set(struct rtpcs_ctrl *ctrl, int sds,
 	rtpcs_930x_sds_set(ctrl, sds, mode);
 
 	/* Set the submode if needed. */
-	if (phy_mode == PHY_INTERFACE_MODE_10G_QXGMII) {
+	if (phy_mode == PHY_INTERFACE_MODE_10G_QXGMII)
 		rtpcs_930x_sds_submode_set(ctrl, sds, submode);
-	}
 }
 
 
@@ -1844,9 +1843,8 @@ static void rtpcs_930x_sds_patch(struct rtpcs_ctrl *ctrl, int sds, phy_interface
 		return;
 	}
 
-	for (size_t i = 0; i < count; ++i) {
+	for (size_t i = 0; i < count; ++i)
 		rtpcs_sds_write(ctrl, sds, config[i].page, config[i].reg, config[i].data);
-	}
 
 	if (mode == PHY_INTERFACE_MODE_10G_QXGMII) {
 		/* Default configuration */
@@ -2148,9 +2146,8 @@ static void rtpcs_931x_sds_cmu_type_set(struct rtpcs_ctrl *ctrl, u32 sds,
 		pr_info("%s A CMU page 0x28 0x7 %08x\n", __func__, rtpcs_sds_read(ctrl, sds, 0x28, 0x7));
 		rtpcs_sds_write_bits(ctrl, sds, cmu_page, 0x7, 15, 15, 0);
 		pr_info("%s B CMU page 0x28 0x7 %08x\n", __func__, rtpcs_sds_read(ctrl, sds, 0x28, 0x7));
-		if (chiptype) {
+		if (chiptype)
 			rtpcs_sds_write_bits(ctrl, sds, cmu_page, 0xd, 14, 14, 0);
-		}
 
 		rtpcs_sds_write_bits(ctrl, evenSds, 0x20, 0x12, 3, 2, 0x3);
 		rtpcs_sds_write_bits(ctrl, evenSds, 0x20, 0x12, frc_lc_mode_bitnum, frc_lc_mode_bitnum, 1);
@@ -2507,12 +2504,12 @@ static int rtpcs_931x_setup_serdes(struct rtpcs_ctrl *ctrl, int sds,
 			val = 0xa0000;
 			regmap_write(ctrl->map, RTL93XX_CHIP_INFO, val);
 			regmap_read(ctrl->map, RTL93XX_CHIP_INFO, &val);
+
 			if (val & BIT(28)) /* consider 9311 etc. RTL9313_CHIP_ID == HWP_CHIP_ID(unit)) */
-			{
 				rtpcs_sds_write(ctrl, sds, 0x2E, 0x1, board_sds_tx2[sds - 2]);
-			} else {
+			else
 				rtpcs_sds_write(ctrl, sds, 0x2E, 0x1, board_sds_tx[sds - 2]);
-			}
+
 			val = 0;
 			regmap_write(ctrl->map, RTL93XX_CHIP_INFO, val);
 		}




More information about the lede-commits mailing list