summaryrefslogtreecommitdiff
path: root/sys/dev/fdt
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2018-07-31 10:07:14 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2018-07-31 10:07:14 +0000
commitbad17f5d01c5e0e6f050e98a51a3a6e6aecd5205 (patch)
treeb8d62a459bdb9204d462586c6592c6d0850dd5b5 /sys/dev/fdt
parent6e3a6094e8aec7a668376a3d73fa7e5e2d9e77e7 (diff)
Fix setting the voltage; the code was using the wrong variable as a step size.
Includes some cosmetic fixes as well.
Diffstat (limited to 'sys/dev/fdt')
-rw-r--r--sys/dev/fdt/fanpwr.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/fdt/fanpwr.c b/sys/dev/fdt/fanpwr.c
index 23d40c2e952..115d52f54f6 100644
--- a/sys/dev/fdt/fanpwr.c
+++ b/sys/dev/fdt/fanpwr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fanpwr.c,v 1.1 2018/06/02 12:19:26 kettenis Exp $ */
+/* $OpenBSD: fanpwr.c,v 1.2 2018/07/31 10:07:13 kettenis Exp $ */
/*
* Copyright (c) 2018 Mark Kettenis <kettenis@openbsd.org>
*
@@ -70,7 +70,7 @@ struct cfdriver fanpwr_cd = {
uint8_t fanpwr_read(struct fanpwr_softc *, int);
void fanpwr_write(struct fanpwr_softc *, int, uint8_t);
uint32_t fanpwr_get_voltage(void *);
-int fanpwr_set_voltage(void *, uint32_t voltage);
+int fanpwr_set_voltage(void *, uint32_t);
int
fanpwr_match(struct device *parent, void *match, void *aux)
@@ -236,7 +236,7 @@ fanpwr_set_voltage(void *cookie, uint32_t voltage)
{
struct fanpwr_softc *sc = cookie;
uint32_t vmin = sc->sc_vbase;
- uint32_t vmax = vmin + (FAN53555_VSEL_NSEL_MASK) * sc->sc_vstep;
+ uint32_t vmax = vmin + FAN53555_VSEL_NSEL_MASK * sc->sc_vstep;
uint8_t vsel;
if (voltage < vmin || voltage > vmax)
@@ -244,7 +244,7 @@ fanpwr_set_voltage(void *cookie, uint32_t voltage)
vsel = fanpwr_read(sc, sc->sc_vsel);
vsel &= ~FAN53555_VSEL_NSEL_MASK;
- vsel |= (voltage - sc->sc_vbase) / sc->sc_vsel;
+ vsel |= (voltage - sc->sc_vbase) / sc->sc_vstep;
fanpwr_write(sc, sc->sc_vsel, vsel);
return 0;