drivers/pwm/pwm-rcar.c:114:19: error: implicit declaration of function 'FIELD_MAX'
kernel test robot
build bottree: https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next head: 4fe924e43a5aabe586ab696651c483c25a8a3abb commit: edd549f4956be84ebd6a3900975544adeb0f3b50 [17/18] pwm: rcar: Improve register calculation config: arc-randconfig-002-20250403 (https://download.01.org/0day-ci/archive/20250403/[email protected]/config) compiler: arc-linux-gcc (GCC) 12.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250403/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All errors (new ones prefixed by >>):
drivers/pwm/pwm-rcar.c: In function 'rcar_pwm_set_counter':
>> drivers/pwm/pwm-rcar.c:114:19: error: implicit declaration of function 'FIELD_MAX' [-Werror=implicit-function-declaration]
114 | if (tmp > FIELD_MAX(RCAR_PWMCNT_CYC0_MASK))
| ^~~~~~~~~
>> drivers/pwm/pwm-rcar.c:117:15: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]
117 | cyc = FIELD_PREP(RCAR_PWMCNT_CYC0_MASK, tmp);
| ^~~~~~~~~~cc1: some warnings being treated as errors
vim +/FIELD_MAX +114 drivers/pwm/pwm-rcar.c
104
105 static int rcar_pwm_set_counter(struct rcar_pwm_chip *rp, int div, u64 duty_ns,
106 u64 period_ns)
107 {
108 unsigned long long tmp;
109 unsigned long clk_rate = clk_get_rate(rp->clk);
110 u32 cyc, ph;
111
112 /* div <= 24 == RCAR_PWM_MAX_DIVISION, so the shift doesn't overflow. */
113 tmp = mul_u64_u64_div_u64(period_ns, clk_rate, (u64)NSEC_PER_SEC << div);
> 114 if (tmp > FIELD_MAX(RCAR_PWMCNT_CYC0_MASK)) 115 tmp = FIELD_MAX(RCAR_PWMCNT_CYC0_MASK); 116 > 117 cyc = FIELD_PREP(RCAR_PWMCNT_CYC0_MASK, tmp);
118
119 tmp = mul_u64_u64_div_u64(duty_ns, clk_rate, (u64)NSEC_PER_SEC << div);
120 if (tmp > FIELD_MAX(RCAR_PWMCNT_PH0_MASK))
121 tmp = FIELD_MAX(RCAR_PWMCNT_PH0_MASK);
122 ph = FIELD_PREP(RCAR_PWMCNT_PH0_MASK, tmp);
123
124 /* Avoid prohibited setting */
125 if (cyc == 0 || ph == 0)
126 return -EINVAL;
127
128 rcar_pwm_write(rp, cyc | ph, RCAR_PWMCNT);
129
130 return 0;
131 }
132
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Hello,
Quoted 14 lines · kernel test robot
tree: https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next head: 4fe924e43a5aabe586ab696651c483c25a8a3abb commit: edd549f4956be84ebd6a3900975544adeb0f3b50 [17/18] pwm: rcar: Improve register calculation config: arc-randconfig-002-20250403 (https://download.01.org/0day-ci/archive/20250403/[email protected]/config) compiler: arc-linux-gcc (GCC) 12.4.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250403/[email protected]/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 <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/All errors (new ones prefixed by >>):
Quoted 8 lines
drivers/pwm/pwm-rcar.c: In function 'rcar_pwm_set_counter':Quoted 1 line
Quoted 1 line
drivers/pwm/pwm-rcar.c:114:19: error: implicit declaration of function 'FIELD_MAX' [-Werror=implicit-function-declaration]114 | if (tmp >
FIELD_MAX(RCAR_PWMCNT_CYC0_MASK))
| ^~~~~~~~~Quoted 1 line
Quoted 1 line
drivers/pwm/pwm-rcar.c:117:15: error: implicit declaration of function 'FIELD_PREP' [-Werror=implicit-function-declaration]117 | cyc = FIELD_PREP(RCAR_PWMCNT_CYC0_MASK, tmp); | ^~~~~~~~~~cc1: some warnings being treated as errors
Thanks, I added an explicit #include <linux/bitfield.h> to the driver to address this. This isn't needed on ARCH=arm because somewhere in the #include jungle (here: arch/arm/include/asm/ptrace.h) this header is pulled in..
Best regards
Uwe