Module Name:    src
Committed By:   pgoyette
Date:           Sun Jul 29 02:58:28 UTC 2012

Modified Files:
        src/sys/dev/acpi: acpi_tz.c

Log Message:
Replace local handling of entropy gathering with the new common code
recently introduced into sysmon_envsys(4).

Thanks to jruoho@ for testing.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/acpi/acpi_tz.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/dev/acpi/acpi_tz.c
diff -u src/sys/dev/acpi/acpi_tz.c:1.86 src/sys/dev/acpi/acpi_tz.c:1.87
--- src/sys/dev/acpi/acpi_tz.c:1.86	Thu Jul 19 18:03:32 2012
+++ src/sys/dev/acpi/acpi_tz.c	Sun Jul 29 02:58:27 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_tz.c,v 1.86 2012/07/19 18:03:32 christos Exp $ */
+/* $NetBSD: acpi_tz.c,v 1.87 2012/07/29 02:58:27 pgoyette Exp $ */
 
 /*
  * Copyright (c) 2003 Jared D. McNeill <jmcne...@invisible.ca>
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.86 2012/07/19 18:03:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.87 2012/07/29 02:58:27 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -39,7 +39,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 
 #include <sys/module.h>
 #include <sys/systm.h>
 #include <sys/kmem.h>
-#include <sys/rnd.h>
 
 #include <dev/acpi/acpireg.h>
 #include <dev/acpi/acpivar.h>
@@ -96,7 +95,6 @@ struct acpitz_zone {
 	uint32_t		 fanmin;
 	uint32_t		 fanmax;
 	uint32_t		 fancurrent;
-	uint32_t		 fanprev;
 };
 
 struct acpitz_softc {
@@ -113,8 +111,6 @@ struct acpitz_softc {
 	bool			 sc_have_fan;
 	struct cpu_info	       **sc_psl;
 	size_t			 sc_psl_size;
-	krndsource_t		 sc_tmp_rs;
-	krndsource_t		 sc_fan_rs;
 };
 
 static int		acpitz_match(device_t, cfdata_t, void *);
@@ -167,8 +163,6 @@ acpitz_attach(device_t parent, device_t 
 {
 	struct acpitz_softc *sc = device_private(self);
 	struct acpi_attach_args *aa = aux;
-	char tmpname[sizeof(sc->sc_tmp_rs.name)];
-	char fanname[sizeof(sc->sc_fan_rs.name)];
 	ACPI_INTEGER val;
 	ACPI_STATUS rv;
 
@@ -217,20 +211,6 @@ acpitz_attach(device_t parent, device_t 
 
 	acpitz_init_envsys(self);
 
-	if (sc->sc_have_fan) {
-		snprintf(fanname, sizeof(fanname), "%s-fan",
-			 device_xname(self));
-		snprintf(tmpname, sizeof(tmpname), "%s-tmp",
-			 device_xname(self));
-		rnd_attach_source(&sc->sc_fan_rs,
-				  fanname, RND_TYPE_ENV, 0);
-		rnd_attach_source(&sc->sc_tmp_rs,
-				  tmpname, RND_TYPE_ENV, 0);
-	} else {
-		rnd_attach_source(&sc->sc_tmp_rs,
-				  device_xname(self), RND_TYPE_ENV, 0);
-	}
-
 	callout_schedule(&sc->sc_callout, sc->sc_zone.tzp * hz / 10);
 }
 
@@ -246,11 +226,6 @@ acpitz_detach(device_t self, int flags)
 	callout_halt(&sc->sc_callout, NULL);
 	callout_destroy(&sc->sc_callout);
 
-	rnd_detach_source(&sc->sc_tmp_rs);
-	if (sc->sc_have_fan) {
-		rnd_detach_source(&sc->sc_fan_rs);
-	}
-
 	pmf_device_deregister(self);
 	acpi_deregister_notify(sc->sc_node);
 
@@ -320,19 +295,10 @@ acpitz_get_status(void *opaque)
 	if (sc->sc_first != false)
 		sc->sc_zone.prevtmp = tmp; /* XXX: Sanity check? */
 
-	if (sc->sc_zone.prevtmp != sc->sc_zone.tmp) {
-		rnd_add_uint32(&sc->sc_tmp_rs, sc->sc_zone.tmp);
-	}
-
 	if (acpitz_get_fanspeed(dv, &fmin, &fmax, &fcurrent) == 0) {
-		if (fcurrent != ATZ_TMP_INVALID) {
-			sc->sc_zone.fanprev = sc->sc_zone.fancurrent;
+
+		if (fcurrent != ATZ_TMP_INVALID)
 			sc->sc_zone.fancurrent = fcurrent;
-			if (sc->sc_zone.fanprev != sc->sc_zone.fancurrent) {
-				rnd_add_uint32(&sc->sc_fan_rs,
-						sc->sc_zone.fancurrent);
-			}
-		}
 	}
 
 	sc->sc_temp_sensor.state = ENVSYS_SVALID;
@@ -807,7 +773,8 @@ acpitz_tick(void *opaque)
 static void
 acpitz_init_envsys(device_t dv)
 {
-	const int flags = ENVSYS_FMONLIMITS | ENVSYS_FMONNOTSUPP;
+	const int flags = ENVSYS_FMONLIMITS | ENVSYS_FMONNOTSUPP |
+			  ENVSYS_FHAS_ENTROPY;
 	struct acpitz_softc *sc = device_private(dv);
 	unsigned int i;
 

Reply via email to