Re: [PATCH V2] hwmon: add fan/pwm driver for corsair h100i platinum

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: h8300-allyesconfig (attached as .config)
compiler: h8300-linux-gcc (GCC) 9.3.0
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
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=h8300 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

   drivers/hwmon/corsair_hydro_i_pro.c: In function 'check_succes':
   drivers/hwmon/corsair_hydro_i_pro.c:165:26: warning: left-hand operand of comma expression has no effect [-Wunused-value]
     165 | #define SUCCES_CODE (0x12, 0x34)
         |                          ^
   drivers/hwmon/corsair_hydro_i_pro.c:170:43: note: in expansion of macro 'SUCCES_CODE'
     170 |  char success[SUCCES_LENGTH] = { command, SUCCES_CODE };
         |                                           ^~~~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c: At top level:
>> drivers/hwmon/corsair_hydro_i_pro.c:175:5: warning: no previous prototype for 'set_fan_pwm_curve' [-Wmissing-prototypes]
     175 | int set_fan_pwm_curve(struct hydro_i_pro_device *hdev,
         |     ^~~~~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:222:5: warning: no previous prototype for 'set_fan_target_rpm' [-Wmissing-prototypes]
     222 | int set_fan_target_rpm(struct hydro_i_pro_device *hdev,
         |     ^~~~~~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:258:5: warning: no previous prototype for 'get_fan_current_rpm' [-Wmissing-prototypes]
     258 | int get_fan_current_rpm(struct hydro_i_pro_device *hdev,
         |     ^~~~~~~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:292:5: warning: no previous prototype for 'set_fan_target_pwm' [-Wmissing-prototypes]
     292 | int set_fan_target_pwm(struct hydro_i_pro_device *hdev,
         |     ^~~~~~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:327:9: warning: no previous prototype for 'hwmon_is_visible' [-Wmissing-prototypes]
     327 | umode_t hwmon_is_visible(const void *d, enum hwmon_sensor_types type, u32 attr,
         |         ^~~~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:481:5: warning: no previous prototype for 'hwmon_read' [-Wmissing-prototypes]
     481 | int hwmon_read(struct device *dev, enum hwmon_sensor_types type, u32 attr,
         |     ^~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:561:6: warning: no previous prototype for 'does_fan_exist' [-Wmissing-prototypes]
     561 | bool does_fan_exist(struct hydro_i_pro_device *hdev, int channel)
         |      ^~~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:589:5: warning: no previous prototype for 'get_fan_count' [-Wmissing-prototypes]
     589 | int get_fan_count(struct hydro_i_pro_device *hdev)
         |     ^~~~~~~~~~~~~
>> drivers/hwmon/corsair_hydro_i_pro.c:598:6: warning: no previous prototype for 'hwmon_init' [-Wmissing-prototypes]
     598 | void hwmon_init(struct hydro_i_pro_device *hdev)
         |      ^~~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c: In function 'hwmon_init':
>> drivers/hwmon/corsair_hydro_i_pro.c:601:17: warning: variable 'hwmon_dev' set but not used [-Wunused-but-set-variable]
     601 |  struct device *hwmon_dev;
         |                 ^~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c: At top level:
>> drivers/hwmon/corsair_hydro_i_pro.c:671:5: warning: no previous prototype for 'init_device' [-Wmissing-prototypes]
     671 | int init_device(struct usb_device *udev)
         |     ^~~~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c: In function 'init_device':
>> drivers/hwmon/corsair_hydro_i_pro.c:681:3: warning: suggest braces around empty body in an 'if' statement [-Wempty-body]
     681 |   ;
         |   ^
   drivers/hwmon/corsair_hydro_i_pro.c: At top level:
>> drivers/hwmon/corsair_hydro_i_pro.c:688:5: warning: no previous prototype for 'deinit_device' [-Wmissing-prototypes]
     688 | int deinit_device(struct usb_device *udev)
         |     ^~~~~~~~~~~~~
   drivers/hwmon/corsair_hydro_i_pro.c:166:19: warning: 'SUCCESS' defined but not used [-Wunused-const-variable=]
     166 | static const char SUCCESS[SUCCES_LENGTH - 1] = { 0x12, 0x34 };
         |                   ^~~~~~~

vim +/set_fan_pwm_curve +175 drivers/hwmon/corsair_hydro_i_pro.c

   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@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux