Module Name:    src
Committed By:   riastradh
Date:           Sat Mar 19 11:36:53 UTC 2022

Modified Files:
        src/sys/arch/arm/nvidia: tegra124_car.c

Log Message:
tegra124_car(4): No need for rnd lock -- delete it.

This only ever reads from a single device register, so no need to
serialize access.

XXX This should really have a hardware-specific health test, but I
can't find any documentation on the underlying physical entropy
source.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/arm/nvidia/tegra124_car.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/nvidia/tegra124_car.c
diff -u src/sys/arch/arm/nvidia/tegra124_car.c:1.22 src/sys/arch/arm/nvidia/tegra124_car.c:1.23
--- src/sys/arch/arm/nvidia/tegra124_car.c:1.22	Wed Jan 27 03:10:19 2021
+++ src/sys/arch/arm/nvidia/tegra124_car.c	Sat Mar 19 11:36:53 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra124_car.c,v 1.22 2021/01/27 03:10:19 thorpej Exp $ */
+/* $NetBSD: tegra124_car.c,v 1.23 2022/03/19 11:36:53 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.22 2021/01/27 03:10:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra124_car.c,v 1.23 2022/03/19 11:36:53 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -708,7 +708,6 @@ struct tegra124_car_softc {
 	u_int			sc_clock_cells;
 	u_int			sc_reset_cells;
 
-	kmutex_t		sc_rndlock;
 	krndsource_t		sc_rndsource;
 };
 
@@ -917,7 +916,6 @@ tegra124_car_rnd_attach(device_t self)
 {
 	struct tegra124_car_softc * const sc = device_private(self);
 
-	mutex_init(&sc->sc_rndlock, MUTEX_DEFAULT, IPL_VM);
 	rndsource_setcb(&sc->sc_rndsource, tegra124_car_rnd_callback, sc);
 	rnd_attach_source(&sc->sc_rndsource, device_xname(sc->sc_dev),
 	    RND_TYPE_RNG, RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
@@ -930,7 +928,6 @@ tegra124_car_rnd_callback(size_t bytes_w
 	uint16_t buf[512];
 	uint32_t cnt;
 
-	mutex_enter(&sc->sc_rndlock);
 	while (bytes_wanted) {
 		const u_int nbytes = MIN(bytes_wanted, 1024);
 		for (cnt = 0; cnt < bytes_wanted / 2; cnt++) {
@@ -942,7 +939,6 @@ tegra124_car_rnd_callback(size_t bytes_w
 		bytes_wanted -= MIN(bytes_wanted, nbytes);
 	}
 	explicit_memset(buf, 0, sizeof(buf));
-	mutex_exit(&sc->sc_rndlock);
 }
 
 static struct tegra_clk *

Reply via email to