Commit 10aa8e4a authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: firewire-lib: use macro for maximum value of second in 1394 OHCI isoc descriptor

In descriptor of isochronous context in 1394 OHCI, the field of second
has 3 bit, thus the maximum value is 8. The value is used for correct
cycle calculation.

This commit replaces hard-coded value with macro to obsolete magic
number.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20200508043635.349339-3-o-takashi@sakamocchi.jpSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 8304cf77
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
#define CYCLES_PER_SECOND 8000 #define CYCLES_PER_SECOND 8000
#define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND) #define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND)
#define OHCI_MAX_SECOND 8
/* Always support Linux tracing subsystem. */ /* Always support Linux tracing subsystem. */
#define CREATE_TRACE_POINTS #define CREATE_TRACE_POINTS
#include "amdtp-stream-trace.h" #include "amdtp-stream-trace.h"
...@@ -680,8 +682,8 @@ static inline u32 compute_cycle_count(__be32 ctx_header_tstamp) ...@@ -680,8 +682,8 @@ static inline u32 compute_cycle_count(__be32 ctx_header_tstamp)
static inline u32 increment_cycle_count(u32 cycle, unsigned int addend) static inline u32 increment_cycle_count(u32 cycle, unsigned int addend)
{ {
cycle += addend; cycle += addend;
if (cycle >= 8 * CYCLES_PER_SECOND) if (cycle >= OHCI_MAX_SECOND * CYCLES_PER_SECOND)
cycle -= 8 * CYCLES_PER_SECOND; cycle -= OHCI_MAX_SECOND * CYCLES_PER_SECOND;
return cycle; return cycle;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment