linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Herbert Xu <herbert@gondor.apana.org.au>
To: Jeff Garzik <jgarzik@pobox.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [I810_AUDIO] 8/x: Remove divides on playback
Date: Sun, 23 Nov 2003 10:53:23 +1100	[thread overview]
Message-ID: <20031122235323.GA9326@gondor.apana.org.au> (raw)
In-Reply-To: <20031122235101.GA9276@gondor.apana.org.au>

[-- Attachment #1: Type: text/plain, Size: 285 bytes --]

This patch removes a couple of divides on the playback path.
-- 
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email:  Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

[-- Attachment #2: p8 --]
[-- Type: text/plain, Size: 1739 bytes --]

Index: kernel-source-2.4/drivers/sound/i810_audio.c
===================================================================
RCS file: /home/gondolin/herbert/src/CVS/debian/kernel-source-2.4/drivers/sound/i810_audio.c,v
retrieving revision 1.15
diff -u -r1.15 i810_audio.c
--- kernel-source-2.4/drivers/sound/i810_audio.c	22 Nov 2003 23:51:09 -0000	1.15
+++ kernel-source-2.4/drivers/sound/i810_audio.c	22 Nov 2003 23:51:29 -0000
@@ -100,6 +100,7 @@
 #include <linux/smp_lock.h>
 #include <linux/ac97_codec.h>
 #include <linux/wrapper.h>
+#include <linux/bitops.h>
 #include <asm/uaccess.h>
 #include <asm/hardirq.h>
 
@@ -990,6 +991,7 @@
 	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;
 
@@ -997,16 +999,12 @@
 
 	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 
@@ -1103,7 +1101,7 @@
 
 	/* 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);
 }
 
@@ -1697,7 +1695,7 @@
 			goto ret;
 		}
 
-		swptr = (swptr + cnt) % dmabuf->dmasize;
+		swptr = MODULOP2(swptr + cnt, dmabuf->dmasize);
 
 		spin_lock_irqsave(&state->card->lock, flags);
                 if (PM_SUSPENDED(card)) {

  reply	other threads:[~2003-11-22 23:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-22  7:09 [I810_AUDIO] 1/x: Fix wait queue race in drain_dac Herbert Xu
2003-11-22  7:13 ` [I810_AUDIO] 2/x: " Herbert Xu
2003-11-22  7:19   ` [I810_AUDIO] 3/x: Remove bogus CIV_TO_LVI Herbert Xu
2003-11-22  8:22     ` [I810_AUDIO] 4/x: Clean up with macros Herbert Xu
2003-11-22  8:26       ` [I810_AUDIO] 5/x: Fixed partial DMA transfers Herbert Xu
2003-11-22  8:39         ` Herbert Xu
2003-11-22 23:51           ` [I810_AUDIO] 7/x: Fix OSS fragments Herbert Xu
2003-11-22 23:53             ` Herbert Xu [this message]
2003-11-23  0:02               ` [I810_AUDIO] 9/x: Fix drain_dac loop when signals_allowed == 0 Herbert Xu
2003-11-23 11:04                 ` [I810_AUDIO] 10/x: Fix reads/writes % 4 != 0 Herbert Xu
2004-01-17  3:58                   ` [I810_AUDIO] 11/x: Fix dead lock in drain_dac Herbert Xu
2004-01-11 21:04   ` [I810_AUDIO] 2/x: Fix wait queue race " Jeff Garzik
2003-12-18  7:23 ` [I810_AUDIO] 1/x: " Jeff Garzik
2004-01-11 21:00 ` Jeff Garzik
2004-01-12  9:46   ` Herbert Xu
2004-01-12 21:48     ` Jeff Garzik
2004-01-12 22:26       ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20031122235323.GA9326@gondor.apana.org.au \
    --to=herbert@gondor.apana.org.au \
    --cc=jgarzik@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).