Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 050cde13 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Samuel Ortiz
Browse files

mfd: twl-core: No need to check for invalid subchip ID



The module id table no longer can have invalid/unused entries.
No need for checking the ID for validity.

Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 5d4e9bd7
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@
#define SUB_CHIP_ID1 1
#define SUB_CHIP_ID2 2
#define SUB_CHIP_ID3 3
#define SUB_CHIP_ID_INVAL 0xff

/* Base Address defns for twl4030_map[] */

@@ -326,12 +325,8 @@ int twl_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
		pr_err("%s: not initialized\n", DRIVER_NAME);
		return -EPERM;
	}

	sid = twl_map[mod_no].sid;
	if (unlikely(sid == SUB_CHIP_ID_INVAL)) {
		pr_err("%s: module %d is not part of the pmic\n",
		       DRIVER_NAME, mod_no);
		return -EINVAL;
	}
	twl = &twl_modules[sid];

	ret = regmap_bulk_write(twl->regmap, twl_map[mod_no].base + reg,
@@ -368,12 +363,8 @@ int twl_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes)
		pr_err("%s: not initialized\n", DRIVER_NAME);
		return -EPERM;
	}

	sid = twl_map[mod_no].sid;
	if (unlikely(sid == SUB_CHIP_ID_INVAL)) {
		pr_err("%s: module %d is not part of the pmic\n",
		       DRIVER_NAME, mod_no);
		return -EINVAL;
	}
	twl = &twl_modules[sid];

	ret = regmap_bulk_read(twl->regmap, twl_map[mod_no].base + reg,