. add a missing call to lockinit() in apmattach()

. while here, explicitly initialize three softc variables to 0
This commit is contained in:
aymeric 2004-04-15 11:03:15 +00:00
parent 299dfa38bf
commit 8f2774036c

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.9 2003/07/15 02:43:28 lukem Exp $ */
/* $NetBSD: apm.c,v 1.10 2004/04/15 11:03:15 aymeric Exp $ */
/* $OpenBSD: apm.c,v 1.5 2002/06/07 07:13:59 miod Exp $ */
/*-
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.9 2003/07/15 02:43:28 lukem Exp $");
__KERNEL_RCSID(0, "$NetBSD: apm.c,v 1.10 2004/04/15 11:03:15 aymeric Exp $");
#include "apm.h"
@ -188,12 +188,18 @@ apmattach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct apm_softc *sc = (struct apm_softc *) self;
struct pmu_battery_info info;
pm_battery_info(0, &info);
printf(": battery flags 0x%X, ", info.flags);
printf("%d%% charged\n", ((info.cur_charge * 100) / info.max_charge));
sc->sc_flags = 0;
sc->event_ptr = 0;
sc->event_count = 0;
lockinit(&sc->sc_lock, PWAIT, "apmlk", 0, 0);
}
int