Split device_t/softc and related cosmetic changes.
This commit is contained in:
parent
08b5f8f61c
commit
2be2546b16
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_lid.c,v 1.24 2008/03/23 14:20:15 xtraeme Exp $ */
|
||||
/* $NetBSD: acpi_lid.c,v 1.25 2008/03/26 15:31:59 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright 2001, 2003 Wasabi Systems, Inc.
|
||||
|
@ -40,7 +40,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.24 2008/03/23 14:20:15 xtraeme Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.25 2008/03/26 15:31:59 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_lid.c,v 1.24 2008/03/23 14:20:15 xtraeme Exp $"
|
|||
#include <dev/sysmon/sysmonvar.h>
|
||||
|
||||
struct acpilid_softc {
|
||||
struct device sc_dev; /* base device glue */
|
||||
struct acpi_devnode *sc_node; /* our ACPI devnode */
|
||||
struct sysmon_pswitch sc_smpsw; /* our sysmon glue */
|
||||
};
|
||||
|
@ -63,16 +62,16 @@ static const char * const lid_hid[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static int acpilid_match(struct device *, struct cfdata *, void *);
|
||||
static void acpilid_attach(struct device *, struct device *, void *);
|
||||
static int acpilid_match(device_t, cfdata_t, void *);
|
||||
static void acpilid_attach(device_t, device_t, void *);
|
||||
|
||||
CFATTACH_DECL(acpilid, sizeof(struct acpilid_softc),
|
||||
CFATTACH_DECL_NEW(acpilid, sizeof(struct acpilid_softc),
|
||||
acpilid_match, acpilid_attach, NULL, NULL);
|
||||
|
||||
static void acpilid_status_changed(void *);
|
||||
static void acpilid_notify_handler(ACPI_HANDLE, UINT32, void *);
|
||||
|
||||
static void acpilid_wake_event(struct acpilid_softc *, bool);
|
||||
static void acpilid_wake_event(device_t, bool);
|
||||
static bool acpilid_suspend(device_t PMF_FN_PROTO);
|
||||
|
||||
/*
|
||||
|
@ -81,8 +80,7 @@ static bool acpilid_suspend(device_t PMF_FN_PROTO);
|
|||
* Autoconfiguration `match' routine.
|
||||
*/
|
||||
static int
|
||||
acpilid_match(struct device *parent, struct cfdata *match,
|
||||
void *aux)
|
||||
acpilid_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
|
@ -98,9 +96,9 @@ acpilid_match(struct device *parent, struct cfdata *match,
|
|||
* Autoconfiguration `attach' routine.
|
||||
*/
|
||||
static void
|
||||
acpilid_attach(struct device *parent, struct device *self, void *aux)
|
||||
acpilid_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct acpilid_softc *sc = (void *) self;
|
||||
struct acpilid_softc *sc = device_private(self);
|
||||
struct acpi_attach_args *aa = aux;
|
||||
ACPI_STATUS rv;
|
||||
|
||||
|
@ -109,19 +107,19 @@ acpilid_attach(struct device *parent, struct device *self, void *aux)
|
|||
|
||||
sc->sc_node = aa->aa_node;
|
||||
|
||||
sc->sc_smpsw.smpsw_name = sc->sc_dev.dv_xname;
|
||||
sc->sc_smpsw.smpsw_name = device_xname(self);
|
||||
sc->sc_smpsw.smpsw_type = PSWITCH_TYPE_LID;
|
||||
if (sysmon_pswitch_register(&sc->sc_smpsw) != 0) {
|
||||
aprint_error("%s: unable to register with sysmon\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(self, "unable to register with sysmon\n");
|
||||
return;
|
||||
}
|
||||
|
||||
rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle,
|
||||
ACPI_DEVICE_NOTIFY, acpilid_notify_handler, sc);
|
||||
ACPI_DEVICE_NOTIFY, acpilid_notify_handler, self);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
aprint_error("%s: unable to register DEVICE NOTIFY handler: %s\n",
|
||||
sc->sc_dev.dv_xname, AcpiFormatException(rv));
|
||||
aprint_error_dev(self,
|
||||
"unable to register DEVICE NOTIFY handler: %s\n",
|
||||
AcpiFormatException(rv));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -132,8 +130,10 @@ acpilid_attach(struct device *parent, struct device *self, void *aux)
|
|||
}
|
||||
|
||||
static void
|
||||
acpilid_wake_event(struct acpilid_softc *sc, bool enable)
|
||||
acpilid_wake_event(device_t dv, bool enable)
|
||||
{
|
||||
struct acpilid_softc *sc = device_private(dv);
|
||||
|
||||
ACPI_STATUS rv;
|
||||
ACPI_OBJECT_LIST ArgList;
|
||||
ACPI_OBJECT Arg;
|
||||
|
@ -144,10 +144,10 @@ acpilid_wake_event(struct acpilid_softc *sc, bool enable)
|
|||
Arg.Type = ACPI_TYPE_INTEGER;
|
||||
Arg.Integer.Value = enable ? 1 : 0;
|
||||
|
||||
rv = AcpiEvaluateObject (sc->sc_node->ad_handle, "_PSW",
|
||||
rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "_PSW",
|
||||
&ArgList, NULL);
|
||||
if (ACPI_FAILURE(rv) && rv != AE_NOT_FOUND)
|
||||
aprint_error_dev(&sc->sc_dev,
|
||||
aprint_error_dev(dv,
|
||||
"unable to evaluate _PSW handler: %s\n",
|
||||
AcpiFormatException(rv));
|
||||
}
|
||||
|
@ -178,29 +178,29 @@ acpilid_status_changed(void *arg)
|
|||
* Callback from ACPI interrupt handler to notify us of an event.
|
||||
*/
|
||||
static void
|
||||
acpilid_notify_handler(ACPI_HANDLE handle, UINT32 notify,
|
||||
void *context)
|
||||
acpilid_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
|
||||
{
|
||||
struct acpilid_softc *sc = context;
|
||||
device_t dv = context;
|
||||
struct acpilid_softc *sc = device_private(dv);
|
||||
int rv;
|
||||
|
||||
switch (notify) {
|
||||
case ACPI_NOTIFY_LidStatusChanged:
|
||||
#ifdef ACPI_LID_DEBUG
|
||||
printf("%s: received LidStatusChanged message\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
device_xname(dv));
|
||||
#endif
|
||||
rv = AcpiOsExecute(OSL_NOTIFY_HANDLER,
|
||||
acpilid_status_changed, sc);
|
||||
if (ACPI_FAILURE(rv))
|
||||
printf("%s: WARNING: unable to queue lid change "
|
||||
"callback: %s\n", sc->sc_dev.dv_xname,
|
||||
AcpiFormatException(rv));
|
||||
aprint_error_dev(dv,
|
||||
"WARNING: unable to queue lid change "
|
||||
"callback: %s\n", AcpiFormatException(rv));
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("%s: received unknown notify message: 0x%x\n",
|
||||
sc->sc_dev.dv_xname, notify);
|
||||
aprint_debug_dev(dv,
|
||||
"received unknown notify message: 0x%x\n", notify);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -215,6 +215,6 @@ acpilid_suspend(device_t dv PMF_FN_ARGS)
|
|||
if (ACPI_FAILURE(rv))
|
||||
return true;
|
||||
|
||||
acpilid_wake_event(sc, status == 0);
|
||||
acpilid_wake_event(dv, status == 0);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: acpi_tz.c,v 1.32 2007/12/09 20:27:53 jmcneill Exp $ */
|
||||
/* $NetBSD: acpi_tz.c,v 1.33 2008/03/26 15:31:59 xtraeme Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2003 Jared D. McNeill <jmcneill@invisible.ca>
|
||||
|
@ -30,7 +30,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.32 2007/12/09 20:27:53 jmcneill Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.33 2008/03/26 15:31:59 xtraeme Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
|
@ -68,8 +68,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_tz.c,v 1.32 2007/12/09 20:27:53 jmcneill Exp $"
|
|||
/* sensor indexes */
|
||||
#define ATZ_SENSOR_TEMP 0 /* thermal zone temperature */
|
||||
|
||||
static int acpitz_match(struct device *, struct cfdata *, void *);
|
||||
static void acpitz_attach(struct device *, struct device *, void *);
|
||||
static int acpitz_match(device_t, cfdata_t, void *);
|
||||
static void acpitz_attach(device_t, device_t, void *);
|
||||
|
||||
/*
|
||||
* ACPI Temperature Zone information. Note all temperatures are reported
|
||||
|
@ -101,7 +101,6 @@ struct acpitz_zone {
|
|||
};
|
||||
|
||||
struct acpitz_softc {
|
||||
struct device sc_dev;
|
||||
struct acpi_devnode *sc_devnode;
|
||||
struct acpitz_zone sc_zone;
|
||||
struct callout sc_callout;
|
||||
|
@ -119,26 +118,26 @@ struct acpitz_softc {
|
|||
static void acpitz_get_status(void *);
|
||||
static void acpitz_get_zone(void *, int);
|
||||
static void acpitz_get_zone_quiet(void *);
|
||||
static char* acpitz_celcius_string(int);
|
||||
static void acpitz_print_status(struct acpitz_softc *);
|
||||
static char *acpitz_celcius_string(int);
|
||||
static void acpitz_print_status(device_t);
|
||||
static void acpitz_power_off(struct acpitz_softc *);
|
||||
static void acpitz_power_zone(struct acpitz_softc *, int, int);
|
||||
static void acpitz_sane_temp(UINT32 *tmp);
|
||||
static ACPI_STATUS
|
||||
acpitz_switch_cooler(ACPI_OBJECT *, void *);
|
||||
static void acpitz_notify_handler(ACPI_HANDLE, UINT32, void *);
|
||||
static int acpitz_get_integer(struct acpitz_softc *, const char *, UINT32 *);
|
||||
static int acpitz_get_integer(device_t, const char *, UINT32 *);
|
||||
static void acpitz_tick(void *);
|
||||
static void acpitz_init_envsys(struct acpitz_softc *);
|
||||
static void acpitz_init_envsys(device_t);
|
||||
|
||||
CFATTACH_DECL(acpitz, sizeof(struct acpitz_softc), acpitz_match,
|
||||
CFATTACH_DECL_NEW(acpitz, sizeof(struct acpitz_softc), acpitz_match,
|
||||
acpitz_attach, NULL, NULL);
|
||||
|
||||
/*
|
||||
* acpitz_match: autoconf(9) match routine
|
||||
*/
|
||||
static int
|
||||
acpitz_match(struct device *parent, struct cfdata *match, void *aux)
|
||||
acpitz_match(device_t parent, cfdata_t match, void *aux)
|
||||
{
|
||||
struct acpi_attach_args *aa = aux;
|
||||
|
||||
|
@ -152,9 +151,9 @@ acpitz_match(struct device *parent, struct cfdata *match, void *aux)
|
|||
* acpitz_attach: autoconf(9) attach routine
|
||||
*/
|
||||
static void
|
||||
acpitz_attach(struct device *parent, struct device *self, void *aux)
|
||||
acpitz_attach(device_t parent, device_t self, void *aux)
|
||||
{
|
||||
struct acpitz_softc *sc = (struct acpitz_softc *)self;
|
||||
struct acpitz_softc *sc = device_private(self);
|
||||
struct acpi_attach_args *aa = aux;
|
||||
ACPI_STATUS rv;
|
||||
ACPI_INTEGER v;
|
||||
|
@ -184,21 +183,21 @@ acpitz_attach(struct device *parent, struct device *self, void *aux)
|
|||
sc->sc_zone_expire = ATZ_ZONE_EXPIRE / sc->sc_zone.tzp;
|
||||
sc->sc_first = 1;
|
||||
|
||||
acpitz_get_zone(sc, 1);
|
||||
acpitz_get_status(sc);
|
||||
acpitz_get_zone(self, 1);
|
||||
acpitz_get_status(self);
|
||||
|
||||
rv = AcpiInstallNotifyHandler(sc->sc_devnode->ad_handle,
|
||||
ACPI_SYSTEM_NOTIFY, acpitz_notify_handler, sc);
|
||||
ACPI_SYSTEM_NOTIFY, acpitz_notify_handler, self);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
aprint_error(": unable to install SYSTEM NOTIFY handler: %s\n",
|
||||
AcpiFormatException(rv));
|
||||
return;
|
||||
}
|
||||
|
||||
callout_init(&sc->sc_callout, 0);
|
||||
callout_setfunc(&sc->sc_callout, acpitz_tick, sc);
|
||||
callout_init(&sc->sc_callout, CALLOUT_MPSAFE);
|
||||
callout_setfunc(&sc->sc_callout, acpitz_tick, self);
|
||||
|
||||
acpitz_init_envsys(sc);
|
||||
acpitz_init_envsys(self);
|
||||
|
||||
if (!pmf_device_register(self, NULL, NULL))
|
||||
aprint_error(": couldn't establish power handler\n");
|
||||
|
@ -215,7 +214,8 @@ acpitz_get_zone_quiet(void *opaque)
|
|||
static void
|
||||
acpitz_get_status(void *opaque)
|
||||
{
|
||||
struct acpitz_softc *sc = opaque;
|
||||
device_t dv = opaque;
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
UINT32 tmp, active;
|
||||
int i, flags;
|
||||
|
||||
|
@ -223,13 +223,12 @@ acpitz_get_status(void *opaque)
|
|||
if (sc->sc_zone_expire <= 0) {
|
||||
sc->sc_zone_expire = ATZ_ZONE_EXPIRE / sc->sc_zone.tzp;
|
||||
if (sc->sc_flags & ATZ_F_VERBOSE)
|
||||
printf("%s: force refetch zone\n", sc->sc_dev.dv_xname);
|
||||
printf("%s: force refetch zone\n", device_xname(dv));
|
||||
acpitz_get_zone(sc, 0);
|
||||
}
|
||||
|
||||
if (acpitz_get_integer(sc, "_TMP", &tmp)) {
|
||||
aprint_error("%s: failed to evaluate _TMP\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
if (acpitz_get_integer(dv, "_TMP", &tmp)) {
|
||||
aprint_error_dev(dv, "failed to evaluate _TMP\n");
|
||||
return;
|
||||
}
|
||||
sc->sc_zone.tmp = tmp;
|
||||
|
@ -245,7 +244,7 @@ acpitz_get_status(void *opaque)
|
|||
sc->sc_sensor.state = ENVSYS_SVALID;
|
||||
|
||||
if (sc->sc_flags & ATZ_F_VERBOSE)
|
||||
acpitz_print_status(sc);
|
||||
acpitz_print_status(dv);
|
||||
|
||||
if (sc->sc_flags & ATZ_F_PASSIVEONLY) {
|
||||
/* Passive Cooling: XXX not yet */
|
||||
|
@ -264,7 +263,8 @@ acpitz_get_status(void *opaque)
|
|||
active = i;
|
||||
}
|
||||
|
||||
flags = sc->sc_flags & ~(ATZ_F_CRITICAL|ATZ_F_HOT|ATZ_F_PASSIVE);
|
||||
flags = sc->sc_flags &
|
||||
~(ATZ_F_CRITICAL|ATZ_F_HOT|ATZ_F_PASSIVE);
|
||||
if (sc->sc_zone.psv != ATZ_TMP_INVALID &&
|
||||
tmp >= sc->sc_zone.psv)
|
||||
flags |= ATZ_F_PASSIVE;
|
||||
|
@ -280,13 +280,13 @@ acpitz_get_status(void *opaque)
|
|||
sc->sc_flags = flags;
|
||||
if (changed & ATZ_F_CRITICAL) {
|
||||
sc->sc_sensor.state = ENVSYS_SCRITICAL;
|
||||
printf("%s: zone went critical at temp %sC\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
aprint_normal_dev(dv,
|
||||
"zone went critical at temp %sC\n",
|
||||
acpitz_celcius_string(tmp));
|
||||
} else if (changed & ATZ_F_HOT) {
|
||||
sc->sc_sensor.state = ENVSYS_SWARNOVER;
|
||||
printf("%s: zone went hot at temp %sC\n",
|
||||
sc->sc_dev.dv_xname,
|
||||
aprint_normal_dev(dv,
|
||||
"zone went hot at temp %sC\n",
|
||||
acpitz_celcius_string(tmp));
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ acpitz_get_status(void *opaque)
|
|||
if (active != ATZ_ACTIVE_NONE) {
|
||||
if (sc->sc_flags & ATZ_F_VERBOSE)
|
||||
printf("%s: active cooling level %u\n",
|
||||
sc->sc_dev.dv_xname, active);
|
||||
device_xname(dv), active);
|
||||
acpitz_power_zone(sc, active, 1);
|
||||
}
|
||||
|
||||
|
@ -322,10 +322,11 @@ acpitz_celcius_string(int dk)
|
|||
}
|
||||
|
||||
static void
|
||||
acpitz_print_status(struct acpitz_softc *sc)
|
||||
acpitz_print_status(device_t dv)
|
||||
{
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
|
||||
printf("%s: zone temperature is now %sC\n", sc->sc_dev.dv_xname,
|
||||
printf("%s: zone temperature is now %sC\n", device_xname(dv),
|
||||
acpitz_celcius_string(sc->sc_zone.tmp));
|
||||
|
||||
return;
|
||||
|
@ -407,7 +408,8 @@ acpitz_power_off(struct acpitz_softc *sc)
|
|||
static void
|
||||
acpitz_get_zone(void *opaque, int verbose)
|
||||
{
|
||||
struct acpitz_softc *sc = opaque;
|
||||
device_t dv = opaque;
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
ACPI_STATUS rv;
|
||||
char buf[8];
|
||||
int i, valid_levels;
|
||||
|
@ -429,7 +431,7 @@ acpitz_get_zone(void *opaque, int verbose)
|
|||
ACPI_OBJECT *obj;
|
||||
|
||||
snprintf(buf, sizeof(buf), "_AC%d", i);
|
||||
if (acpitz_get_integer(sc, buf, &sc->sc_zone.ac[i]))
|
||||
if (acpitz_get_integer(dv, buf, &sc->sc_zone.ac[i]))
|
||||
continue;
|
||||
|
||||
snprintf(buf, sizeof(buf), "_AL%d", i);
|
||||
|
@ -457,15 +459,15 @@ acpitz_get_zone(void *opaque, int verbose)
|
|||
valid_levels++;
|
||||
}
|
||||
|
||||
acpitz_get_integer(sc, "_TMP", &sc->sc_zone.tmp);
|
||||
acpitz_get_integer(sc, "_CRT", &sc->sc_zone.crt);
|
||||
acpitz_get_integer(sc, "_HOT", &sc->sc_zone.hot);
|
||||
acpitz_get_integer(dv, "_TMP", &sc->sc_zone.tmp);
|
||||
acpitz_get_integer(dv, "_CRT", &sc->sc_zone.crt);
|
||||
acpitz_get_integer(dv, "_HOT", &sc->sc_zone.hot);
|
||||
sc->sc_zone.psl.Length = ACPI_ALLOCATE_BUFFER;
|
||||
sc->sc_zone.psl.Pointer = NULL;
|
||||
AcpiEvaluateObject(sc, "_PSL", NULL, &sc->sc_zone.psl);
|
||||
acpitz_get_integer(sc, "_PSV", &sc->sc_zone.psv);
|
||||
acpitz_get_integer(sc, "_TC1", &sc->sc_zone.tc1);
|
||||
acpitz_get_integer(sc, "_TC2", &sc->sc_zone.tc2);
|
||||
acpitz_get_integer(dv, "_PSV", &sc->sc_zone.psv);
|
||||
acpitz_get_integer(dv, "_TC1", &sc->sc_zone.tc1);
|
||||
acpitz_get_integer(dv, "_TC2", &sc->sc_zone.tc2);
|
||||
|
||||
acpitz_sane_temp(&sc->sc_zone.tmp);
|
||||
acpitz_sane_temp(&sc->sc_zone.crt);
|
||||
|
@ -503,7 +505,7 @@ acpitz_get_zone(void *opaque, int verbose)
|
|||
static void
|
||||
acpitz_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
|
||||
{
|
||||
struct acpitz_softc *sc = opaque;
|
||||
device_t dv = opaque;
|
||||
ACPI_OSD_EXEC_CALLBACK func = NULL;
|
||||
const char *name;
|
||||
int rv;
|
||||
|
@ -519,18 +521,16 @@ acpitz_notify_handler(ACPI_HANDLE hdl, UINT32 notify, void *opaque)
|
|||
name = "get zone";
|
||||
break;
|
||||
default:
|
||||
printf("%s: received unhandled notify message 0x%x\n",
|
||||
sc->sc_dev.dv_xname, notify);
|
||||
aprint_debug_dev(dv,
|
||||
"received unhandled notify message 0x%x\n", notify);
|
||||
return;
|
||||
}
|
||||
|
||||
KASSERT(func != NULL);
|
||||
|
||||
rv = AcpiOsExecute(OSL_NOTIFY_HANDLER, func, sc);
|
||||
rv = AcpiOsExecute(OSL_NOTIFY_HANDLER, func, dv);
|
||||
if (rv != AE_OK)
|
||||
printf("%s: unable to queue %s\n", sc->sc_dev.dv_xname, name);
|
||||
|
||||
return;
|
||||
aprint_debug_dev(dv, "unable to queue %s\n", name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -542,15 +542,16 @@ acpitz_sane_temp(UINT32 *tmp)
|
|||
}
|
||||
|
||||
static int
|
||||
acpitz_get_integer(struct acpitz_softc *sc, const char *cm, UINT32 *val)
|
||||
acpitz_get_integer(device_t dv, const char *cm, UINT32 *val)
|
||||
{
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
ACPI_STATUS rv;
|
||||
ACPI_INTEGER tmp;
|
||||
|
||||
rv = acpi_eval_integer(sc->sc_devnode->ad_handle, cm, &tmp);
|
||||
if (ACPI_FAILURE(rv)) {
|
||||
#ifdef ACPI_DEBUG
|
||||
printf("%s: failed to evaluate %s: %s\n", sc->sc_dev.dv_xname,
|
||||
printf("%s: failed to evaluate %s: %s\n", device_private(dv),
|
||||
cm, AcpiFormatException(rv));
|
||||
#endif
|
||||
*val = ATZ_TMP_INVALID;
|
||||
|
@ -565,16 +566,19 @@ acpitz_get_integer(struct acpitz_softc *sc, const char *cm, UINT32 *val)
|
|||
static void
|
||||
acpitz_tick(void *opaque)
|
||||
{
|
||||
struct acpitz_softc *sc = opaque;
|
||||
device_t dv = opaque;
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
|
||||
AcpiOsExecute(OSL_NOTIFY_HANDLER, acpitz_get_status, sc);
|
||||
AcpiOsExecute(OSL_NOTIFY_HANDLER, acpitz_get_status, dv);
|
||||
|
||||
callout_schedule(&sc->sc_callout, sc->sc_zone.tzp * hz / 10);
|
||||
}
|
||||
|
||||
static void
|
||||
acpitz_init_envsys(struct acpitz_softc *sc)
|
||||
acpitz_init_envsys(device_t dv)
|
||||
{
|
||||
struct acpitz_softc *sc = device_private(dv);
|
||||
|
||||
sc->sc_sme = sysmon_envsys_create();
|
||||
sc->sc_sensor.monitor = true;
|
||||
sc->sc_sensor.flags = (ENVSYS_FMONCRITICAL|ENVSYS_FMONWARNOVER);
|
||||
|
@ -585,13 +589,11 @@ acpitz_init_envsys(struct acpitz_softc *sc)
|
|||
}
|
||||
|
||||
/* hook into sysmon */
|
||||
sc->sc_sme->sme_name = sc->sc_dev.dv_xname;
|
||||
sc->sc_sme->sme_cookie = sc;
|
||||
sc->sc_sme->sme_name = device_xname(dv);
|
||||
sc->sc_sme->sme_flags = SME_DISABLE_REFRESH;
|
||||
|
||||
if (sysmon_envsys_register(sc->sc_sme)) {
|
||||
printf("%s: unable to register with sysmon\n",
|
||||
sc->sc_dev.dv_xname);
|
||||
aprint_error_dev(dv, "unable to register with sysmon\n");
|
||||
sysmon_envsys_destroy(sc->sc_sme);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue