2022-05-23 06:42:24

by Li Chen

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

From: Li Chen <[email protected]>

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

Signed-off-by: Li Chen <[email protected]>
---
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




2022-05-23 06:56:07

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH 4/4] pinctrl: st: Switch to use regmap_field_test_bits

Hi Li,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on broonie-regmap/for-next]
[also build test ERROR on linusw-pinctrl/devel broonie-sound/for-next v5.18-rc7]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url: https://github.com/intel-lab-lkp/linux/commits/Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352
base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git for-next
config: arm-allmodconfig (https://download.01.org/0day-ci/archive/20220522/[email protected]/config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/73189e14ed111777ac60a95ae3008337c69589da
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Li-Chen/Add-regmap_field-helpers-for-simple-bit-operations/20220521-224352
git checkout 73189e14ed111777ac60a95ae3008337c69589da
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arm SHELL=/bin/bash drivers/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/pinctrl/pinctrl-st.c: In function 'st_pinconf_get_direction':
>> drivers/pinctrl/pinctrl-st.c:587:53: error: 'od_value' undeclared (first use in this function); did you mean 'si_value'?
587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin)))
| ^~~~~~~~
| si_value
drivers/pinctrl/pinctrl-st.c:587:53: note: each undeclared identifier is reported only once for each function it appears in
>> drivers/pinctrl/pinctrl-st.c:587:21: error: too many arguments to function 'regmap_field_test_bits'
587 | if (regmap_field_test_bits(pc->od, &od_value, BIT(pin)))
| ^~~~~~~~~~~~~~~~~~~~~~
In file included from drivers/pinctrl/pinctrl-st.c:18:
include/linux/regmap.h:1353:5: note: declared here
1353 | int regmap_field_test_bits(struct regmap_field *field, unsigned int bits);
| ^~~~~~~~~~~~~~~~~~~~~~


vim +587 drivers/pinctrl/pinctrl-st.c

572
573 static void st_pinconf_get_direction(struct st_pio_control *pc,
574 int pin, unsigned long *config)
575 {
576 if (pc->oe) {
577 if (regmap_field_test_bits(pc->oe, BIT(pin)))
578 ST_PINCONF_PACK_OE(*config);
579 }
580
581 if (pc->pu) {
582 if (regmap_field_test_bits(pc->pu, BIT(pin)))
583 ST_PINCONF_PACK_PU(*config);
584 }
585
586 if (pc->od) {
> 587 if (regmap_field_test_bits(pc->od, &od_value, BIT(pin)))
588 ST_PINCONF_PACK_OD(*config);
589 }
590 }
591

--
0-DAY CI Kernel Test Service
https://01.org/lkp