summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-01-09 14:35:21 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-01-09 14:35:21 +0000
commit25aaeac2e7ff4e81296b12f4c7c9ae1e6369da89 (patch)
tree0f8f6679b0fd02d5814725a02c6390bd0e87ac9c /sys/dev
parent2a3120725f4d4b08fb2361463775f11844321eb0 (diff)
Convert sleeps of 1sec or more to tsleep_nsec(9).
ok bluhm@
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/tipmic.c5
-rw-r--r--sys/dev/fdt/dwmmc.c5
-rw-r--r--sys/dev/fdt/sximmc.c5
-rw-r--r--sys/dev/i2c/iatp.c5
-rw-r--r--sys/dev/ic/bwfm.c4
-rw-r--r--sys/dev/ic/pgt.c6
-rw-r--r--sys/dev/ic/rtwn.c4
-rw-r--r--sys/dev/ic/z8530tty.c4
-rw-r--r--sys/dev/pci/amdiic.c5
-rw-r--r--sys/dev/pci/amdpm.c5
-rw-r--r--sys/dev/pci/arc.c15
-rw-r--r--sys/dev/pci/cz.c4
-rw-r--r--sys/dev/pci/ichiic.c5
-rw-r--r--sys/dev/pci/if_bwfm_pci.c4
-rw-r--r--sys/dev/pci/if_tht.c4
-rw-r--r--sys/dev/pci/piixpm.c5
-rw-r--r--sys/dev/pci/viapm.c5
17 files changed, 51 insertions, 39 deletions
diff --git a/sys/dev/acpi/tipmic.c b/sys/dev/acpi/tipmic.c
index 51ebd3569d4..e8f027c24f4 100644
--- a/sys/dev/acpi/tipmic.c
+++ b/sys/dev/acpi/tipmic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tipmic.c,v 1.4 2019/04/04 06:33:10 kettenis Exp $ */
+/* $OpenBSD: tipmic.c,v 1.5 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
@@ -333,7 +333,8 @@ tipmic_thermal_opreg_handler(void *cookie, int iodir, uint64_t address,
splx(s);
while (sc->sc_stat_adc == 0) {
- if (tsleep(&sc->sc_stat_adc, PRIBIO, "tipmic", hz)) {
+ if (tsleep_nsec(&sc->sc_stat_adc, PRIBIO, "tipmic",
+ SEC_TO_NSEC(1))) {
printf("%s: ADC timeout\n", sc->sc_dev.dv_xname);
break;
}
diff --git a/sys/dev/fdt/dwmmc.c b/sys/dev/fdt/dwmmc.c
index 425f88d2751..a9d3ee564f4 100644
--- a/sys/dev/fdt/dwmmc.c
+++ b/sys/dev/fdt/dwmmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dwmmc.c,v 1.21 2019/09/20 20:46:15 kettenis Exp $ */
+/* $OpenBSD: dwmmc.c,v 1.22 2020/01/09 14:35:20 mpi Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -1007,7 +1007,8 @@ dwmmc_exec_command(sdmmc_chipset_handle_t sch, struct sdmmc_command *cmd)
if (cmd->c_datalen > 0 && cmd->c_dmamap) {
while (sc->sc_idsts == 0) {
- error = tsleep(&sc->sc_idsts, PWAIT, "idsts", hz);
+ error = tsleep_nsec(&sc->sc_idsts, PWAIT, "idsts",
+ SEC_TO_NSEC(1));
if (error) {
cmd->c_error = error;
dwmmc_dma_reset(sc, cmd);
diff --git a/sys/dev/fdt/sximmc.c b/sys/dev/fdt/sximmc.c
index 0c22ec82a6b..71c2cbacd5a 100644
--- a/sys/dev/fdt/sximmc.c
+++ b/sys/dev/fdt/sximmc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sximmc.c,v 1.9 2019/02/10 11:56:26 kettenis Exp $ */
+/* $OpenBSD: sximmc.c,v 1.10 2020/01/09 14:35:20 mpi Exp $ */
/* $NetBSD: awin_mmc.c,v 1.23 2015/11/14 10:32:40 bouyer Exp $ */
/*-
@@ -551,7 +551,8 @@ sximmc_wait_rint(struct sximmc_softc *sc, uint32_t mask, int timeout)
while (retry > 0) {
if (sc->sc_use_dma) {
- error = tsleep(&sc->sc_intr_rint, PWAIT, "rint", hz);
+ error = tsleep_nsec(&sc->sc_intr_rint, PWAIT, "rint",
+ SEC_TO_NSEC(1));
if (error && error != EWOULDBLOCK)
return error;
if (sc->sc_intr_rint & mask)
diff --git a/sys/dev/i2c/iatp.c b/sys/dev/i2c/iatp.c
index 7c6fdad4dbe..cb5021dcfb5 100644
--- a/sys/dev/i2c/iatp.c
+++ b/sys/dev/i2c/iatp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iatp.c,v 1.6 2018/07/30 15:56:30 jcs Exp $ */
+/* $OpenBSD: iatp.c,v 1.7 2020/01/09 14:35:19 mpi Exp $ */
/*
* Atmel maXTouch i2c touchscreen/touchpad driver
* Copyright (c) 2016 joshua stein <jcs@openbsd.org>
@@ -347,7 +347,8 @@ iatp_enable(void *v)
{
struct iatp_softc *sc = v;
- if (sc->sc_busy && tsleep(&sc->sc_busy, PRIBIO, "iatp", hz) != 0) {
+ if (sc->sc_busy &&
+ tsleep_nsec(&sc->sc_busy, PRIBIO, "iatp", SEC_TO_NSEC(1)) != 0) {
printf("%s: trying to enable but we're busy\n",
sc->sc_dev.dv_xname);
return 1;
diff --git a/sys/dev/ic/bwfm.c b/sys/dev/ic/bwfm.c
index 43097a6f4db..aec8c113470 100644
--- a/sys/dev/ic/bwfm.c
+++ b/sys/dev/ic/bwfm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bwfm.c,v 1.67 2019/11/09 20:53:55 patrick Exp $ */
+/* $OpenBSD: bwfm.c,v 1.68 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2016,2017 Patrick Wildt <patrick@blueri.se>
@@ -1526,7 +1526,7 @@ bwfm_proto_bcdc_txctl(struct bwfm_softc *sc, int reqid, char *buf, size_t *len)
return 1;
}
- if (tsleep(ctl, PWAIT, "bwfm", hz))
+ if (tsleep_nsec(ctl, PWAIT, "bwfm", SEC_TO_NSEC(1)))
timeout = 1;
TAILQ_FOREACH_SAFE(ctl, &sc->sc_bcdc_rxctlq, next, tmp) {
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index d7bc9038a3c..c61f1a44ae8 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.96 2019/12/31 10:05:32 mpi Exp $ */
+/* $OpenBSD: pgt.c,v 1.97 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -521,7 +521,7 @@ trying_again:
sc->sc_flags |= SC_NEEDS_FIRMWARE;
error = pgt_reset(sc);
if (error == 0) {
- tsleep(&sc->sc_flags, 0, "pgtres", hz);
+ tsleep_nsec(&sc->sc_flags, 0, "pgtres", SEC_TO_NSEC(1));
if (sc->sc_flags & SC_UNINITIALIZED) {
printf("%s: not responding\n",
sc->sc_dev.dv_xname);
@@ -589,7 +589,7 @@ pgt_attach(struct device *self)
if (error)
return;
- tsleep(&sc->sc_flags, 0, "pgtres", hz);
+ tsleep_nsec(&sc->sc_flags, 0, "pgtres", SEC_TO_NSEC(1));
if (sc->sc_flags & SC_UNINITIALIZED) {
printf("%s: not responding\n", sc->sc_dev.dv_xname);
sc->sc_flags |= SC_NEEDS_FIRMWARE;
diff --git a/sys/dev/ic/rtwn.c b/sys/dev/ic/rtwn.c
index 646498b7b2d..0daeae3ea72 100644
--- a/sys/dev/ic/rtwn.c
+++ b/sys/dev/ic/rtwn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtwn.c,v 1.48 2019/12/31 10:05:32 mpi Exp $ */
+/* $OpenBSD: rtwn.c,v 1.49 2020/01/09 14:35:19 mpi Exp $ */
/*-
* Copyright (c) 2010 Damien Bergamini <damien.bergamini@free.fr>
@@ -1642,7 +1642,7 @@ sleep:
* We must sleep for one second to let the firmware settle.
* Accessing registers too early will hang the whole system.
*/
- tsleep(&reg, 0, "rtwnrst", hz);
+ tsleep_nsec(&reg, 0, "rtwnrst", SEC_TO_NSEC(1));
}
}
diff --git a/sys/dev/ic/z8530tty.c b/sys/dev/ic/z8530tty.c
index 5737c6ee076..a0472d3f3a4 100644
--- a/sys/dev/ic/z8530tty.c
+++ b/sys/dev/ic/z8530tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: z8530tty.c,v 1.31 2019/07/19 00:17:15 cheloha Exp $ */
+/* $OpenBSD: z8530tty.c,v 1.32 2020/01/09 14:35:19 mpi Exp $ */
/* $NetBSD: z8530tty.c,v 1.77 2001/05/30 15:24:24 lukem Exp $ */
/*-
@@ -429,7 +429,7 @@ zs_shutdown(struct zstty_softc *zst)
if (ISSET(tp->t_cflag, HUPCL) || ISSET(tp->t_state, TS_WOPEN)) {
zs_modem(zst, 0);
/* hold low for 1 second */
- (void)tsleep(cs, TTIPRI, ttclos, hz);
+ tsleep_nsec(cs, TTIPRI, ttclos, SEC_TO_NSEC(1));
}
/* Turn off interrupts if not the console. */
diff --git a/sys/dev/pci/amdiic.c b/sys/dev/pci/amdiic.c
index fa3b31646ab..612e20cee76 100644
--- a/sys/dev/pci/amdiic.c
+++ b/sys/dev/pci/amdiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdiic.c,v 1.11 2013/10/01 20:06:00 sf Exp $ */
+/* $OpenBSD: amdiic.c,v 1.12 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2005 Alexander Yurchenko <grange@openbsd.org>
@@ -348,7 +348,8 @@ amdiic_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
amdiic_intr(sc);
} else {
/* Wait for interrupt */
- if (tsleep(sc, PRIBIO, "amdiic", AMDIIC_TIMEOUT * hz))
+ if (tsleep_nsec(sc, PRIBIO, "amdiic",
+ SEC_TO_NSEC(AMDIIC_TIMEOUT)))
return (1);
}
diff --git a/sys/dev/pci/amdpm.c b/sys/dev/pci/amdpm.c
index 7a0cff54547..3abe03de722 100644
--- a/sys/dev/pci/amdpm.c
+++ b/sys/dev/pci/amdpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: amdpm.c,v 1.33 2018/04/28 15:44:59 jasper Exp $ */
+/* $OpenBSD: amdpm.c,v 1.34 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -485,7 +485,8 @@ amdpm_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
amdpm_intr(sc);
} else {
/* Wait for interrupt */
- if (tsleep(sc, PRIBIO, "amdpm", AMDPM_SMBUS_TIMEOUT * hz))
+ if (tsleep_nsec(sc, PRIBIO, "amdpm",
+ SEC_TO_NSEC(AMDPM_SMBUS_TIMEOUT)))
goto timeout;
}
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c
index d88304eebc1..f5ad53b7a38 100644
--- a/sys/dev/pci/arc.c
+++ b/sys/dev/pci/arc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: arc.c,v 1.107 2015/09/10 18:10:33 deraadt Exp $ */
+/* $OpenBSD: arc.c,v 1.108 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2006 David Gwynne <dlg@openbsd.org>
@@ -2571,7 +2571,7 @@ arc_unlock(struct arc_softc *sc)
void
arc_wait(struct arc_softc *sc)
{
- int s;
+ int error, s;
u_int32_t int_mask;
s = splbio();
@@ -2579,7 +2579,8 @@ arc_wait(struct arc_softc *sc)
case ARC_HBA_TYPE_A:
int_mask = arc_read(sc, ARC_RA_INTRMASK) & ~ARC_RA_INTRMASK_DOORBELL;
arc_write(sc, ARC_RA_INTRMASK, int_mask);
- if (tsleep(sc, PWAIT, "arcdb", hz) == EWOULDBLOCK) {
+ error = tsleep_nsec(sc, PWAIT, "arcdb", SEC_TO_NSEC(1));
+ if (error == EWOULDBLOCK) {
int_mask = arc_read(sc, ARC_RA_INTRMASK) | ARC_RA_INTRMASK_DOORBELL;
arc_write(sc, ARC_RA_INTRMASK, int_mask);
}
@@ -2587,7 +2588,8 @@ arc_wait(struct arc_softc *sc)
case ARC_HBA_TYPE_C:
int_mask = arc_read(sc, ARC_RC_INTR_MASK) & ~ARC_RC_INTR_MASK_DOORBELL;
arc_write(sc, ARC_RC_INTR_MASK, int_mask);
- if (tsleep(sc, PWAIT, "arcdb", hz) == EWOULDBLOCK) {
+ error = tsleep_nsec(sc, PWAIT, "arcdb", SEC_TO_NSEC(1));
+ if (error == EWOULDBLOCK) {
int_mask = arc_read(sc, ARC_RC_INTR_MASK) | ARC_RC_INTR_MASK_DOORBELL;
arc_write(sc, ARC_RC_INTR_MASK, int_mask);
}
@@ -2595,7 +2597,8 @@ arc_wait(struct arc_softc *sc)
case ARC_HBA_TYPE_D:
int_mask = arc_read(sc, ARC_RD_INTR_ENABLE) | ARC_RD_INTR_ENABLE_DOORBELL;
arc_write(sc, ARC_RD_INTR_ENABLE, int_mask);
- if (tsleep(sc, PWAIT, "arcdb", hz) == EWOULDBLOCK) {
+ error = tsleep_nsec(sc, PWAIT, "arcdb", SEC_TO_NSEC(1));
+ if (error == EWOULDBLOCK) {
int_mask = arc_read(sc, ARC_RD_INTR_ENABLE) & ~ARC_RD_INTR_ENABLE_DOORBELL;
arc_write(sc, ARC_RD_INTR_ENABLE, int_mask);
}
@@ -2621,7 +2624,7 @@ arc_create_sensors(void *xat)
* XXX * this is bollocks. the firmware has garbage coming out of it
* so we have to wait a bit for it to finish spewing.
*/
- tsleep(sc, PWAIT, "arcspew", 2 * hz);
+ tsleep_nsec(sc, PWAIT, "arcspew", SEC_TO_NSEC(2));
bzero(&bi, sizeof(bi));
if (arc_bio_inq(sc, &bi) != 0) {
diff --git a/sys/dev/pci/cz.c b/sys/dev/pci/cz.c
index a9fb72c8c71..54945003eee 100644
--- a/sys/dev/pci/cz.c
+++ b/sys/dev/pci/cz.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cz.c,v 1.21 2018/02/19 08:59:52 mpi Exp $ */
+/* $OpenBSD: cz.c,v 1.22 2020/01/09 14:35:19 mpi Exp $ */
/* $NetBSD: cz.c,v 1.15 2001/01/20 19:10:36 thorpej Exp $ */
/*-
@@ -921,7 +921,7 @@ cztty_shutdown(struct cztty_softc *sc)
*/
if (ISSET(tp->t_cflag, HUPCL)) {
cztty_modem(sc, 0);
- (void) tsleep(tp, TTIPRI, ttclos, hz);
+ tsleep_nsec(tp, TTIPRI, ttclos, SEC_TO_NSEC(1));
}
/* Disable the channel. */
diff --git a/sys/dev/pci/ichiic.c b/sys/dev/pci/ichiic.c
index 2be25f6cf2e..c42944e5463 100644
--- a/sys/dev/pci/ichiic.c
+++ b/sys/dev/pci/ichiic.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ichiic.c,v 1.42 2019/05/08 15:20:05 jsg Exp $ */
+/* $OpenBSD: ichiic.c,v 1.43 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -311,7 +311,8 @@ ichiic_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
ichiic_intr(sc);
} else {
/* Wait for interrupt */
- if (tsleep(sc, PRIBIO, "ichiic", ICHIIC_TIMEOUT * hz))
+ if (tsleep_nsec(sc, PRIBIO, "ichiic",
+ SEC_TO_NSEC(ICHIIC_TIMEOUT)))
goto timeout;
}
diff --git a/sys/dev/pci/if_bwfm_pci.c b/sys/dev/pci/if_bwfm_pci.c
index d3ef993b28a..16fc305957a 100644
--- a/sys/dev/pci/if_bwfm_pci.c
+++ b/sys/dev/pci/if_bwfm_pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_bwfm_pci.c,v 1.29 2019/02/07 07:39:56 patrick Exp $ */
+/* $OpenBSD: if_bwfm_pci.c,v 1.30 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2010-2016 Broadcom Corporation
* Copyright (c) 2017 Patrick Wildt <patrick@blueri.se>
@@ -1971,7 +1971,7 @@ bwfm_pci_msgbuf_query_dcmd(struct bwfm_softc *bwfm, int ifidx,
bwfm_pci_ring_write_commit(sc, &sc->sc_ctrl_submit);
- tsleep(ctl, PWAIT, "bwfm", hz);
+ tsleep_nsec(ctl, PWAIT, "bwfm", SEC_TO_NSEC(1));
TAILQ_REMOVE(&sc->sc_ioctlq, ctl, next);
if (ctl->m == NULL) {
diff --git a/sys/dev/pci/if_tht.c b/sys/dev/pci/if_tht.c
index 001c6353389..a562222fcb8 100644
--- a/sys/dev/pci/if_tht.c
+++ b/sys/dev/pci/if_tht.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_tht.c,v 1.140 2017/01/22 10:17:38 dlg Exp $ */
+/* $OpenBSD: if_tht.c,v 1.141 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2007 David Gwynne <dlg@openbsd.org>
@@ -1066,7 +1066,7 @@ tht_down(struct tht_softc *sc)
while (tht_fifo_writable(sc, &sc->sc_txt) < sc->sc_txt.tf_len &&
tht_fifo_readable(sc, &sc->sc_txf) > 0)
- tsleep(sc, 0, "thtdown", hz);
+ tsleep_nsec(sc, 0, "thtdown", SEC_TO_NSEC(1));
sc->sc_imr = THT_IMR_DOWN(sc->sc_port);
tht_write(sc, THT_REG_IMR, sc->sc_imr);
diff --git a/sys/dev/pci/piixpm.c b/sys/dev/pci/piixpm.c
index 170e7115d0d..e6f4ec3abeb 100644
--- a/sys/dev/pci/piixpm.c
+++ b/sys/dev/pci/piixpm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: piixpm.c,v 1.40 2019/12/16 21:39:40 claudio Exp $ */
+/* $OpenBSD: piixpm.c,v 1.41 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2005, 2006 Alexander Yurchenko <grange@openbsd.org>
@@ -421,7 +421,8 @@ piixpm_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
piixpm_intr(sc);
} else {
/* Wait for interrupt */
- if (tsleep(sc, PRIBIO, "piixpm", PIIXPM_TIMEOUT * hz))
+ if (tsleep_nsec(sc, PRIBIO, "piixpm",
+ SEC_TO_NSEC(PIIXPM_TIMEOUT)))
goto timeout;
}
diff --git a/sys/dev/pci/viapm.c b/sys/dev/pci/viapm.c
index 3a698512888..db806eedf80 100644
--- a/sys/dev/pci/viapm.c
+++ b/sys/dev/pci/viapm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viapm.c,v 1.17 2018/07/05 10:09:11 fcambus Exp $ */
+/* $OpenBSD: viapm.c,v 1.18 2020/01/09 14:35:19 mpi Exp $ */
/*
* Copyright (c) 2005 Mark Kettenis <kettenis@openbsd.org>
@@ -602,7 +602,8 @@ viapm_i2c_exec(void *cookie, i2c_op_t op, i2c_addr_t addr,
viapm_intr(sc);
} else {
/* Wait for interrupt */
- if (tsleep(sc, PRIBIO, "iicexec", VIAPM_SMBUS_TIMEOUT * hz))
+ if (tsleep_nsec(sc, PRIBIO, "iicexec",
+ SEC_TO_NSEC(VIAPM_SMBUS_TIMEOUT)))
goto timeout;
}