mirror of https://gitee.com/openkylin/linux.git
DaVinci: EDMA: Fix Bug while obtaining contiguous params
The reserve_contiguous_params function is used to reserve a set of contiguous PARAMs. If we do not find a complete set of contiguous PARAMs, the functions still has to free every PARAM that it found to be free in the process of finding a complete set and thus marked as "in use". This patch mainly deals with correctly handling the freeing of PARAMs. Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
This commit is contained in:
parent
dc4c05a513
commit
cc93fc3f34
|
@ -515,17 +515,30 @@ static int reserve_contiguous_params(int ctlr, unsigned int id,
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
unsigned int count = num_params;
|
unsigned int count = num_params;
|
||||||
|
int stop_param = start_param;
|
||||||
|
DECLARE_BITMAP(tmp_inuse, EDMA_MAX_PARAMENTRY);
|
||||||
|
|
||||||
for (i = start_param; i < edma_info[ctlr]->num_slots; ++i) {
|
for (i = start_param; i < edma_info[ctlr]->num_slots; ++i) {
|
||||||
j = EDMA_CHAN_SLOT(i);
|
j = EDMA_CHAN_SLOT(i);
|
||||||
if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse))
|
if (!test_and_set_bit(j, edma_info[ctlr]->edma_inuse)) {
|
||||||
|
/* Record our current beginning slot */
|
||||||
|
if (count == num_params)
|
||||||
|
stop_param = i;
|
||||||
|
|
||||||
count--;
|
count--;
|
||||||
|
set_bit(j, tmp_inuse);
|
||||||
|
|
||||||
if (count == 0)
|
if (count == 0)
|
||||||
break;
|
break;
|
||||||
else if (id == EDMA_CONT_PARAMS_FIXED_EXACT)
|
} else {
|
||||||
break;
|
clear_bit(j, tmp_inuse);
|
||||||
else
|
|
||||||
count = num_params;
|
if (id == EDMA_CONT_PARAMS_FIXED_EXACT) {
|
||||||
|
stop_param = i;
|
||||||
|
break;
|
||||||
|
} else
|
||||||
|
count = num_params;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -534,12 +547,15 @@ static int reserve_contiguous_params(int ctlr, unsigned int id,
|
||||||
* of contiguous parameter RAMs but do not find the exact number
|
* of contiguous parameter RAMs but do not find the exact number
|
||||||
* requested as we may reach the total number of parameter RAMs
|
* requested as we may reach the total number of parameter RAMs
|
||||||
*/
|
*/
|
||||||
if (count) {
|
if (i == edma_info[ctlr]->num_slots)
|
||||||
for (j = i - num_params + count + 1; j <= i ; ++j)
|
stop_param = i;
|
||||||
|
|
||||||
|
for (j = start_param; j < stop_param; j++)
|
||||||
|
if (test_bit(j, tmp_inuse))
|
||||||
clear_bit(j, edma_info[ctlr]->edma_inuse);
|
clear_bit(j, edma_info[ctlr]->edma_inuse);
|
||||||
|
|
||||||
|
if (count)
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
|
||||||
|
|
||||||
for (j = i - num_params + 1; j <= i; ++j)
|
for (j = i - num_params + 1; j <= i; ++j)
|
||||||
memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(j),
|
memcpy_toio(edmacc_regs_base[ctlr] + PARM_OFFSET(j),
|
||||||
|
|
Loading…
Reference in New Issue