Skip to content

Commit

Permalink
drm: count reaches -1
Browse files Browse the repository at this point in the history
With a postfix decrement in the test count will reach -1 rather than 0,
subsequent tests fail.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
  • Loading branch information
Roel Kluin authored and Dave Airlie committed Apr 19, 2009
1 parent 029a2ed commit d9c6f54
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions drivers/gpu/drm/via/via_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,11 +481,13 @@ static int via_wait_idle(drm_via_private_t * dev_priv)
{
int count = 10000000;

while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && count--);
while (!(VIA_READ(VIA_REG_STATUS) & VIA_VR_QUEUE_BUSY) && --count)
;

while (count-- && (VIA_READ(VIA_REG_STATUS) &
while (count && (VIA_READ(VIA_REG_STATUS) &
(VIA_CMD_RGTR_BUSY | VIA_2D_ENG_BUSY |
VIA_3D_ENG_BUSY))) ;
VIA_3D_ENG_BUSY)))
--count;
return count;
}

Expand Down Expand Up @@ -705,7 +707,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *
switch (d_siz->func) {
case VIA_CMDBUF_SPACE:
while (((tmp_size = via_cmdbuf_space(dev_priv)) < d_siz->size)
&& count--) {
&& --count) {
if (!d_siz->wait) {
break;
}
Expand All @@ -717,7 +719,7 @@ static int via_cmdbuf_size(struct drm_device *dev, void *data, struct drm_file *
break;
case VIA_CMDBUF_LAG:
while (((tmp_size = via_cmdbuf_lag(dev_priv)) > d_siz->size)
&& count--) {
&& --count) {
if (!d_siz->wait) {
break;
}
Expand Down

0 comments on commit d9c6f54

Please sign in to comment.