diff options
author | Imre Deak <imre.deak@intel.com> | 2013-03-26 15:14:18 +0200 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2013-03-27 17:13:44 +0100 |
commit | 2db76d7c3c6db93058f983c8240f7c7c25e87ee6 (patch) | |
tree | a35f01706b353841b71645da050bc721c9f0467b /lib | |
parent | 693db1842d864ca2771e881127cdb4d09979758b (diff) | |
download | linux-3.10-2db76d7c3c6db93058f983c8240f7c7c25e87ee6.tar.gz linux-3.10-2db76d7c3c6db93058f983c8240f7c7c25e87ee6.tar.bz2 linux-3.10-2db76d7c3c6db93058f983c8240f7c7c25e87ee6.zip |
lib/scatterlist: sg_page_iter: support sg lists w/o backing pages
The i915 driver uses sg lists for memory without backing 'struct page'
pages, similarly to other IO memory regions, setting only the DMA
address for these. It does this, so that it can program the HW MMU
tables in a uniform way both for sg lists with and without backing pages.
Without a valid page pointer we can't call nth_page to get the current
page in __sg_page_iter_next, so add a helper that relevant users can
call separately. Also add a helper to get the DMA address of the current
page (idea from Daniel).
Convert all places in i915, to use the new API.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Reviewed-by: Damien Lespiau <damien.lespiau@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/scatterlist.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/lib/scatterlist.c b/lib/scatterlist.c index b83c144d731..a1cf8cae60e 100644 --- a/lib/scatterlist.c +++ b/lib/scatterlist.c @@ -401,7 +401,6 @@ void __sg_page_iter_start(struct sg_page_iter *piter, piter->__pg_advance = 0; piter->__nents = nents; - piter->page = NULL; piter->sg = sglist; piter->sg_pgoffset = pgoffset; } @@ -426,7 +425,6 @@ bool __sg_page_iter_next(struct sg_page_iter *piter) if (!--piter->__nents || !piter->sg) return false; } - piter->page = nth_page(sg_page(piter->sg), piter->sg_pgoffset); return true; } @@ -496,7 +494,7 @@ bool sg_miter_next(struct sg_mapping_iter *miter) miter->__remaining = min_t(unsigned long, miter->__remaining, PAGE_SIZE - miter->__offset); } - miter->page = miter->piter.page; + miter->page = sg_page_iter_page(&miter->piter); miter->consumed = miter->length = miter->__remaining; if (miter->__flags & SG_MITER_ATOMIC) |