mirror of
https://github.com/openbsd/src.git
synced 2026-06-18 15:23:33 +02:00
Don't allocate a framebuffer if no interface ports have been configured.
ok patrick@
This commit is contained in:
+5
-3
@@ -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);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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 *);
|
||||
|
||||
Reference in New Issue
Block a user