Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev fix hang when SSDFB_ATTACH_FLAG_CONSOLE used with spi



details:   https://anonhg.NetBSD.org/src/rev/c86b7a9ebda1
branches:  trunk
changeset: 460753:c86b7a9ebda1
user:      tnn <tnn%NetBSD.org@localhost>
date:      Sat Nov 02 17:13:20 2019 +0000

description:
fix hang when SSDFB_ATTACH_FLAG_CONSOLE used with spi

diffstat:

 sys/dev/ic/ssdfb.c      |  7 ++++---
 sys/dev/spi/ssdfb_spi.c |  8 ++++----
 2 files changed, 8 insertions(+), 7 deletions(-)

diffs (64 lines):

diff -r a718190988c2 -r c86b7a9ebda1 sys/dev/ic/ssdfb.c
--- a/sys/dev/ic/ssdfb.c        Sat Nov 02 16:36:56 2019 +0000
+++ b/sys/dev/ic/ssdfb.c        Sat Nov 02 17:13:20 2019 +0000
@@ -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 @@
        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. */
diff -r a718190988c2 -r c86b7a9ebda1 sys/dev/spi/ssdfb_spi.c
--- a/sys/dev/spi/ssdfb_spi.c   Sat Nov 02 16:36:56 2019 +0000
+++ b/sys/dev/spi/ssdfb_spi.c   Sat Nov 02 17:13:20 2019 +0000
@@ -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 @@
        /*
         * 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 @@
        /*
         * 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);



Home | Main Index | Thread Index | Old Index