fix hang when SSDFB_ATTACH_FLAG_CONSOLE used with spi

This commit is contained in:
tnn 2019-11-02 17:13:20 +00:00
parent 8cce55b527
commit c022c48edf
2 changed files with 8 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ssdfb.c,v 1.9 2019/11/02 14:18:36 tnn Exp $ */
/* $NetBSD: ssdfb.c,v 1.10 2019/11/02 17:13:20 tnn Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.9 2019/11/02 14:18:36 tnn Exp $");
__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.10 2019/11/02 17:13:20 tnn Exp $");
#include "opt_ddb.h"
@ -331,7 +331,8 @@ ssdfb_attach(struct ssdfb_softc *sc, int flags)
if (sc->sc_is_console)
ssdfb_set_usepoll(sc, true);
mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT, IPL_SCHED);
mutex_init(&sc->sc_cond_mtx, MUTEX_DEFAULT,
ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE) ? IPL_SCHED : IPL_BIO);
cv_init(&sc->sc_cond, "ssdfb");
kt_flags = KTHREAD_MUSTJOIN;
/* XXX spi(4) is not MPSAFE yet. */

View File

@ -1,4 +1,4 @@
/* $NetBSD: ssdfb_spi.c,v 1.1 2019/11/02 14:33:27 tnn Exp $ */
/* $NetBSD: ssdfb_spi.c,v 1.2 2019/11/02 17:13:20 tnn Exp $ */
/*
* Copyright (c) 2019 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.1 2019/11/02 14:33:27 tnn Exp $");
__KERNEL_RCSID(0, "$NetBSD: ssdfb_spi.c,v 1.2 2019/11/02 17:13:20 tnn Exp $");
#include <sys/param.h>
#include <sys/device.h>
@ -170,7 +170,7 @@ ssdfb_spi_xfer_rect_3wire_ssd1322(void *cookie, uint8_t fromcol, uint8_t tocol,
/*
* Unlike iic(4), there is no way to force spi(4) to use polling.
*/
if (usepoll || cold)
if (usepoll && !cold)
return 0;
ssdfb_bitstream_init(&s, bitstream);
@ -294,7 +294,7 @@ ssdfb_spi_xfer_rect_4wire_ssd1322(void *cookie, uint8_t fromcol, uint8_t tocol,
/*
* Unlike iic(4), there is no way to force spi(4) to use polling.
*/
if (usepoll || cold)
if (usepoll && !cold)
return 0;
ssdfb_spi_4wire_set_dc(sc, 0);