]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
soc: renesas: r9a09g057-sys: Move common code to a helper
authorClaudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Fri, 3 Apr 2026 14:13:41 +0000 (17:13 +0300)
committerGeert Uytterhoeven <geert+renesas@glider.be>
Mon, 27 Apr 2026 09:27:46 +0000 (11:27 +0200)
Move common code from rzv2h_regmap_{readable,writeable}_reg() to a
helper and use it to avoid code duplication.

Signed-off-by: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/20260403141341.2851926-6-claudiu.beznea.uj@bp.reneasas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
drivers/soc/renesas/r9a09g057-sys.c

index f3e054206acbd99b051fca157345805a7f844d17..308492c31acbbca4fb44e8606a76563ec6a6ff13 100644 (file)
@@ -91,13 +91,9 @@ static const struct rz_sysc_soc_id_init_data rzv2h_sys_soc_id_init_data __initco
        .print_id = rzv2h_sys_print_id,
 };
 
-static bool rzv2h_regmap_readable_reg(struct device *dev, unsigned int reg)
+static bool rzv2h_regmap_readable_writeable_reg(unsigned int reg)
 {
        switch (reg) {
-       case SYS_LSI_OTPTSU0TRMVAL0:
-       case SYS_LSI_OTPTSU0TRMVAL1:
-       case SYS_LSI_OTPTSU1TRMVAL0:
-       case SYS_LSI_OTPTSU1TRMVAL1:
        case SYS_GBETH0_CFG:
        case SYS_GBETH1_CFG:
        case SYS_PCIE_INTX_CH0:
@@ -128,39 +124,27 @@ static bool rzv2h_regmap_readable_reg(struct device *dev, unsigned int reg)
        }
 }
 
-static bool rzv2h_regmap_writeable_reg(struct device *dev, unsigned int reg)
+static bool rzv2h_regmap_readable_reg(struct device *dev, unsigned int reg)
 {
+       if (rzv2h_regmap_readable_writeable_reg(reg))
+               return true;
+
        switch (reg) {
-       case SYS_GBETH0_CFG:
-       case SYS_GBETH1_CFG:
-       case SYS_PCIE_INTX_CH0:
-       case SYS_PCIE_MSI1_CH0:
-       case SYS_PCIE_MSI2_CH0:
-       case SYS_PCIE_MSI3_CH0:
-       case SYS_PCIE_MSI4_CH0:
-       case SYS_PCIE_MSI5_CH0:
-       case SYS_PCIE_PME_CH0:
-       case SYS_PCIE_ACK_CH0:
-       case SYS_PCIE_MISC_CH0:
-       case SYS_PCIE_MODE_CH0:
-       case SYS_PCIE_INTX_CH1:
-       case SYS_PCIE_MSI1_CH1:
-       case SYS_PCIE_MSI2_CH1:
-       case SYS_PCIE_MSI3_CH1:
-       case SYS_PCIE_MSI4_CH1:
-       case SYS_PCIE_MSI5_CH1:
-       case SYS_PCIE_PME_CH1:
-       case SYS_PCIE_ACK_CH1:
-       case SYS_PCIE_MISC_CH1:
-       case SYS_PCIE_MODE_CH1:
-       case SYS_PCIE_MODE:
-       case SYS_ADC_CFG:
+       case SYS_LSI_OTPTSU0TRMVAL0:
+       case SYS_LSI_OTPTSU0TRMVAL1:
+       case SYS_LSI_OTPTSU1TRMVAL0:
+       case SYS_LSI_OTPTSU1TRMVAL1:
                return true;
        default:
                return false;
        }
 }
 
+static bool rzv2h_regmap_writeable_reg(struct device *dev, unsigned int reg)
+{
+       return rzv2h_regmap_readable_writeable_reg(reg);
+}
+
 const struct rz_sysc_init_data rzv2h_sys_init_data __initconst = {
        .soc_id_init_data = &rzv2h_sys_soc_id_init_data,
        .readable_reg = rzv2h_regmap_readable_reg,