OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: [PATCH] fix recent regression in acpibat(4)

From: Marco Peereboom (slashpeereboom.us)
Date: Mon Aug 04 2008 - 13:01:44 CDT


Stefan, my apologies, you were right and so was your patch.

Slightly modified patch.

Index: acpibat.c
===================================================================
RCS file: /cvs/src/sys/dev/acpi/acpibat.c,v
retrieving revision 1.50
diff -u -p -u -p -r1.50 acpibat.c
--- acpibat.c 13 Jun 2008 05:50:21 -0000 1.50
+++ acpibat.c 4 Aug 2008 18:01:33 -0000
-292,9 +292,10 acpibat_getbif(struct acpibat_softc *sc)
         struct aml_value res;
         int rv = EINVAL;
 
- memset(&sc->sc_bif, 0, sizeof(sc->sc_bif));
- if (!sc->sc_bat_present)
- return 0;
+ if (!sc->sc_bat_present) {
+ memset(&sc->sc_bif, 0, sizeof(sc->sc_bif));
+ return (0);
+ }
 
         if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BIF", 0, NULL, &res)) {
                 dnprintf(10, "%s: no _BIF\n", DEVNAME(sc));
-355,9 +356,10 acpibat_getbst(struct acpibat_softc *sc)
         struct aml_value res;
         int rv = EINVAL;
 
- memset(&sc->sc_bst, 0, sizeof(sc->sc_bst));
- if (!sc->sc_bat_present)
- return 0;
+ if (!sc->sc_bat_present) {
+ memset(&sc->sc_bst, 0, sizeof(sc->sc_bst));
+ return (0);
+ }
 
         if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BST", 0, NULL, &res)) {
                 dnprintf(10, "%s: no _BST\n", DEVNAME(sc));
-400,7 +402,8 int
 acpibat_notify(struct aml_node *node, int notify_type, void *arg)
 {
         struct acpibat_softc *sc = arg;
- struct aml_value res;
+ struct aml_value res;
+ int present
 
         dnprintf(10, "acpibat_notify: %.2x %s\n", notify_type,
             sc->sc_devnode->name);
-408,8 +411,7 acpibat_notify(struct aml_node *node, in
         /* Check if installed state of battery has changed */
         memset(&res, 0, sizeof(res));
         if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res) == 0) {
- int present = (res.v_integer & STA_BATTERY);
-
+ present = res.v_integer & STA_BATTERY;
                 if (!sc->sc_bat_present && present) {
                         printf("%s: %s inserted\n", DEVNAME(sc),
                             sc->sc_devnode->name);

On Mon, Aug 04, 2008 at 12:22:27PM -0500, Marco Peereboom wrote:
> Ok I misdiagnosed the issue.
>
> My bad let me restart from scratch.
>
> On Mon, Aug 04, 2008 at 06:59:45PM +0200, Marco Pfatschbacher wrote:
> > On Mon, Aug 04, 2008 at 10:57:34AM -0500, Marco Peereboom wrote:
> > > Since we have always used NOPOLL and put POLL in there to work around
> > > stupid systems I'll keep the current code as is. Release is getting
> > > closer and this is not important enough to risk. I will revisit this
> > > after release.
> >
> > Why not just backout acpibat.c -r 1.50 ?
> > Or maybe reconsider Stefan's first patch.
> > No ACPIDEV_POLL changes involved and it's enough to fix things.
> >
> >
> > Marco