Fix some CmdQ nonsense (?)
authorThomas White <taw@bitwiz.org.uk>
Sun, 8 Nov 2009 17:53:16 +0000 (18:53 +0100)
committerThomas White <taw@bitwiz.org.uk>
Sun, 8 Nov 2009 17:53:16 +0000 (18:53 +0100)
Signed-off-by: Thomas White <taw@bitwiz.org.uk>
drivers/mfd/glamo/glamo-cmdq.c

index f7bb0be..215017d 100644 (file)
@@ -125,6 +125,11 @@ static int glamo_add_to_ring(struct glamodrm_handle *gdrm, u16 *addr,
        size_t ring_write, ring_read;
        size_t new_ring_write;
 
+       if ( count >= GLAMO_CMDQ_SIZE ) {
+               printk(KERN_WARNING "[glamo-drm] CmdQ submission too large\n");
+               return -EINVAL;
+       }
+
        down(&gdrm->add_to_ring);
 
        ring_write = glamo_get_write(gdrm);
@@ -170,16 +175,6 @@ static int glamo_add_to_ring(struct glamodrm_handle *gdrm, u16 *addr,
                        new_ring_write = 4;
                }
 
-               /* Suppose we just filled the WHOLE ring buffer, and so the
-                * write position ends up in the same place as it started.
-                * No change in poginter means no activity from the command
-                * queue engine.  So, insert a no-op */
-               if (ring_write == new_ring_write) {
-                       iowrite16(0x0000, gdrm->cmdq_base + new_ring_write);
-                       iowrite16(0x0000, gdrm->cmdq_base + new_ring_write + 2);
-                       new_ring_write += 4;
-               }
-
        } else {
 
                memcpy_toio(gdrm->cmdq_base+ring_write, addr, count);