[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <180e705f8de.1012cdc8c45890.1645144071309904245@zohomail.com>
Date: Sat, 21 May 2022 07:29:29 -0700
From: Li Chen <lchen.firstlove@...omail.com>
To: "Mark Brown" <broonie@...nel.org>,
"linux-kernel" <linux-kernel@...r.kernel.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
"linux-gpio" <linux-gpio@...r.kernel.org>,
"Linus Walleij" <linus.walleij@...aro.org>,
"linux-arm-kernel" <linux-arm-kernel@...ts.infradead.org>,
"Patrice Chotard" <patrice.chotard@...s.st.com>,
"linux-sunxi" <linux-sunxi@...ts.linux.dev>,
"Liam Girdwood" <lgirdwood@...il.com>,
"Jaroslav Kysela" <perex@...ex.cz>,
"Takashi Iwai" <tiwai@...e.com>, "Chen-Yu Tsai" <wens@...e.org>,
"Jernej Skrabec" <jernej.skrabec@...il.com>,
"Samuel Holland" <samuel@...lland.org>,
"Philipp Zabel" <p.zabel@...gutronix.de>
Subject: [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits
From: Li Chen <lchen@...arella.com>
Appropriately change calls to regmap_field_read() with
regmap_field_test_bits() for improved readability.
Signed-off-by: Li Chen <lchen@...arella.com>
---
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
Powered by blists - more mailing lists