Skip to content

Commit

Permalink
ALSA: firewire-lib: use macro for maximum value of second in 1394 OHC…
Browse files Browse the repository at this point in the history
…I 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: Takashi Sakamoto <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
takaswie authored and tiwai committed May 8, 2020
1 parent 8304cf7 commit 10aa8e4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sound/firewire/amdtp-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
#define CYCLES_PER_SECOND 8000
#define TICKS_PER_SECOND (TICKS_PER_CYCLE * CYCLES_PER_SECOND)

#define OHCI_MAX_SECOND 8

/* Always support Linux tracing subsystem. */
#define CREATE_TRACE_POINTS
#include "amdtp-stream-trace.h"
Expand Down Expand Up @@ -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)
{
cycle += addend;
if (cycle >= 8 * CYCLES_PER_SECOND)
cycle -= 8 * CYCLES_PER_SECOND;
if (cycle >= OHCI_MAX_SECOND * CYCLES_PER_SECOND)
cycle -= OHCI_MAX_SECOND * CYCLES_PER_SECOND;
return cycle;
}

Expand Down

0 comments on commit 10aa8e4

Please sign in to comment.