Message ID | 20200929151437.19717-2-tzimmermann@suse.de (mailing list archive) |
---|---|
State | Not Applicable |
Headers | show |
Series | Support GEM object mappings from I/O memory | expand |
On Tue, Sep 29, 2020 at 05:14:31PM +0200, Thomas Zimmermann wrote: > The parameters map and is_iomem are always of the same value. Removed them > to prepares the function for conversion to struct dma_buf_map. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> > --- > drivers/gpu/drm/drm_gem_vram_helper.c | 17 ++++++----------- > 1 file changed, 6 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c > index 3fe4b326e18e..256b346664f2 100644 > --- a/drivers/gpu/drm/drm_gem_vram_helper.c > +++ b/drivers/gpu/drm/drm_gem_vram_helper.c > @@ -382,16 +382,16 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo) > } > EXPORT_SYMBOL(drm_gem_vram_unpin); > > -static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, > - bool map, bool *is_iomem) > +static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo) > { > int ret; > struct ttm_bo_kmap_obj *kmap = &gbo->kmap; > + bool is_iomem; > > if (gbo->kmap_use_count > 0) > goto out; > > - if (kmap->virtual || !map) > + if (kmap->virtual) > goto out; > > ret = ttm_bo_kmap(&gbo->bo, 0, gbo->bo.num_pages, kmap); > @@ -399,15 +399,10 @@ static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, > return ERR_PTR(ret); > > out: > - if (!kmap->virtual) { > - if (is_iomem) > - *is_iomem = false; > + if (!kmap->virtual) > return NULL; /* not mapped; don't increment ref */ > - } > ++gbo->kmap_use_count; > - if (is_iomem) > - return ttm_kmap_obj_virtual(kmap, is_iomem); > - return kmap->virtual; > + return ttm_kmap_obj_virtual(kmap, &is_iomem); > } > > static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo) > @@ -452,7 +447,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) > ret = drm_gem_vram_pin_locked(gbo, 0); > if (ret) > goto err_ttm_bo_unreserve; > - base = drm_gem_vram_kmap_locked(gbo, true, NULL); > + base = drm_gem_vram_kmap_locked(gbo); > if (IS_ERR(base)) { > ret = PTR_ERR(base); > goto err_drm_gem_vram_unpin_locked; > -- > 2.28.0 >
diff --git a/drivers/gpu/drm/drm_gem_vram_helper.c b/drivers/gpu/drm/drm_gem_vram_helper.c index 3fe4b326e18e..256b346664f2 100644 --- a/drivers/gpu/drm/drm_gem_vram_helper.c +++ b/drivers/gpu/drm/drm_gem_vram_helper.c @@ -382,16 +382,16 @@ int drm_gem_vram_unpin(struct drm_gem_vram_object *gbo) } EXPORT_SYMBOL(drm_gem_vram_unpin); -static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, - bool map, bool *is_iomem) +static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo) { int ret; struct ttm_bo_kmap_obj *kmap = &gbo->kmap; + bool is_iomem; if (gbo->kmap_use_count > 0) goto out; - if (kmap->virtual || !map) + if (kmap->virtual) goto out; ret = ttm_bo_kmap(&gbo->bo, 0, gbo->bo.num_pages, kmap); @@ -399,15 +399,10 @@ static void *drm_gem_vram_kmap_locked(struct drm_gem_vram_object *gbo, return ERR_PTR(ret); out: - if (!kmap->virtual) { - if (is_iomem) - *is_iomem = false; + if (!kmap->virtual) return NULL; /* not mapped; don't increment ref */ - } ++gbo->kmap_use_count; - if (is_iomem) - return ttm_kmap_obj_virtual(kmap, is_iomem); - return kmap->virtual; + return ttm_kmap_obj_virtual(kmap, &is_iomem); } static void drm_gem_vram_kunmap_locked(struct drm_gem_vram_object *gbo) @@ -452,7 +447,7 @@ void *drm_gem_vram_vmap(struct drm_gem_vram_object *gbo) ret = drm_gem_vram_pin_locked(gbo, 0); if (ret) goto err_ttm_bo_unreserve; - base = drm_gem_vram_kmap_locked(gbo, true, NULL); + base = drm_gem_vram_kmap_locked(gbo); if (IS_ERR(base)) { ret = PTR_ERR(base); goto err_drm_gem_vram_unpin_locked;
The parameters map and is_iomem are always of the same value. Removed them to prepares the function for conversion to struct dma_buf_map. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/drm_gem_vram_helper.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)