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-dri...
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(a)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