summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/mgag200/mgag200_main.c
diff options
context:
space:
mode:
authorMark Brown2015-09-16 21:44:25 +0200
committerMark Brown2015-09-16 21:44:25 +0200
commit92243b6fc8fcb16bf401b055f7a0ba79f70a4115 (patch)
tree08e9fa205efb9bfab23b6ea59fc0a3eaa3fed82b /drivers/gpu/drm/mgag200/mgag200_main.c
parentspi: Fix documentation of spi_alloc_master() (diff)
parentLinux 4.3-rc1 (diff)
downloadkernel-qcow2-linux-92243b6fc8fcb16bf401b055f7a0ba79f70a4115.tar.gz
kernel-qcow2-linux-92243b6fc8fcb16bf401b055f7a0ba79f70a4115.tar.xz
kernel-qcow2-linux-92243b6fc8fcb16bf401b055f7a0ba79f70a4115.zip
Merge tag 'v4.3-rc1' into spi-fix-doc
Linux 4.3-rc1
Diffstat (limited to 'drivers/gpu/drm/mgag200/mgag200_main.c')
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_main.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_main.c b/drivers/gpu/drm/mgag200/mgag200_main.c
index f6b283b8375e..de06388069e7 100644
--- a/drivers/gpu/drm/mgag200/mgag200_main.c
+++ b/drivers/gpu/drm/mgag200/mgag200_main.c
@@ -82,12 +82,19 @@ static int mga_probe_vram(struct mga_device *mdev, void __iomem *mem)
int orig;
int test1, test2;
int orig1, orig2;
+ unsigned int vram_size;
/* Probe */
orig = ioread16(mem);
iowrite16(0, mem);
- for (offset = 0x100000; offset < mdev->mc.vram_window; offset += 0x4000) {
+ vram_size = mdev->mc.vram_window;
+
+ if ((mdev->type == G200_EW3) && (vram_size >= 0x1000000)) {
+ vram_size = vram_size - 0x400000;
+ }
+
+ for (offset = 0x100000; offset < vram_size; offset += 0x4000) {
orig1 = ioread8(mem + offset);
orig2 = ioread8(mem + offset + 0x100);
@@ -345,23 +352,15 @@ mgag200_dumb_mmap_offset(struct drm_file *file,
uint64_t *offset)
{
struct drm_gem_object *obj;
- int ret;
struct mgag200_bo *bo;
- mutex_lock(&dev->struct_mutex);
obj = drm_gem_object_lookup(dev, file, handle);
- if (obj == NULL) {
- ret = -ENOENT;
- goto out_unlock;
- }
+ if (obj == NULL)
+ return -ENOENT;
bo = gem_to_mga_bo(obj);
*offset = mgag200_bo_mmap_offset(bo);
- drm_gem_object_unreference(obj);
- ret = 0;
-out_unlock:
- mutex_unlock(&dev->struct_mutex);
- return ret;
-
+ drm_gem_object_unreference_unlocked(obj);
+ return 0;
}