In the unlikely event that card->driver->get_bus_time() is called during
a cycle64Seconds interrupt, we could read garbage unless atomic accesses
are used.
The switch to atomic ops requires to change the 64 seconds counter from
unsigned to signed, but this shouldn't matter to the end result.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
#include <linux/pci.h>
#include <linux/spinlock.h>
+#include <asm/atomic.h>
#include <asm/page.h>
#include <asm/system.h>
int node_id;
int generation;
int request_generation; /* for timestamping incoming requests */
- u32 bus_seconds;
+ atomic_t bus_seconds;
bool use_dualbuffer;
bool old_uninorth;
if (event & OHCI1394_cycle64Seconds) {
cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
if ((cycle_time & 0x80000000) == 0)
- ohci->bus_seconds++;
+ atomic_inc(&ohci->bus_seconds);
}
return IRQ_HANDLED;
u64 bus_time;
cycle_time = reg_read(ohci, OHCI1394_IsochronousCycleTimer);
- bus_time = ((u64) ohci->bus_seconds << 32) | cycle_time;
+ bus_time = ((u64)atomic_read(&ohci->bus_seconds) << 32) | cycle_time;
return bus_time;
}