Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/amlogic meson_rng(4): No need for lock -- delet...



details:   https://anonhg.NetBSD.org/src/rev/968fbff6f500
branches:  trunk
changeset: 364359:968fbff6f500
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat Mar 19 11:36:43 2022 +0000

description:
meson_rng(4): No need for lock -- delete it.

We only ever read a single register at a time; no exclusive access or
serialization needed.

XXX This driver should have some kind of hardware-specific health
test -- is there documentation anywhere for what this RNG actually
is?

diffstat:

 sys/arch/arm/amlogic/meson_rng.c |  9 ++-------
 1 files changed, 2 insertions(+), 7 deletions(-)

diffs (49 lines):

diff -r 2ce17eb32344 -r 968fbff6f500 sys/arch/arm/amlogic/meson_rng.c
--- a/sys/arch/arm/amlogic/meson_rng.c  Sat Mar 19 10:05:52 2022 +0000
+++ b/sys/arch/arm/amlogic/meson_rng.c  Sat Mar 19 11:36:43 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: meson_rng.c,v 1.4 2021/01/27 03:10:18 thorpej Exp $ */
+/* $NetBSD: meson_rng.c,v 1.5 2022/03/19 11:36:43 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015-2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.4 2021/01/27 03:10:18 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: meson_rng.c,v 1.5 2022/03/19 11:36:43 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -49,7 +49,6 @@
        bus_space_tag_t         sc_bst;
        bus_space_handle_t      sc_bsh;
 
-       kmutex_t                sc_lock;
        krndsource_t            sc_rndsource;
 };
 
@@ -91,8 +90,6 @@
                return;
        }
 
-       mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_VM);
-
        /* Core clock is optional */
        clk = fdtbus_clock_get(phandle, "core");
        if (clk != NULL && clk_enable(clk) != 0) {
@@ -114,7 +111,6 @@
        struct meson_rng_softc * const sc = priv;
        uint32_t data;
 
-       mutex_spin_enter(&sc->sc_lock);
        while (bytes_wanted) {
                data = bus_space_read_4(sc->sc_bst, sc->sc_bsh, 0);
                rnd_add_data_sync(&sc->sc_rndsource, &data, sizeof(data),
@@ -122,5 +118,4 @@
                bytes_wanted -= MIN(bytes_wanted, sizeof(data));
        }
        explicit_memset(&data, 0, sizeof(data));
-       mutex_spin_exit(&sc->sc_lock);
 }



Home | Main Index | Thread Index | Old Index