Revert "hwmon: (max16065) Fix overflows seen when writing limits"

This reverts commit 177d70c1eb.
This commit is contained in:
Ksawlii 2024-11-24 00:23:27 +01:00
parent b4841d2300
commit 86504fcf57

View file

@ -114,10 +114,9 @@ static inline int LIMIT_TO_MV(int limit, int range)
return limit * range / 256;
}
static inline int MV_TO_LIMIT(unsigned long mv, int range)
static inline int MV_TO_LIMIT(int mv, int range)
{
mv = clamp_val(mv, 0, ULONG_MAX / 256);
return DIV_ROUND_CLOSEST(clamp_val(mv * 256, 0, range * 255), range);
return clamp_val(DIV_ROUND_CLOSEST(mv * 256, range), 0, 255);
}
static inline int ADC_TO_CURR(int adc, int gain)