All of lore.kernel.org
 help / color / mirror / Atom feed
* [pdx86-platform-drivers-x86:platform-drivers-x86-simatic-ipc 14/14] drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: warning: use of logical '||' with constant operand
@ 2023-07-31 16:32 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-07-31 16:32 UTC (permalink / raw)
  To: xingtong.wu; +Cc: llvm, oe-kbuild-all, Andy Shevchenko, Hans de Goede

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git platform-drivers-x86-simatic-ipc
head:   c56beff2037549c951042d178de75e535818a98a
commit: c56beff2037549c951042d178de75e535818a98a [14/14] platform/x86/siemens: simatic-ipc-batt: add support for module BX-59A
config: i386-randconfig-i011-20230731 (https://download.01.org/0day-ci/archive/20230801/202308010001.BGYCSQrl-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce: (https://download.01.org/0day-ci/archive/20230801/202308010001.BGYCSQrl-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308010001.BGYCSQrl-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
                   if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A)
                                                                 ^  ~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: note: use '|' for a bitwise operation
                   if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A)
                                                                 ^~
                                                                 |
   1 warning generated.


vim +197 drivers/platform/x86/siemens/simatic-ipc-batt.c

   155	
   156	int simatic_ipc_batt_probe(struct platform_device *pdev, struct gpiod_lookup_table *table)
   157	{
   158		struct simatic_ipc_platform *plat;
   159		struct device *dev = &pdev->dev;
   160		struct device *hwmon_dev;
   161		unsigned long flags;
   162		int err;
   163	
   164		plat = pdev->dev.platform_data;
   165		priv.devmode = plat->devmode;
   166	
   167		switch (priv.devmode) {
   168		case SIMATIC_IPC_DEVICE_127E:
   169		case SIMATIC_IPC_DEVICE_227G:
   170		case SIMATIC_IPC_DEVICE_BX_39A:
   171		case SIMATIC_IPC_DEVICE_BX_21A:
   172		case SIMATIC_IPC_DEVICE_BX_59A:
   173			table->dev_id = dev_name(dev);
   174			gpiod_add_lookup_table(table);
   175			break;
   176		case SIMATIC_IPC_DEVICE_227E:
   177			goto nogpio;
   178		default:
   179			return -ENODEV;
   180		}
   181	
   182		priv.gpios[0] = devm_gpiod_get_index(dev, "CMOSBattery empty", 0, GPIOD_IN);
   183		if (IS_ERR(priv.gpios[0])) {
   184			err = PTR_ERR(priv.gpios[0]);
   185			priv.gpios[0] = NULL;
   186			goto out;
   187		}
   188		priv.gpios[1] = devm_gpiod_get_index(dev, "CMOSBattery low", 1, GPIOD_IN);
   189		if (IS_ERR(priv.gpios[1])) {
   190			err = PTR_ERR(priv.gpios[1]);
   191			priv.gpios[1] = NULL;
   192			goto out;
   193		}
   194	
   195		if (table->table[2].key) {
   196			flags = GPIOD_OUT_HIGH;
 > 197			if (priv.devmode == SIMATIC_IPC_DEVICE_BX_21A || SIMATIC_IPC_DEVICE_BX_59A)
   198				flags = GPIOD_OUT_LOW;
   199			priv.gpios[2] = devm_gpiod_get_index(dev, "CMOSBattery meter", 2, flags);
   200			if (IS_ERR(priv.gpios[2])) {
   201				err = PTR_ERR(priv.gpios[1]);
   202				priv.gpios[2] = NULL;
   203				goto out;
   204			}
   205		} else {
   206			priv.gpios[2] = NULL;
   207		}
   208	
   209	nogpio:
   210		hwmon_dev = devm_hwmon_device_register_with_info(dev, KBUILD_MODNAME,
   211								 &priv,
   212								 &simatic_ipc_batt_chip_info,
   213								 NULL);
   214		if (IS_ERR(hwmon_dev)) {
   215			err = PTR_ERR(hwmon_dev);
   216			goto out;
   217		}
   218	
   219		/* warn about aging battery even if userspace never reads hwmon */
   220		simatic_ipc_batt_read_value(dev);
   221	
   222		return 0;
   223	out:
   224		simatic_ipc_batt_remove(pdev, table);
   225	
   226		return err;
   227	}
   228	EXPORT_SYMBOL_GPL(simatic_ipc_batt_probe);
   229	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-07-31 16:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-31 16:32 [pdx86-platform-drivers-x86:platform-drivers-x86-simatic-ipc 14/14] drivers/platform/x86/siemens/simatic-ipc-batt.c:197:49: warning: use of logical '||' with constant operand kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.