Re: [PATCH 09/20] clocksource/drivers/vf-pit: Register the clocksource from the driver
From: Daniel Lezcano
Date: Sat Jul 26 2025 - 15:37:58 EST
On 07/07/2025 14:02, Ghennadi Procopciuc wrote:
On 7/5/2025 7:01 PM, Daniel Lezcano wrote:
[...]
+static u64 pit_timer_clocksource_read(struct clocksource *cs)
+{
+ struct pit_timer *pit = cs_to_pit(cs);
+
+ return ~(u64)readl(pit->clksrc_base + PITCVAL);
+}
The CVAL register is a 32-bit countdown timer. Casting its value to 64 bits before applying bitwise negation results in a 64-bit value where the upper 32 bits are always set. To avoid this, shouldn't the operations be reordered so that the bitwise negation is applied first to the 32-bit value, followed by casting the result to 64 bits?
Yes, that's right
Good catch !
Thanks
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog