Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'hwmon-for-v6.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging

Pull hwmon fixes from Guenter Roeck:

- corsair-cpro: Validate the size of the received input buffer

- ina238: Report energy in microjoules as expected by the ABI

- pmbus/ucd9000: Fixed GPIO functionality

* tag 'hwmon-for-v6.16-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (pmbus/ucd9000) Fix error in ucd9000_gpio_set
hwmon: (ina238) Report energy in microjoules
hwmon: (corsair-cpro) Validate the size of the received input buffer

+14 -9
+1 -1
Documentation/hwmon/ina238.rst
··· 65 65 ------------------------------------ 66 66 67 67 ======================= ======================================================= 68 - energy1_input Energy measurement (mJ) 68 + energy1_input Energy measurement (uJ) 69 69 70 70 power1_input_highest Peak Power (uW) 71 71 ======================= =======================================================
+5
drivers/hwmon/corsair-cpro.c
··· 89 89 struct mutex mutex; /* whenever buffer is used, lock before send_usb_cmd */ 90 90 u8 *cmd_buffer; 91 91 u8 *buffer; 92 + int buffer_recv_size; /* number of received bytes in buffer */ 92 93 int target[6]; 93 94 DECLARE_BITMAP(temp_cnct, NUM_TEMP_SENSORS); 94 95 DECLARE_BITMAP(fan_cnct, NUM_FANS); ··· 147 146 if (!t) 148 147 return -ETIMEDOUT; 149 148 149 + if (ccp->buffer_recv_size != IN_BUFFER_SIZE) 150 + return -EPROTO; 151 + 150 152 return ccp_get_errno(ccp); 151 153 } 152 154 ··· 161 157 spin_lock(&ccp->wait_input_report_lock); 162 158 if (!completion_done(&ccp->wait_input_report)) { 163 159 memcpy(ccp->buffer, data, min(IN_BUFFER_SIZE, size)); 160 + ccp->buffer_recv_size = size; 164 161 complete_all(&ccp->wait_input_report); 165 162 } 166 163 spin_unlock(&ccp->wait_input_report_lock);
+4 -4
drivers/hwmon/ina238.c
··· 97 97 * Power (mW) = 0.2 * register value * 20000 / rshunt / 4 * gain 98 98 * (Specific for SQ52206) 99 99 * Power (mW) = 0.24 * register value * 20000 / rshunt / 4 * gain 100 - * Energy (mJ) = 16 * 0.24 * register value * 20000 / rshunt / 4 * gain 100 + * Energy (uJ) = 16 * 0.24 * register value * 20000 / rshunt / 4 * gain * 1000 101 101 */ 102 102 #define INA238_CALIBRATION_VALUE 16384 103 103 #define INA238_FIXED_SHUNT 20000 ··· 500 500 if (ret) 501 501 return ret; 502 502 503 - /* result in mJ */ 504 - energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 * 505 - data->config->power_calculate_factor, 4 * 100 * data->rshunt); 503 + /* result in uJ */ 504 + energy = div_u64(regval * INA238_FIXED_SHUNT * data->gain * 16 * 10 * 505 + data->config->power_calculate_factor, 4 * data->rshunt); 506 506 507 507 return sysfs_emit(buf, "%llu\n", energy); 508 508 }
+4 -4
drivers/hwmon/pmbus/ucd9000.c
··· 226 226 } 227 227 228 228 if (value) { 229 - if (ret & UCD9000_GPIO_CONFIG_STATUS) 229 + if (ret & UCD9000_GPIO_CONFIG_OUT_VALUE) 230 230 return 0; 231 231 232 - ret |= UCD9000_GPIO_CONFIG_STATUS; 232 + ret |= UCD9000_GPIO_CONFIG_OUT_VALUE; 233 233 } else { 234 - if (!(ret & UCD9000_GPIO_CONFIG_STATUS)) 234 + if (!(ret & UCD9000_GPIO_CONFIG_OUT_VALUE)) 235 235 return 0; 236 236 237 - ret &= ~UCD9000_GPIO_CONFIG_STATUS; 237 + ret &= ~UCD9000_GPIO_CONFIG_OUT_VALUE; 238 238 } 239 239 240 240 ret |= UCD9000_GPIO_CONFIG_ENABLE;