diff options
author | Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com> | 2010-05-17 18:41:21 -0400 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2010-05-17 18:45:06 -0400 |
commit | 4aed79b2818e7330b5d00143e4c20bc6555df91f (patch) | |
tree | af69dd8e9a09ea2eb1df8a58e67d36cf3a77cb1f /drivers/dma/ste_dma40.c | |
parent | a5ebca4769f28ceade28ff59fcbffb8e184e599c (diff) |
DMAENGINE: DMA40 fix for allocation of logical channel 0
Fix for allocation failure of logical channel when event line
happens to be number 0.
Signed-off-by: Marcin Mielczarczyk <marcin.mielczarczyk@tieto.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma/ste_dma40.c')
-rw-r--r-- | drivers/dma/ste_dma40.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index 16a7d2b605ed..81fec95312b6 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -1039,11 +1039,11 @@ static int d40_validate_conf(struct d40_chan *d40c, | |||
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | static bool d40_alloc_mask_set(struct d40_phy_res *phy, bool is_src, | 1041 | static bool d40_alloc_mask_set(struct d40_phy_res *phy, bool is_src, |
1042 | int log_event_line) | 1042 | int log_event_line, bool is_log) |
1043 | { | 1043 | { |
1044 | unsigned long flags; | 1044 | unsigned long flags; |
1045 | spin_lock_irqsave(&phy->lock, flags); | 1045 | spin_lock_irqsave(&phy->lock, flags); |
1046 | if (!log_event_line) { | 1046 | if (!is_log) { |
1047 | /* Physical interrupts are masked per physical full channel */ | 1047 | /* Physical interrupts are masked per physical full channel */ |
1048 | if (phy->allocated_src == D40_ALLOC_FREE && | 1048 | if (phy->allocated_src == D40_ALLOC_FREE && |
1049 | phy->allocated_dst == D40_ALLOC_FREE) { | 1049 | phy->allocated_dst == D40_ALLOC_FREE) { |
@@ -1161,15 +1161,16 @@ static int d40_allocate_channel(struct d40_chan *d40c) | |||
1161 | /* Find physical half channel */ | 1161 | /* Find physical half channel */ |
1162 | for (i = 0; i < d40c->base->num_phy_chans; i++) { | 1162 | for (i = 0; i < d40c->base->num_phy_chans; i++) { |
1163 | 1163 | ||
1164 | if (d40_alloc_mask_set(&phys[i], is_src, 0)) | 1164 | if (d40_alloc_mask_set(&phys[i], is_src, |
1165 | 0, is_log)) | ||
1165 | goto found_phy; | 1166 | goto found_phy; |
1166 | } | 1167 | } |
1167 | } else | 1168 | } else |
1168 | for (j = 0; j < d40c->base->num_phy_chans; j += 8) { | 1169 | for (j = 0; j < d40c->base->num_phy_chans; j += 8) { |
1169 | int phy_num = j + event_group * 2; | 1170 | int phy_num = j + event_group * 2; |
1170 | for (i = phy_num; i < phy_num + 2; i++) { | 1171 | for (i = phy_num; i < phy_num + 2; i++) { |
1171 | if (d40_alloc_mask_set(&phys[i], | 1172 | if (d40_alloc_mask_set(&phys[i], is_src, |
1172 | is_src, 0)) | 1173 | 0, is_log)) |
1173 | goto found_phy; | 1174 | goto found_phy; |
1174 | } | 1175 | } |
1175 | } | 1176 | } |
@@ -1193,13 +1194,13 @@ found_phy: | |||
1193 | if (is_src) { | 1194 | if (is_src) { |
1194 | for (i = phy_num; i < phy_num + 2; i++) { | 1195 | for (i = phy_num; i < phy_num + 2; i++) { |
1195 | if (d40_alloc_mask_set(&phys[i], is_src, | 1196 | if (d40_alloc_mask_set(&phys[i], is_src, |
1196 | event_line)) | 1197 | event_line, is_log)) |
1197 | goto found_log; | 1198 | goto found_log; |
1198 | } | 1199 | } |
1199 | } else { | 1200 | } else { |
1200 | for (i = phy_num + 1; i >= phy_num; i--) { | 1201 | for (i = phy_num + 1; i >= phy_num; i--) { |
1201 | if (d40_alloc_mask_set(&phys[i], is_src, | 1202 | if (d40_alloc_mask_set(&phys[i], is_src, |
1202 | event_line)) | 1203 | event_line, is_log)) |
1203 | goto found_log; | 1204 | goto found_log; |
1204 | } | 1205 | } |
1205 | } | 1206 | } |