Thread (22 messages) 22 messages, 4 authors, 2022-06-15
STALE1467d
Revisions (3)
  1. v1 current
  2. v2 [diff vs current]
  3. v3 [diff vs current]

[PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits

From: Li Chen <hidden>
Date: 2022-05-21 14:31:01
Also in: linux-gpio, linux-sunxi, lkml
Subsystem: arm/sti architecture, pin control subsystem, the rest · Maintainers: Patrice Chotard, Linus Walleij, Linus Torvalds

From: Li Chen <redacted>

Appropriately change calls to regmap_field_read() with
regmap_field_test_bits() for improved readability.

Signed-off-by: Li Chen <redacted>
---
 drivers/pinctrl/pinctrl-st.c | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-st.c b/drivers/pinctrl/pinctrl-st.c
index 0fea71fd9a00..971b54bb478a 100644
--- a/drivers/pinctrl/pinctrl-st.c
+++ b/drivers/pinctrl/pinctrl-st.c
@@ -573,23 +573,18 @@ static void st_pinconf_set_retime_dedicated(struct st_pinctrl *info,
 static void st_pinconf_get_direction(struct st_pio_control *pc,
 	int pin, unsigned long *config)
 {
-	unsigned int oe_value, pu_value, od_value;
-
 	if (pc->oe) {
-		regmap_field_read(pc->oe, &oe_value);
-		if (oe_value & BIT(pin))
+		if (regmap_field_test_bits(pc->oe, BIT(pin)))
 			ST_PINCONF_PACK_OE(*config);
 	}
 
 	if (pc->pu) {
-		regmap_field_read(pc->pu, &pu_value);
-		if (pu_value & BIT(pin))
+		if (regmap_field_test_bits(pc->pu, BIT(pin)))
 			ST_PINCONF_PACK_PU(*config);
 	}
 
 	if (pc->od) {
-		regmap_field_read(pc->od, &od_value);
-		if (od_value & BIT(pin))
+		if (regmap_field_test_bits(pc->od, &od_value, BIT(pin)))
 			ST_PINCONF_PACK_OD(*config);
 	}
 }
@@ -599,22 +594,22 @@ static int st_pinconf_get_retime_packed(struct st_pinctrl *info,
 {
 	const struct st_pctl_data *data = info->data;
 	struct st_retime_packed *rt_p = &pc->rt.rt_p;
-	unsigned int delay_bits, delay, delay0, delay1, val;
+	unsigned int delay_bits, delay, delay0, delay1;
 	int output = ST_PINCONF_UNPACK_OE(*config);
 
-	if (!regmap_field_read(rt_p->retime, &val) && (val & BIT(pin)))
+	if (!regmap_field_test_bits(rt_p->retime, BIT(pin)))
 		ST_PINCONF_PACK_RT(*config);
 
-	if (!regmap_field_read(rt_p->clk1notclk0, &val) && (val & BIT(pin)))
+	if (!regmap_field_test_bits(rt_p->clk1notclk0, BIT(pin)))
 		ST_PINCONF_PACK_RT_CLK(*config, 1);
 
-	if (!regmap_field_read(rt_p->clknotdata, &val) && (val & BIT(pin)))
+	if (!regmap_field_test_bits(rt_p->clknotdata, BIT(pin)))
 		ST_PINCONF_PACK_RT_CLKNOTDATA(*config);
 
-	if (!regmap_field_read(rt_p->double_edge, &val) && (val & BIT(pin)))
+	if (!regmap_field_test_bits(rt_p->double_edge, BIT(pin)))
 		ST_PINCONF_PACK_RT_DOUBLE_EDGE(*config);
 
-	if (!regmap_field_read(rt_p->invertclk, &val) && (val & BIT(pin)))
+	if (!regmap_field_test_bits(rt_p->invertclk, BIT(pin)))
 		ST_PINCONF_PACK_RT_INVERTCLK(*config);
 
 	regmap_field_read(rt_p->delay_0, &delay0);
-- 
2.36.1



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help