summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/fdt/rkdrm.c8
-rw-r--r--sys/dev/ofw/ofw_misc.c11
-rw-r--r--sys/dev/ofw/ofw_misc.h4
3 files changed, 15 insertions, 8 deletions
diff --git a/sys/dev/fdt/rkdrm.c b/sys/dev/fdt/rkdrm.c
index 9349bc092ea..3165e99c95c 100644
--- a/sys/dev/fdt/rkdrm.c
+++ b/sys/dev/fdt/rkdrm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rkdrm.c,v 1.3 2020/03/16 21:51:25 kettenis Exp $ */
+/* $OpenBSD: rkdrm.c,v 1.4 2020/03/22 14:56:24 kettenis Exp $ */
/* $NetBSD: rk_drm.c,v 1.3 2019/12/15 01:00:58 mrg Exp $ */
/*-
* Copyright (c) 2019 Jared D. McNeill <jmcneill@invisible.ca>
@@ -422,6 +422,7 @@ rkdrm_attachhook(struct device *dev)
struct drm_device *ddev;
uint32_t *ports;
int i, portslen, nports;
+ int error;
portslen = OF_getproplen(sc->sc_node, "ports");
if (portslen < 0) {
@@ -441,8 +442,9 @@ rkdrm_attachhook(struct device *dev)
ports = malloc(portslen, M_TEMP, M_WAITOK);
OF_getpropintarray(sc->sc_node, "ports", ports, portslen);
for (i = 0; i < portslen / sizeof(uint32_t); i++) {
- device_port_activate(ports[i], &sc->sc_ddev);
- nports++;
+ error = device_port_activate(ports[i], &sc->sc_ddev);
+ if (error == 0)
+ nports++;
}
free(ports, M_TEMP, portslen);
diff --git a/sys/dev/ofw/ofw_misc.c b/sys/dev/ofw/ofw_misc.c
index 2ffdab2efe5..c212e6c39aa 100644
--- a/sys/dev/ofw/ofw_misc.c
+++ b/sys/dev/ofw/ofw_misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.c,v 1.17 2020/03/21 22:45:18 patrick Exp $ */
+/* $OpenBSD: ofw_misc.c,v 1.18 2020/03/22 14:56:24 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -565,11 +565,12 @@ endpoint_get_cookie(struct endpoint *ep)
return ports->dp_ep_get_cookie(ports->dp_cookie, ep);
}
-void
+int
device_port_activate(uint32_t phandle, void *arg)
{
struct device_port *dp = NULL;
struct endpoint *ep, *rep;
+ int count;
int error;
LIST_FOREACH(ep, &endpoints, ep_list) {
@@ -579,8 +580,9 @@ device_port_activate(uint32_t phandle, void *arg)
}
}
if (dp == NULL)
- return;
+ return ENXIO;
+ count = 0;
LIST_FOREACH(ep, &dp->dp_endpoints, ep_plist) {
rep = endpoint_remote(ep);
if (rep == NULL)
@@ -592,5 +594,8 @@ device_port_activate(uint32_t phandle, void *arg)
error = endpoint_activate(rep, arg);
if (error)
continue;
+ count++;
}
+
+ return count ? 0 : ENXIO;
}
diff --git a/sys/dev/ofw/ofw_misc.h b/sys/dev/ofw/ofw_misc.h
index 8dc20e9c33b..dcbf0546e7a 100644
--- a/sys/dev/ofw/ofw_misc.h
+++ b/sys/dev/ofw/ofw_misc.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofw_misc.h,v 1.11 2020/03/16 21:51:26 kettenis Exp $ */
+/* $OpenBSD: ofw_misc.h,v 1.12 2020/03/22 14:56:24 kettenis Exp $ */
/*
* Copyright (c) 2017 Mark Kettenis
*
@@ -171,7 +171,7 @@ struct endpoint {
};
void device_ports_register(struct device_ports *, enum endpoint_type);
-void device_port_activate(uint32_t, void *);
+int device_port_activate(uint32_t, void *);
struct endpoint *endpoint_byreg(struct device_ports *, uint32_t, uint32_t);
struct endpoint *endpoint_remote(struct endpoint *);
int endpoint_activate(struct endpoint *, void *);