tree:
https://github.com/Freescale/linux-fslc 5.10.x+fslc
head: 9496f7cd9619027b3ab4b4d5559d04122fb09457
commit: 10c7ebc67e346551cbbaca494c03976e64b18e3f [4/7] drivers, misc: add U-Boot bootcount
driver
config: h8300-randconfig-r016-20210113 (attached as .config)
compiler: h8300-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/Freescale/linux-fslc/commit/10c7ebc67e346551cbbaca494c...
git remote add freescale-fslc
https://github.com/Freescale/linux-fslc
git fetch --no-tags freescale-fslc 5.10.x+fslc
git checkout 10c7ebc67e346551cbbaca494c03976e64b18e3f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
All errors (new ones prefixed by >>):
In file included from include/linux/kobject.h:20,
from include/linux/energy_model.h:7,
from include/linux/device.h:16,
from include/linux/miscdevice.h:7,
from drivers/misc/uboot_bootcount.c:17:
> drivers/misc/uboot_bootcount.c:70:50: error: initialization of
'ssize_t (*)(struct device *, struct device_attribute *, char *)' {aka 'long
int (*)(struct device *, struct device_attribute *, char *)'} from incompatible
pointer type 'int (*)(struct device *, struct device_attribute *, char *)'
[-Werror=incompatible-pointer-types]
70 | static DEVICE_ATTR(bootcount,
S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, \
| ^~~~~
drivers/misc/uboot_bootcount.c:70:8: note: in expansion of macro 'DEVICE_ATTR'
70 | static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~
drivers/misc/uboot_bootcount.c:70:50: note: (near initialization for
'dev_attr_bootcount.show')
70 | static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~~~~~~~~
include/linux/sysfs.h:104:10: note: in definition of macro '__ATTR'
104 | .show = _show, \
| ^~~~~
drivers/misc/uboot_bootcount.c:70:8: note: in expansion of macro 'DEVICE_ATTR'
70 | static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~
> drivers/misc/uboot_bootcount.c:71:3: error: initialization of
'ssize_t (*)(struct device *, struct device_attribute *, const char *, size_t)'
{aka 'long int (*)(struct device *, struct device_attribute *, const char *, long
unsigned int)'} from incompatible pointer type 'int (*)(struct device *, struct
device_attribute *, const char *, size_t)' {aka 'int (*)(struct device *, struct
device_attribute *, const char *, long unsigned int)'}
[-Werror=incompatible-pointer-types]
71 | store_str_bootcount);
| ^~~~~~~~~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, \
| ^~~~~~
drivers/misc/uboot_bootcount.c:70:8: note: in expansion of macro 'DEVICE_ATTR'
70 | static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~
drivers/misc/uboot_bootcount.c:71:3: note: (near initialization for
'dev_attr_bootcount.store')
71 | store_str_bootcount);
| ^~~~~~~~~~~~~~~~~~~
include/linux/sysfs.h:105:11: note: in definition of macro '__ATTR'
105 | .store = _store, \
| ^~~~~~
drivers/misc/uboot_bootcount.c:70:8: note: in expansion of macro 'DEVICE_ATTR'
70 | static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO, show_str_bootcount,
| ^~~~~~~~~~~
cc1: some warnings being treated as errors
vim +70 drivers/misc/uboot_bootcount.c
17 #include <linux/miscdevice.h>
18 #include
<linux/module.h>
19 #include <linux/of.h>
20 #include <linux/of_address.h>
21 #include <linux/of_platform.h>
22
23 #define UBOOT_BOOTCOUNT_NAME "bootcount"
24
25 #define UBOOT_BOOTCOUNT_MAGIC_OFFSET 0x04 /* offset of magic number */
26 #define UBOOT_BOOTCOUNT_MAGIC 0xB001C041 /* magic number value */
27 #define UBOOT_BOOTCOUNT_MAGIC_MASK 0xFFFF0000 /* magic, when combined */
28 #define UBOOT_BOOTCOUNT_COUNT_MASK 0x0000FFFF /* value, when combined */
29
30 static void __iomem *mem;
31 /* Default to magic number being adjacent. */
32 static bool single_register = false;
33
34 /* Helper for the sysfs */
35 static int show_str_bootcount(struct device *device,
36 struct device_attribute *attr,
37 char *buf)
38 {
39 unsigned long counter;
40
41 counter = be32_to_cpu(readl(mem));
42
43 if (single_register)
44 counter &= UBOOT_BOOTCOUNT_COUNT_MASK;
45
46 return sprintf(buf, "%lu\n", counter);
47 }
48
49 static int store_str_bootcount(struct device *dev,
50 struct device_attribute *attr,
51 const char *buf,
52 size_t count)
53 {
54 int r;
55 u32 value;
56
57 r = kstrtou32(buf, 0, &value);
58 if (r < 0)
59 return -EINVAL;
60
61 if (single_register)
62 value = (UBOOT_BOOTCOUNT_MAGIC & UBOOT_BOOTCOUNT_MAGIC_MASK) |
63 (value & UBOOT_BOOTCOUNT_COUNT_MASK);
64
65 writel(cpu_to_be32(value), mem);
66
67 return count;
68 }
69
70 static DEVICE_ATTR(bootcount, S_IWUSR | S_IRUGO,
show_str_bootcount,
71 store_str_bootcount);
72
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org