diff options
author | David Woodhouse <David.Woodhouse@intel.com> | 2009-07-27 16:44:32 +0100 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2009-08-03 09:04:52 +0100 |
commit | 56ec4c1e72865c6d99f643b6574e6e074c3e8823 (patch) | |
tree | 92b34c18f1d5d343d5997ee01cc786016d7f1785 /drivers/char/agp/backend.c | |
parent | 176616814d700f19914d8509d9f65dec51a6ebf7 (diff) |
agp: tidy up handling of scratch pages w.r.t. DMA API
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/char/agp/backend.c')
-rw-r--r-- | drivers/char/agp/backend.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/char/agp/backend.c b/drivers/char/agp/backend.c index 19ac3663acd..3c3a487f7b9 100644 --- a/drivers/char/agp/backend.c +++ b/drivers/char/agp/backend.c @@ -150,17 +150,20 @@ static int agp_backend_initialize(struct agp_bridge_data *bridge) } bridge->scratch_page_real = phys_to_gart(page_to_phys(page)); - bridge->scratch_page = bridge->driver->mask_memory(bridge, - phys_to_gart(page_to_phys(page)), 0); - - if (bridge->driver->agp_map_page && - bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), - &bridge->scratch_page_dma)) { - dev_err(&bridge->dev->dev, - "unable to dma-map scratch page\n"); - rc = -ENOMEM; - goto err_out_nounmap; + if (bridge->driver->agp_map_page) { + if (bridge->driver->agp_map_page(phys_to_virt(page_to_phys(page)), + &bridge->scratch_page_dma)) { + dev_err(&bridge->dev->dev, + "unable to dma-map scratch page\n"); + rc = -ENOMEM; + goto err_out_nounmap; + } + } else { + bridge->scratch_page_dma = phys_to_gart(page_to_phys(page)); } + + bridge->scratch_page = bridge->driver->mask_memory(bridge, + bridge->scratch_page_dma, 0); } size_value = bridge->driver->fetch_size(); |