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