diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2004-05-10 20:01:34 -0400 |
---|---|---|
committer | David S. Miller <davem@nuts.davemloft.net> | 2004-05-10 20:01:34 -0400 |
commit | 8fb892d48802abfdd082f00043d4c1c27b3c47f4 (patch) | |
tree | 41d22153bad79ea53d55e4c28f4627889cfdaff9 /sound | |
parent | 011fba7bca5108e12613915f46e43a45eb0ae9ca (diff) | |
download | history-8fb892d48802abfdd082f00043d4c1c27b3c47f4.tar.gz |
[sound/oss i810] remove divides on playback
This patch removes a couple of divides on the playback path.
Diffstat (limited to 'sound')
-rw-r--r-- | sound/oss/i810_audio.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c index cd2380b8fad22b..c76c1a19e8abae 100644 --- a/sound/oss/i810_audio.c +++ b/sound/oss/i810_audio.c @@ -99,6 +99,7 @@ #include <linux/spinlock.h> #include <linux/smp_lock.h> #include <linux/ac97_codec.h> +#include <linux/bitops.h> #include <asm/uaccess.h> #include <asm/hardirq.h> @@ -1000,6 +1001,7 @@ static int prog_dmabuf(struct i810_state *state, unsigned rec) dmabuf->numfrag = SG_LEN; dmabuf->fragsize = dmabuf->dmasize/dmabuf->numfrag; dmabuf->fragsamples = dmabuf->fragsize >> 1; + dmabuf->fragshift = ffs(dmabuf->fragsize) - 1; dmabuf->userfragsize = dmabuf->ossfragsize; dmabuf->userfrags = dmabuf->dmasize/dmabuf->ossfragsize; @@ -1007,16 +1009,12 @@ static int prog_dmabuf(struct i810_state *state, unsigned rec) if(dmabuf->ossmaxfrags == 4) { fragint = 8; - dmabuf->fragshift = 2; } else if (dmabuf->ossmaxfrags == 8) { fragint = 4; - dmabuf->fragshift = 3; } else if (dmabuf->ossmaxfrags == 16) { fragint = 2; - dmabuf->fragshift = 4; } else { fragint = 1; - dmabuf->fragshift = 5; } /* * Now set up the ring @@ -1113,7 +1111,7 @@ static void __i810_update_lvi(struct i810_state *state, int rec) /* MASKP2(swptr, fragsize) - 1 is the tail of our transfer */ x = MODULOP2(MASKP2(dmabuf->swptr, fragsize) - 1, dmabuf->dmasize); - x /= fragsize; + x >>= dmabuf->fragshift; outb(x, port + OFF_LVI); } @@ -1708,7 +1706,7 @@ static ssize_t i810_write(struct file *file, const char *buffer, size_t count, l goto ret; } - swptr = (swptr + cnt) % dmabuf->dmasize; + swptr = MODULOP2(swptr + cnt, dmabuf->dmasize); spin_lock_irqsave(&state->card->lock, flags); if (PM_SUSPENDED(card)) { |