From owner-cvs-all@FreeBSD.ORG Sun Oct 23 00:16:42 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 760E016A420; Sun, 23 Oct 2005 00:16:42 +0000 (GMT) (envelope-from njl@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0405E43D48; Sun, 23 Oct 2005 00:16:42 +0000 (GMT) (envelope-from njl@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id j9N0GfVq046659; Sun, 23 Oct 2005 00:16:41 GMT (envelope-from njl@repoman.freebsd.org) Received: (from njl@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id j9N0GfWa046658; Sun, 23 Oct 2005 00:16:41 GMT (envelope-from njl) Message-Id: <200510230016.j9N0GfWa046658@repoman.freebsd.org> From: Nate Lawson Date: Sun, 23 Oct 2005 00:16:41 +0000 (UTC) To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org X-FreeBSD-CVS-Branch: HEAD Cc: Subject: cvs commit: src/sys/dev/acpica acpi_battery.c acpiio.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2005 00:16:42 -0000 njl 2005-10-23 00:16:41 UTC FreeBSD src repository Modified files: sys/dev/acpica acpi_battery.c acpiio.h Log: Cleanups and support code for importing smart battery support. * Use ACPI_BATT_UNKNOWN instead of constants * Use maxunit instead of a count of devices since we may have sparse battery devices in the future. Only userland should be using unit numbers anyway, so provide a translation function. (Kernel use of batteries should be restricted to looking up a device_t and calling methods directly. * Don't check acpi_BatteryIsPresent() in acpi_battery. Leave it up to the hardware-specific driver (i.e. cmbat) since smart batteries seem to not report the "battery present" flag. * Convert mA to mW if the battery uses those units. CM-batteries only used mW so this deficiency went unnoticed. * Clean strings reported in the battery info from any control chars. * Only dereference the unit from ioctl_arg if the full struct is present. Unit wouldn't have been used later if it wasn't present but this is cleaner. Translate the unit if it's not ACPI_BATTERY_ALL_UNITS. * bzero structs before returning them to usermode for future compat. Most of this work was submitted by Hans Petter Selasky and then majorly reworked by myself. Submitted by: Hans Petter Selasky Revision Changes Path 1.20 +120 -29 src/sys/dev/acpica/acpi_battery.c 1.16 +4 -1 src/sys/dev/acpica/acpiio.h