summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorDavid Gwynne <dlg@cvs.openbsd.org>2013-11-11 03:08:21 +0000
committerDavid Gwynne <dlg@cvs.openbsd.org>2013-11-11 03:08:21 +0000
commitab378f87dc16cf02fd42d9f7527e76e0f3413f86 (patch)
tree034a790f028003299e2e2ff991efa7302148a682 /sys
parent51e03cc9e3148211a40d87e10ed632f88c7c4f27 (diff)
replace things like "start + interval > ticks" with
"ticks - start > interval" because the latter copes with ticks wrapping. pointed out by guenther@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/athn.c4
-rw-r--r--sys/dev/pci/drm/radeon/radeon_pm.c4
-rw-r--r--sys/dev/pci/if_sandrv.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/sys/dev/ic/athn.c b/sys/dev/ic/athn.c
index 0ae50c853fc..8f397534bbb 100644
--- a/sys/dev/ic/athn.c
+++ b/sys/dev/ic/athn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: athn.c,v 1.76 2013/08/07 01:06:28 bluhm Exp $ */
+/* $OpenBSD: athn.c,v 1.77 2013/11/11 03:08:20 dlg Exp $ */
/*-
* Copyright (c) 2009 Damien Bergamini <damien.bergamini@free.fr>
@@ -1239,7 +1239,7 @@ athn_calib_to(void *arg)
/* Do periodic (every 4 minutes) PA calibration. */
if (AR_SREV_9285_11_OR_LATER(sc) &&
!AR_SREV_9380_10_OR_LATER(sc) &&
- ticks >= sc->pa_calib_ticks + 240 * hz) {
+ (ticks - sc->pa_calib_ticks + 240 * hz) >= 0) {
sc->pa_calib_ticks = ticks;
if (AR_SREV_9271(sc))
ar9271_pa_calib(sc);
diff --git a/sys/dev/pci/drm/radeon/radeon_pm.c b/sys/dev/pci/drm/radeon/radeon_pm.c
index 46672da41a9..b9a25f3ac66 100644
--- a/sys/dev/pci/drm/radeon/radeon_pm.c
+++ b/sys/dev/pci/drm/radeon/radeon_pm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radeon_pm.c,v 1.4 2013/10/30 02:11:33 dlg Exp $ */
+/* $OpenBSD: radeon_pm.c,v 1.5 2013/11/11 03:08:20 dlg Exp $ */
/*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -874,7 +874,7 @@ radeon_dynpm_idle_work_handler(void *arg1, void *arg2)
* to false since we want to wait for vbl to avoid flicker.
*/
if (rdev->pm.dynpm_planned_action != DYNPM_ACTION_NONE &&
- ticks > rdev->pm.dynpm_action_timeout) {
+ ticks - rdev->pm.dynpm_action_timeout > 0) {
radeon_pm_get_dynpm_state(rdev);
radeon_pm_set_clocks(rdev);
}
diff --git a/sys/dev/pci/if_sandrv.c b/sys/dev/pci/if_sandrv.c
index db53b162c79..57c8df4dc98 100644
--- a/sys/dev/pci/if_sandrv.c
+++ b/sys/dev/pci/if_sandrv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_sandrv.c,v 1.14 2009/03/29 21:53:52 sthen Exp $ */
+/* $OpenBSD: if_sandrv.c,v 1.15 2013/11/11 03:08:20 dlg Exp $ */
/*-
* Copyright (c) 2001-2004 Sangoma Technologies (SAN)
@@ -904,7 +904,7 @@ sdla_exec(sdlahw_t *hw, unsigned long offset)
sdla_peek(hw, offset, (void*)&value, 1);
for (nloops = 1; value == 0x01; ++ nloops) {
DELAY(EXEC_DELAY);
- if (ticks > tstop || nloops > MAX_NLOOPS) {
+ if (ticks - tstop > 0 || nloops > MAX_NLOOPS) {
log(LOG_INFO, "%s: Timeout %lu ticks (max=%lu) "
"loops %lu (max=%u)\n", hw->devname,
(ticks-tstop+EXEC_TIMEOUT),