diff options
author | 2020-01-26 23:04:41 +0000 | |
---|---|---|
committer | 2020-01-26 23:04:41 +0000 | |
commit | feb18c6c03642d1ac61962b428d223ec35710518 (patch) | |
tree | 6fb9eb01da6e8844192f668a3e620a00f6db2bed | |
parent | Log the old kernel version before doing the upgrade. Makes it easier (diff) | |
download | wireguard-openbsd-feb18c6c03642d1ac61962b428d223ec35710518.tar.xz wireguard-openbsd-feb18c6c03642d1ac61962b428d223ec35710518.zip |
The enable-gpios property is an optional property, so don't error out if
it's not there. This allows pwmbl(4) to attach and work on the Pinebook
Pro.
-rw-r--r-- | sys/dev/fdt/pwmbl.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/sys/dev/fdt/pwmbl.c b/sys/dev/fdt/pwmbl.c index d2c336568b8..db9dde295c1 100644 --- a/sys/dev/fdt/pwmbl.c +++ b/sys/dev/fdt/pwmbl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pwmbl.c,v 1.1 2019/10/21 20:52:33 kettenis Exp $ */ +/* $OpenBSD: pwmbl.c,v 1.2 2020/01/26 23:04:41 patrick Exp $ */ /* * Copyright (c) 2019 Krystian Lewandowski * Copyright (c) 2019 Mark Kettenis <kettenis@openbsd.org> @@ -86,18 +86,14 @@ pwmbl_attach(struct device *parent, struct device *self, void *aux) sc->sc_pwm_len = len; len = OF_getproplen(faa->fa_node, "enable-gpios"); - if (len < 0) { - free(sc->sc_pwm, M_DEVBUF, sc->sc_pwm_len); - printf(": no gpio\n"); - return; + if (len > 0) { + gpios = malloc(len, M_TEMP, M_WAITOK); + OF_getpropintarray(faa->fa_node, "enable-gpios", gpios, len); + gpio_controller_config_pin(&gpios[0], GPIO_CONFIG_OUTPUT); + gpio_controller_set_pin(&gpios[0], 1); + free(gpios, M_TEMP, len); } - gpios = malloc(len, M_TEMP, M_WAITOK); - OF_getpropintarray(faa->fa_node, "enable-gpios", gpios, len); - gpio_controller_config_pin(&gpios[0], GPIO_CONFIG_OUTPUT); - gpio_controller_set_pin(&gpios[0], 1); - free(gpios, M_TEMP, len); - len = OF_getproplen(faa->fa_node, "brightness-levels"); if (len < 0) { free(sc->sc_pwm, M_DEVBUF, sc->sc_pwm_len); |