From: kernel test robot <lkp@intel.com>
To: "xingtong.wu" <xingtong.wu@siemens.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Hans de Goede <hdegoede@redhat.com>
Subject: [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
Date: Tue, 1 Aug 2023 00:32:44 +0800 [thread overview]
Message-ID: <202308010001.BGYCSQrl-lkp@intel.com> (raw)
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
reply other threads:[~2023-07-31 16:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202308010001.BGYCSQrl-lkp@intel.com \
--to=lkp@intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=xingtong.wu@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.