aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOswald Buddenhagen <[email protected]>2023-05-14 19:03:23 +0200
committerTakashi Iwai <[email protected]>2023-05-15 22:00:56 +0200
commit2e9bd50f117ea3f638802627a196949f7eefcf02 (patch)
tree66aa59c2bcba9d538d055158119699d44a4b051d
parent2093dcfc04e1477efd47d3acf0adc4582dc5f4f6 (diff)
ALSA: emu10k1: optimize mask calculation in snd_emu10k1_ptr_read()
Unlike in snd_emu10k1_ptr_write(), we don't need to keep the value's bits in place, so we can save one shift. Signed-off-by: Oswald Buddenhagen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
-rw-r--r--sound/pci/emu10k1/io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index 2d6bbb77c961..59b0f4d08c6b 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -50,9 +50,9 @@ unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, un
size = (reg >> 24) & 0x3f;
offset = (reg >> 16) & 0x1f;
- mask = ((1 << size) - 1) << offset;
+ mask = (1 << size) - 1;
- return (val & mask) >> offset;
+ return (val >> offset) & mask;
} else {
return val;
}