Source-Changes-HG archive

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

[src/trunk]: src/sys/dev ssdfb: revert rev 1.14



details:   https://anonhg.NetBSD.org/src/rev/9162f6495606
branches:  trunk
changeset: 1022763:9162f6495606
user:      tnn <tnn%NetBSD.org@localhost>
date:      Thu Aug 05 22:31:20 2021 +0000

description:
ssdfb: revert rev 1.14

Can't run the worker thread MPSAFE with spi(4) yet because most controller
drivers still lack MP safety. Cause issues when using multiple displays.

diffstat:

 sys/dev/i2c/ssdfb_i2c.c |   5 +++--
 sys/dev/ic/ssdfb.c      |  17 +++++++++++------
 sys/dev/ic/ssdfbvar.h   |   3 ++-
 3 files changed, 16 insertions(+), 9 deletions(-)

diffs (89 lines):

diff -r 3e49eef2f2a7 -r 9162f6495606 sys/dev/i2c/ssdfb_i2c.c
--- a/sys/dev/i2c/ssdfb_i2c.c   Thu Aug 05 19:23:44 2021 +0000
+++ b/sys/dev/i2c/ssdfb_i2c.c   Thu Aug 05 22:31:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $ */
+/* $NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.10 2021/07/30 13:44:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb_i2c.c,v 1.11 2021/08/05 22:31:20 tnn Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -112,6 +112,7 @@
        if ((flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK) == SSDFB_PRODUCT_UNKNOWN)
                flags |= SSDFB_PRODUCT_SSD1306_GENERIC;
 
+       flags |= SSDFB_ATTACH_FLAG_MPSAFE;
        sc->sc.sc_dev = self;
        sc->sc_i2c_tag = ia->ia_tag;
        sc->sc_i2c_addr = ia->ia_addr;
diff -r 3e49eef2f2a7 -r 9162f6495606 sys/dev/ic/ssdfb.c
--- a/sys/dev/ic/ssdfb.c        Thu Aug 05 19:23:44 2021 +0000
+++ b/sys/dev/ic/ssdfb.c        Thu Aug 05 22:31:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.18 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31: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.18 2021/08/05 19:07:09 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -268,6 +268,7 @@
        int error = 0;
        long defattr;
        const struct ssdfb_product *p;
+       int kt_flags;
 
        p = ssdfb_lookup_product(flags & SSDFB_ATTACH_FLAG_PRODUCT_MASK);
        if (p == NULL) {
@@ -393,11 +394,15 @@
        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");
-       error = kthread_create(PRI_SOFTCLOCK, KTHREAD_MUSTJOIN | KTHREAD_MPSAFE,
-           NULL, ssdfb_thread, sc,  &sc->sc_thread, "%s",
-           device_xname(sc->sc_dev));
+       kt_flags = KTHREAD_MUSTJOIN;
+       /* XXX spi(4) is not MPSAFE yet. */
+       if (ISSET(flags, SSDFB_ATTACH_FLAG_MPSAFE))
+               kt_flags |= KTHREAD_MPSAFE;
+       error = kthread_create(PRI_SOFTCLOCK, kt_flags, NULL, ssdfb_thread, sc,
+           &sc->sc_thread, "%s", device_xname(sc->sc_dev));
        if (error) {
                cv_destroy(&sc->sc_cond);
                mutex_destroy(&sc->sc_cond_mtx);
diff -r 3e49eef2f2a7 -r 9162f6495606 sys/dev/ic/ssdfbvar.h
--- a/sys/dev/ic/ssdfbvar.h     Thu Aug 05 19:23:44 2021 +0000
+++ b/sys/dev/ic/ssdfbvar.h     Thu Aug 05 22:31:20 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfbvar.h,v 1.9 2021/08/05 19:07:09 tnn Exp $ */
+/* $NetBSD: ssdfbvar.h,v 1.10 2021/08/05 22:31:20 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -36,6 +36,7 @@
 #define SSDFB_ATTACH_FLAG_UPSIDEDOWN           0x00000100
 #define SSDFB_ATTACH_FLAG_INVERSE              0x00000200
 #define SSDFB_ATTACH_FLAG_CONSOLE              0x00000400
+#define SSDFB_ATTACH_FLAG_MPSAFE               0x00000800
 
 /*
  * Fundamental commands



Home | Main Index | Thread Index | Old Index