LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
To: Dan Williams <dan.j.williams@intel.com>, linux-kernel@vger.kernel.org
Cc: Shannon Nelson <shannon.nelson@intel.com>,
David Brownell <david-b@pacbell.net>,
kernel@avr32linux.org, "Francis Moreau" <francis.moro@gmail.com>,
"Paul Mundt" <lethal@linux-sh.org>,
"Vladimir A. Barinov" <vbarinov@ru.mvista.com>,
Pierre Ossman <drzeus-list@drzeus.cx>,
Haavard Skinnemoen <hskinnemoen@atmel.com>
Subject: [RFC v2 1/5] dmaengine: Add dma_client parameter to device_alloc_chan_resources
Date: Tue, 29 Jan 2008 19:10:09 +0100 [thread overview]
Message-ID: <1201630213-31900-2-git-send-email-hskinnemoen@atmel.com> (raw)
In-Reply-To: <1201630213-31900-1-git-send-email-hskinnemoen@atmel.com>
A DMA controller capable of doing slave transfers may need to know a
few things about the slave when preparing the channel. We don't want
to add this information to struct dma_channel since the channel hasn't
yet been bound to a client at this point.
Instead, pass a reference to the client requesting the channel to the
driver's device_alloc_chan_resources hook so that it can pick the
necessary information from the dma_client struct by itself.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
drivers/dma/dmaengine.c | 3 ++-
drivers/dma/ioat_dma.c | 5 +++--
drivers/dma/iop-adma.c | 7 ++++---
include/linux/dmaengine.h | 3 ++-
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 2996523..9b5bed9 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -174,7 +174,8 @@ static void dma_client_chan_alloc(struct dma_client *client)
if (!dma_chan_satisfies_mask(chan, client->cap_mask))
continue;
- desc = chan->device->device_alloc_chan_resources(chan);
+ desc = chan->device->device_alloc_chan_resources(
+ chan, client);
if (desc >= 0) {
ack = client->event_callback(client,
chan,
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index dff38ac..3e82bfb 100644
--- a/drivers/dma/ioat_dma.c
+++ b/drivers/dma/ioat_dma.c
@@ -452,7 +452,8 @@ static void ioat2_dma_massage_chan_desc(struct ioat_dma_chan *ioat_chan)
* ioat_dma_alloc_chan_resources - returns the number of allocated descriptors
* @chan: the channel to be filled out
*/
-static int ioat_dma_alloc_chan_resources(struct dma_chan *chan)
+static int ioat_dma_alloc_chan_resources(struct dma_chan *chan,
+ struct dma_client *client)
{
struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
struct ioat_desc_sw *desc;
@@ -1058,7 +1059,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
dma_chan = container_of(device->common.channels.next,
struct dma_chan,
device_node);
- if (device->common.device_alloc_chan_resources(dma_chan) < 1) {
+ if (device->common.device_alloc_chan_resources(dma_chan, NULL) < 1) {
dev_err(&device->pdev->dev,
"selftest cannot allocate chan resource\n");
err = -ENODEV;
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 853af18..a784918 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -447,7 +447,8 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan);
static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan);
/* returns the number of allocated descriptors */
-static int iop_adma_alloc_chan_resources(struct dma_chan *chan)
+static int iop_adma_alloc_chan_resources(struct dma_chan *chan,
+ struct dma_client *client)
{
char *hw_desc;
int idx;
@@ -844,7 +845,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
dma_chan = container_of(device->common.channels.next,
struct dma_chan,
device_node);
- if (iop_adma_alloc_chan_resources(dma_chan) < 1) {
+ if (iop_adma_alloc_chan_resources(dma_chan, NULL) < 1) {
err = -ENODEV;
goto out;
}
@@ -942,7 +943,7 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)
dma_chan = container_of(device->common.channels.next,
struct dma_chan,
device_node);
- if (iop_adma_alloc_chan_resources(dma_chan) < 1) {
+ if (iop_adma_alloc_chan_resources(dma_chan, NULL) < 1) {
err = -ENODEV;
goto out;
}
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 586ea37..160835c 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -278,7 +278,8 @@ struct dma_device {
int dev_id;
struct device *dev;
- int (*device_alloc_chan_resources)(struct dma_chan *chan);
+ int (*device_alloc_chan_resources)(struct dma_chan *chan,
+ struct dma_client *client);
void (*device_free_chan_resources)(struct dma_chan *chan);
struct dma_async_tx_descriptor *(*device_prep_dma_memcpy)(
--
1.5.3.8
next prev parent reply other threads:[~2008-01-29 18:11 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-29 18:10 [RFC v2 0/5] dmaengine: Slave DMA interface and example users Haavard Skinnemoen
2008-01-29 18:10 ` Haavard Skinnemoen [this message]
2008-01-29 18:10 ` [RFC v2 2/5] dmaengine: Add slave DMA interface Haavard Skinnemoen
2008-01-29 18:10 ` [RFC v2 3/5] dmaengine: Make DMA Engine menu visible for AVR32 users Haavard Skinnemoen
2008-01-29 18:10 ` [RFC v2 4/5] dmaengine: Driver for the Synopsys DesignWare DMA controller Haavard Skinnemoen
2008-01-29 18:10 ` [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers Haavard Skinnemoen
2008-02-13 18:30 ` Pierre Ossman
2008-02-13 18:47 ` Haavard Skinnemoen
2008-02-14 14:00 ` MMC core debugfs support (was Re: [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers) Haavard Skinnemoen
2008-02-25 17:12 ` Pierre Ossman
2008-02-13 19:11 ` [RFC v2 5/5] Atmel MCI: Driver for Atmel on-chip MMC controllers Dan Williams
2008-02-13 21:06 ` Haavard Skinnemoen
2008-02-13 23:55 ` Dan Williams
2008-02-14 8:36 ` Haavard Skinnemoen
2008-02-14 18:34 ` Dan Williams
2008-02-14 19:21 ` Haavard Skinnemoen
2008-01-30 18:53 ` [RFC v2 4/5] dmaengine: Driver for the Synopsys DesignWare DMA controller Dan Williams
2008-01-30 7:30 ` [RFC v2 2/5] dmaengine: Add slave DMA interface David Brownell
2008-01-30 9:27 ` Haavard Skinnemoen
2008-01-30 10:52 ` David Brownell
2008-01-30 12:26 ` Haavard Skinnemoen
2008-01-31 8:27 ` David Brownell
2008-01-31 8:44 ` Paul Mundt
2008-01-31 12:51 ` David Brownell
2008-01-31 14:12 ` Haavard Skinnemoen
2008-01-31 13:52 ` Haavard Skinnemoen
2008-02-06 21:08 ` Dan Williams
2008-02-07 17:56 ` Haavard Skinnemoen
2008-01-30 18:28 ` Dan Williams
2008-01-30 20:45 ` David Brownell
2008-01-31 6:35 ` SDIO driver not receiving responses Farbod Nejati
2008-02-07 19:51 ` Pierre Ossman
2008-01-29 20:54 ` [RFC v2 0/5] dmaengine: Slave DMA interface and example users Haavard Skinnemoen
2008-01-30 6:56 ` David Brownell
2008-01-30 8:56 ` Haavard Skinnemoen
2008-01-30 17:39 ` Dan Williams
2008-02-04 15:32 ` Haavard Skinnemoen
2008-02-06 18:46 ` Dan Williams
2008-02-07 17:52 ` Haavard Skinnemoen
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=1201630213-31900-2-git-send-email-hskinnemoen@atmel.com \
--to=hskinnemoen@atmel.com \
--cc=dan.j.williams@intel.com \
--cc=david-b@pacbell.net \
--cc=drzeus-list@drzeus.cx \
--cc=francis.moro@gmail.com \
--cc=kernel@avr32linux.org \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=shannon.nelson@intel.com \
--cc=vbarinov@ru.mvista.com \
--subject='Re: [RFC v2 1/5] dmaengine: Add dma_client parameter to device_alloc_chan_resources' \
/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
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).