Re: [PATCH v1 1/2] regulator: rtmv20: Adds support for Richtek RTMV20 load switch regulator

From: kernel test robot
Date: Fri Sep 25 2020 - 02:19:12 EST


Hi cy_huang,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on v5.9-rc6]
[also build test WARNING on next-20200924]
[cannot apply to regulator/for-next]
[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/0day-ci/linux/commits/cy_huang/regulator-rtmv20-Adds-support-for-Richtek-RTMV20-load-switch-regulator/20200924-230631
base: ba4f184e126b751d1bffad5897f263108befc780
config: m68k-randconfig-s031-20200925 (attached as .config)
compiler: m68k-linux-gcc (GCC) 9.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.2-201-g24bdaac6-dirty
# https://github.com/0day-ci/linux/commit/98eb1836ead59206f951ad8466fde2faca6472f4
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review cy_huang/regulator-rtmv20-Adds-support-for-Richtek-RTMV20-load-switch-regulator/20200924-230631
git checkout 98eb1836ead59206f951ad8466fde2faca6472f4
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=m68k

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)

>> drivers/regulator/rtmv20-regulator.c:136:31: sparse: sparse: cast to restricted __be16
>> drivers/regulator/rtmv20-regulator.c:139:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [addressable] [assigned] [usertype] tmp @@ got restricted __be16 [usertype] @@
>> drivers/regulator/rtmv20-regulator.c:139:29: sparse: expected unsigned short [addressable] [assigned] [usertype] tmp
>> drivers/regulator/rtmv20-regulator.c:139:29: sparse: got restricted __be16 [usertype]

vim +136 drivers/regulator/rtmv20-regulator.c

96
97 static int rtmv20_apply_properties(struct rtmv20_priv *priv)
98 {
99 const struct {
100 int offset;
101 int len;
102 unsigned int reg;
103 unsigned int mask;
104 } props[] = {
105 PROP_REG_DECL(ld_pulse_delay, RTMV20_REG_PULSEDELAY, RTMV20_DELAY_MASK),
106 PROP_REG_DECL(ld_pulse_width, RTMV20_REG_PULSEWIDTH, RTMV20_WIDTH_MASK),
107 PROP_REG_DECL(fsin1_delay, RTMV20_REG_FSIN1CTRL1, RTMV20_DELAY_MASK),
108 PROP_REG_DECL(fsin1_width, RTMV20_REG_FSIN1CTRL3, RTMV20_WIDTH2_MASK),
109 PROP_REG_DECL(fsin2_delay, RTMV20_REG_FSIN2CTRL1, RTMV20_DELAY_MASK),
110 PROP_REG_DECL(fsin2_width, RTMV20_REG_FSIN2CTRL3, RTMV20_WIDTH2_MASK),
111 PROP_REG_DECL(es_pulse_width, RTMV20_REG_ESPULSEWIDTH, RTMV20_WIDTH_MASK),
112 PROP_REG_DECL(es_ld_current, RTMV20_REG_ESLDCTRL1, RTMV20_LDCURR_MASK),
113 PROP_REG_DECL(lbp_level, RTMV20_REG_LBP, RTMV20_LBPLVL_MASK),
114 PROP_REG_DECL(lbp_enable, RTMV20_REG_LBP, RTMV20_LBPEN_MASK),
115 PROP_REG_DECL(strobe_polarity, RTMV20_REG_LDCTRL2, RTMV20_STROBEPOL_MASK),
116 PROP_REG_DECL(vsync_polarity, RTMV20_REG_LDCTRL2, RTMV20_VSYNPOL_MASK),
117 PROP_REG_DECL(fsin_enable, RTMV20_REG_ENCTRL, RTMV20_FSINEN_MASK),
118 PROP_REG_DECL(fsin_output, RTMV20_REG_ENCTRL, RTMV20_FSINOUT_MASK),
119 PROP_REG_DECL(es_enable, RTMV20_REG_ENCTRL, RTMV20_ESEN_MASK),
120 };
121 void *start = &priv->properties;
122 int i;
123
124 for (i = 0; i < ARRAY_SIZE(props); i++) {
125 u16 tmp = 0;
126 u16 *u16p = start + props[i].offset;
127 u8 *u8p = start + props[i].offset;
128 int shift = ffs(props[i].mask) - 1, ret;
129
130 switch (props[i].len) {
131 case RTMV20_2BYTE_ACCES:
132 ret = regmap_raw_read(priv->regmap, props[i].reg, &tmp, props[i].len);
133 if (ret)
134 return ret;
135
> 136 tmp = be16_to_cpu(tmp);
137 tmp &= ~props[i].mask;
138 tmp |= (*u16p << shift);
> 139 tmp = cpu_to_be16(tmp);
140
141 ret = regmap_raw_write(priv->regmap, props[i].reg, &tmp, props[i].len);
142 break;
143 case RTMV20_1BYTE_ACCES:
144 ret = regmap_update_bits(priv->regmap, props[i].reg, props[i].mask,
145 *u8p << shift);
146 break;
147 default:
148 return -EINVAL;
149 }
150
151 if (ret)
152 return ret;
153 }
154
155 return 0;
156 }
157

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip