Searched hist:"29 a8c9ec9090b335ece3bd58d779af7f569b5a65" (Results 1 – 1 of 1) sorted by relevance
/openbmc/linux/drivers/net/can/usb/ |
H A D | gs_usb.c | diff 29a8c9ec9090b335ece3bd58d779af7f569b5a65 Mon Sep 19 02:53:45 CDT 2022 Marc Kleine-Budde <mkl@pengutronix.de> can: gs_usb: add missing lock to protect struct timecounter::cycle_last
The struct timecounter::cycle_last is a 64 bit variable, read by timecounter_cyc2time(), and written by timecounter_read(). On 32 bit architectures this is not atomic.
Add a spinlock to protect access to struct timecounter::cycle_last. In the gs_usb_timestamp_read() callback the lock is dropped to execute a sleeping synchronous USB transfer. This is safe, as the variable we want to protect is accessed during this call.
Fixes: 45dfa45f52e6 ("can: gs_usb: add RX and TX hardware timestamp support") Link: https://lore.kernel.org/all/20220920100416.959226-3-mkl@pengutronix.de Cc: John Whittington <git@jbrengineering.co.uk> Tested-by: John Whittington <git@jbrengineering.co.uk> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
|