From: kernel test robot <lkp@intel.com>
To: jaap aarts <jaap.aarts1@gmail.com>,
Jean Delvare <jdelvare@suse.com>,
Guenter Roeck <linux@roeck-us.net>,
linux-hwmon@vger.kernel.org, linux-usb@vger.kernel.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
jaap aarts <jaap.aarts1@gmail.com>
Subject: Re: [PATCH V2] hwmon: add fan/pwm driver for corsair h100i platinum
Date: Sat, 18 Jul 2020 14:11:32 +0800 [thread overview]
Message-ID: <202007181443.EU7LejuZ%lkp@intel.com> (raw)
In-Reply-To: <20200717121642.41022-1-jaap.aarts1@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 12974 bytes --]
Hi jaap,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on hwmon/hwmon-next]
[also build test WARNING on v5.8-rc5 next-20200717]
[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/0day-ci/linux/commits/jaap-aarts/hwmon-add-fan-pwm-driver-for-corsair-h100i-platinum/20200717-201923
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: x86_64-allyesconfig (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project ed6b578040a85977026c93bf4188f996148f3218)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
>> drivers/hwmon/corsair_hydro_i_pro.c:175:5: warning: no previous prototype for function 'set_fan_pwm_curve' [-Wmissing-prototypes]
int set_fan_pwm_curve(struct hydro_i_pro_device *hdev,
^
drivers/hwmon/corsair_hydro_i_pro.c:175:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int set_fan_pwm_curve(struct hydro_i_pro_device *hdev,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:222:5: warning: no previous prototype for function 'set_fan_target_rpm' [-Wmissing-prototypes]
int set_fan_target_rpm(struct hydro_i_pro_device *hdev,
^
drivers/hwmon/corsair_hydro_i_pro.c:222:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int set_fan_target_rpm(struct hydro_i_pro_device *hdev,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:258:5: warning: no previous prototype for function 'get_fan_current_rpm' [-Wmissing-prototypes]
int get_fan_current_rpm(struct hydro_i_pro_device *hdev,
^
drivers/hwmon/corsair_hydro_i_pro.c:258:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int get_fan_current_rpm(struct hydro_i_pro_device *hdev,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:292:5: warning: no previous prototype for function 'set_fan_target_pwm' [-Wmissing-prototypes]
int set_fan_target_pwm(struct hydro_i_pro_device *hdev,
^
drivers/hwmon/corsair_hydro_i_pro.c:292:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int set_fan_target_pwm(struct hydro_i_pro_device *hdev,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:327:9: warning: no previous prototype for function 'hwmon_is_visible' [-Wmissing-prototypes]
umode_t hwmon_is_visible(const void *d, enum hwmon_sensor_types type, u32 attr,
^
drivers/hwmon/corsair_hydro_i_pro.c:327:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
umode_t hwmon_is_visible(const void *d, enum hwmon_sensor_types type, u32 attr,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:481:5: warning: no previous prototype for function 'hwmon_read' [-Wmissing-prototypes]
int hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
^
drivers/hwmon/corsair_hydro_i_pro.c:481:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:561:6: warning: no previous prototype for function 'does_fan_exist' [-Wmissing-prototypes]
bool does_fan_exist(struct hydro_i_pro_device *hdev, int channel)
^
drivers/hwmon/corsair_hydro_i_pro.c:561:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
bool does_fan_exist(struct hydro_i_pro_device *hdev, int channel)
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:589:5: warning: no previous prototype for function 'get_fan_count' [-Wmissing-prototypes]
int get_fan_count(struct hydro_i_pro_device *hdev)
^
drivers/hwmon/corsair_hydro_i_pro.c:589:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int get_fan_count(struct hydro_i_pro_device *hdev)
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:598:6: warning: no previous prototype for function 'hwmon_init' [-Wmissing-prototypes]
void hwmon_init(struct hydro_i_pro_device *hdev)
^
drivers/hwmon/corsair_hydro_i_pro.c:598:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void hwmon_init(struct hydro_i_pro_device *hdev)
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:671:5: warning: no previous prototype for function 'init_device' [-Wmissing-prototypes]
int init_device(struct usb_device *udev)
^
drivers/hwmon/corsair_hydro_i_pro.c:671:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int init_device(struct usb_device *udev)
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:688:5: warning: no previous prototype for function 'deinit_device' [-Wmissing-prototypes]
int deinit_device(struct usb_device *udev)
^
drivers/hwmon/corsair_hydro_i_pro.c:688:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int deinit_device(struct usb_device *udev)
^
static
>> drivers/hwmon/corsair_hydro_i_pro.c:166:19: warning: unused variable 'SUCCESS' [-Wunused-const-variable]
static const char SUCCESS[SUCCES_LENGTH - 1] = { 0x12, 0x34 };
^
12 warnings generated.
vim +/set_fan_pwm_curve +175 drivers/hwmon/corsair_hydro_i_pro.c
163
164 #define SUCCES_LENGTH 3
165 #define SUCCES_CODE (0x12, 0x34)
> 166 static const char SUCCESS[SUCCES_LENGTH - 1] = { 0x12, 0x34 };
167
168 static bool check_succes(enum opcodes command, char ret[SUCCES_LENGTH])
169 {
170 char success[SUCCES_LENGTH] = { command, SUCCES_CODE };
171
172 return strncmp(ret, success, SUCCES_LENGTH) == 0;
173 }
174
> 175 int set_fan_pwm_curve(struct hydro_i_pro_device *hdev,
176 struct hwmon_fan_data *fan_data,
177 struct curve_point point[7])
178 {
179 int retval;
180 int wrote;
181 int sndpipe = usb_sndbulkpipe(hdev->udev, hdev->bulk_out_endpointAddr);
182 int rcvpipe = usb_rcvbulkpipe(hdev->udev, hdev->bulk_in_endpointAddr);
183 unsigned char *send_buf = hdev->bulk_out_buffer;
184 unsigned char *recv_buf = hdev->bulk_in_buffer;
185
186 memcpy(fan_data->curve, point, sizeof(fan_data->curve));
187
188 send_buf[0] = PWM_FAN_CURVE_CMD;
189 send_buf[1] = fan_data->fan_channel;
190 send_buf[2] = point[0].temp;
191 send_buf[3] = point[1].temp;
192 send_buf[4] = point[2].temp;
193 send_buf[5] = point[3].temp;
194 send_buf[6] = point[4].temp;
195 send_buf[7] = point[5].temp;
196 send_buf[8] = point[6].temp;
197 send_buf[9] = point[0].pwm;
198 send_buf[10] = point[1].pwm;
199 send_buf[11] = point[2].pwm;
200 send_buf[12] = point[3].pwm;
201 send_buf[13] = point[4].pwm;
202 send_buf[14] = point[5].pwm;
203 send_buf[15] = point[6].pwm;
204
205 retval = usb_bulk_msg(hdev->udev, sndpipe, send_buf, 16, &wrote, 100);
206 if (retval != 0)
207 return retval;
208
209 retval = usb_bulk_msg(hdev->udev, rcvpipe, recv_buf, 4, &wrote, 100);
210 if (retval != 0)
211 return retval;
212
213 if (!check_succes(send_buf[0], recv_buf)) {
214 dev_info(&hdev->udev->dev,
215 "[*] failed setting fan curve %d,%d,%d/%d\n",
216 recv_buf[0], recv_buf[1], recv_buf[2], recv_buf[3]);
217 return -EINVAL;
218 }
219 return 0;
220 }
221
> 222 int set_fan_target_rpm(struct hydro_i_pro_device *hdev,
223 struct hwmon_fan_data *fan_data, long val)
224 {
225 int retval;
226 int wrote;
227 int sndpipe = usb_sndbulkpipe(hdev->udev, hdev->bulk_out_endpointAddr);
228 int rcvpipe = usb_rcvbulkpipe(hdev->udev, hdev->bulk_in_endpointAddr);
229
230 unsigned char *send_buf = hdev->bulk_out_buffer;
231 unsigned char *recv_buf = hdev->bulk_in_buffer;
232
233 fan_data->fan_target = val;
234 fan_data->fan_pwm_target = 0;
235
236 send_buf[0] = RPM_FAN_TARGET_CMD;
237 send_buf[1] = fan_data->fan_channel;
238 send_buf[2] = (fan_data->fan_target >> 8);
239 send_buf[3] = fan_data->fan_target;
240
241 retval = usb_bulk_msg(hdev->udev, sndpipe, send_buf, 4, &wrote, 100);
242 if (retval != 0)
243 return retval;
244
245 retval = usb_bulk_msg(hdev->udev, rcvpipe, recv_buf, 6, &wrote, 100);
246 if (retval != 0)
247 return retval;
248
249 if (!check_succes(send_buf[0], recv_buf)) {
250 dev_info(&hdev->udev->dev,
251 "[*] failed setting fan rpm %d,%d,%d/%d\n",
252 recv_buf[0], recv_buf[1], recv_buf[2], recv_buf[3]);
253 return -EINVAL;
254 }
255 return 0;
256 }
257
> 258 int get_fan_current_rpm(struct hydro_i_pro_device *hdev,
259 struct hwmon_fan_data *fan_data, long *val)
260 {
261 int retval;
262 int wrote;
263 int sndpipe = usb_sndbulkpipe(hdev->udev, hdev->bulk_out_endpointAddr);
264 int rcvpipe = usb_rcvbulkpipe(hdev->udev, hdev->bulk_in_endpointAddr);
265
266 unsigned char *send_buf = hdev->bulk_out_buffer;
267 unsigned char *recv_buf = hdev->bulk_in_buffer;
268
269 send_buf[0] = PWM_GET_CURRENT_CMD;
270 send_buf[1] = fan_data->fan_channel;
271
272 retval = usb_bulk_msg(hdev->udev, sndpipe, send_buf, 2, &wrote, 100);
273 if (retval != 0)
274 return retval;
275
276 retval = usb_bulk_msg(hdev->udev, rcvpipe, recv_buf, 6, &wrote, 100);
277 if (retval != 0)
278 return retval;
279
280 if (!check_succes(send_buf[0], recv_buf) ||
281 recv_buf[3] != fan_data->fan_channel) {
282 dev_info(&hdev->udev->dev,
283 "[*] failed retrieving fan rmp %d,%d,%d/%d\n",
284 recv_buf[0], recv_buf[1], recv_buf[2], recv_buf[3]);
285 return -EINVAL;
286 }
287
288 *val = ((recv_buf[4]) << 8) + recv_buf[5];
289 return 0;
290 }
291
> 292 int set_fan_target_pwm(struct hydro_i_pro_device *hdev,
293 struct hwmon_fan_data *fan_data, long val)
294 {
295 int retval;
296 int wrote;
297 int sndpipe = usb_sndbulkpipe(hdev->udev, hdev->bulk_out_endpointAddr);
298 int rcvpipe = usb_rcvbulkpipe(hdev->udev, hdev->bulk_in_endpointAddr);
299
300 unsigned char *send_buf = hdev->bulk_out_buffer;
301 unsigned char *recv_buf = hdev->bulk_in_buffer;
302
303 fan_data->fan_pwm_target = val;
304 fan_data->fan_target = 0;
305
306 send_buf[0] = PWM_FAN_TARGET_CMD;
307 send_buf[1] = fan_data->fan_channel;
308 send_buf[3] = fan_data->fan_pwm_target;
309
310 retval = usb_bulk_msg(hdev->udev, sndpipe, send_buf, 4, &wrote, 100);
311 if (retval != 0)
312 return retval;
313
314 retval = usb_bulk_msg(hdev->udev, rcvpipe, recv_buf, 6, &wrote, 100000);
315 if (retval != 0)
316 return retval;
317
318 if (!check_succes(send_buf[0], recv_buf)) {
319 dev_info(&hdev->udev->dev,
320 "[*] failed setting fan pwm %d,%d,%d/%d\n",
321 recv_buf[0], recv_buf[1], recv_buf[2], recv_buf[3]);
322 return -EINVAL;
323 }
324 return 0;
325 }
326
> 327 umode_t hwmon_is_visible(const void *d, enum hwmon_sensor_types type, u32 attr,
328 int channel)
329 {
330 switch (type) {
331 case hwmon_fan:
332 switch (attr) {
333 case hwmon_fan_input:
334 return 0444;
335 break;
336 case hwmon_fan_target:
337 return 0644;
338 break;
339 case hwmon_fan_min:
340 return 0444;
341 break;
342 default:
343 break;
344 }
345 break;
346 case hwmon_pwm:
347 switch (attr) {
348 case hwmon_pwm_input:
349 return 0200;
350 break;
351 case hwmon_pwm_enable:
352 return 0644;
353 break;
354 default:
355 break;
356 }
357 break;
358 default:
359 break;
360 }
361 return 0;
362 }
363
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 75375 bytes --]
next prev parent reply other threads:[~2020-07-18 7:01 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-17 12:16 [PATCH V2] hwmon: add fan/pwm driver for corsair h100i platinum jaap aarts
2020-07-17 21:41 ` kernel test robot
2020-07-17 23:15 ` Guenter Roeck
2020-07-18 9:33 ` jaap aarts
2020-07-18 15:10 ` Guenter Roeck
2020-07-18 19:51 ` jaap aarts
2020-07-21 10:10 ` jaap aarts
2020-07-18 6:11 ` kernel test robot [this message]
2020-07-19 0:30 ` kernel test robot
2020-07-19 9:38 ` jaap aarts
2020-07-22 8:16 ` Xia, Hui
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=202007181443.EU7LejuZ%lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=jaap.aarts1@gmail.com \
--cc=jdelvare@suse.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
/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).