Re: [PATCH v1 3/3] RTC: nuvoton: Add NCT3018Y real time clock driver

From: kernel test robot
Date: Mon May 16 2022 - 19:09:05 EST


Hi Medad,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on robh/for-next v5.18-rc7]
[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/intel-lab-lkp/linux/commits/Medad-CChien/ARM-dts-nuvoton-Add-nuvoton-RTC3018Y-node/20220516-232940
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: i386-allyesconfig (https://download.01.org/0day-ci/archive/20220517/202205170654.jQqRSbra-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.2.0-20) 11.2.0
reproduce (this is a W=1 build):
# https://github.com/intel-lab-lkp/linux/commit/5c51862ee8030cfd9f2e955c10ee580f168663e3
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Medad-CChien/ARM-dts-nuvoton-Add-nuvoton-RTC3018Y-node/20220516-232940
git checkout 5c51862ee8030cfd9f2e955c10ee580f168663e3
# save the config file
mkdir build_dir && cp config build_dir/.config
make W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/rtc/

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

All warnings (new ones prefixed by >>):

drivers/rtc/rtc-nct3018y.c: In function 'nct3018y_rtc_read_time':
>> drivers/rtc/rtc-nct3018y.c:192:26: warning: unused variable 'nct3018y' [-Wunused-variable]
192 | struct nct3018y *nct3018y = i2c_get_clientdata(client);
| ^~~~~~~~
drivers/rtc/rtc-nct3018y.c: In function 'nct3018y_rtc_set_time':
drivers/rtc/rtc-nct3018y.c:227:26: warning: unused variable 'nct3018y' [-Wunused-variable]
227 | struct nct3018y *nct3018y = i2c_get_clientdata(client);
| ^~~~~~~~
drivers/rtc/rtc-nct3018y.c: In function 'nct3018y_rtc_set_alarm':
drivers/rtc/rtc-nct3018y.c:292:26: warning: unused variable 'nct3018y' [-Wunused-variable]
292 | struct nct3018y *nct3018y = i2c_get_clientdata(client);
| ^~~~~~~~
drivers/rtc/rtc-nct3018y.c: In function 'nct3018y_irq_enable':
drivers/rtc/rtc-nct3018y.c:322:26: warning: unused variable 'nct3018y' [-Wunused-variable]
322 | struct nct3018y *nct3018y = i2c_get_clientdata(client);
| ^~~~~~~~
In file included from include/linux/printk.h:555,
from include/linux/kernel.h:29,
from arch/x86/include/asm/percpu.h:27,
from arch/x86/include/asm/current.h:6,
from include/linux/mutex.h:14,
from include/linux/kernfs.h:11,
from include/linux/sysfs.h:16,
from include/linux/kobject.h:20,
from include/linux/of.h:17,
from include/linux/clk-provider.h:9,
from drivers/rtc/rtc-nct3018y.c:5:
drivers/rtc/rtc-nct3018y.c: In function 'nct3018y_probe':
drivers/rtc/rtc-nct3018y.c:513:39: warning: format '%d' expects argument of type 'int', but argument 5 has type 'long unsigned int' [-Wformat=]
513 | dev_dbg(&client->dev, "%s: NCT3018Y_BIT_TWO is :%d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dynamic_debug.h:134:29: note: in definition of macro '__dynamic_func_call'
134 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:166:9: note: in expansion of macro '_dynamic_func_call'
166 | _dynamic_func_call(fmt,__dynamic_dev_dbg, \
| ^~~~~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:9: note: in expansion of macro 'dynamic_dev_dbg'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~~~~~~~~~
include/linux/dev_printk.h:155:30: note: in expansion of macro 'dev_fmt'
155 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ^~~~~~~
drivers/rtc/rtc-nct3018y.c:513:17: note: in expansion of macro 'dev_dbg'
513 | dev_dbg(&client->dev, "%s: NCT3018Y_BIT_TWO is :%d\n",
| ^~~~~~~
drivers/rtc/rtc-nct3018y.c:513:66: note: format string is defined here
513 | dev_dbg(&client->dev, "%s: NCT3018Y_BIT_TWO is :%d\n",
| ~^
| |
| int
| %ld
drivers/rtc/rtc-nct3018y.c:535:22: error: 'struct rtc_device' has no member named 'uie_unsupported'
535 | nct3018y->rtc->uie_unsupported = 1;
| ^~
drivers/rtc/rtc-nct3018y.c:561:15: error: implicit declaration of function 'rtc_register_device'; did you mean 'i2c_unregister_device'? [-Werror=implicit-function-declaration]
561 | err = rtc_register_device(nct3018y->rtc);
| ^~~~~~~~~~~~~~~~~~~
| i2c_unregister_device
cc1: some warnings being treated as errors


vim +/nct3018y +192 drivers/rtc/rtc-nct3018y.c

184
185 /*
186 * In the routines that deal directly with the nct3018y hardware, we use
187 * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch.
188 */
189 static int nct3018y_rtc_read_time(struct device *dev, struct rtc_time *tm)
190 {
191 struct i2c_client *client = to_i2c_client(dev);
> 192 struct nct3018y *nct3018y = i2c_get_clientdata(client);
193 unsigned char buf[10];
194 int err;
195
196 err = nct3018y_read_block_data(client, NCT3018Y_REG_ST, 1, buf);
197 if (err)
198 return err;
199
200 if (!buf[0]) {
201 dev_err(&client->dev, " voltage <=1.7, date/time is not reliable.\n");
202 return -EINVAL;
203 }
204
205 err = nct3018y_read_block_data(client, NCT3018Y_REG_SC, 10, buf);
206 if (err)
207 return err;
208
209 tm->tm_sec = bcd2bin(buf[0] & 0x7F);
210 tm->tm_min = bcd2bin(buf[2] & 0x7F);
211 tm->tm_hour = bcd2bin(buf[4] & 0x3F); /* rtc hr 0-24 */
212 tm->tm_wday = buf[6] & 0x07;
213 tm->tm_mday = bcd2bin(buf[7] & 0x3F);
214 tm->tm_mon = bcd2bin(buf[8] & 0x1F) - 1 ; /* rtc mn 1-12 */
215 tm->tm_year = bcd2bin(buf[9]) + 100;
216
217 dev_dbg(&client->dev, "%s:s=%d, m=%d, hr=%d, md=%d, m=%d, yr=%d, wd=%d\n",
218 __func__, tm->tm_sec, tm->tm_min, tm->tm_hour, tm->tm_mday, tm->tm_mon,
219 tm->tm_year, tm->tm_wday);
220
221 return 0;
222 }
223

--
0-DAY CI Kernel Test Service
https://01.org/lkp