Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Thu, 12 Mar 2009
 09:20:42 -0700
Received: from psmtp.com ([64.18.0.98]) by mail.onstor.com with Microsoft
 SMTPSVC(6.0.3790.3959);	 Thu, 12 Mar 2009 09:20:41 -0700
Received: from source ([213.58.128.207]) by exprod5mx275.postini.com
 ([64.18.4.10]) with SMTP;	Thu, 12 Mar 2009 09:20:41 PDT
Received: from localhost.localdomain ([127.0.0.1]:16338 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S21103533AbZCLQUQ
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Thu, 12 Mar 2009 16:20:16 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 12 Mar 2009 16:19:59
 +0000 (GMT)
Received: from mba.ocn.ne.jp ([122.1.235.107]:7152 "HELO smtp.mba.ocn.ne.jp")
	by ftp.linux-mips.org with SMTP id S21367622AbZCLQTv (ORCPT
	<rfc822;linux-mips@linux-mips.org>); Thu, 12 Mar 2009 16:19:51 +0000
Received: from localhost (p7055-ipad304funabasi.chiba.ocn.ne.jp
 [123.217.161.55])	by smtp.mba.ocn.ne.jp (Postfix) with ESMTP	id D8172A840;
 Fri, 13 Mar 2009 01:19:44 +0900 (JST)
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
To: "dan.j.williams@intel.com" <dan.j.williams@intel.com>
CC: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>,
	"ralf@linux-mips.org" <ralf@linux-mips.org>, "linux-kernel@vger.kernel.org"
	<linux-kernel@vger.kernel.org>, "haavard.skinnemoen@atmel.com"
	<haavard.skinnemoen@atmel.com>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Thu, 12 Mar 2009 09:19:50 -0700
Subject: Re: [PATCH 1/2] dmaengine: TXx9 Soc DMA Controller driver
Thread-Topic: [PATCH 1/2] dmaengine: TXx9 Soc DMA Controller driver
Thread-Index: AcmjLn1kuWBbF0pWShqCgE/OqvatmA==
Message-ID: <20090313.011950.61509382.anemo@mba.ocn.ne.jp>
References: <1234538938-23479-1-git-send-email-anemo@mba.ocn.ne.jp>
	<e9c3a7c20902251745t314c1e0cs114d2199ccc8cf36@mail.gmail.com>
	<20090227.002436.106263719.anemo@mba.ocn.ne.jp>
In-Reply-To: <20090227.002436.106263719.anemo@mba.ocn.ne.jp>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 12 Mar 2009 16:20:41.0280 (UTC)
 FILETIME=[7CB48C00:01C9A32E]
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:99.90000/99.90000 CV: 8.2367 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-neptune: 0/0/0.00/0
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: WBVOq8bF69ybYVFmnUB7UQ==
x-list: linux-mips
x-archive-position: 22070
x-ecartis-version: Ecartis v1.0.0
x-original-sender: anemo@mba.ocn.ne.jp
x-fingerprint: 6ACA 1623 39BD 9A94 9B1A  B746 CA77 FE94 2874 D52F
x-pgp-public-key: http://wwwkeys.pgp.net/pks/lookup?op=get&search=0x2874D52F
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

On Fri, 27 Feb 2009 00:24:36 +0900 (JST), Atsushi Nemoto <anemo@mba.ocn.ne.=
jp> wrote:
> > Can you explain how reserved channels work?  It looks like you are
> > working around the generic dma channel allocator, maybe it requires
> > updating to meet your needs.
...
> I need the reserved_chan to make channel 3 named "dma0chan3".  If I
> can chose chan_id for each channels in dma_device, the reserved_chan
> is not needed.

So, how about this?  If it was accepted, I can remove reserved_chan
from txx9dmac driver.

------------------------------------------------------
Subject: dmaengine: Use chan_id provided by DMA device driver
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>

If chan_id was already given by the DMA device driver, use it.
Otherwise assign an incremental number for each channels.

This allows the DMA device driver to reserve some channel ID numbers.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
---
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 280a9d2..a3679a7 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -609,6 +609,7 @@ EXPORT_SYMBOL(dmaengine_put);
 int dma_async_device_register(struct dma_device *device)
 {
 	int chancnt =3D 0, rc;
+	unsigned int chan_id =3D 0;
 	struct dma_chan* chan;
 	atomic_t *idr_ref;
=20
@@ -663,7 +664,9 @@ int dma_async_device_register(struct dma_device *device=
)
 			continue;
 		}
=20
-		chan->chan_id =3D chancnt++;
+		if (!chan->chan_id)
+			chan->chan_id =3D chan_id++;
+		chancnt++;
 		chan->dev->device.class =3D &dma_devclass;
 		chan->dev->device.parent =3D device->dev;
 		chan->dev->chan =3D chan;

