[PATCH 06/11] mfd: axp20x: remove dependency on regmap.h

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Oct 20 00:18:48 PDT 2023


axp20x_read_variable_width() is not used in barebox and
struct regmap and struct regmap_config could just be forward-declared
avoiding the need to include regmap.h. Thus drop the function and
forward declare. Should the function be needed in future, it can be
added back.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/linux/mfd/axp20x.h | 26 +++-----------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index b406c019e449..93d303c45991 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -8,7 +8,6 @@
 #ifndef __LINUX_MFD_AXP20X_H
 #define __LINUX_MFD_AXP20X_H
 
-#include <regmap.h>
 #include <poweroff.h>
 
 enum axp20x_variants {
@@ -448,6 +447,9 @@ enum {
 	AXP813_REG_ID_MAX,
 };
 
+struct regmap;
+struct regmap_config;
+
 struct axp20x_dev {
 	struct device			*dev;
 	struct regmap			*regmap;
@@ -458,28 +460,6 @@ struct axp20x_dev {
 	struct poweroff_handler		poweroff;
 };
 
-/* generic helper function for reading 9-16 bit wide regs */
-static inline int axp20x_read_variable_width(struct regmap *regmap,
-	unsigned int reg, unsigned int width)
-{
-	unsigned int reg_val, result;
-	int err;
-
-	err = regmap_read(regmap, reg, &reg_val);
-	if (err)
-		return err;
-
-	result = reg_val << (width - 8);
-
-	err = regmap_read(regmap, reg + 1, &reg_val);
-	if (err)
-		return err;
-
-	result |= reg_val;
-
-	return result;
-}
-
 /**
  * axp20x_match_device(): Setup axp20x variant related fields
  *
-- 
2.39.2




More information about the barebox mailing list