Skip to content

Commit 3cdc0e8

Browse files
Christopher Harveyairlied
authored andcommitted
drm/mgag200: Convert counter delays to jiffies
Signed-off-by: Christopher Harvey <charvey@matrox.com> Acked-by: Julia Lemire <jlemire@matrox.com> Tested-by: Julia Lemire <jlemire@matrox.com> Acked-by: Mathieu Larouche <mathieu.larouche@matrox.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
1 parent fb70a66 commit 3cdc0e8

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

‎drivers/gpu/drm/mgag200/mgag200_mode.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,29 +46,26 @@ static void mga_crtc_load_lut(struct drm_crtc *crtc)
4646

4747
static inline void mga_wait_vsync(struct mga_device *mdev)
4848
{
49-
unsigned int count = 0;
49+
unsigned long timeout = jiffies + HZ/10;
5050
unsigned int status = 0;
5151

5252
do {
5353
status = RREG32(MGAREG_Status);
54-
count++;
55-
} while ((status & 0x08) && (count < 250000));
56-
count = 0;
54+
} while ((status & 0x08) && time_before(jiffies, timeout));
55+
timeout = jiffies + HZ/10;
5756
status = 0;
5857
do {
5958
status = RREG32(MGAREG_Status);
60-
count++;
61-
} while (!(status & 0x08) && (count < 250000));
59+
} while (!(status & 0x08) && time_before(jiffies, timeout));
6260
}
6361

6462
static inline void mga_wait_busy(struct mga_device *mdev)
6563
{
66-
unsigned int count = 0;
64+
unsigned long timeout = jiffies + HZ;
6765
unsigned int status = 0;
6866
do {
6967
status = RREG8(MGAREG_Status + 2);
70-
count++;
71-
} while ((status & 0x01) && (count < 500000));
68+
} while ((status & 0x01) && time_before(jiffies, timeout));
7269
}
7370

7471
/*

0 commit comments

Comments
 (0)