platform: starfive: remove redundant compatibility check in pmic_ops
authorNam Cao <namcao@linutronix.de>
Thu, 22 Feb 2024 08:16:16 +0000 (09:16 +0100)
committerAnup Patel <anup@brainfault.org>
Thu, 22 Feb 2024 12:37:49 +0000 (18:07 +0530)
pmic_ops() is only called if a compatible device is found in device
tree. It is redundant for this function to check the compability again.
Remove this check.

Signed-off-by: Nam Cao <namcao@linutronix.de>
Tested-by: Minda Chen <minda.chen@starfivetech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
platform/generic/starfive/jh7110.c

index efa4029f8bb57dae4b98a7b8817460596c4ff716..0e37d5642985a9038fee02b9a246d0b8498d0bba 100644 (file)
@@ -23,7 +23,6 @@
 struct pmic {
        struct i2c_adapter *adapter;
        u32 dev_addr;
-       const char *compatible;
 };
 
 struct jh7110 {
@@ -129,32 +128,26 @@ static void pmic_ops(struct pmic *pmic, int type)
        u8 val;
 
        ret = shutdown_device_power_domain();
-
        if (ret)
                return;
 
-       if (!sbi_strcmp("stf,axp15060-regulator", pmic->compatible)) {
-               ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr,
-                                          AXP15060_POWER_REG, &val);
-
-               if (ret) {
-                       sbi_printf("%s: cannot read pmic power register\n",
-                                  __func__);
-                       return;
-               }
+       ret = i2c_adapter_reg_read(pmic->adapter, pmic->dev_addr,
+                                  AXP15060_POWER_REG, &val);
+       if (ret) {
+               sbi_printf("%s: cannot read pmic power register\n", __func__);
+               return;
+       }
 
+       val |= AXP15060_POWER_OFF_BIT;
+       if (type == SBI_SRST_RESET_TYPE_SHUTDOWN)
                val |= AXP15060_POWER_OFF_BIT;
-               if (type == SBI_SRST_RESET_TYPE_SHUTDOWN)
-                       val |= AXP15060_POWER_OFF_BIT;
-               else
-                       val |= AXP15060_RESET_BIT;
+       else
+               val |= AXP15060_RESET_BIT;
 
-               ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr,
-                                           AXP15060_POWER_REG, val);
-               if (ret)
-                       sbi_printf("%s: cannot write pmic power register\n",
-                                  __func__);
-       }
+       ret = i2c_adapter_reg_write(pmic->adapter, pmic->dev_addr,
+                                       AXP15060_POWER_REG, val);
+       if (ret)
+               sbi_printf("%s: cannot write pmic power register\n", __func__);
 }
 
 static void pmic_i2c_clk_enable(void)
@@ -206,7 +199,6 @@ static int pm_reset_init(void *fdt, int nodeoff,
                return rc;
 
        pmic_inst.dev_addr = addr;
-       pmic_inst.compatible = match->compatible;
 
        i2c_bus = fdt_parent_offset(fdt, nodeoff);
        if (i2c_bus < 0)