public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] es1370 fix
@ 2002-02-14 15:17 Gerd Knorr
  2002-02-14 17:27 ` Thomas Sailer
  2002-02-16  9:31 ` [PATCH] 2.4.18-rc1 " Pierre Rousselet
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Knorr @ 2002-02-14 15:17 UTC (permalink / raw)
  To: Linus Torvalds, Kernel List

  Hi,

This patch fixes the es1370 driver (the virt_to_bus thing).

  Gerd

----------------------------- cut here --------------------------
--- linux-2.5.5-pre1/sound/oss/es1370.c	Thu Feb 14 15:57:34 2002
+++ linux/sound/oss/es1370.c	Thu Feb 14 16:03:43 2002
@@ -374,6 +374,10 @@
 		unsigned subdivision;
 	} dma_dac1, dma_dac2, dma_adc;
 
+	/* The following buffer is used to point the phantom write channel to. */
+	unsigned char *bugbuf_cpu;
+	dma_addr_t bugbuf_dma;
+
 	/* midi stuff */
 	struct {
 		unsigned ird, iwr, icnt;
@@ -392,13 +396,6 @@
 
 static LIST_HEAD(devs);
 
-/*
- * The following buffer is used to point the phantom write channel to,
- * so that it cannot wreak havoc. The attribute makes sure it doesn't
- * cross a page boundary and ensures dword alignment for the DMA engine
- */
-static unsigned char bugbuf[16] __attribute__ ((aligned (16)));
-
 /* --------------------------------------------------------------------- */
 
 static inline unsigned ld2(unsigned int x)
@@ -2653,8 +2650,9 @@
 	outl(s->ctrl, s->io+ES1370_REG_CONTROL);
 	outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
 	/* point phantom write channel to "bugbuf" */
+	s->bugbuf_cpu = pci_alloc_consistent(pcidev,16,&s->bugbuf_dma);
 	outl((ES1370_REG_PHANTOM_FRAMEADR >> 8) & 15, s->io+ES1370_REG_MEMPAGE);
-	outl(virt_to_bus(bugbuf), s->io+(ES1370_REG_PHANTOM_FRAMEADR & 0xff));
+	outl(s->bugbuf_dma, s->io+(ES1370_REG_PHANTOM_FRAMEADR & 0xff));
 	outl(0, s->io+(ES1370_REG_PHANTOM_FRAMECNT & 0xff));
 	pci_set_master(pcidev);  /* enable bus mastering */
 	wrcodec(s, 0x16, 3); /* no RST, PD */
@@ -2721,6 +2719,7 @@
 	unregister_sound_mixer(s->dev_mixer);
 	unregister_sound_dsp(s->dev_dac);
 	unregister_sound_midi(s->dev_midi);
+	pci_free_consistent(dev, 16, s->bugbuf_cpu, s->bugbuf_dma);
 	kfree(s);
 	pci_set_drvdata(dev, NULL);
 }

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] es1370 fix
  2002-02-14 15:17 [PATCH] es1370 fix Gerd Knorr
@ 2002-02-14 17:27 ` Thomas Sailer
  2002-02-16  9:31 ` [PATCH] 2.4.18-rc1 " Pierre Rousselet
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Sailer @ 2002-02-14 17:27 UTC (permalink / raw)
  To: Gerd Knorr; +Cc: Linus Torvalds, Kernel List

Gerd Knorr wrote:
> 
>   Hi,
> 
> This patch fixes the es1370 driver (the virt_to_bus thing).

Bugbuf could be shared among all cards in the system...
Otherwise looks correct

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] 2.4.18-rc1 es1370 fix
  2002-02-14 15:17 [PATCH] es1370 fix Gerd Knorr
  2002-02-14 17:27 ` Thomas Sailer
@ 2002-02-16  9:31 ` Pierre Rousselet
  1 sibling, 0 replies; 3+ messages in thread
From: Pierre Rousselet @ 2002-02-16  9:31 UTC (permalink / raw)
  To: Gerd Knorr; +Cc: Kernel List

Gerd Knorr wrote:
>   Hi,
> 
> This patch (against 2.5.5-pre1) fixes the es1370 driver (the virt_to_bus thing).

The same applies to 2.4.18-rc1

----------------------------- cut here --------------------------
--- linux.orig/drivers/sound/es1370.c	Sat Feb 16 09:33:37 2002
+++ linux/drivers/sound/es1370.c	Sat Feb 16 09:41:02 2002
@@ -374,6 +374,10 @@
  		unsigned subdivision;
  	} dma_dac1, dma_dac2, dma_adc;

+ 
/* The following buffer is used to point the phantom write channel to. */
+ 
unsigned char *bugbuf_cpu;
+ 
dma_addr_t bugbuf_dma;
+
  	/* midi stuff */
  	struct {
  		unsigned ird, iwr, icnt;
@@ -392,13 +396,6 @@

  static LIST_HEAD(devs);

-/*
- * The following buffer is used to point the phantom write channel to,
- * so that it cannot wreak havoc. The attribute makes sure it doesn't
- * cross a page boundary and ensures dword alignment for the DMA engine
- */
-static unsigned char bugbuf[16] __attribute__ ((aligned (16)));
-
  /* 
--------------------------------------------------------------------- */

  static inline unsigned ld2(unsigned int x)
@@ -2649,8 +2646,9 @@
  	outl(s->ctrl, s->io+ES1370_REG_CONTROL);
  	outl(s->sctrl, s->io+ES1370_REG_SERIAL_CONTROL);
  	/* point phantom write channel to "bugbuf" */
+ 
s->bugbuf_cpu = pci_alloc_consistent(pcidev,16,&s->bugbuf_dma);
  	outl((ES1370_REG_PHANTOM_FRAMEADR >> 8) & 15, s->io+ES1370_REG_MEMPAGE);
- 
outl(virt_to_bus(bugbuf), s->io+(ES1370_REG_PHANTOM_FRAMEADR & 0xff));
+ 
outl(s->bugbuf_dma, s->io+(ES1370_REG_PHANTOM_FRAMEADR & 0xff));
  	outl(0, s->io+(ES1370_REG_PHANTOM_FRAMECNT & 0xff));
  	pci_set_master(pcidev);  /* enable bus mastering */
  	wrcodec(s, 0x16, 3); /* no RST, PD */
@@ -2717,6 +2715,7 @@
  	unregister_sound_mixer(s->dev_mixer);
  	unregister_sound_dsp(s->dev_dac);
  	unregister_sound_midi(s->dev_midi);
+ 
pci_free_consistent(dev, 16, s->bugbuf_cpu, s->bugbuf_dma);
  	kfree(s);
  	pci_set_drvdata(dev, NULL);
}

-- 
------------------------------------------------
  Pierre Rousselet <pierre.rousselet@wanadoo.fr>
------------------------------------------------


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-02-16  9:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-14 15:17 [PATCH] es1370 fix Gerd Knorr
2002-02-14 17:27 ` Thomas Sailer
2002-02-16  9:31 ` [PATCH] 2.4.18-rc1 " Pierre Rousselet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox