]> git.ipfire.org Git - thirdparty/linux.git/commit
iio: adc: ad7625: fix type mismatch in clamp() macro
authorGiorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Sat, 25 Apr 2026 07:16:16 +0000 (11:16 +0400)
committerJonathan Cameron <jic23@kernel.org>
Sun, 31 May 2026 09:59:32 +0000 (10:59 +0100)
commitc09f950fd87ad6505cc7bdbac4e0a125b6ed313c
tree7c09fb7213b239b458341ba2693fbed543df3c87
parent74c3923344c6ad4b7199948d54dc947504c39483
iio: adc: ad7625: fix type mismatch in clamp() macro

clamp() expects compatible operand types. The period calculation uses
nanosecond constants, while the local target variable was narrower than
the upper bound expression.

Make target unsigned long and use unsigned long bounds, including
NSEC_PER_USEC for the upper limit. This keeps the operands naturally
aligned without adding casts.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Giorgi Tchankvetadze <giorgitchankvetadze1997@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/adc/ad7625.c