[PATCH] pbl/pmic.h: rename pmic_reg_write() to pmic_reg_write8()

Sascha Hauer s.hauer at pengutronix.de
Tue Jan 2 03:21:13 PST 2024


pmic_reg_write() does 8 bit writes, so rename the function accordingly.

When adding 16/32 bit writes there is no point in abstracting the
register width in pmic_reg_write(), because the caller actually must
know the register width to make useful register changes. This means
we better add pmic_reg_write16/32 when need arises.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/mnt-reform/lowlevel.c | 2 +-
 include/pbl/pmic.h                    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boards/mnt-reform/lowlevel.c b/arch/arm/boards/mnt-reform/lowlevel.c
index 01a50fac56..9f951508df 100644
--- a/arch/arm/boards/mnt-reform/lowlevel.c
+++ b/arch/arm/boards/mnt-reform/lowlevel.c
@@ -59,7 +59,7 @@ static void i2c_mux_set(struct pbl_i2c *i2c, u8 channel)
 
 static void i2c_regulator_set_voltage(struct pbl_i2c *i2c, u8 reg, u8 voffs)
 {
-	pmic_reg_write(i2c, 0x60, reg, 0x80 + voffs);
+	pmic_reg_write8(i2c, 0x60, reg, 0x80 + voffs);
 }
 
 #define I2C_PAD_CTRL	MUX_PAD_CTRL(MX8MQ_PAD_CTL_DSE_45R | \
diff --git a/include/pbl/pmic.h b/include/pbl/pmic.h
index 0f882c5649..695e47a564 100644
--- a/include/pbl/pmic.h
+++ b/include/pbl/pmic.h
@@ -9,7 +9,7 @@ struct pmic_config {
 	u8 val;
 };
 
-static void pmic_reg_write(struct pbl_i2c *i2c, int addr, u8 reg, u8 val)
+static void pmic_reg_write8(struct pbl_i2c *i2c, int addr, u8 reg, u8 val)
 {
 	int ret;
 	u8 buf[32];
@@ -35,7 +35,7 @@ static inline void pmic_configure(struct pbl_i2c *i2c, u8 addr,
 				  size_t config_len)
 {
 	for (; config_len--; config++)
-		pmic_reg_write(i2c, addr, config->reg, config->val);
+		pmic_reg_write8(i2c, addr, config->reg, config->val);
 }
 
 #endif
-- 
2.39.2




More information about the barebox mailing list