Commit 4aed79b2818e7330b5d00143e4c20bc6555df91f

Authored by Marcin Mielczarczyk
Committed by Dan Williams
1 parent a5ebca4769

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>

Showing 1 changed file with 8 additions and 7 deletions Side-by-side Diff

drivers/dma/ste_dma40.c
... ... @@ -1039,11 +1039,11 @@
1039 1039 }
1040 1040  
1041 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 1044 unsigned long flags;
1045 1045 spin_lock_irqsave(&phy->lock, flags);
1046   - if (!log_event_line) {
  1046 + if (!is_log) {
1047 1047 /* Physical interrupts are masked per physical full channel */
1048 1048 if (phy->allocated_src == D40_ALLOC_FREE &&
1049 1049 phy->allocated_dst == D40_ALLOC_FREE) {
1050 1050  
... ... @@ -1161,15 +1161,16 @@
1161 1161 /* Find physical half channel */
1162 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 1166 goto found_phy;
1166 1167 }
1167 1168 } else
1168 1169 for (j = 0; j < d40c->base->num_phy_chans; j += 8) {
1169 1170 int phy_num = j + event_group * 2;
1170 1171 for (i = phy_num; i < phy_num + 2; i++) {
1171   - if (d40_alloc_mask_set(&phys[i],
1172   - is_src, 0))
  1172 + if (d40_alloc_mask_set(&phys[i], is_src,
  1173 + 0, is_log))
1173 1174 goto found_phy;
1174 1175 }
1175 1176 }
1176 1177  
... ... @@ -1193,13 +1194,13 @@
1193 1194 if (is_src) {
1194 1195 for (i = phy_num; i < phy_num + 2; i++) {
1195 1196 if (d40_alloc_mask_set(&phys[i], is_src,
1196   - event_line))
  1197 + event_line, is_log))
1197 1198 goto found_log;
1198 1199 }
1199 1200 } else {
1200 1201 for (i = phy_num + 1; i >= phy_num; i--) {
1201 1202 if (d40_alloc_mask_set(&phys[i], is_src,
1202   - event_line))
  1203 + event_line, is_log))
1203 1204 goto found_log;
1204 1205 }
1205 1206 }