Re: [PATCH] rtc: rv3028: configure backup switch mode from device tree

kernel test robot <[email protected]>
Newsgroups dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel,org.kernel.vger.linux-rtc
Message-ID <[email protected]>
Hi Dhaval,

kernel test robot noticed the following build warnings:

[auto build test WARNING on abelloni/rtc-next]
[also build test WARNING on linus/master v7.2 next-20260821]
[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/Dhaval-Shiroya/rtc-rv3028-configure-backup-switch-mode-from-device-tree/20260822-145911
base:   https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
patch link:    https://lore.kernel.org/r/20260822092911.318342-1-dhaval.shiroya%40siliconsignals.io
patch subject: [PATCH] rtc: rv3028: configure backup switch mode from device tree
config: nios2-allmodconfig (https://download.01.org/0day-ci/archive/20260825/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 11.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260825/[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 warnings (new ones prefixed by >>):

   In file included from include/linux/device.h:15,
                    from include/linux/acpi.h:15,
                    from include/linux/i2c.h:13,
                    from drivers/rtc/rtc-rv3028.c:15:
   drivers/rtc/rtc-rv3028.c: In function 'rv3028_set_bsm_from_dt':
>> drivers/rtc/rtc-rv3028.c:906:18: warning: format '%x' expects argument of type 'unsigned int', but argument 5 has type 'long unsigned int' [-Wformat=]
     906 |                  "setting backup switch mode to %u (reg 0x37: 0x%02x -> 0x%02x)\n",
         |                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap'
     110 |                 _p_func(dev, fmt, ##__VA_ARGS__);                       \
         |                              ^~~
   include/linux/dev_printk.h:160:58: note: in expansion of macro 'dev_fmt'
     160 |         dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__)
         |                                                          ^~~~~~~
   drivers/rtc/rtc-rv3028.c:905:9: note: in expansion of macro 'dev_info'
     905 |         dev_info(&client->dev,
         |         ^~~~~~~~
   drivers/rtc/rtc-rv3028.c:906:78: note: format string is defined here
     906 |                  "setting backup switch mode to %u (reg 0x37: 0x%02x -> 0x%02x)\n",
         |                                                                           ~~~^
         |                                                                              |
         |                                                                              unsigned int
         |                                                                           %02lx


vim +906 drivers/rtc/rtc-rv3028.c

   857	
   858	/*
   859	 * Configure backup switchover mode from device tree.
   860	 *   0 = disabled
   861	 *   1 = DSM (Direct Switching Mode)  - switch when VDD < VBACKUP
   862	 *   3 = LSM (Level Switching Mode)   - switch when VDD < 2.0V
   863	 */
   864	static int rv3028_set_bsm_from_dt(struct rv3028_data *rv3028,
   865					  struct i2c_client *client)
   866	{
   867		u32 val_old, bsm_dt, bsm_bits;
   868		int ret;
   869	
   870		if (device_property_read_u32(&client->dev, "backup-switch-mode",
   871					     &bsm_dt))
   872			return 0;
   873	
   874		/* Validate and convert DT value to register bits */
   875		switch (bsm_dt) {
   876		case 0:
   877			bsm_bits = 0;
   878			break;
   879		case 1:
   880			bsm_bits = FIELD_PREP(RV3028_BACKUP_BSM, RV3028_BACKUP_BSM_DSM);
   881			break;
   882		case 3:
   883			bsm_bits = FIELD_PREP(RV3028_BACKUP_BSM, RV3028_BACKUP_BSM_LSM);
   884			break;
   885		default:
   886			dev_warn(&client->dev,
   887				 "invalid backup-switch-mode %u (use 0, 1, or 3)\n",
   888				 bsm_dt);
   889			return 0;
   890		}
   891	
   892		/* Read current BACKUP register */
   893		ret = regmap_read(rv3028->regmap, RV3028_BACKUP, &val_old);
   894		if (ret < 0)
   895			return ret;
   896	
   897		/* Check if BSM and FEDE already match desired values */
   898		if ((val_old & (RV3028_BACKUP_BSM | RV3028_BACKUP_FEDE)) ==
   899		    (bsm_bits | RV3028_BACKUP_FEDE)) {
   900			dev_dbg(&client->dev,
   901				"backup switch mode already set to %u\n", bsm_dt);
   902			return 0;
   903		}
   904	
   905		dev_info(&client->dev,
 > 906			 "setting backup switch mode to %u (reg 0x37: 0x%02x -> 0x%02x)\n",
   907			 bsm_dt, val_old,
   908			 (val_old & ~(RV3028_BACKUP_BSM | RV3028_BACKUP_FEDE)) |
   909			 bsm_bits | RV3028_BACKUP_FEDE);
   910	
   911		/* Set BSM and always enable FEDE as recommended by datasheet */
   912		return rv3028_update_cfg(rv3028, RV3028_BACKUP,
   913					 RV3028_BACKUP_BSM | RV3028_BACKUP_FEDE,
   914					 bsm_bits | RV3028_BACKUP_FEDE);
   915	}
   916	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.