Received: from mail.onstor.com ([66.201.51.107]) by onstor-exch02.onstor.net with Microsoft SMTPSVC(6.0.3790.1830);
	 Sun, 10 Feb 2008 11:32:45 -0800
Received: from ftp.linux-mips.org ([194.74.144.162]) by mail.onstor.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Sun, 10 Feb 2008 11:32:45 -0800
Received: from localhost.localdomain ([127.0.0.1]:30140 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP
	id S20029484AbYBJTcZ (ORCPT <rfc822;andy.sharp@onstor.com>);
	Sun, 10 Feb 2008 19:32:25 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Sun, 10 Feb 2008 19:32:04 +0000 (GMT)
Received: from bes.recconet.de ([212.227.59.164]:43923 "EHLO bes.recconet.de")
	by ftp.linux-mips.org with ESMTP id S20029073AbYBJTb4 (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Sun, 10 Feb 2008 19:31:56 +0000
Received: from trinity.recco.de (trinity.intern.recconet.de [192.168.11.241])
	by bes.recconet.de (8.13.1/8.13.1/Recconet-2005031001) with ESMTP id m1AJVbDQ007339;
	Sun, 10 Feb 2008 20:31:55 +0100
Received: from [172.16.135.104] (galileo.recco.de [172.16.135.104])
	(authenticated bits=0)
	by trinity.recco.de (8.13.1/8.13.1/Reccoware-2005061101) with ESMTP id m1AJVXEp032277;
	Sun, 10 Feb 2008 20:31:34 +0100
Subject: [PATCH] [MIPS] Fix ids in Alchemy db dma device table (Repost in
	hopefully correct format)
From:	Wolfgang Ocker <weo@reccoware.de>
To:	ralf@linux-mips.org
Cc:	linux-mips@linux-mips.org
Content-Type: text/plain
Organization: Reccoware Systems
Date:	Sun, 10 Feb 2008 20:31:33 +0100
Message-Id: <1202671893.3384.20.camel@galileo.recco.de>
Mime-Version: 1.0
X-Mailer: Evolution 2.12.3 (2.12.3-1.fc8) 
Content-Transfer-Encoding: 7bit
X-archive-position: 18210
X-ecartis-version: Ecartis v1.0.0
Sender:	linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: weo@reccoware.de
Precedence: bulk
X-list:	linux-mips
Return-Path: linux-mips-bounce@linux-mips.org
X-OriginalArrivalTime: 10 Feb 2008 19:32:45.0062 (UTC) FILETIME=[B5D52260:01C86C1B]

From: Wolfgang Ocker <weo@reccoware.de>

0 is a valid device id (DSCR_CMD0_UART0_TX), so we can't use it to mark
an empty entry in the device table. Use ~0 instead and search for id ~0
when looking for a free entry.

Signed-off-by: Wolfgang Ocker <weo@reccoware.de>
---

diff -up linux-2.6.24/arch/mips/au1000/common/dbdma.c.devtab_fix linux-2.6.24/arch/mips/au1000/common/dbdma.c
--- linux-2.6.24/arch/mips/au1000/common/dbdma.c.devtab_fix	2008-01-24 23:58:37.000000000 +0100
+++ linux-2.6.24/arch/mips/au1000/common/dbdma.c	2008-02-06 11:51:16.000000000 +0100
@@ -161,22 +161,22 @@ static dbdev_tab_t dbdev_tab[] = {
 	{ DSCR_CMD0_ALWAYS, DEV_FLAGS_ANYUSE, 0, 0, 0x00000000, 0, 0 },
 
 	/* Provide 16 user definable device types */
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
-	{ 0, 0, 0, 0, 0, 0, 0 },
+	{ ~0, 0, 0, 0, 0, 0, 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