|
@@ -1699,7 +1699,6 @@ static bool _chan_ns(const struct pl330_dmac *pl330, int i)
|
|
static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
|
|
static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
|
|
{
|
|
{
|
|
struct pl330_thread *thrd = NULL;
|
|
struct pl330_thread *thrd = NULL;
|
|
- unsigned long flags;
|
|
|
|
int chans, i;
|
|
int chans, i;
|
|
|
|
|
|
if (pl330->state == DYING)
|
|
if (pl330->state == DYING)
|
|
@@ -1707,8 +1706,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
|
|
|
|
|
|
chans = pl330->pcfg.num_chan;
|
|
chans = pl330->pcfg.num_chan;
|
|
|
|
|
|
- spin_lock_irqsave(&pl330->lock, flags);
|
|
|
|
-
|
|
|
|
for (i = 0; i < chans; i++) {
|
|
for (i = 0; i < chans; i++) {
|
|
thrd = &pl330->channels[i];
|
|
thrd = &pl330->channels[i];
|
|
if ((thrd->free) && (!_manager_ns(thrd) ||
|
|
if ((thrd->free) && (!_manager_ns(thrd) ||
|
|
@@ -1726,8 +1723,6 @@ static struct pl330_thread *pl330_request_channel(struct pl330_dmac *pl330)
|
|
thrd = NULL;
|
|
thrd = NULL;
|
|
}
|
|
}
|
|
|
|
|
|
- spin_unlock_irqrestore(&pl330->lock, flags);
|
|
|
|
-
|
|
|
|
return thrd;
|
|
return thrd;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1745,7 +1740,6 @@ static inline void _free_event(struct pl330_thread *thrd, int ev)
|
|
static void pl330_release_channel(struct pl330_thread *thrd)
|
|
static void pl330_release_channel(struct pl330_thread *thrd)
|
|
{
|
|
{
|
|
struct pl330_dmac *pl330;
|
|
struct pl330_dmac *pl330;
|
|
- unsigned long flags;
|
|
|
|
|
|
|
|
if (!thrd || thrd->free)
|
|
if (!thrd || thrd->free)
|
|
return;
|
|
return;
|
|
@@ -1757,10 +1751,8 @@ static void pl330_release_channel(struct pl330_thread *thrd)
|
|
|
|
|
|
pl330 = thrd->dmac;
|
|
pl330 = thrd->dmac;
|
|
|
|
|
|
- spin_lock_irqsave(&pl330->lock, flags);
|
|
|
|
_free_event(thrd, thrd->ev);
|
|
_free_event(thrd, thrd->ev);
|
|
thrd->free = true;
|
|
thrd->free = true;
|
|
- spin_unlock_irqrestore(&pl330->lock, flags);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/* Initialize the structure for PL330 configuration, that can be used
|
|
/* Initialize the structure for PL330 configuration, that can be used
|
|
@@ -2122,20 +2114,20 @@ static int pl330_alloc_chan_resources(struct dma_chan *chan)
|
|
struct pl330_dmac *pl330 = pch->dmac;
|
|
struct pl330_dmac *pl330 = pch->dmac;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
- spin_lock_irqsave(&pch->lock, flags);
|
|
|
|
|
|
+ spin_lock_irqsave(&pl330->lock, flags);
|
|
|
|
|
|
dma_cookie_init(chan);
|
|
dma_cookie_init(chan);
|
|
pch->cyclic = false;
|
|
pch->cyclic = false;
|
|
|
|
|
|
pch->thread = pl330_request_channel(pl330);
|
|
pch->thread = pl330_request_channel(pl330);
|
|
if (!pch->thread) {
|
|
if (!pch->thread) {
|
|
- spin_unlock_irqrestore(&pch->lock, flags);
|
|
|
|
|
|
+ spin_unlock_irqrestore(&pl330->lock, flags);
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
}
|
|
}
|
|
|
|
|
|
tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
|
|
tasklet_init(&pch->task, pl330_tasklet, (unsigned long) pch);
|
|
|
|
|
|
- spin_unlock_irqrestore(&pch->lock, flags);
|
|
|
|
|
|
+ spin_unlock_irqrestore(&pl330->lock, flags);
|
|
|
|
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
@@ -2238,12 +2230,13 @@ static int pl330_pause(struct dma_chan *chan)
|
|
static void pl330_free_chan_resources(struct dma_chan *chan)
|
|
static void pl330_free_chan_resources(struct dma_chan *chan)
|
|
{
|
|
{
|
|
struct dma_pl330_chan *pch = to_pchan(chan);
|
|
struct dma_pl330_chan *pch = to_pchan(chan);
|
|
|
|
+ struct pl330_dmac *pl330 = pch->dmac;
|
|
unsigned long flags;
|
|
unsigned long flags;
|
|
|
|
|
|
tasklet_kill(&pch->task);
|
|
tasklet_kill(&pch->task);
|
|
|
|
|
|
pm_runtime_get_sync(pch->dmac->ddma.dev);
|
|
pm_runtime_get_sync(pch->dmac->ddma.dev);
|
|
- spin_lock_irqsave(&pch->lock, flags);
|
|
|
|
|
|
+ spin_lock_irqsave(&pl330->lock, flags);
|
|
|
|
|
|
pl330_release_channel(pch->thread);
|
|
pl330_release_channel(pch->thread);
|
|
pch->thread = NULL;
|
|
pch->thread = NULL;
|
|
@@ -2251,7 +2244,7 @@ static void pl330_free_chan_resources(struct dma_chan *chan)
|
|
if (pch->cyclic)
|
|
if (pch->cyclic)
|
|
list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
|
|
list_splice_tail_init(&pch->work_list, &pch->dmac->desc_pool);
|
|
|
|
|
|
- spin_unlock_irqrestore(&pch->lock, flags);
|
|
|
|
|
|
+ spin_unlock_irqrestore(&pl330->lock, flags);
|
|
pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
|
|
pm_runtime_mark_last_busy(pch->dmac->ddma.dev);
|
|
pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
|
|
pm_runtime_put_autosuspend(pch->dmac->ddma.dev);
|
|
}
|
|
}
|