[PATCH 2/3] drivers/perf: convert sysfs scnprintf family to sysfs_emit_at
kernel test robot
lkp at intel.com
Wed Mar 17 13:47:17 GMT 2021
Hi Qi,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linus/master]
[also build test WARNING on v5.12-rc3 next-20210317]
[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/Qi-Liu/drivers-perf-convert-sysfs-sprintf-snprintf-scnprintf-to-sysfs_emit/20210317-174750
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1df27313f50a57497c1faeb6a6ae4ca939c85a7d
config: arm64-randconfig-r003-20210317 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.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/0day-ci/linux/commit/81a69a2f7fa73d0c41d699d6c6993c2594001241
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Qi-Liu/drivers-perf-convert-sysfs-sprintf-snprintf-scnprintf-to-sysfs_emit/20210317-174750
git checkout 81a69a2f7fa73d0c41d699d6c6993c2594001241
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
All warnings (new ones prefixed by >>):
drivers/perf/arm-ccn.c: In function 'arm_ccn_pmu_event_show':
>> drivers/perf/arm-ccn.c:345:32: warning: passing argument 2 of 'sysfs_emit' makes pointer from integer without a cast [-Wint-conversion]
345 | res += sysfs_emit(buf + res, res, ",xp=?,vc=?");
| ^~~
| |
| ssize_t {aka long int}
In file included from include/linux/kobject.h:20,
from include/linux/irqdesc.h:6,
from include/linux/irq.h:584,
from include/asm-generic/hardirq.h:17,
from arch/arm64/include/asm/hardirq.h:17,
from include/linux/hardirq.h:10,
from include/linux/interrupt.h:11,
from drivers/perf/arm-ccn.c:10:
include/linux/sysfs.h:335:39: note: expected 'const char *' but argument is of type 'ssize_t' {aka 'long int'}
335 | int sysfs_emit(char *buf, const char *fmt, ...);
| ~~~~~~~~~~~~^~~
vim +/sysfs_emit +345 drivers/perf/arm-ccn.c
274
275 #define CCN_EVENT_ATTR(_name) \
276 __ATTR(_name, S_IRUGO, arm_ccn_pmu_event_show, NULL)
277
278 /*
279 * Events defined in TRM for MN, HN-I and SBSX are actually watchpoints set on
280 * their ports in XP they are connected to. For the sake of usability they are
281 * explicitly defined here (and translated into a relevant watchpoint in
282 * arm_ccn_pmu_event_init()) so the user can easily request them without deep
283 * knowledge of the flit format.
284 */
285
286 #define CCN_EVENT_MN(_name, _def, _mask) { .attr = CCN_EVENT_ATTR(mn_##_name), \
287 .type = CCN_TYPE_MN, .event = CCN_EVENT_WATCHPOINT, \
288 .num_ports = CCN_NUM_XP_PORTS, .num_vcs = CCN_NUM_VCS, \
289 .def = _def, .mask = _mask, }
290
291 #define CCN_EVENT_HNI(_name, _def, _mask) { \
292 .attr = CCN_EVENT_ATTR(hni_##_name), .type = CCN_TYPE_HNI, \
293 .event = CCN_EVENT_WATCHPOINT, .num_ports = CCN_NUM_XP_PORTS, \
294 .num_vcs = CCN_NUM_VCS, .def = _def, .mask = _mask, }
295
296 #define CCN_EVENT_SBSX(_name, _def, _mask) { \
297 .attr = CCN_EVENT_ATTR(sbsx_##_name), .type = CCN_TYPE_SBSX, \
298 .event = CCN_EVENT_WATCHPOINT, .num_ports = CCN_NUM_XP_PORTS, \
299 .num_vcs = CCN_NUM_VCS, .def = _def, .mask = _mask, }
300
301 #define CCN_EVENT_HNF(_name, _event) { .attr = CCN_EVENT_ATTR(hnf_##_name), \
302 .type = CCN_TYPE_HNF, .event = _event, }
303
304 #define CCN_EVENT_XP(_name, _event) { .attr = CCN_EVENT_ATTR(xp_##_name), \
305 .type = CCN_TYPE_XP, .event = _event, \
306 .num_ports = CCN_NUM_XP_PORTS, .num_vcs = CCN_NUM_VCS, }
307
308 /*
309 * RN-I & RN-D (RN-D = RN-I + DVM) nodes have different type ID depending
310 * on configuration. One of them is picked to represent the whole group,
311 * as they all share the same event types.
312 */
313 #define CCN_EVENT_RNI(_name, _event) { .attr = CCN_EVENT_ATTR(rni_##_name), \
314 .type = CCN_TYPE_RNI_3P, .event = _event, }
315
316 #define CCN_EVENT_SBAS(_name, _event) { .attr = CCN_EVENT_ATTR(sbas_##_name), \
317 .type = CCN_TYPE_SBAS, .event = _event, }
318
319 #define CCN_EVENT_CYCLES(_name) { .attr = CCN_EVENT_ATTR(_name), \
320 .type = CCN_TYPE_CYCLES }
321
322
323 static ssize_t arm_ccn_pmu_event_show(struct device *dev,
324 struct device_attribute *attr, char *buf)
325 {
326 struct arm_ccn *ccn = pmu_to_arm_ccn(dev_get_drvdata(dev));
327 struct arm_ccn_pmu_event *event = container_of(attr,
328 struct arm_ccn_pmu_event, attr);
329 ssize_t res;
330
331 res = sysfs_emit(buf, "type=0x%x", event->type);
332 if (event->event)
333 res += sysfs_emit_at(buf + res, res, ",event=0x%x",
334 event->event);
335 if (event->def)
336 res += sysfs_emit_at(buf + res, res, ",%s", event->def);
337 if (event->mask)
338 res += sysfs_emit_at(buf + res, res, ",mask=0x%x", event->mask);
339
340 /* Arguments required by an event */
341 switch (event->type) {
342 case CCN_TYPE_CYCLES:
343 break;
344 case CCN_TYPE_XP:
> 345 res += sysfs_emit(buf + res, res, ",xp=?,vc=?");
346 if (event->event == CCN_EVENT_WATCHPOINT)
347 res += sysfs_emit_at(buf + res, res,
348 ",port=?,dir=?,cmp_l=?,cmp_h=?,mask=?");
349 else
350 res += sysfs_emit_at(buf + res, res, ",bus=?");
351
352 break;
353 case CCN_TYPE_MN:
354 res += sysfs_emit_at(buf + res, res, ",node=%d", ccn->mn_id);
355 break;
356 default:
357 res += sysfs_emit_at(buf + res, res, ",node=?");
358 break;
359 }
360
361 res += sysfs_emit_at(buf + res, res, "\n");
362
363 return res;
364 }
365
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 36853 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210317/d5bbf04a/attachment-0001.gz>
More information about the linux-arm-kernel
mailing list