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 13/14] drivers/platform/x86/siemens/simatic-ipc.c:132:42: warning: use of logical '||' with constant operand
Date: Mon, 31 Jul 2023 23:52:02 +0800 [thread overview]
Message-ID: <202307312322.Aa8upHWK-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: b8af77951941e943434a76ef40fdc372bf95030e [13/14] platform/x86/siemens: simatic-ipc: add new models BX-56A/BX-59A
config: i386-randconfig-i011-20230731 (https://download.01.org/0day-ci/archive/20230731/202307312322.Aa8upHWK-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/20230731/202307312322.Aa8upHWK-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/202307312322.Aa8upHWK-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/platform/x86/siemens/simatic-ipc.c:132:42: warning: use of logical '||' with constant operand [-Wconstant-logical-operand]
if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A)
^ ~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/platform/x86/siemens/simatic-ipc.c:132:42: note: use '|' for a bitwise operation
if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A)
^~
|
1 warning generated.
vim +132 drivers/platform/x86/siemens/simatic-ipc.c
88
89 static int register_platform_devices(u32 station_id)
90 {
91 u8 ledmode = SIMATIC_IPC_DEVICE_NONE;
92 u8 wdtmode = SIMATIC_IPC_DEVICE_NONE;
93 u8 battmode = SIMATIC_IPC_DEVICE_NONE;
94 char *pdevname;
95 int i;
96
97 for (i = 0; i < ARRAY_SIZE(device_modes); i++) {
98 if (device_modes[i].station_id == station_id) {
99 ledmode = device_modes[i].led_mode;
100 wdtmode = device_modes[i].wdt_mode;
101 battmode = device_modes[i].batt_mode;
102 break;
103 }
104 }
105
106 if (battmode != SIMATIC_IPC_DEVICE_NONE) {
107 pdevname = KBUILD_MODNAME "_batt";
108 if (battmode == SIMATIC_IPC_DEVICE_127E)
109 pdevname = KBUILD_MODNAME "_batt_apollolake";
110 if (battmode == SIMATIC_IPC_DEVICE_BX_21A)
111 pdevname = KBUILD_MODNAME "_batt_elkhartlake";
112 if (battmode == SIMATIC_IPC_DEVICE_227G ||
113 battmode == SIMATIC_IPC_DEVICE_BX_39A ||
114 battmode == SIMATIC_IPC_DEVICE_BX_59A)
115 pdevname = KBUILD_MODNAME "_batt_f7188x";
116 platform_data.devmode = battmode;
117 ipc_batt_platform_device =
118 platform_device_register_data(NULL, pdevname,
119 PLATFORM_DEVID_NONE, &platform_data,
120 sizeof(struct simatic_ipc_platform));
121 if (IS_ERR(ipc_batt_platform_device))
122 return PTR_ERR(ipc_batt_platform_device);
123
124 pr_debug("device=%s created\n",
125 ipc_batt_platform_device->name);
126 }
127
128 if (ledmode != SIMATIC_IPC_DEVICE_NONE) {
129 pdevname = KBUILD_MODNAME "_leds";
130 if (ledmode == SIMATIC_IPC_DEVICE_127E)
131 pdevname = KBUILD_MODNAME "_leds_gpio_apollolake";
> 132 if (ledmode == SIMATIC_IPC_DEVICE_227G || SIMATIC_IPC_DEVICE_BX_59A)
133 pdevname = KBUILD_MODNAME "_leds_gpio_f7188x";
134 if (ledmode == SIMATIC_IPC_DEVICE_BX_21A)
135 pdevname = KBUILD_MODNAME "_leds_gpio_elkhartlake";
136 platform_data.devmode = ledmode;
137 ipc_led_platform_device =
138 platform_device_register_data(NULL,
139 pdevname, PLATFORM_DEVID_NONE,
140 &platform_data,
141 sizeof(struct simatic_ipc_platform));
142 if (IS_ERR(ipc_led_platform_device))
143 return PTR_ERR(ipc_led_platform_device);
144
145 pr_debug("device=%s created\n",
146 ipc_led_platform_device->name);
147 }
148
149 if (wdtmode != SIMATIC_IPC_DEVICE_NONE) {
150 platform_data.devmode = wdtmode;
151 ipc_wdt_platform_device =
152 platform_device_register_data(NULL,
153 KBUILD_MODNAME "_wdt", PLATFORM_DEVID_NONE,
154 &platform_data,
155 sizeof(struct simatic_ipc_platform));
156 if (IS_ERR(ipc_wdt_platform_device))
157 return PTR_ERR(ipc_wdt_platform_device);
158
159 pr_debug("device=%s created\n",
160 ipc_wdt_platform_device->name);
161 }
162
163 if (ledmode == SIMATIC_IPC_DEVICE_NONE &&
164 wdtmode == SIMATIC_IPC_DEVICE_NONE &&
165 battmode == SIMATIC_IPC_DEVICE_NONE) {
166 pr_warn("unsupported IPC detected, station id=%08x\n",
167 station_id);
168 return -EINVAL;
169 }
170
171 return 0;
172 }
173
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
reply other threads:[~2023-07-31 15:52 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=202307312322.Aa8upHWK-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).