Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Replace local handling of entropy gathering wit...



details:   https://anonhg.NetBSD.org/src/rev/6be7fdb85934
branches:  trunk
changeset: 780556:6be7fdb85934
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Jul 29 02:58:27 2012 +0000

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

Thanks to jruoho@ for testing.

diffstat:

 sys/dev/acpi/acpi_tz.c |  45 ++++++---------------------------------------
 1 files changed, 6 insertions(+), 39 deletions(-)

diffs (117 lines):

diff -r 6f0899f1f6b1 -r 6be7fdb85934 sys/dev/acpi/acpi_tz.c
--- a/sys/dev/acpi/acpi_tz.c    Sun Jul 29 00:08:19 2012 +0000
+++ b/sys/dev/acpi/acpi_tz.c    Sun Jul 29 02:58:27 2012 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
 #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 @@
        uint32_t                 fanmin;
        uint32_t                 fanmax;
        uint32_t                 fancurrent;
-       uint32_t                 fanprev;
 };
 
 struct acpitz_softc {
@@ -113,8 +111,6 @@
        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 @@
 {
        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_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 @@
        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 @@
        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 (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 @@
 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;
 



Home | Main Index | Thread Index | Old Index