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

Pull hwmon fixes from Guenter Roeck:

- ltc2991, tmp513: Fix problems seen when dividing negative numbers

- drivetemp: Handle large timeouts observed on some drives

- acpi_power_meter: Fix loading the driver on platforms without _PMD
method

* tag 'hwmon-for-v6.13-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (ltc2991) Fix mixed signed/unsigned in DIV_ROUND_CLOSEST
hwmon: (drivetemp) Set scsi command timeout to 10s
hwmon: (acpi_power_meter) Fix a check for the return value of read_domain_devices().
hwmon: (tmp513) Fix division of negative numbers

Changed files
+7 -6
drivers
+1 -1
drivers/hwmon/acpi_power_meter.c
··· 682 683 /* _PMD method is optional. */ 684 res = read_domain_devices(resource); 685 - if (res != -ENODEV) 686 return res; 687 688 if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
··· 682 683 /* _PMD method is optional. */ 684 res = read_domain_devices(resource); 685 + if (res && res != -ENODEV) 686 return res; 687 688 if (resource->caps.flags & POWER_METER_CAN_MEASURE) {
+1 -1
drivers/hwmon/drivetemp.c
··· 194 scsi_cmd[14] = ata_command; 195 196 err = scsi_execute_cmd(st->sdev, scsi_cmd, op, st->smartdata, 197 - ATA_SECT_SIZE, HZ, 5, NULL); 198 if (err > 0) 199 err = -EIO; 200 return err;
··· 194 scsi_cmd[14] = ata_command; 195 196 err = scsi_execute_cmd(st->sdev, scsi_cmd, op, st->smartdata, 197 + ATA_SECT_SIZE, 10 * HZ, 5, NULL); 198 if (err > 0) 199 err = -EIO; 200 return err;
+1 -1
drivers/hwmon/ltc2991.c
··· 125 126 /* Vx-Vy, 19.075uV/LSB */ 127 *val = DIV_ROUND_CLOSEST(sign_extend32(reg_val, 14) * 19075, 128 - st->r_sense_uohm[channel]); 129 130 return 0; 131 }
··· 125 126 /* Vx-Vy, 19.075uV/LSB */ 127 *val = DIV_ROUND_CLOSEST(sign_extend32(reg_val, 14) * 19075, 128 + (s32)st->r_sense_uohm[channel]); 129 130 return 0; 131 }
+4 -3
drivers/hwmon/tmp513.c
··· 207 *val = sign_extend32(regval, 208 reg == TMP51X_SHUNT_CURRENT_RESULT ? 209 16 - tmp51x_get_pga_shift(data) : 15); 210 - *val = DIV_ROUND_CLOSEST(*val * 10 * MILLI, data->shunt_uohms); 211 break; 212 case TMP51X_BUS_VOLTAGE_RESULT: 213 case TMP51X_BUS_VOLTAGE_H_LIMIT: ··· 224 case TMP51X_BUS_CURRENT_RESULT: 225 // Current = (ShuntVoltage * CalibrationRegister) / 4096 226 *val = sign_extend32(regval, 15) * (long)data->curr_lsb_ua; 227 - *val = DIV_ROUND_CLOSEST(*val, MILLI); 228 break; 229 case TMP51X_LOCAL_TEMP_RESULT: 230 case TMP51X_REMOTE_TEMP_RESULT_1: ··· 264 * The user enter current value and we convert it to 265 * voltage. 1lsb = 10uV 266 */ 267 - val = DIV_ROUND_CLOSEST(val * data->shunt_uohms, 10 * MILLI); 268 max_val = U16_MAX >> tmp51x_get_pga_shift(data); 269 regval = clamp_val(val, -max_val, max_val); 270 break;
··· 207 *val = sign_extend32(regval, 208 reg == TMP51X_SHUNT_CURRENT_RESULT ? 209 16 - tmp51x_get_pga_shift(data) : 15); 210 + *val = DIV_ROUND_CLOSEST(*val * 10 * (long)MILLI, (long)data->shunt_uohms); 211 + 212 break; 213 case TMP51X_BUS_VOLTAGE_RESULT: 214 case TMP51X_BUS_VOLTAGE_H_LIMIT: ··· 223 case TMP51X_BUS_CURRENT_RESULT: 224 // Current = (ShuntVoltage * CalibrationRegister) / 4096 225 *val = sign_extend32(regval, 15) * (long)data->curr_lsb_ua; 226 + *val = DIV_ROUND_CLOSEST(*val, (long)MILLI); 227 break; 228 case TMP51X_LOCAL_TEMP_RESULT: 229 case TMP51X_REMOTE_TEMP_RESULT_1: ··· 263 * The user enter current value and we convert it to 264 * voltage. 1lsb = 10uV 265 */ 266 + val = DIV_ROUND_CLOSEST(val * (long)data->shunt_uohms, 10 * (long)MILLI); 267 max_val = U16_MAX >> tmp51x_get_pga_shift(data); 268 regval = clamp_val(val, -max_val, max_val); 269 break;