aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/dma/idma64.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-10-09 22:13:30 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2015-10-09 22:13:30 +0200
commit670aee3fc7ac37ae947f8b582d87b51d5fa36524 (patch)
tree9885998483d4506208e5aef9c13c8a86adea20bb /drivers/dma/idma64.c
parentMerge tag 'pull_req_4.3_rc4' of https://git.kernel.org/pub/scm/linux/kernel/git/mzx/devfreq into pm-devfreq (diff)
parentcpufreq: prevent lockup on reading scaling_available_frequencies (diff)
downloadlinux-dev-670aee3fc7ac37ae947f8b582d87b51d5fa36524.tar.xz
linux-dev-670aee3fc7ac37ae947f8b582d87b51d5fa36524.zip
Merge branches 'pm-devfreq' and 'pm-cpufreq'
* pm-devfreq: PM / devfreq: fix double kfree PM / devfreq: Fix governor_store() * pm-cpufreq: cpufreq: prevent lockup on reading scaling_available_frequencies cpufreq: acpi_cpufreq: prevent crash on reading freqdomain_cpus
Diffstat (limited to 'drivers/dma/idma64.c')
-rw-r--r--drivers/dma/idma64.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/dma/idma64.c b/drivers/dma/idma64.c
index 18c14e1f1414..48d6d9e94f67 100644
--- a/drivers/dma/idma64.c
+++ b/drivers/dma/idma64.c
@@ -355,23 +355,23 @@ static size_t idma64_active_desc_size(struct idma64_chan *idma64c)
struct idma64_desc *desc = idma64c->desc;
struct idma64_hw_desc *hw;
size_t bytes = desc->length;
- u64 llp;
- u32 ctlhi;
+ u64 llp = channel_readq(idma64c, LLP);
+ u32 ctlhi = channel_readl(idma64c, CTL_HI);
unsigned int i = 0;
- llp = channel_readq(idma64c, LLP);
do {
hw = &desc->hw[i];
- } while ((hw->llp != llp) && (++i < desc->ndesc));
+ if (hw->llp == llp)
+ break;
+ bytes -= hw->len;
+ } while (++i < desc->ndesc);
if (!i)
return bytes;
- do {
- bytes -= desc->hw[--i].len;
- } while (i);
+ /* The current chunk is not fully transfered yet */
+ bytes += desc->hw[--i].len;
- ctlhi = channel_readl(idma64c, CTL_HI);
return bytes - IDMA64C_CTLH_BLOCK_TS(ctlhi);
}