From dedeb0029b9c83420fc1337d4ee53daa7b2a0ad4 Mon Sep 17 00:00:00 2001
From: Hugh Dickins <hugh@veritas.com>
Date: Mon, 7 Nov 2005 14:09:01 -0800
Subject: [SPARC64] mm: context switch ptlock

sparc64 is unique among architectures in taking the page_table_lock in
its context switch (well, cris does too, but erroneously, and it's not
yet SMP anyway).

This seems to be a private affair between switch_mm and activate_mm,
using page_table_lock as a per-mm lock, without any relation to its uses
elsewhere.  That's fine, but comment it as such; and unlock sooner in
switch_mm, more like in activate_mm (preemption is disabled here).

There is a block of "if (0)"ed code in smp_flush_tlb_pending which would
have liked to rely on the page_table_lock, in switch_mm and elsewhere;
but its comment explains how dup_mmap's flush_tlb_mm defeated it.  And
though that could have been changed at any time over the past few years,
now the chance vanishes as we push the page_table_lock downwards, and
perhaps split it per page table page.  Just delete that block of code.

Which leaves the mysterious spin_unlock_wait(&oldmm->page_table_lock)
in kernel/fork.c copy_mm.  Textual analysis (supported by Nick Piggin)
suggests that the comment was written by DaveM, and that it relates to
the defeated approach in the sparc64 smp_flush_tlb_pending.  Just delete
this block too.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/asm-sparc64/mmu_context.h | 46 ++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 22 deletions(-)

(limited to 'include')

diff --git a/include/asm-sparc64/mmu_context.h b/include/asm-sparc64/mmu_context.h
index 87c43c67866e..08ba72d7722c 100644
--- a/include/asm-sparc64/mmu_context.h
+++ b/include/asm-sparc64/mmu_context.h
@@ -87,37 +87,35 @@ extern void __flush_tlb_mm(unsigned long, unsigned long);
 static inline void switch_mm(struct mm_struct *old_mm, struct mm_struct *mm, struct task_struct *tsk)
 {
 	unsigned long ctx_valid;
+	int cpu;
 
+	/* Note: page_table_lock is used here to serialize switch_mm
+	 * and activate_mm, and their calls to get_new_mmu_context.
+	 * This use of page_table_lock is unrelated to its other uses.
+	 */ 
 	spin_lock(&mm->page_table_lock);
-	if (CTX_VALID(mm->context))
-		ctx_valid = 1;
-        else
-		ctx_valid = 0;
+	ctx_valid = CTX_VALID(mm->context);
+	if (!ctx_valid)
+		get_new_mmu_context(mm);
+	spin_unlock(&mm->page_table_lock);
 
 	if (!ctx_valid || (old_mm != mm)) {
-		if (!ctx_valid)
-			get_new_mmu_context(mm);
-
 		load_secondary_context(mm);
 		reload_tlbmiss_state(tsk, mm);
 	}
 
-	{
-		int cpu = smp_processor_id();
-
-		/* Even if (mm == old_mm) we _must_ check
-		 * the cpu_vm_mask.  If we do not we could
-		 * corrupt the TLB state because of how
-		 * smp_flush_tlb_{page,range,mm} on sparc64
-		 * and lazy tlb switches work. -DaveM
-		 */
-		if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) {
-			cpu_set(cpu, mm->cpu_vm_mask);
-			__flush_tlb_mm(CTX_HWBITS(mm->context),
-				       SECONDARY_CONTEXT);
-		}
+	/* Even if (mm == old_mm) we _must_ check
+	 * the cpu_vm_mask.  If we do not we could
+	 * corrupt the TLB state because of how
+	 * smp_flush_tlb_{page,range,mm} on sparc64
+	 * and lazy tlb switches work. -DaveM
+	 */
+	cpu = smp_processor_id();
+	if (!ctx_valid || !cpu_isset(cpu, mm->cpu_vm_mask)) {
+		cpu_set(cpu, mm->cpu_vm_mask);
+		__flush_tlb_mm(CTX_HWBITS(mm->context),
+			       SECONDARY_CONTEXT);
 	}
-	spin_unlock(&mm->page_table_lock);
 }
 
 #define deactivate_mm(tsk,mm)	do { } while (0)
@@ -127,6 +125,10 @@ static inline void activate_mm(struct mm_struct *active_mm, struct mm_struct *mm
 {
 	int cpu;
 
+	/* Note: page_table_lock is used here to serialize switch_mm
+	 * and activate_mm, and their calls to get_new_mmu_context.
+	 * This use of page_table_lock is unrelated to its other uses.
+	 */ 
 	spin_lock(&mm->page_table_lock);
 	if (!CTX_VALID(mm->context))
 		get_new_mmu_context(mm);
-- 
cgit v1.2.3


From b128254fdb172eaa3273de24fa6ce405a1f534c9 Mon Sep 17 00:00:00 2001
From: Georg Chini <georg.chini@triaton-webhosting.com>
Date: Mon, 7 Nov 2005 14:09:19 -0800
Subject: [SPARC]: More abstractions and cleanups of dma handling in cs4231.

From: Georg Chini <georg.chini@triaton-webhosting.com>

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/asm-sparc64/ebus.h |   1 +
 sound/sparc/cs4231.c       | 683 +++++++++++++++++++++++----------------------
 2 files changed, 343 insertions(+), 341 deletions(-)

(limited to 'include')

diff --git a/include/asm-sparc64/ebus.h b/include/asm-sparc64/ebus.h
index 543e4e500a72..7a408a030f52 100644
--- a/include/asm-sparc64/ebus.h
+++ b/include/asm-sparc64/ebus.h
@@ -79,6 +79,7 @@ extern int ebus_dma_request(struct ebus_dma_info *p, dma_addr_t bus_addr,
 			    size_t len);
 extern void ebus_dma_prepare(struct ebus_dma_info *p, int write);
 extern unsigned int ebus_dma_residue(struct ebus_dma_info *p);
+extern unsigned int ebus_dma_addr(struct ebus_dma_info *p);
 extern void ebus_dma_enable(struct ebus_dma_info *p, int on);
 
 extern struct linux_ebus		*ebus_chain;
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 110d64d4848d..1f8d27a6152e 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -62,25 +62,36 @@ MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Sun,CS4231}}");
 
 #ifdef SBUS_SUPPORT
-struct sbus_dma_info {
+typedef struct sbus_dma_info {
        spinlock_t      lock;
        int             dir;
        void __iomem    *regs;
-};
+} sbus_dma_info_t;
 #endif
 
-typedef struct snd_cs4231 {
-	spinlock_t		lock;
-	void __iomem		*port;
+typedef struct snd_cs4231 cs4231_t;
+
+typedef struct cs4231_dma_control {
+        void		(*prepare)(struct cs4231_dma_control *dma_cont, int dir);
+        void		(*enable)(struct cs4231_dma_control *dma_cont, int on);
+        int		(*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
+        unsigned int	(*address)(struct cs4231_dma_control *dma_cont);
+        void		(*reset)(cs4231_t *chip); 
+        void		(*preallocate)(cs4231_t *chip, snd_pcm_t *pcm); 
 #ifdef EBUS_SUPPORT
-	struct ebus_dma_info	eb2c;
-	struct ebus_dma_info	eb2p;
+	struct		ebus_dma_info	ebus_info;
 #endif
-
 #ifdef SBUS_SUPPORT
-	struct sbus_dma_info	sb2c;
-	struct sbus_dma_info	sb2p;
+	struct		sbus_dma_info	sbus_info;
 #endif
+} cs4231_dma_control_t;
+
+struct snd_cs4231 {
+	spinlock_t		lock;
+	void __iomem		*port;
+
+	cs4231_dma_control_t	p_dma;
+	cs4231_dma_control_t	c_dma;
 
 	u32			flags;
 #define CS4231_FLAG_EBUS	0x00000001
@@ -119,7 +130,7 @@ typedef struct snd_cs4231 {
 	unsigned int		irq[2];
 	unsigned int		regs_size;
 	struct snd_cs4231	*next;
-} cs4231_t;
+};
 
 static cs4231_t *cs4231_list;
 
@@ -493,103 +504,6 @@ static unsigned char snd_cs4231_in(cs4231_t *chip, unsigned char reg)
 	return ret;
 }
 
-/*
- * SBUS DMA routines
- */
-#ifdef SBUS_SUPPORT
-
-int sbus_dma_request(struct sbus_dma_info *base, dma_addr_t bus_addr, size_t len)
-{
-	unsigned long flags;
-	u32 test, csr;
-	int err;
-	
-	if (len >= (1 << 24))
-		return -EINVAL;
-	spin_lock_irqsave(&base->lock, flags);
-	csr = sbus_readl(base->regs + APCCSR);
-	err = -EINVAL;
-	test = APC_CDMA_READY;
-	if ( base->dir == APC_PLAY )
-		test = APC_PDMA_READY;
-	if (!(csr & test))
-		goto out;
-	err = -EBUSY;
-	csr = sbus_readl(base->regs + APCCSR);
-	test = APC_XINT_CNVA;
-	if ( base->dir == APC_PLAY )
-		test = APC_XINT_PNVA;
-	if (!(csr & test))
-		goto out;
-	err = 0;
-	sbus_writel(bus_addr, base->regs + base->dir + APCNVA);
-	sbus_writel(len, base->regs + base->dir + APCNC);
-out:
-	spin_unlock_irqrestore(&base->lock, flags);
-	return err;
-}
-
-void sbus_dma_prepare(struct sbus_dma_info *base)
-{
-	unsigned long flags;
-	u32 csr, test;
-
-	spin_lock_irqsave(&base->lock, flags);
-	csr = sbus_readl(base->regs + APCCSR);
-	test =  APC_GENL_INT | APC_PLAY_INT | APC_XINT_ENA |
-		APC_XINT_PLAY | APC_XINT_PEMP | APC_XINT_GENL |
-		 APC_XINT_PENA;
-	if ( base->dir == APC_RECORD )
-		test = APC_GENL_INT | APC_CAPT_INT | APC_XINT_ENA |
-			APC_XINT_CAPT | APC_XINT_CEMP | APC_XINT_GENL;
-	csr |= test;
-	sbus_writel(csr, base->regs + APCCSR);
-	spin_unlock_irqrestore(&base->lock, flags);
-}
-
-void sbus_dma_enable(struct sbus_dma_info *base, int on)
-{
-	unsigned long flags;
-	u32 csr, shift;
-
-	spin_lock_irqsave(&base->lock, flags);
-	if (!on) {
-		if (base->dir == APC_PLAY) { 
-			sbus_writel(0, base->regs + base->dir + APCNVA); 
-			sbus_writel(1, base->regs + base->dir + APCC); 
-		}
-		else
-		{
-			sbus_writel(0, base->regs + base->dir + APCNC); 
-			sbus_writel(0, base->regs + base->dir + APCVA); 
-		} 
-	} 
-	udelay(500); 
-	csr = sbus_readl(base->regs + APCCSR);
-	shift = 0;
-	if ( base->dir == APC_PLAY )
-		shift = 1;
-	if (on)
-		csr &= ~(APC_CPAUSE << shift);
-	else
-		csr |= (APC_CPAUSE << shift); 
-	sbus_writel(csr, base->regs + APCCSR);
-	if (on)
-		csr |= (APC_CDMA_READY << shift);
-	else
-		csr &= ~(APC_CDMA_READY << shift);
-	sbus_writel(csr, base->regs + APCCSR);
-	
-	spin_unlock_irqrestore(&base->lock, flags);
-}
-
-unsigned int sbus_dma_addr(struct sbus_dma_info *base)
-{
-        return sbus_readl(base->regs + base->dir + APCVA);
-}
-
-#endif
-
 /*
  *  CS4231 detection / MCE routines
  */
@@ -688,8 +602,7 @@ static void snd_cs4231_mce_down(cs4231_t *chip)
 	spin_unlock_irqrestore(&chip->lock, flags);
 }
 
-#ifdef EBUS_SUPPORT
-static void snd_cs4231_ebus_advance_dma(struct ebus_dma_info *p, snd_pcm_substream_t *substream, unsigned int *periods_sent)
+static void snd_cs4231_advance_dma(struct cs4231_dma_control *dma_cont, snd_pcm_substream_t *substream, unsigned int *periods_sent)
 {
 	snd_pcm_runtime_t *runtime = substream->runtime;
 
@@ -700,89 +613,41 @@ static void snd_cs4231_ebus_advance_dma(struct ebus_dma_info *p, snd_pcm_substre
 		if (period_size >= (1 << 24))
 			BUG();
 
-		if (ebus_dma_request(p, runtime->dma_addr + offset, period_size))
+		if (dma_cont->request(dma_cont, runtime->dma_addr + offset, period_size))
 			return;
 		(*periods_sent) = ((*periods_sent) + 1) % runtime->periods;
 	}
 }
-#endif
-
-#ifdef SBUS_SUPPORT
-static void snd_cs4231_sbus_advance_dma(struct sbus_dma_info *p, snd_pcm_substream_t *substream, unsigned int *periods_sent)
-{
-	snd_pcm_runtime_t *runtime = substream->runtime;
-
-	 while (1) {  
-		unsigned int period_size = snd_pcm_lib_period_bytes(substream);
-		unsigned int offset = period_size * (*periods_sent);
-
-		if (period_size > 0xffff + 1)
-			BUG();
-	
-		if (sbus_dma_request(p, runtime->dma_addr + offset, period_size))
-			return;
-		(*periods_sent) = (*periods_sent + 1) % runtime->periods;
-	} 
-}
-#endif
 
 static void cs4231_dma_trigger(snd_pcm_substream_t *substream, unsigned int what, int on)
 {
 	cs4231_t *chip = snd_pcm_substream_chip(substream);
+	cs4231_dma_control_t *dma_cont;
 
-#ifdef EBUS_SUPPORT
-	if (chip->flags & CS4231_FLAG_EBUS) {
-		if (what & CS4231_PLAYBACK_ENABLE) {
-			if (on) {
-				ebus_dma_prepare(&chip->eb2p, 0);
-				ebus_dma_enable(&chip->eb2p, 1);
-				snd_cs4231_ebus_advance_dma(&chip->eb2p,
-					chip->playback_substream,
-					&chip->p_periods_sent);
-			} else {
-				ebus_dma_enable(&chip->eb2p, 0);
-			}
-		}
-		if (what & CS4231_RECORD_ENABLE) {
-			if (on) {
-				ebus_dma_prepare(&chip->eb2c, 1);
-				ebus_dma_enable(&chip->eb2c, 1);
-				snd_cs4231_ebus_advance_dma(&chip->eb2c,
-					chip->capture_substream,
-					&chip->c_periods_sent);
-			} else {
-				ebus_dma_enable(&chip->eb2c, 0);
-			}
-		}
-	} else {
-#endif
-#ifdef SBUS_SUPPORT
 	if (what & CS4231_PLAYBACK_ENABLE) {
+		dma_cont = &chip->p_dma;
 		if (on) {
-			sbus_dma_prepare(&chip->sb2p);
-			sbus_dma_enable(&chip->sb2p, 1);
-			snd_cs4231_sbus_advance_dma(&chip->sb2p,
+			dma_cont->prepare(dma_cont, 0);
+			dma_cont->enable(dma_cont, 1);
+			snd_cs4231_advance_dma(dma_cont,
 				chip->playback_substream,
 				&chip->p_periods_sent);
 		} else {
-			sbus_dma_enable(&chip->sb2p, 0);
+			dma_cont->enable(dma_cont, 0);
 		}
 	}
 	if (what & CS4231_RECORD_ENABLE) {
+		dma_cont = &chip->c_dma;
 		if (on) {
-			sbus_dma_prepare(&chip->sb2c);
-			sbus_dma_enable(&chip->sb2c, 1);
-			snd_cs4231_sbus_advance_dma(&chip->sb2c,
+			dma_cont->prepare(dma_cont, 1);
+			dma_cont->enable(dma_cont, 1);
+			snd_cs4231_advance_dma(dma_cont,
 				chip->capture_substream,
 				&chip->c_periods_sent);
 		} else {
-			sbus_dma_enable(&chip->sb2c, 0);
+			dma_cont->enable(dma_cont, 0);
 		}
 	}
-#endif
-#ifdef EBUS_SUPPORT
-	}
-#endif
 }
 
 static int snd_cs4231_trigger(snd_pcm_substream_t *substream, int cmd)
@@ -1273,140 +1138,55 @@ static void snd_cs4231_overrange(cs4231_t *chip)
 		chip->capture_substream->runtime->overrange++;
 }
 
-#ifdef SBUS_SUPPORT
-static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-	unsigned long flags;
-	unsigned char status;
-	u32 csr;
-	cs4231_t *chip = dev_id;
-
-	/*This is IRQ is not raised by the cs4231*/
-	if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ))
-		return IRQ_NONE;
-
-	/* ACK the APC interrupt. */
-	csr = sbus_readl(chip->port + APCCSR);
-
-	sbus_writel(csr, chip->port + APCCSR);
-
-	if ((chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) &&
-	    (csr & APC_PLAY_INT) &&
-	    (csr & APC_XINT_PNVA) &&
-	    !(csr & APC_XINT_EMPT)) {
-		snd_pcm_period_elapsed(chip->playback_substream);
-		snd_cs4231_sbus_advance_dma(&chip->sb2p, chip->playback_substream,
-					    &chip->p_periods_sent);
-	}
-
-	if ((chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) &&
-	    (csr & APC_CAPT_INT) &&
-	    (csr & APC_XINT_CNVA) &&
-	    !(csr & APC_XINT_EMPT)) {
-		snd_pcm_period_elapsed(chip->capture_substream);
-		snd_cs4231_sbus_advance_dma(&chip->sb2c,chip->capture_substream,
-					    &chip->c_periods_sent);
-	}
-	
-	status = snd_cs4231_in(chip, CS4231_IRQ_STATUS);
-
-	if (status & CS4231_TIMER_IRQ) {
-		if (chip->timer)
-			snd_timer_interrupt(chip->timer, chip->timer->sticks);
-	}		
-
-	if (status & CS4231_RECORD_IRQ)
-		snd_cs4231_overrange(chip);
-
-	/* ACK the CS4231 interrupt. */
-	spin_lock_irqsave(&chip->lock, flags);
-	snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0);
-	spin_unlock_irqrestore(&chip->lock, flags);
-
-	return 0;
-}
-#endif
-
-#ifdef EBUS_SUPPORT
-static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie)
+static void snd_cs4231_play_callback(cs4231_t *cookie)
 {
 	cs4231_t *chip = cookie;
 
 	if (chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE) {
 		snd_pcm_period_elapsed(chip->playback_substream);
-		snd_cs4231_ebus_advance_dma(p, chip->playback_substream,
+		snd_cs4231_advance_dma(&chip->p_dma, chip->playback_substream,
 					    &chip->p_periods_sent);
 	}
 }
 
-static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie)
+static void snd_cs4231_capture_callback(cs4231_t *cookie)
 {
 	cs4231_t *chip = cookie;
 
 	if (chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE) {
 		snd_pcm_period_elapsed(chip->capture_substream);
-		snd_cs4231_ebus_advance_dma(p, chip->capture_substream,
+		snd_cs4231_advance_dma(&chip->c_dma, chip->capture_substream,
 					    &chip->c_periods_sent);
 	}
 }
-#endif
 
 static snd_pcm_uframes_t snd_cs4231_playback_pointer(snd_pcm_substream_t *substream)
 {
 	cs4231_t *chip = snd_pcm_substream_chip(substream);
+	cs4231_dma_control_t *dma_cont = &chip->p_dma;
 	size_t ptr;
-#ifdef EBUS_SUPPORT
-	size_t residue, period_bytes;
-#endif
 	
 	if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_PLAYBACK_ENABLE))
 		return 0;
-#ifdef EBUS_SUPPORT
-	period_bytes = snd_pcm_lib_period_bytes(substream);
-	ptr = period_bytes * chip->p_periods_sent;
-	if (chip->flags & CS4231_FLAG_EBUS) {
-		residue = ebus_dma_residue(&chip->eb2p);
-		ptr += period_bytes - residue;
-	} else {
-#endif
-#ifdef SBUS_SUPPORT
-		ptr = sbus_dma_addr(&chip->sb2p);
-		if (ptr != 0)
-			ptr -= substream->runtime->dma_addr;
-#endif
-#ifdef EBUS_SUPPORT
-	}
-#endif
-
+	ptr = dma_cont->address(dma_cont);
+	if (ptr != 0)
+		ptr -= substream->runtime->dma_addr;
+	
 	return bytes_to_frames(substream->runtime, ptr);
 }
 
 static snd_pcm_uframes_t snd_cs4231_capture_pointer(snd_pcm_substream_t * substream)
 {
 	cs4231_t *chip = snd_pcm_substream_chip(substream);
+	cs4231_dma_control_t *dma_cont = &chip->c_dma;
 	size_t ptr;
-#ifdef EBUS_SUPPORT
-	size_t residue, period_bytes;
-#endif
 	
 	if (!(chip->image[CS4231_IFACE_CTRL] & CS4231_RECORD_ENABLE))
 		return 0;
-#ifdef EBUS_SUPPORT
-	period_bytes = snd_pcm_lib_period_bytes(substream);
-	ptr = period_bytes * chip->c_periods_sent;
-	if (chip->flags & CS4231_FLAG_EBUS) {
-		residue = ebus_dma_residue(&chip->eb2c);
-		ptr += period_bytes - residue;
-	} else {
-#endif
-#ifdef SBUS_SUPPORT
-		ptr = sbus_dma_addr(&chip->sb2c);
-		if (ptr != 0)
-			ptr -= substream->runtime->dma_addr;
-#endif
-#ifdef EBUS_SUPPORT
-	}
-#endif
+	ptr = dma_cont->address(dma_cont);
+	if (ptr != 0)
+		ptr -= substream->runtime->dma_addr;
+	
 	return bytes_to_frames(substream->runtime, ptr);
 }
 
@@ -1442,30 +1222,8 @@ static int snd_cs4231_probe(cs4231_t *chip)
 	spin_lock_irqsave(&chip->lock, flags);
 
 
-	/* Reset DMA engine.  */
-#ifdef EBUS_SUPPORT
-	if (chip->flags & CS4231_FLAG_EBUS) {
-		/* Done by ebus_dma_register */
-	} else {
-#endif
-#ifdef SBUS_SUPPORT
-                sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
-                sbus_writel(0x00, chip->port + APCCSR);
-                sbus_writel(sbus_readl(chip->port + APCCSR) | APC_CDC_RESET,
-			    chip->port + APCCSR);
-  
-                udelay(20);
-  
-                sbus_writel(sbus_readl(chip->port + APCCSR) & ~APC_CDC_RESET,
-			    chip->port + APCCSR);
-                sbus_writel(sbus_readl(chip->port + APCCSR) | (APC_XINT_ENA |
-							       APC_XINT_PENA |
-							       APC_XINT_CENA),
-			    chip->port + APCCSR);
-#endif
-#ifdef EBUS_SUPPORT
-	}
-#endif
+	/* Reset DMA engine (sbus only).  */
+	chip->p_dma.reset(chip);
 
 	__cs4231_readb(chip, CS4231P(chip, STATUS));	/* clear any pendings IRQ */
 	__cs4231_writeb(chip, 0, CS4231P(chip, STATUS));
@@ -1585,8 +1343,8 @@ static int snd_cs4231_playback_close(snd_pcm_substream_t *substream)
 {
 	cs4231_t *chip = snd_pcm_substream_chip(substream);
 
-	chip->playback_substream = NULL;
 	snd_cs4231_close(chip, CS4231_MODE_PLAY);
+	chip->playback_substream = NULL;
 
 	return 0;
 }
@@ -1595,8 +1353,8 @@ static int snd_cs4231_capture_close(snd_pcm_substream_t *substream)
 {
 	cs4231_t *chip = snd_pcm_substream_chip(substream);
 
-	chip->capture_substream = NULL;
 	snd_cs4231_close(chip, CS4231_MODE_RECORD);
+	chip->capture_substream = NULL;
 
 	return 0;
 }
@@ -1651,21 +1409,7 @@ int snd_cs4231_pcm(cs4231_t *chip)
 	pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX;
 	strcpy(pcm->name, "CS4231");
 
-#ifdef EBUS_SUPPORT
-	if (chip->flags & CS4231_FLAG_EBUS) {
-		snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
-						      snd_dma_pci_data(chip->dev_u.pdev),
-						      64*1024, 128*1024);
-	} else {
-#endif
-#ifdef SBUS_SUPPORT
-		snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
-						      snd_dma_sbus_data(chip->dev_u.sdev),
-						      64*1024, 128*1024);
-#endif
-#ifdef EBUS_SUPPORT
-	}
-#endif
+	chip->p_dma.preallocate(chip, pcm);
 
 	chip->pcm = pcm;
 
@@ -2022,6 +1766,180 @@ out_err:
 }
 
 #ifdef SBUS_SUPPORT
+
+static irqreturn_t snd_cs4231_sbus_interrupt(int irq, void *dev_id, struct pt_regs *regs)
+{
+	unsigned long flags;
+	unsigned char status;
+	u32 csr;
+	cs4231_t *chip = dev_id;
+
+	/*This is IRQ is not raised by the cs4231*/
+	if (!(__cs4231_readb(chip, CS4231P(chip, STATUS)) & CS4231_GLOBALIRQ))
+		return IRQ_NONE;
+
+	/* ACK the APC interrupt. */
+	csr = sbus_readl(chip->port + APCCSR);
+
+	sbus_writel(csr, chip->port + APCCSR);
+
+	if ((csr & APC_PDMA_READY) && 
+ 	    (csr & APC_PLAY_INT) &&
+	    (csr & APC_XINT_PNVA) &&
+	    !(csr & APC_XINT_EMPT))
+			snd_cs4231_play_callback(chip);
+
+	if ((csr & APC_CDMA_READY) && 
+  	    (csr & APC_CAPT_INT) &&
+	    (csr & APC_XINT_CNVA) &&
+	    !(csr & APC_XINT_EMPT))
+			snd_cs4231_capture_callback(chip);
+	
+	status = snd_cs4231_in(chip, CS4231_IRQ_STATUS);
+
+	if (status & CS4231_TIMER_IRQ) {
+		if (chip->timer)
+			snd_timer_interrupt(chip->timer, chip->timer->sticks);
+	}		
+
+	if ((status & CS4231_RECORD_IRQ) && (csr & APC_CDMA_READY))
+		snd_cs4231_overrange(chip);
+
+	/* ACK the CS4231 interrupt. */
+	spin_lock_irqsave(&chip->lock, flags);
+	snd_cs4231_outm(chip, CS4231_IRQ_STATUS, ~CS4231_ALL_IRQS | ~status, 0);
+	spin_unlock_irqrestore(&chip->lock, flags);
+
+	return 0;
+}
+
+/*
+ * SBUS DMA routines
+ */
+
+int sbus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
+{
+	unsigned long flags;
+	u32 test, csr;
+	int err;
+	sbus_dma_info_t *base = &dma_cont->sbus_info;
+	
+	if (len >= (1 << 24))
+		return -EINVAL;
+	spin_lock_irqsave(&base->lock, flags);
+	csr = sbus_readl(base->regs + APCCSR);
+	err = -EINVAL;
+	test = APC_CDMA_READY;
+	if ( base->dir == APC_PLAY )
+		test = APC_PDMA_READY;
+	if (!(csr & test))
+		goto out;
+	err = -EBUSY;
+	csr = sbus_readl(base->regs + APCCSR);
+	test = APC_XINT_CNVA;
+	if ( base->dir == APC_PLAY )
+		test = APC_XINT_PNVA;
+	if (!(csr & test))
+		goto out;
+	err = 0;
+	sbus_writel(bus_addr, base->regs + base->dir + APCNVA);
+	sbus_writel(len, base->regs + base->dir + APCNC);
+out:
+	spin_unlock_irqrestore(&base->lock, flags);
+	return err;
+}
+
+void sbus_dma_prepare(struct cs4231_dma_control *dma_cont, int d)
+{
+	unsigned long flags;
+	u32 csr, test;
+	sbus_dma_info_t *base = &dma_cont->sbus_info;
+
+	spin_lock_irqsave(&base->lock, flags);
+	csr = sbus_readl(base->regs + APCCSR);
+	test =  APC_GENL_INT | APC_PLAY_INT | APC_XINT_ENA |
+		APC_XINT_PLAY | APC_XINT_PEMP | APC_XINT_GENL |
+		 APC_XINT_PENA;
+	if ( base->dir == APC_RECORD )
+		test = APC_GENL_INT | APC_CAPT_INT | APC_XINT_ENA |
+			APC_XINT_CAPT | APC_XINT_CEMP | APC_XINT_GENL;
+	csr |= test;
+	sbus_writel(csr, base->regs + APCCSR);
+	spin_unlock_irqrestore(&base->lock, flags);
+}
+
+void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
+{
+	unsigned long flags;
+	u32 csr, shift;
+	sbus_dma_info_t *base = &dma_cont->sbus_info;
+
+	spin_lock_irqsave(&base->lock, flags);
+	if (!on) {
+		if (base->dir == APC_PLAY) { 
+			sbus_writel(0, base->regs + base->dir + APCNVA); 
+			sbus_writel(1, base->regs + base->dir + APCC); 
+		}
+		else
+		{
+			sbus_writel(0, base->regs + base->dir + APCNC); 
+			sbus_writel(0, base->regs + base->dir + APCVA); 
+		} 
+	} 
+	udelay(600); 
+	csr = sbus_readl(base->regs + APCCSR);
+	shift = 0;
+	if ( base->dir == APC_PLAY )
+		shift = 1;
+	if (on)
+		csr &= ~(APC_CPAUSE << shift);
+	else
+		csr |= (APC_CPAUSE << shift); 
+	sbus_writel(csr, base->regs + APCCSR);
+	if (on)
+		csr |= (APC_CDMA_READY << shift);
+	else
+		csr &= ~(APC_CDMA_READY << shift);
+	sbus_writel(csr, base->regs + APCCSR);
+	
+	spin_unlock_irqrestore(&base->lock, flags);
+}
+
+unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
+{
+	sbus_dma_info_t *base = &dma_cont->sbus_info;
+
+        return sbus_readl(base->regs + base->dir + APCVA);
+}
+
+void sbus_dma_reset(cs4231_t *chip)
+{
+        sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
+        sbus_writel(0x00, chip->port + APCCSR);
+        sbus_writel(sbus_readl(chip->port + APCCSR) | APC_CDC_RESET,
+		    chip->port + APCCSR);
+  
+        udelay(20);
+  
+        sbus_writel(sbus_readl(chip->port + APCCSR) & ~APC_CDC_RESET,
+		    chip->port + APCCSR);
+        sbus_writel(sbus_readl(chip->port + APCCSR) | (APC_XINT_ENA |
+		       APC_XINT_PENA |
+		       APC_XINT_CENA),
+	               chip->port + APCCSR);
+}
+
+void sbus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
+{
+	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
+					      snd_dma_sbus_data(chip->dev_u.sdev),
+					      64*1024, 128*1024);
+}
+
+/*
+ * Init and exit routines
+ */
+
 static int snd_cs4231_sbus_free(cs4231_t *chip)
 {
 	if (chip->irq[0])
@@ -2063,8 +1981,8 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
 		return -ENOMEM;
 
 	spin_lock_init(&chip->lock);
-	spin_lock_init(&chip->sb2c.lock);
-	spin_lock_init(&chip->sb2p.lock);
+	spin_lock_init(&chip->c_dma.sbus_info.lock);
+	spin_lock_init(&chip->p_dma.sbus_info.lock);
 	init_MUTEX(&chip->mce_mutex);
 	init_MUTEX(&chip->open_mutex);
 	chip->card = card;
@@ -2080,10 +1998,24 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
 		return -EIO;
 	}
 
-	chip->sb2c.regs = chip->port;
-	chip->sb2p.regs = chip->port;
-	chip->sb2c.dir = APC_RECORD;
-	chip->sb2p.dir = APC_PLAY;
+	chip->c_dma.sbus_info.regs = chip->port;
+	chip->p_dma.sbus_info.regs = chip->port;
+	chip->c_dma.sbus_info.dir = APC_RECORD;
+	chip->p_dma.sbus_info.dir = APC_PLAY;
+
+	chip->p_dma.prepare = sbus_dma_prepare;
+	chip->p_dma.enable = sbus_dma_enable;
+	chip->p_dma.request = sbus_dma_request;
+	chip->p_dma.address = sbus_dma_addr;
+	chip->p_dma.reset = sbus_dma_reset;
+	chip->p_dma.preallocate = sbus_dma_preallocate;
+
+	chip->c_dma.prepare = sbus_dma_prepare;
+	chip->c_dma.enable = sbus_dma_enable;
+	chip->c_dma.request = sbus_dma_request;
+	chip->c_dma.address = sbus_dma_addr;
+	chip->c_dma.reset = sbus_dma_reset;
+	chip->c_dma.preallocate = sbus_dma_preallocate;
 
 	if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
 			SA_SHIRQ, "cs4231", chip)) {
@@ -2138,15 +2070,70 @@ static int cs4231_sbus_attach(struct sbus_dev *sdev)
 #endif
 
 #ifdef EBUS_SUPPORT
+
+static void snd_cs4231_ebus_play_callback(struct ebus_dma_info *p, int event, void *cookie)
+{
+	cs4231_t *chip = cookie;
+	
+	snd_cs4231_play_callback(chip);
+}
+
+static void snd_cs4231_ebus_capture_callback(struct ebus_dma_info *p, int event, void *cookie)
+{
+	cs4231_t *chip = cookie;
+
+	snd_cs4231_capture_callback(chip);
+}
+
+/*
+ * EBUS DMA wrappers
+ */
+
+int _ebus_dma_request(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len)
+{
+	return ebus_dma_request(&dma_cont->ebus_info, bus_addr, len);
+}
+
+void _ebus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
+{
+	ebus_dma_enable(&dma_cont->ebus_info, on);
+}
+
+void _ebus_dma_prepare(struct cs4231_dma_control *dma_cont, int dir)
+{
+	ebus_dma_prepare(&dma_cont->ebus_info, dir);
+}
+
+unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
+{
+	return ebus_dma_addr(&dma_cont->ebus_info);
+}
+
+void _ebus_dma_reset(cs4231_t *chip)
+{
+	return;
+}
+
+void _ebus_dma_preallocate(cs4231_t *chip, snd_pcm_t *pcm)
+{
+	snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+				      snd_dma_pci_data(chip->dev_u.pdev),
+				      64*1024, 128*1024);
+}
+
+/*
+ * Init and exit routines
+ */
+
 static int snd_cs4231_ebus_free(cs4231_t *chip)
 {
-	if (chip->eb2c.regs) {
-		ebus_dma_unregister(&chip->eb2c);
-		iounmap(chip->eb2c.regs);
+	if (chip->c_dma.ebus_info.regs) {
+		ebus_dma_unregister(&chip->c_dma.ebus_info);
+		iounmap(chip->c_dma.ebus_info.regs);
 	}
-	if (chip->eb2p.regs) {
-		ebus_dma_unregister(&chip->eb2p);
-		iounmap(chip->eb2p.regs);
+	if (chip->p_dma.ebus_info.regs) {
+		ebus_dma_unregister(&chip->p_dma.ebus_info);
+		iounmap(chip->p_dma.ebus_info.regs);
 	}
 
 	if (chip->port)
@@ -2184,8 +2171,8 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
 		return -ENOMEM;
 
 	spin_lock_init(&chip->lock);
-	spin_lock_init(&chip->eb2c.lock);
-	spin_lock_init(&chip->eb2p.lock);
+	spin_lock_init(&chip->c_dma.ebus_info.lock);
+	spin_lock_init(&chip->p_dma.ebus_info.lock);
 	init_MUTEX(&chip->mce_mutex);
 	init_MUTEX(&chip->open_mutex);
 	chip->flags |= CS4231_FLAG_EBUS;
@@ -2193,43 +2180,57 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
 	chip->dev_u.pdev = edev->bus->self;
 	memcpy(&chip->image, &snd_cs4231_original_image,
 	       sizeof(snd_cs4231_original_image));
-	strcpy(chip->eb2c.name, "cs4231(capture)");
-	chip->eb2c.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
-	chip->eb2c.callback = snd_cs4231_ebus_capture_callback;
-	chip->eb2c.client_cookie = chip;
-	chip->eb2c.irq = edev->irqs[0];
-	strcpy(chip->eb2p.name, "cs4231(play)");
-	chip->eb2p.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
-	chip->eb2p.callback = snd_cs4231_ebus_play_callback;
-	chip->eb2p.client_cookie = chip;
-	chip->eb2p.irq = edev->irqs[1];
+	strcpy(chip->c_dma.ebus_info.name, "cs4231(capture)");
+	chip->c_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
+	chip->c_dma.ebus_info.callback = snd_cs4231_ebus_capture_callback;
+	chip->c_dma.ebus_info.client_cookie = chip;
+	chip->c_dma.ebus_info.irq = edev->irqs[0];
+	strcpy(chip->p_dma.ebus_info.name, "cs4231(play)");
+	chip->p_dma.ebus_info.flags = EBUS_DMA_FLAG_USE_EBDMA_HANDLER;
+	chip->p_dma.ebus_info.callback = snd_cs4231_ebus_play_callback;
+	chip->p_dma.ebus_info.client_cookie = chip;
+	chip->p_dma.ebus_info.irq = edev->irqs[1];
+
+	chip->p_dma.prepare = _ebus_dma_prepare;
+	chip->p_dma.enable = _ebus_dma_enable;
+	chip->p_dma.request = _ebus_dma_request;
+	chip->p_dma.address = _ebus_dma_addr;
+	chip->p_dma.reset = _ebus_dma_reset;
+	chip->p_dma.preallocate = _ebus_dma_preallocate;
+
+	chip->c_dma.prepare = _ebus_dma_prepare;
+	chip->c_dma.enable = _ebus_dma_enable;
+	chip->c_dma.request = _ebus_dma_request;
+	chip->c_dma.address = _ebus_dma_addr;
+	chip->c_dma.reset = _ebus_dma_reset;
+	chip->c_dma.preallocate = _ebus_dma_preallocate;
 
 	chip->port = ioremap(edev->resource[0].start, 0x10);
-	chip->eb2p.regs = ioremap(edev->resource[1].start, 0x10);
-	chip->eb2c.regs = ioremap(edev->resource[2].start, 0x10);
-	if (!chip->port || !chip->eb2p.regs || !chip->eb2c.regs) {
+	chip->p_dma.ebus_info.regs = ioremap(edev->resource[1].start, 0x10);
+	chip->c_dma.ebus_info.regs = ioremap(edev->resource[2].start, 0x10);
+	if (!chip->port || !chip->p_dma.ebus_info.regs || !chip->c_dma.ebus_info.regs) {
 		snd_cs4231_ebus_free(chip);
 		snd_printdd("cs4231-%d: Unable to map chip registers.\n", dev);
 		return -EIO;
 	}
 
-	if (ebus_dma_register(&chip->eb2c)) {
+	if (ebus_dma_register(&chip->c_dma.ebus_info)) {
 		snd_cs4231_ebus_free(chip);
 		snd_printdd("cs4231-%d: Unable to register EBUS capture DMA\n", dev);
 		return -EBUSY;
 	}
-	if (ebus_dma_irq_enable(&chip->eb2c, 1)) {
+	if (ebus_dma_irq_enable(&chip->c_dma.ebus_info, 1)) {
 		snd_cs4231_ebus_free(chip);
 		snd_printdd("cs4231-%d: Unable to enable EBUS capture IRQ\n", dev);
 		return -EBUSY;
 	}
 
-	if (ebus_dma_register(&chip->eb2p)) {
+	if (ebus_dma_register(&chip->p_dma.ebus_info)) {
 		snd_cs4231_ebus_free(chip);
 		snd_printdd("cs4231-%d: Unable to register EBUS play DMA\n", dev);
 		return -EBUSY;
 	}
-	if (ebus_dma_irq_enable(&chip->eb2p, 1)) {
+	if (ebus_dma_irq_enable(&chip->p_dma.ebus_info, 1)) {
 		snd_cs4231_ebus_free(chip);
 		snd_printdd("cs4231-%d: Unable to enable EBUS play IRQ\n", dev);
 		return -EBUSY;
-- 
cgit v1.2.3


From 62dbec78be652c28f63ad5eda3d01c244c916040 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@davemloft.net>
Date: Mon, 7 Nov 2005 14:09:58 -0800
Subject: [SPARC64] mm: Do not flush TLB mm in tlb_finish_mmu()

It isn't needed any longer, as noted by Hugh Dickins.

We still need the flush routines, due to the one remaining
call site in hugetlb_prefault_arch_hook().  That can be
eliminated at some later point, however.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/smp.c | 48 +++++++++++++++++------------------------------
 include/asm-sparc64/tlb.h |  6 ++----
 2 files changed, 19 insertions(+), 35 deletions(-)

(limited to 'include')

diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index a9089e2140e9..5d90ee9aebf1 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -839,43 +839,29 @@ void smp_flush_tlb_all(void)
  *    questionable (in theory the big win for threads is the massive sharing of
  *    address space state across processors).
  */
+
+/* This currently is only used by the hugetlb arch pre-fault
+ * hook on UltraSPARC-III+ and later when changing the pagesize
+ * bits of the context register for an address space.
+ */
 void smp_flush_tlb_mm(struct mm_struct *mm)
 {
-        /*
-         * This code is called from two places, dup_mmap and exit_mmap. In the
-         * former case, we really need a flush. In the later case, the callers
-         * are single threaded exec_mmap (really need a flush), multithreaded
-         * exec_mmap case (do not need to flush, since the caller gets a new
-         * context via activate_mm), and all other callers of mmput() whence
-         * the flush can be optimized since the associated threads are dead and
-         * the mm is being torn down (__exit_mm and other mmput callers) or the
-         * owning thread is dissociating itself from the mm. The
-         * (atomic_read(&mm->mm_users) == 0) check ensures real work is done
-         * for single thread exec and dup_mmap cases. An alternate check might
-         * have been (current->mm != mm).
-         *                                              Kanoj Sarcar
-         */
-        if (atomic_read(&mm->mm_users) == 0)
-                return;
-
-	{
-		u32 ctx = CTX_HWBITS(mm->context);
-		int cpu = get_cpu();
+	u32 ctx = CTX_HWBITS(mm->context);
+	int cpu = get_cpu();
 
-		if (atomic_read(&mm->mm_users) == 1) {
-			mm->cpu_vm_mask = cpumask_of_cpu(cpu);
-			goto local_flush_and_out;
-		}
+	if (atomic_read(&mm->mm_users) == 1) {
+		mm->cpu_vm_mask = cpumask_of_cpu(cpu);
+		goto local_flush_and_out;
+	}
 
-		smp_cross_call_masked(&xcall_flush_tlb_mm,
-				      ctx, 0, 0,
-				      mm->cpu_vm_mask);
+	smp_cross_call_masked(&xcall_flush_tlb_mm,
+			      ctx, 0, 0,
+			      mm->cpu_vm_mask);
 
-	local_flush_and_out:
-		__flush_tlb_mm(ctx, SECONDARY_CONTEXT);
+local_flush_and_out:
+	__flush_tlb_mm(ctx, SECONDARY_CONTEXT);
 
-		put_cpu();
-	}
+	put_cpu();
 }
 
 void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long *vaddrs)
diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
index 66138d959df5..1eda17954f39 100644
--- a/include/asm-sparc64/tlb.h
+++ b/include/asm-sparc64/tlb.h
@@ -78,11 +78,9 @@ static inline void tlb_finish_mmu(struct mmu_gather *mp, unsigned long start, un
 {
 	tlb_flush_mmu(mp);
 
-	if (mp->fullmm) {
-		if (CTX_VALID(mp->mm->context))
-			do_flush_tlb_mm(mp->mm);
+	if (mp->fullmm)
 		mp->fullmm = 0;
-	} else
+	else
 		flush_tlb_pending();
 
 	/* keep the page table cache within bounds */
-- 
cgit v1.2.3


From d16436e686949a17b3bcfff2d688c97354b599aa Mon Sep 17 00:00:00 2001
From: Stephen Rothwell <sfr@canb.auug.org.au>
Date: Mon, 7 Nov 2005 14:10:42 -0800
Subject: [SPARC]: remove duplicate TIOCPKT_ definitions

The TIOCPKT_ macros are defined by all other architectures in asm/ioctls.h
and so does sparc and sparc64, so reomve the duplicates in asm/termios.h.

Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/asm-sparc/termios.h   | 9 ---------
 include/asm-sparc64/termios.h | 9 ---------
 2 files changed, 18 deletions(-)

(limited to 'include')

diff --git a/include/asm-sparc/termios.h b/include/asm-sparc/termios.h
index 0a8ad4cac125..d05f83c80989 100644
--- a/include/asm-sparc/termios.h
+++ b/include/asm-sparc/termios.h
@@ -38,15 +38,6 @@ struct sunos_ttysize {
 	int st_columns; /* Columns on the terminal */
 };
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
diff --git a/include/asm-sparc64/termios.h b/include/asm-sparc64/termios.h
index 9777a9cca88a..ee26a071c677 100644
--- a/include/asm-sparc64/termios.h
+++ b/include/asm-sparc64/termios.h
@@ -38,15 +38,6 @@ struct sunos_ttysize {
 	int st_columns; /* Columns on the terminal */
 };
 
-/* Used for packet mode */
-#define TIOCPKT_DATA		 0
-#define TIOCPKT_FLUSHREAD	 1
-#define TIOCPKT_FLUSHWRITE	 2
-#define TIOCPKT_STOP		 4
-#define TIOCPKT_START		 8
-#define TIOCPKT_NOSTOP		16
-#define TIOCPKT_DOSTOP		32
-
 struct winsize {
 	unsigned short ws_row;
 	unsigned short ws_col;
-- 
cgit v1.2.3


From 9d3c7d1bfd41d5082a541666db404aae7699b79e Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 7 Nov 2005 14:11:14 -0800
Subject: [SPARC]: remove audioio.h

The old sound drivers are gone in 2.6, so the only user left are the
compat ioctls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/ioctl32.c |   7 --
 include/asm-sparc/audioio.h   | 234 ------------------------------------------
 include/asm-sparc64/audioio.h | 234 ------------------------------------------
 3 files changed, 475 deletions(-)
 delete mode 100644 include/asm-sparc/audioio.h
 delete mode 100644 include/asm-sparc64/audioio.h

(limited to 'include')

diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
index 0e587d6de319..6fda044a7372 100644
--- a/arch/sparc64/kernel/ioctl32.c
+++ b/arch/sparc64/kernel/ioctl32.c
@@ -19,7 +19,6 @@
 #include <asm/envctrl.h>
 #include <asm/display7seg.h>
 #include <asm/openpromio.h>
-#include <asm/audioio.h>
 #include <asm/watchdog.h>
 
 /* Use this to get at 32-bit user passed pointers. 
@@ -524,12 +523,6 @@ COMPATIBLE_IOCTL(OPROMPATH2NODE)
 COMPATIBLE_IOCTL(LOOP_SET_STATUS64)
 COMPATIBLE_IOCTL(LOOP_GET_STATUS64)
 /* Big A */
-COMPATIBLE_IOCTL(AUDIO_GETINFO)
-COMPATIBLE_IOCTL(AUDIO_SETINFO)
-COMPATIBLE_IOCTL(AUDIO_DRAIN)
-COMPATIBLE_IOCTL(AUDIO_GETDEV)
-COMPATIBLE_IOCTL(AUDIO_GETDEV_SUNOS)
-COMPATIBLE_IOCTL(AUDIO_FLUSH)
 COMPATIBLE_IOCTL(AUTOFS_IOC_EXPIRE_MULTI)
 #if defined(CONFIG_DRM) || defined(CONFIG_DRM_MODULE)
 COMPATIBLE_IOCTL(DRM_IOCTL_GET_MAGIC)
diff --git a/include/asm-sparc/audioio.h b/include/asm-sparc/audioio.h
deleted file mode 100644
index cf16173f521b..000000000000
--- a/include/asm-sparc/audioio.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * include/asm-sparc/audioio.h
- *
- * Sparc Audio Midlayer
- * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
- */
-
-#ifndef _AUDIOIO_H_
-#define _AUDIOIO_H_
-
-/*
- *	SunOS/Solaris /dev/audio interface
- */
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/ioctl.h>
-#endif
-
-/*
- * This structure contains state information for audio device IO streams.
- */
-typedef struct audio_prinfo {
-	/*
-	 * The following values describe the audio data encoding.
-	 */
-	unsigned int sample_rate;	/* samples per second */
-	unsigned int channels;	/* number of interleaved channels */
-	unsigned int precision;	/* bit-width of each sample */
-	unsigned int encoding;	/* data encoding method */
-
-	/*
-	 * The following values control audio device configuration
-	 */
-	unsigned int gain;		/* gain level: 0 - 255 */
-	unsigned int port;		/* selected I/O port (see below) */
-	unsigned int avail_ports;	/* available I/O ports (see below) */
-	unsigned int _xxx[2];		/* Reserved for future use */
-
-	unsigned int buffer_size;	/* I/O buffer size */
-
-	/*
-	 * The following values describe driver state
-	 */
-	unsigned int samples;		/* number of samples converted */
-	unsigned int eof;		/* End Of File counter (play only) */
-
-	unsigned char	pause;		/* non-zero for pause, zero to resume */
-	unsigned char	error;		/* non-zero if overflow/underflow */
-	unsigned char	waiting;	/* non-zero if a process wants access */
-	unsigned char balance;	/* stereo channel balance */
-
-	unsigned short minordev;
-
-	/*
-	 * The following values are read-only state flags
-	 */
-	unsigned char open;		/* non-zero if open access permitted */
-	unsigned char active;		/* non-zero if I/O is active */
-} audio_prinfo_t;
-
-
-/*
- * This structure describes the current state of the audio device.
- */
-typedef struct audio_info {
-	/*
-	 * Per-stream information
-	 */
-	audio_prinfo_t play;	/* output status information */
-	audio_prinfo_t record;	/* input status information */
-
-	/*
-	 * Per-unit/channel information
-	 */
-	unsigned int monitor_gain;	/* input to output mix: 0 - 255 */
-	unsigned char output_muted;	/* non-zero if output is muted */
-	unsigned char _xxx[3];	/* Reserved for future use */
-	unsigned int _yyy[3];		/* Reserved for future use */
-} audio_info_t;
-
-
-/*
- * Audio encoding types
- */
-#define	AUDIO_ENCODING_NONE	(0)	/* no encoding assigned	  */
-#define	AUDIO_ENCODING_ULAW	(1)	/* u-law encoding	  */
-#define	AUDIO_ENCODING_ALAW	(2)	/* A-law encoding	  */
-#define	AUDIO_ENCODING_LINEAR	(3)	/* Linear PCM encoding	  */
-#define AUDIO_ENCODING_FLOAT    (4)     /* IEEE float (-1. <-> +1.) */
-#define	AUDIO_ENCODING_DVI	(104)	/* DVI ADPCM		  */
-#define	AUDIO_ENCODING_LINEAR8	(105)	/* 8 bit UNSIGNED	  */
-#define	AUDIO_ENCODING_LINEARLE	(106)	/* Linear PCM LE encoding */
-
-/*
- * These ranges apply to record, play, and monitor gain values
- */
-#define	AUDIO_MIN_GAIN	(0)	/* minimum gain value */
-#define	AUDIO_MAX_GAIN	(255)	/* maximum gain value */
-
-/*
- * These values apply to the balance field to adjust channel gain values
- */
-#define	AUDIO_LEFT_BALANCE	(0)	/* left channel only	*/
-#define	AUDIO_MID_BALANCE	(32)	/* equal left/right channel */
-#define	AUDIO_RIGHT_BALANCE	(64)	/* right channel only	*/
-#define	AUDIO_BALANCE_SHIFT	(3)
-
-/*
- * Generic minimum/maximum limits for number of channels, both modes
- */
-#define	AUDIO_MIN_PLAY_CHANNELS	(1)
-#define	AUDIO_MAX_PLAY_CHANNELS	(4)
-#define	AUDIO_MIN_REC_CHANNELS	(1)
-#define	AUDIO_MAX_REC_CHANNELS	(4)
-
-/*
- * Generic minimum/maximum limits for sample precision
- */
-#define	AUDIO_MIN_PLAY_PRECISION	(8)
-#define	AUDIO_MAX_PLAY_PRECISION	(32)
-#define	AUDIO_MIN_REC_PRECISION		(8)
-#define	AUDIO_MAX_REC_PRECISION		(32)
-
-/*
- * Define some convenient names for typical audio ports
- */
-/*
- * output ports (several may be enabled simultaneously)
- */
-#define	AUDIO_SPEAKER		0x01	/* output to built-in speaker */
-#define	AUDIO_HEADPHONE		0x02	/* output to headphone jack */
-#define	AUDIO_LINE_OUT		0x04	/* output to line out	 */
-
-/*
- * input ports (usually only one at a time)
- */
-#define	AUDIO_MICROPHONE	0x01	/* input from microphone */
-#define	AUDIO_LINE_IN		0x02	/* input from line in	 */
-#define	AUDIO_CD		0x04	/* input from on-board CD inputs */
-#define	AUDIO_INTERNAL_CD_IN	AUDIO_CD	/* input from internal CDROM */
-#define AUDIO_ANALOG_LOOPBACK   0x40    /* input from output */
-
-
-/*
- * This macro initializes an audio_info structure to 'harmless' values.
- * Note that (~0) might not be a harmless value for a flag that was
- * a signed int.
- */
-#define	AUDIO_INITINFO(i)	{					\
-	unsigned int	*__x__;						\
-	for (__x__ = (unsigned int *)(i);				\
-	    (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t));	\
-	    *__x__++ = ~0);						\
-}
-
-/*
- * These allow testing for what the user wants to set 
- */
-#define AUD_INITVALUE   (~0)
-#define Modify(X)       ((unsigned int)(X) != AUD_INITVALUE)
-#define Modifys(X)      ((X) != (unsigned short)AUD_INITVALUE)
-#define Modifyc(X)      ((X) != (unsigned char)AUD_INITVALUE)
-
-/*
- * Parameter for the AUDIO_GETDEV ioctl to determine current
- * audio devices.
- */
-#define	MAX_AUDIO_DEV_LEN	(16)
-typedef struct audio_device {
-	char name[MAX_AUDIO_DEV_LEN];
-	char version[MAX_AUDIO_DEV_LEN];
-	char config[MAX_AUDIO_DEV_LEN];
-} audio_device_t;
-
-
-/*
- * Ioctl calls for the audio device.
- */
-
-/*
- * AUDIO_GETINFO retrieves the current state of the audio device.
- *
- * AUDIO_SETINFO copies all fields of the audio_info structure whose
- * values are not set to the initialized value (-1) to the device state.
- * It performs an implicit AUDIO_GETINFO to return the new state of the
- * device.  Note that the record.samples and play.samples fields are set
- * to the last value before the AUDIO_SETINFO took effect.  This allows
- * an application to reset the counters while atomically retrieving the
- * last value.
- *
- * AUDIO_DRAIN suspends the calling process until the write buffers are
- * empty.
- *
- * AUDIO_GETDEV returns a structure of type audio_device_t which contains
- * three strings.  The string "name" is a short identifying string (for
- * example, the SBus Fcode name string), the string "version" identifies
- * the current version of the device, and the "config" string identifies
- * the specific configuration of the audio stream.  All fields are
- * device-dependent -- see the device specific manual pages for details.
- *
- * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined 
- * herein (making it not too portable)
- *
- * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, 
- * resets error counters, and restarts recording and playback as appropriate
- * for the current sampling mode.
- */
-#define	AUDIO_GETINFO	_IOR('A', 1, audio_info_t)
-#define	AUDIO_SETINFO	_IOWR('A', 2, audio_info_t)
-#define	AUDIO_DRAIN	_IO('A', 3)
-#define	AUDIO_GETDEV	_IOR('A', 4, audio_device_t)
-#define	AUDIO_GETDEV_SUNOS	_IOR('A', 4, int)
-#define AUDIO_FLUSH     _IO('A', 5)
-
-/* Define possible audio hardware configurations for 
- * old SunOS-style AUDIO_GETDEV ioctl */
-#define AUDIO_DEV_UNKNOWN       (0)     /* not defined */
-#define AUDIO_DEV_AMD           (1)     /* audioamd device */
-#define AUDIO_DEV_SPEAKERBOX    (2)     /* dbri device with speakerbox */
-#define AUDIO_DEV_CODEC         (3)     /* dbri device (internal speaker) */
-#define AUDIO_DEV_CS4231        (5)     /* cs4231 device */
-
-/*
- * The following ioctl sets the audio device into an internal loopback mode,
- * if the hardware supports this.  The argument is TRUE to set loopback,
- * FALSE to reset to normal operation.  If the hardware does not support
- * internal loopback, the ioctl should fail with EINVAL.
- * Causes ADC data to be digitally mixed in and sent to the DAC.
- */
-#define	AUDIO_DIAG_LOOPBACK	_IOW('A', 101, int)
-
-#endif /* _AUDIOIO_H_ */
diff --git a/include/asm-sparc64/audioio.h b/include/asm-sparc64/audioio.h
deleted file mode 100644
index cf16173f521b..000000000000
--- a/include/asm-sparc64/audioio.h
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * include/asm-sparc/audioio.h
- *
- * Sparc Audio Midlayer
- * Copyright (C) 1996 Thomas K. Dyas (tdyas@noc.rutgers.edu)
- */
-
-#ifndef _AUDIOIO_H_
-#define _AUDIOIO_H_
-
-/*
- *	SunOS/Solaris /dev/audio interface
- */
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/ioctl.h>
-#endif
-
-/*
- * This structure contains state information for audio device IO streams.
- */
-typedef struct audio_prinfo {
-	/*
-	 * The following values describe the audio data encoding.
-	 */
-	unsigned int sample_rate;	/* samples per second */
-	unsigned int channels;	/* number of interleaved channels */
-	unsigned int precision;	/* bit-width of each sample */
-	unsigned int encoding;	/* data encoding method */
-
-	/*
-	 * The following values control audio device configuration
-	 */
-	unsigned int gain;		/* gain level: 0 - 255 */
-	unsigned int port;		/* selected I/O port (see below) */
-	unsigned int avail_ports;	/* available I/O ports (see below) */
-	unsigned int _xxx[2];		/* Reserved for future use */
-
-	unsigned int buffer_size;	/* I/O buffer size */
-
-	/*
-	 * The following values describe driver state
-	 */
-	unsigned int samples;		/* number of samples converted */
-	unsigned int eof;		/* End Of File counter (play only) */
-
-	unsigned char	pause;		/* non-zero for pause, zero to resume */
-	unsigned char	error;		/* non-zero if overflow/underflow */
-	unsigned char	waiting;	/* non-zero if a process wants access */
-	unsigned char balance;	/* stereo channel balance */
-
-	unsigned short minordev;
-
-	/*
-	 * The following values are read-only state flags
-	 */
-	unsigned char open;		/* non-zero if open access permitted */
-	unsigned char active;		/* non-zero if I/O is active */
-} audio_prinfo_t;
-
-
-/*
- * This structure describes the current state of the audio device.
- */
-typedef struct audio_info {
-	/*
-	 * Per-stream information
-	 */
-	audio_prinfo_t play;	/* output status information */
-	audio_prinfo_t record;	/* input status information */
-
-	/*
-	 * Per-unit/channel information
-	 */
-	unsigned int monitor_gain;	/* input to output mix: 0 - 255 */
-	unsigned char output_muted;	/* non-zero if output is muted */
-	unsigned char _xxx[3];	/* Reserved for future use */
-	unsigned int _yyy[3];		/* Reserved for future use */
-} audio_info_t;
-
-
-/*
- * Audio encoding types
- */
-#define	AUDIO_ENCODING_NONE	(0)	/* no encoding assigned	  */
-#define	AUDIO_ENCODING_ULAW	(1)	/* u-law encoding	  */
-#define	AUDIO_ENCODING_ALAW	(2)	/* A-law encoding	  */
-#define	AUDIO_ENCODING_LINEAR	(3)	/* Linear PCM encoding	  */
-#define AUDIO_ENCODING_FLOAT    (4)     /* IEEE float (-1. <-> +1.) */
-#define	AUDIO_ENCODING_DVI	(104)	/* DVI ADPCM		  */
-#define	AUDIO_ENCODING_LINEAR8	(105)	/* 8 bit UNSIGNED	  */
-#define	AUDIO_ENCODING_LINEARLE	(106)	/* Linear PCM LE encoding */
-
-/*
- * These ranges apply to record, play, and monitor gain values
- */
-#define	AUDIO_MIN_GAIN	(0)	/* minimum gain value */
-#define	AUDIO_MAX_GAIN	(255)	/* maximum gain value */
-
-/*
- * These values apply to the balance field to adjust channel gain values
- */
-#define	AUDIO_LEFT_BALANCE	(0)	/* left channel only	*/
-#define	AUDIO_MID_BALANCE	(32)	/* equal left/right channel */
-#define	AUDIO_RIGHT_BALANCE	(64)	/* right channel only	*/
-#define	AUDIO_BALANCE_SHIFT	(3)
-
-/*
- * Generic minimum/maximum limits for number of channels, both modes
- */
-#define	AUDIO_MIN_PLAY_CHANNELS	(1)
-#define	AUDIO_MAX_PLAY_CHANNELS	(4)
-#define	AUDIO_MIN_REC_CHANNELS	(1)
-#define	AUDIO_MAX_REC_CHANNELS	(4)
-
-/*
- * Generic minimum/maximum limits for sample precision
- */
-#define	AUDIO_MIN_PLAY_PRECISION	(8)
-#define	AUDIO_MAX_PLAY_PRECISION	(32)
-#define	AUDIO_MIN_REC_PRECISION		(8)
-#define	AUDIO_MAX_REC_PRECISION		(32)
-
-/*
- * Define some convenient names for typical audio ports
- */
-/*
- * output ports (several may be enabled simultaneously)
- */
-#define	AUDIO_SPEAKER		0x01	/* output to built-in speaker */
-#define	AUDIO_HEADPHONE		0x02	/* output to headphone jack */
-#define	AUDIO_LINE_OUT		0x04	/* output to line out	 */
-
-/*
- * input ports (usually only one at a time)
- */
-#define	AUDIO_MICROPHONE	0x01	/* input from microphone */
-#define	AUDIO_LINE_IN		0x02	/* input from line in	 */
-#define	AUDIO_CD		0x04	/* input from on-board CD inputs */
-#define	AUDIO_INTERNAL_CD_IN	AUDIO_CD	/* input from internal CDROM */
-#define AUDIO_ANALOG_LOOPBACK   0x40    /* input from output */
-
-
-/*
- * This macro initializes an audio_info structure to 'harmless' values.
- * Note that (~0) might not be a harmless value for a flag that was
- * a signed int.
- */
-#define	AUDIO_INITINFO(i)	{					\
-	unsigned int	*__x__;						\
-	for (__x__ = (unsigned int *)(i);				\
-	    (char *) __x__ < (((char *)(i)) + sizeof (audio_info_t));	\
-	    *__x__++ = ~0);						\
-}
-
-/*
- * These allow testing for what the user wants to set 
- */
-#define AUD_INITVALUE   (~0)
-#define Modify(X)       ((unsigned int)(X) != AUD_INITVALUE)
-#define Modifys(X)      ((X) != (unsigned short)AUD_INITVALUE)
-#define Modifyc(X)      ((X) != (unsigned char)AUD_INITVALUE)
-
-/*
- * Parameter for the AUDIO_GETDEV ioctl to determine current
- * audio devices.
- */
-#define	MAX_AUDIO_DEV_LEN	(16)
-typedef struct audio_device {
-	char name[MAX_AUDIO_DEV_LEN];
-	char version[MAX_AUDIO_DEV_LEN];
-	char config[MAX_AUDIO_DEV_LEN];
-} audio_device_t;
-
-
-/*
- * Ioctl calls for the audio device.
- */
-
-/*
- * AUDIO_GETINFO retrieves the current state of the audio device.
- *
- * AUDIO_SETINFO copies all fields of the audio_info structure whose
- * values are not set to the initialized value (-1) to the device state.
- * It performs an implicit AUDIO_GETINFO to return the new state of the
- * device.  Note that the record.samples and play.samples fields are set
- * to the last value before the AUDIO_SETINFO took effect.  This allows
- * an application to reset the counters while atomically retrieving the
- * last value.
- *
- * AUDIO_DRAIN suspends the calling process until the write buffers are
- * empty.
- *
- * AUDIO_GETDEV returns a structure of type audio_device_t which contains
- * three strings.  The string "name" is a short identifying string (for
- * example, the SBus Fcode name string), the string "version" identifies
- * the current version of the device, and the "config" string identifies
- * the specific configuration of the audio stream.  All fields are
- * device-dependent -- see the device specific manual pages for details.
- *
- * AUDIO_GETDEV_SUNOS returns a number which is an audio device defined 
- * herein (making it not too portable)
- *
- * AUDIO_FLUSH stops all playback and recording, clears all queued buffers, 
- * resets error counters, and restarts recording and playback as appropriate
- * for the current sampling mode.
- */
-#define	AUDIO_GETINFO	_IOR('A', 1, audio_info_t)
-#define	AUDIO_SETINFO	_IOWR('A', 2, audio_info_t)
-#define	AUDIO_DRAIN	_IO('A', 3)
-#define	AUDIO_GETDEV	_IOR('A', 4, audio_device_t)
-#define	AUDIO_GETDEV_SUNOS	_IOR('A', 4, int)
-#define AUDIO_FLUSH     _IO('A', 5)
-
-/* Define possible audio hardware configurations for 
- * old SunOS-style AUDIO_GETDEV ioctl */
-#define AUDIO_DEV_UNKNOWN       (0)     /* not defined */
-#define AUDIO_DEV_AMD           (1)     /* audioamd device */
-#define AUDIO_DEV_SPEAKERBOX    (2)     /* dbri device with speakerbox */
-#define AUDIO_DEV_CODEC         (3)     /* dbri device (internal speaker) */
-#define AUDIO_DEV_CS4231        (5)     /* cs4231 device */
-
-/*
- * The following ioctl sets the audio device into an internal loopback mode,
- * if the hardware supports this.  The argument is TRUE to set loopback,
- * FALSE to reset to normal operation.  If the hardware does not support
- * internal loopback, the ioctl should fail with EINVAL.
- * Causes ADC data to be digitally mixed in and sent to the DAC.
- */
-#define	AUDIO_DIAG_LOOPBACK	_IOW('A', 101, int)
-
-#endif /* _AUDIOIO_H_ */
-- 
cgit v1.2.3


From e1413315b8dfcdebc61416dadc1334619dfb4543 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 7 Nov 2005 14:11:25 -0800
Subject: [SPARC]: remove kbio.h

The old keyboard driver is gone in 2.6, so the only user left are the
compat ioctls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/ioctl32.c | 11 ---------
 include/asm-sparc/kbio.h      | 56 -------------------------------------------
 include/asm-sparc64/kbio.h    | 56 -------------------------------------------
 3 files changed, 123 deletions(-)
 delete mode 100644 include/asm-sparc/kbio.h
 delete mode 100644 include/asm-sparc64/kbio.h

(limited to 'include')

diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
index 6fda044a7372..947bd265aaa4 100644
--- a/arch/sparc64/kernel/ioctl32.c
+++ b/arch/sparc64/kernel/ioctl32.c
@@ -14,7 +14,6 @@
 #include <linux/ncp_fs.h>
 #include <linux/syscalls.h>
 #include <asm/fbio.h>
-#include <asm/kbio.h>
 #include <asm/vuid_event.h>
 #include <asm/envctrl.h>
 #include <asm/display7seg.h>
@@ -473,16 +472,6 @@ COMPATIBLE_IOCTL(FBIOSCURPOS)
 COMPATIBLE_IOCTL(FBIOGCURPOS)
 COMPATIBLE_IOCTL(FBIOGCURMAX)
 /* Little k */
-COMPATIBLE_IOCTL(KIOCTYPE)
-COMPATIBLE_IOCTL(KIOCLAYOUT)
-COMPATIBLE_IOCTL(KIOCGTRANS)
-COMPATIBLE_IOCTL(KIOCTRANS)
-COMPATIBLE_IOCTL(KIOCCMD)
-COMPATIBLE_IOCTL(KIOCSDIRECT)
-COMPATIBLE_IOCTL(KIOCSLED)
-COMPATIBLE_IOCTL(KIOCGLED)
-COMPATIBLE_IOCTL(KIOCSRATE)
-COMPATIBLE_IOCTL(KIOCGRATE)
 COMPATIBLE_IOCTL(VUIDSFORMAT)
 COMPATIBLE_IOCTL(VUIDGFORMAT)
 /* Little v, the video4linux ioctls */
diff --git a/include/asm-sparc/kbio.h b/include/asm-sparc/kbio.h
deleted file mode 100644
index 3cf496bdf399..000000000000
--- a/include/asm-sparc/kbio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __LINUX_KBIO_H
-#define __LINUX_KBIO_H
-
-/* Return keyboard type */
-#define KIOCTYPE    _IOR('k', 9, int)
-/* Return Keyboard layout */
-#define KIOCLAYOUT  _IOR('k', 20, int)
-
-enum {
-    TR_NONE,
-    TR_ASCII,			/* keyboard is in regular state */
-    TR_EVENT,			/* keystrokes sent as firm events */
-    TR_UNTRANS_EVENT		/* EVENT+up and down+no translation */
-};
-
-/* Return the current keyboard translation */
-#define KIOCGTRANS  _IOR('k', 5, int)
-/* Set the keyboard translation */
-#define KIOCTRANS   _IOW('k', 0, int)
-
-/* Send a keyboard command */
-#define KIOCCMD     _IOW('k', 8, int)
-
-/* Return if keystrokes are being sent to /dev/kbd */
-
-/* Set routing of keystrokes to /dev/kbd */
-#define KIOCSDIRECT _IOW('k', 10, int)
-
-/* Set keyboard leds */
-#define KIOCSLED    _IOW('k', 14, unsigned char)
-
-/* Get keyboard leds */
-#define KIOCGLED    _IOR('k', 15, unsigned char)
-
-/* Used by KIOC[GS]RATE */
-struct kbd_rate {
-	unsigned char delay;	/* Delay in Hz before first repeat.	*/
-	unsigned char rate;	/* In characters per second (0..50).	*/
-};
-
-/* Set keyboard rate */
-#define KIOCSRATE   _IOW('k', 40, struct kbd_rate)
-
-/* Get keyboard rate */
-#define KIOCGRATE   _IOW('k', 41, struct kbd_rate)
-
-/* Top bit records if the key is up or down */
-#define KBD_UP      0x80
-
-/* Usable information */
-#define KBD_KEYMASK 0x7f
-
-/* All keys up */
-#define KBD_IDLE    0x75
-
-#endif /* __LINUX_KBIO_H */
diff --git a/include/asm-sparc64/kbio.h b/include/asm-sparc64/kbio.h
deleted file mode 100644
index 3cf496bdf399..000000000000
--- a/include/asm-sparc64/kbio.h
+++ /dev/null
@@ -1,56 +0,0 @@
-#ifndef __LINUX_KBIO_H
-#define __LINUX_KBIO_H
-
-/* Return keyboard type */
-#define KIOCTYPE    _IOR('k', 9, int)
-/* Return Keyboard layout */
-#define KIOCLAYOUT  _IOR('k', 20, int)
-
-enum {
-    TR_NONE,
-    TR_ASCII,			/* keyboard is in regular state */
-    TR_EVENT,			/* keystrokes sent as firm events */
-    TR_UNTRANS_EVENT		/* EVENT+up and down+no translation */
-};
-
-/* Return the current keyboard translation */
-#define KIOCGTRANS  _IOR('k', 5, int)
-/* Set the keyboard translation */
-#define KIOCTRANS   _IOW('k', 0, int)
-
-/* Send a keyboard command */
-#define KIOCCMD     _IOW('k', 8, int)
-
-/* Return if keystrokes are being sent to /dev/kbd */
-
-/* Set routing of keystrokes to /dev/kbd */
-#define KIOCSDIRECT _IOW('k', 10, int)
-
-/* Set keyboard leds */
-#define KIOCSLED    _IOW('k', 14, unsigned char)
-
-/* Get keyboard leds */
-#define KIOCGLED    _IOR('k', 15, unsigned char)
-
-/* Used by KIOC[GS]RATE */
-struct kbd_rate {
-	unsigned char delay;	/* Delay in Hz before first repeat.	*/
-	unsigned char rate;	/* In characters per second (0..50).	*/
-};
-
-/* Set keyboard rate */
-#define KIOCSRATE   _IOW('k', 40, struct kbd_rate)
-
-/* Get keyboard rate */
-#define KIOCGRATE   _IOW('k', 41, struct kbd_rate)
-
-/* Top bit records if the key is up or down */
-#define KBD_UP      0x80
-
-/* Usable information */
-#define KBD_KEYMASK 0x7f
-
-/* All keys up */
-#define KBD_IDLE    0x75
-
-#endif /* __LINUX_KBIO_H */
-- 
cgit v1.2.3


From 59f85dc95e81281b424b2eb0e7b002cf7f77db03 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 7 Nov 2005 14:11:38 -0800
Subject: [SPARC]: remove vuid_event.h

I don't know if we ever implemented this, but the only user in any 2.6
tree are the compat ioctls.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/ioctl32.c    |  3 ---
 include/asm-m68k/vuid_event.h    |  4 ----
 include/asm-sparc/vuid_event.h   | 41 ----------------------------------------
 include/asm-sparc64/vuid_event.h | 40 ---------------------------------------
 4 files changed, 88 deletions(-)
 delete mode 100644 include/asm-m68k/vuid_event.h
 delete mode 100644 include/asm-sparc/vuid_event.h
 delete mode 100644 include/asm-sparc64/vuid_event.h

(limited to 'include')

diff --git a/arch/sparc64/kernel/ioctl32.c b/arch/sparc64/kernel/ioctl32.c
index 947bd265aaa4..94e2b99802c8 100644
--- a/arch/sparc64/kernel/ioctl32.c
+++ b/arch/sparc64/kernel/ioctl32.c
@@ -14,7 +14,6 @@
 #include <linux/ncp_fs.h>
 #include <linux/syscalls.h>
 #include <asm/fbio.h>
-#include <asm/vuid_event.h>
 #include <asm/envctrl.h>
 #include <asm/display7seg.h>
 #include <asm/openpromio.h>
@@ -472,8 +471,6 @@ COMPATIBLE_IOCTL(FBIOSCURPOS)
 COMPATIBLE_IOCTL(FBIOGCURPOS)
 COMPATIBLE_IOCTL(FBIOGCURMAX)
 /* Little k */
-COMPATIBLE_IOCTL(VUIDSFORMAT)
-COMPATIBLE_IOCTL(VUIDGFORMAT)
 /* Little v, the video4linux ioctls */
 COMPATIBLE_IOCTL(_IOR('p', 20, int[7])) /* RTCGET */
 COMPATIBLE_IOCTL(_IOW('p', 21, int[7])) /* RTCSET */
diff --git a/include/asm-m68k/vuid_event.h b/include/asm-m68k/vuid_event.h
deleted file mode 100644
index 52ecb521a395..000000000000
--- a/include/asm-m68k/vuid_event.h
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef _M68K_VUID_EVENT_H
-#define _M68K_VUID_EVENT_H
-#include <asm-sparc/vuid_event.h>
-#endif
diff --git a/include/asm-sparc/vuid_event.h b/include/asm-sparc/vuid_event.h
deleted file mode 100644
index 7781e9f2fdd3..000000000000
--- a/include/asm-sparc/vuid_event.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* SunOS Virtual User Input Device (VUID) compatibility */
-
-
-typedef struct firm_event {
-	unsigned short id;	  /* tag for this event */
-	unsigned char  pair_type; /* unused by X11 */
-        unsigned char  pair;	  /* unused by X11 */
-        int            value;	  /* VKEY_UP, VKEY_DOWN or delta */
-        struct timeval time;
-} Firm_event;
-
-enum {
-    FE_PAIR_NONE,
-    FE_PAIR_SET,
-    FE_PAIR_DELTA,
-    FE_PAIR_ABSOLUTE
-};
-
-/* VUID stream formats */
-#define VUID_NATIVE     0	/* Native byte stream format */
-#define VUID_FIRM_EVENT 1	/* send firm_event structures */
-
-/* ioctls */
-    /* Set input device byte stream format (any of VUID_{NATIVE,FIRM_EVENT}) */
-#define VUIDSFORMAT   _IOW('v', 1, int)
-    /* Retrieve input device byte stream format */
-#define VUIDGFORMAT   _IOR('v', 2, int)
-
-/* Possible tag values */
-/*    mouse buttons: */
-#define MS_LEFT         0x7f20
-#define MS_MIDDLE       0x7f21
-#define MS_RIGHT        0x7f22
-/*    motion: */
-#define LOC_X_DELTA     0x7f80
-#define LOC_Y_DELTA     0x7f81
-#define LOC_X_ABSOLUTE  0x7f82  /* X compat, unsupported */
-#define LOC_Y_ABSOLUTE  0x7f83  /* X compat, unsupported */
-
-#define VKEY_UP   0
-#define VKEY_DOWN 1
diff --git a/include/asm-sparc64/vuid_event.h b/include/asm-sparc64/vuid_event.h
deleted file mode 100644
index 9ef4d17ad08f..000000000000
--- a/include/asm-sparc64/vuid_event.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* SunOS Virtual User Input Device (VUID) compatibility */
-
-typedef struct firm_event {
-	unsigned short id;	  /* tag for this event */
-	unsigned char  pair_type; /* unused by X11 */
-        unsigned char  pair;	  /* unused by X11 */
-        int            value;	  /* VKEY_UP, VKEY_DOWN or delta */
-        struct timeval time;
-} Firm_event;
-
-enum {
-    FE_PAIR_NONE,
-    FE_PAIR_SET,
-    FE_PAIR_DELTA,
-    FE_PAIR_ABSOLUTE
-};
-
-/* VUID stream formats */
-#define VUID_NATIVE     0	/* Native byte stream format */
-#define VUID_FIRM_EVENT 1	/* send firm_event structures */
-
-/* ioctls */
-    /* Set input device byte stream format (any of VUID_{NATIVE,FIRM_EVENT}) */
-#define VUIDSFORMAT   _IOW('v', 1, int)
-    /* Retrieve input device byte stream format */
-#define VUIDGFORMAT   _IOR('v', 2, int)
-
-/* Possible tag values */
-/*    mouse buttons: */
-#define MS_LEFT         0x7f20
-#define MS_MIDDLE       0x7f21
-#define MS_RIGHT        0x7f22
-/*    motion: */
-#define LOC_X_DELTA     0x7f80
-#define LOC_Y_DELTA     0x7f81
-#define LOC_X_ABSOLUTE  0x7f82  /* X compat, unsupported */
-#define LOC_Y_ABSOLUTE  0x7f83  /* X compat, unsupported */
-
-#define VKEY_UP   0
-#define VKEY_DOWN 1
-- 
cgit v1.2.3


From 59871bcd1197014aacdf8e398c407cab70ab74e7 Mon Sep 17 00:00:00 2001
From: Hugh Dickins <hugh@veritas.com>
Date: Mon, 7 Nov 2005 14:12:08 -0800
Subject: [SPARC64] mm: simpler tlb_flush_mmu

Minor simplification to the sparc64 tlb_flush_mmu: tlb_remove_page
set need_flush only after handling the tlb_fast_mode case, then
tlb_flush_mmu need not consider whether it's tlb_fast_mode.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/asm-sparc64/tlb.h | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

(limited to 'include')

diff --git a/include/asm-sparc64/tlb.h b/include/asm-sparc64/tlb.h
index 1eda17954f39..61c01882b562 100644
--- a/include/asm-sparc64/tlb.h
+++ b/include/asm-sparc64/tlb.h
@@ -58,11 +58,9 @@ static inline struct mmu_gather *tlb_gather_mmu(struct mm_struct *mm, unsigned i
 static inline void tlb_flush_mmu(struct mmu_gather *mp)
 {
 	if (mp->need_flush) {
+		free_pages_and_swap_cache(mp->pages, mp->pages_nr);
+		mp->pages_nr = 0;
 		mp->need_flush = 0;
-		if (!tlb_fast_mode(mp)) {
-			free_pages_and_swap_cache(mp->pages, mp->pages_nr);
-			mp->pages_nr = 0;
-		}
 	}
 
 }
@@ -91,11 +89,11 @@ static inline void tlb_finish_mmu(struct mmu_gather *mp, unsigned long start, un
 
 static inline void tlb_remove_page(struct mmu_gather *mp, struct page *page)
 {
-	mp->need_flush = 1;
 	if (tlb_fast_mode(mp)) {
 		free_page_and_swap_cache(page);
 		return;
 	}
+	mp->need_flush = 1;
 	mp->pages[mp->pages_nr++] = page;
 	if (mp->pages_nr >= FREE_PTE_NR)
 		tlb_flush_mmu(mp);
-- 
cgit v1.2.3


From 16cf0d816541fde06ed8f37c0f5cf9940cdfc145 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 7 Nov 2005 14:12:21 -0800
Subject: [SPARC]: Kill remaining kbio.h references.

Would you mind applying the following patch that kills those two + the
m68k and Documentation/ references?

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 Documentation/ioctl-number.txt      | 2 --
 arch/sparc/kernel/sunos_ioctl.c     | 1 -
 arch/sparc64/kernel/sunos_ioctl32.c | 1 -
 include/asm-m68k/kbio.h             | 1 -
 4 files changed, 5 deletions(-)
 delete mode 100644 include/asm-m68k/kbio.h

(limited to 'include')

diff --git a/Documentation/ioctl-number.txt b/Documentation/ioctl-number.txt
index 769f925c8526..87f4d052e39c 100644
--- a/Documentation/ioctl-number.txt
+++ b/Documentation/ioctl-number.txt
@@ -130,8 +130,6 @@ Code	Seq#	Include File		Comments
 					<mailto:zapman@interlan.net>
 'i'	00-3F	linux/i2o.h
 'j'	00-3F	linux/joystick.h
-'k'	all	asm-sparc/kbio.h
-		asm-sparc64/kbio.h
 'l'	00-3F	linux/tcfs_fs.h		transparent cryptographic file system
 					<http://mikonos.dia.unisa.it/tcfs>
 'l'	40-7F	linux/udf_fs_i.h	in development:
diff --git a/arch/sparc/kernel/sunos_ioctl.c b/arch/sparc/kernel/sunos_ioctl.c
index df1c0b31a930..a6ba3d26222c 100644
--- a/arch/sparc/kernel/sunos_ioctl.c
+++ b/arch/sparc/kernel/sunos_ioctl.c
@@ -23,7 +23,6 @@
 #include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 #include <linux/file.h>
-#include <asm/kbio.h>
 
 #if 0
 extern char sunkbd_type;
diff --git a/arch/sparc64/kernel/sunos_ioctl32.c b/arch/sparc64/kernel/sunos_ioctl32.c
index 7654b8a7f03a..3f619ead22cc 100644
--- a/arch/sparc64/kernel/sunos_ioctl32.c
+++ b/arch/sparc64/kernel/sunos_ioctl32.c
@@ -24,7 +24,6 @@
 #include <linux/smp_lock.h>
 #include <linux/syscalls.h>
 #include <linux/compat.h>
-#include <asm/kbio.h>
 
 #define SUNOS_NR_OPEN	256
 
diff --git a/include/asm-m68k/kbio.h b/include/asm-m68k/kbio.h
deleted file mode 100644
index e1fbf8fba3e8..000000000000
--- a/include/asm-m68k/kbio.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-sparc/kbio.h>
-- 
cgit v1.2.3