aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma
diff options
context:
space:
mode:
authorHaavard Skinnemoen <haavard.skinnemoen@atmel.com>2008-07-08 14:58:58 -0400
committerDan Williams <dan.j.williams@intel.com>2008-07-08 14:58:58 -0400
commit848c536a37b8db4e461f14ca15fe29850151c822 (patch)
treef4a88e92e31de28511e3a3de99200a77d2613dae /drivers/dma
parent4a776f0aa922a552460192c07b56f4fe9cd82632 (diff)
dmaengine: Add dma_client parameter to device_alloc_chan_resources
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. [dan.j.williams@intel.com: fixed up fsldma and mv_xor] Acked-by: Maciej Sosnowski <maciej.sosnowski@intel.com> Signed-off-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r--drivers/dma/dmaengine.c3
-rw-r--r--drivers/dma/fsldma.c7
-rw-r--r--drivers/dma/ioat_dma.c5
-rw-r--r--drivers/dma/iop-adma.c7
-rw-r--r--drivers/dma/mv_xor.c7
5 files changed, 17 insertions, 12 deletions
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 10de69eb1a3e..7344f5dbd501 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)
174 if (!dma_chan_satisfies_mask(chan, client->cap_mask)) 174 if (!dma_chan_satisfies_mask(chan, client->cap_mask))
175 continue; 175 continue;
176 176
177 desc = chan->device->device_alloc_chan_resources(chan); 177 desc = chan->device->device_alloc_chan_resources(
178 chan, client);
178 if (desc >= 0) { 179 if (desc >= 0) {
179 ack = client->event_callback(client, 180 ack = client->event_callback(client,
180 chan, 181 chan,
diff --git a/drivers/dma/fsldma.c b/drivers/dma/fsldma.c
index 724f6fdd0af6..c0059ca58340 100644
--- a/drivers/dma/fsldma.c
+++ b/drivers/dma/fsldma.c
@@ -366,7 +366,8 @@ static struct fsl_desc_sw *fsl_dma_alloc_descriptor(
366 * 366 *
367 * Return - The number of descriptors allocated. 367 * Return - The number of descriptors allocated.
368 */ 368 */
369static int fsl_dma_alloc_chan_resources(struct dma_chan *chan) 369static int fsl_dma_alloc_chan_resources(struct dma_chan *chan,
370 struct dma_client *client)
370{ 371{
371 struct fsl_dma_chan *fsl_chan = to_fsl_chan(chan); 372 struct fsl_dma_chan *fsl_chan = to_fsl_chan(chan);
372 LIST_HEAD(tmp_list); 373 LIST_HEAD(tmp_list);
@@ -819,7 +820,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
819 820
820 chan = &fsl_chan->common; 821 chan = &fsl_chan->common;
821 822
822 if (fsl_dma_alloc_chan_resources(chan) < 1) { 823 if (fsl_dma_alloc_chan_resources(chan, NULL) < 1) {
823 dev_err(fsl_chan->dev, 824 dev_err(fsl_chan->dev,
824 "selftest: Cannot alloc resources for DMA\n"); 825 "selftest: Cannot alloc resources for DMA\n");
825 err = -ENODEV; 826 err = -ENODEV;
@@ -847,7 +848,7 @@ static int fsl_dma_self_test(struct fsl_dma_chan *fsl_chan)
847 /* Test free and re-alloc channel resources */ 848 /* Test free and re-alloc channel resources */
848 fsl_dma_free_chan_resources(chan); 849 fsl_dma_free_chan_resources(chan);
849 850
850 if (fsl_dma_alloc_chan_resources(chan) < 1) { 851 if (fsl_dma_alloc_chan_resources(chan, NULL) < 1) {
851 dev_err(fsl_chan->dev, 852 dev_err(fsl_chan->dev,
852 "selftest: Cannot alloc resources for DMA\n"); 853 "selftest: Cannot alloc resources for DMA\n");
853 err = -ENODEV; 854 err = -ENODEV;
diff --git a/drivers/dma/ioat_dma.c b/drivers/dma/ioat_dma.c
index 318e8a22d814..90e5b0a28cbf 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)
452 * ioat_dma_alloc_chan_resources - returns the number of allocated descriptors 452 * ioat_dma_alloc_chan_resources - returns the number of allocated descriptors
453 * @chan: the channel to be filled out 453 * @chan: the channel to be filled out
454 */ 454 */
455static int ioat_dma_alloc_chan_resources(struct dma_chan *chan) 455static int ioat_dma_alloc_chan_resources(struct dma_chan *chan,
456 struct dma_client *client)
456{ 457{
457 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan); 458 struct ioat_dma_chan *ioat_chan = to_ioat_chan(chan);
458 struct ioat_desc_sw *desc; 459 struct ioat_desc_sw *desc;
@@ -1049,7 +1050,7 @@ static int ioat_dma_self_test(struct ioatdma_device *device)
1049 dma_chan = container_of(device->common.channels.next, 1050 dma_chan = container_of(device->common.channels.next,
1050 struct dma_chan, 1051 struct dma_chan,
1051 device_node); 1052 device_node);
1052 if (device->common.device_alloc_chan_resources(dma_chan) < 1) { 1053 if (device->common.device_alloc_chan_resources(dma_chan, NULL) < 1) {
1053 dev_err(&device->pdev->dev, 1054 dev_err(&device->pdev->dev,
1054 "selftest cannot allocate chan resource\n"); 1055 "selftest cannot allocate chan resource\n");
1055 err = -ENODEV; 1056 err = -ENODEV;
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c
index 4e6b052c0654..b57564dd0232 100644
--- a/drivers/dma/iop-adma.c
+++ b/drivers/dma/iop-adma.c
@@ -444,7 +444,8 @@ static void iop_chan_start_null_memcpy(struct iop_adma_chan *iop_chan);
444static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan); 444static void iop_chan_start_null_xor(struct iop_adma_chan *iop_chan);
445 445
446/* returns the number of allocated descriptors */ 446/* returns the number of allocated descriptors */
447static int iop_adma_alloc_chan_resources(struct dma_chan *chan) 447static int iop_adma_alloc_chan_resources(struct dma_chan *chan,
448 struct dma_client *client)
448{ 449{
449 char *hw_desc; 450 char *hw_desc;
450 int idx; 451 int idx;
@@ -838,7 +839,7 @@ static int __devinit iop_adma_memcpy_self_test(struct iop_adma_device *device)
838 dma_chan = container_of(device->common.channels.next, 839 dma_chan = container_of(device->common.channels.next,
839 struct dma_chan, 840 struct dma_chan,
840 device_node); 841 device_node);
841 if (iop_adma_alloc_chan_resources(dma_chan) < 1) { 842 if (iop_adma_alloc_chan_resources(dma_chan, NULL) < 1) {
842 err = -ENODEV; 843 err = -ENODEV;
843 goto out; 844 goto out;
844 } 845 }
@@ -936,7 +937,7 @@ iop_adma_xor_zero_sum_self_test(struct iop_adma_device *device)
936 dma_chan = container_of(device->common.channels.next, 937 dma_chan = container_of(device->common.channels.next,
937 struct dma_chan, 938 struct dma_chan,
938 device_node); 939 device_node);
939 if (iop_adma_alloc_chan_resources(dma_chan) < 1) { 940 if (iop_adma_alloc_chan_resources(dma_chan, NULL) < 1) {
940 err = -ENODEV; 941 err = -ENODEV;
941 goto out; 942 goto out;
942 } 943 }
diff --git a/drivers/dma/mv_xor.c b/drivers/dma/mv_xor.c
index f0c123ce8ae0..8239cfdbc2e6 100644
--- a/drivers/dma/mv_xor.c
+++ b/drivers/dma/mv_xor.c
@@ -588,7 +588,8 @@ submit_done:
588} 588}
589 589
590/* returns the number of allocated descriptors */ 590/* returns the number of allocated descriptors */
591static int mv_xor_alloc_chan_resources(struct dma_chan *chan) 591static int mv_xor_alloc_chan_resources(struct dma_chan *chan,
592 struct dma_client *client)
592{ 593{
593 char *hw_desc; 594 char *hw_desc;
594 int idx; 595 int idx;
@@ -938,7 +939,7 @@ static int __devinit mv_xor_memcpy_self_test(struct mv_xor_device *device)
938 dma_chan = container_of(device->common.channels.next, 939 dma_chan = container_of(device->common.channels.next,
939 struct dma_chan, 940 struct dma_chan,
940 device_node); 941 device_node);
941 if (mv_xor_alloc_chan_resources(dma_chan) < 1) { 942 if (mv_xor_alloc_chan_resources(dma_chan, NULL) < 1) {
942 err = -ENODEV; 943 err = -ENODEV;
943 goto out; 944 goto out;
944 } 945 }
@@ -1033,7 +1034,7 @@ mv_xor_xor_self_test(struct mv_xor_device *device)
1033 dma_chan = container_of(device->common.channels.next, 1034 dma_chan = container_of(device->common.channels.next,
1034 struct dma_chan, 1035 struct dma_chan,
1035 device_node); 1036 device_node);
1036 if (mv_xor_alloc_chan_resources(dma_chan) < 1) { 1037 if (mv_xor_alloc_chan_resources(dma_chan, NULL) < 1) {
1037 err = -ENODEV; 1038 err = -ENODEV;
1038 goto out; 1039 goto out;
1039 } 1040 }