Re: [PATCH v3 1/3] input: pm8xxx-vib: refactor to easily support new SPMI vibrator

kernel test robot
2023-07-25T10:03:43Z

Hi Fenglin,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on dtor-input/for-linus linus/master v6.5-rc3 next-20230725]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Fenglin-Wu/input-pm8xxx-vib-refactor-to-easily-support-new-SPMI-vibrator/20230725-134504
base: https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link: https://lore.kernel.org/r/20230725054138.129497-2-quic_fenglinw%40quicinc.com
patch subject: [PATCH v3 1/3] input: pm8xxx-vib: refactor to easily support new SPMI vibrator
config: x86_64-buildonly-randconfig-r002-20230725 (https://download.01.org/0day-ci/archive/20230725/202307251741.PMtlVAgD-lkp@intel.com/config)
compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project.git 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a)
reproduce: (https://download.01.org/0day-ci/archive/20230725/202307251741.PMtlVAgD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202307251741.PMtlVAgD-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/input/misc/pm8xxx-vibrator.c:190:17: warning: cast to smaller integer type 'enum pm8xxx_vib_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
vib->hw_type = (enum pm8xxx_vib_type)of_device_get_match_data(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

vim +190 drivers/input/misc/pm8xxx-vibrator.c

163
164 static int pm8xxx_vib_probe(struct platform_device *pdev)
165 {
166 struct pm8xxx_vib *vib;
167 struct input_dev *input_dev;
168 struct device *dev = &pdev->dev;
169 struct regmap *regmap;
170 struct reg_field *regs;
171 int error, i;
172 unsigned int val;
173 u32 reg_base;
174
175 vib = devm_kzalloc(dev, sizeof(*vib), GFP_KERNEL);
176 if (!vib)
177 return -ENOMEM;
178
179 regmap = dev_get_regmap(dev->parent, NULL);
180 if (!regmap)
181 return -ENODEV;
182
183 input_dev = devm_input_allocate_device(dev);
184 if (!input_dev)
185 return -ENOMEM;
186
187 INIT_WORK(&vib->work, pm8xxx_work_handler);
188 vib->vib_input_dev = input_dev;
189
> 190 vib->hw_type = (enum pm8xxx_vib_type)of_device_get_match_data(dev);
191
192 regs = ssbi_vib_regs;
193 if (vib->hw_type != SSBI_VIB) {
194 error = fwnode_property_read_u32(dev->fwnode, "reg", &reg_base);
195 if (error < 0) {
196 dev_err(dev, "Failed to read reg address, rc=%d\n", error);
197 return error;
198 }
199
200 if (vib->hw_type == SPMI_VIB_GEN1)
201 regs = spmi_vib_gen1_regs;
202
203 for (i = 0; i < VIB_MAX_REG; i++)
204 if (regs[i].reg != 0)
205 regs[i].reg += reg_base;
206 }
207
208 error = devm_regmap_field_bulk_alloc(dev, regmap, vib->r_fields, regs, VIB_MAX_REG);
209 if (error < 0)
210 {
211 dev_err(dev, "Failed to allocate regmap failed, rc=%d\n", error);
212 return error;
213 }
214
215 error = regmap_field_read(vib->r_fields[VIB_DRV_REG], &val);
216 if (error < 0)
217 return error;
218
219 /* operate in manual mode */
220 if (vib->hw_type == SSBI_VIB) {
221 val &= SSBI_VIB_DRV_EN_MANUAL_MASK;
222 error = regmap_field_write(vib->r_fields[VIB_DRV_REG], val);
223 if (error < 0)
224 return error;
225 }
226
227 vib->reg_vib_drv = val;
228
229 input_dev->name = "pm8xxx_vib_ffmemless";
230 input_dev->id.version = 1;
231 input_dev->close = pm8xxx_vib_close;
232 input_set_drvdata(input_dev, vib);
233 input_set_capability(vib->vib_input_dev, EV_FF, FF_RUMBLE);
234
235 error = input_ff_create_memless(input_dev, NULL,
236 pm8xxx_vib_play_effect);
237 if (error) {
238 dev_err(dev, "couldn't register vibrator as FF device\n");
239 return error;
240 }
241
242 error = input_register_device(input_dev);
243 if (error) {
244 dev_err(dev, "couldn't register input device\n");
245 return error;
246 }
247
248 platform_set_drvdata(pdev, vib);
249 return 0;
250 }
251

--
0-DAY CI Kernel Test Service