acpi_battery.c (85556) | acpi_battery.c (85729) |
---|---|
1/*- 2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * | 1/*- 2 * Copyright (c) 2000 Mitsuru IWASAKI <iwasaki@jp.freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/dev/acpica/acpi_battery.c 85556 2001-10-26 17:43:05Z iwasaki $ | 26 * $FreeBSD: head/sys/dev/acpica/acpi_battery.c 85729 2001-10-30 14:24:26Z iwasaki $ |
27 */ 28 29#include "opt_acpi.h" /* XXX trim includes */ 30#include <sys/param.h> 31#include <sys/kernel.h> 32#include <sys/proc.h> 33#include <sys/lock.h> 34#include <sys/malloc.h> --- 23 unchanged lines hidden (view full) --- 58struct acpi_batteries { 59 TAILQ_ENTRY(acpi_batteries) link; 60 struct acpi_battdesc battdesc; 61}; 62 63static TAILQ_HEAD(,acpi_batteries) acpi_batteries; 64static int acpi_batteries_initted = 0; 65static int acpi_batteries_units = 0; | 27 */ 28 29#include "opt_acpi.h" /* XXX trim includes */ 30#include <sys/param.h> 31#include <sys/kernel.h> 32#include <sys/proc.h> 33#include <sys/lock.h> 34#include <sys/malloc.h> --- 23 unchanged lines hidden (view full) --- 58struct acpi_batteries { 59 TAILQ_ENTRY(acpi_batteries) link; 60 struct acpi_battdesc battdesc; 61}; 62 63static TAILQ_HEAD(,acpi_batteries) acpi_batteries; 64static int acpi_batteries_initted = 0; 65static int acpi_batteries_units = 0; |
66static int acpi_battery_info_expire = 5; |
|
66static struct acpi_battinfo acpi_battery_battinfo; 67 68int 69acpi_battery_get_units(void) 70{ 71 72 return (acpi_batteries_units); 73} --- 44 unchanged lines hidden (view full) --- 118 error = ENXIO; 119 break; 120 } 121 } 122out: 123 return (error); 124} 125 | 67static struct acpi_battinfo acpi_battery_battinfo; 68 69int 70acpi_battery_get_units(void) 71{ 72 73 return (acpi_batteries_units); 74} --- 44 unchanged lines hidden (view full) --- 119 error = ENXIO; 120 break; 121 } 122 } 123out: 124 return (error); 125} 126 |
127int 128acpi_battery_get_info_expire(void) 129{ 130 131 return (acpi_battery_info_expire); 132} 133 |
|
126static int 127acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg) 128{ 129 int error; 130 int logical_unit; 131 union acpi_battery_ioctl_arg *ioctl_arg; 132 133 ioctl_arg = (union acpi_battery_ioctl_arg *)addr; --- 80 unchanged lines hidden (view full) --- 214 &acpi_battery_battinfo.min, 0, acpi_battery_sysctl, "I", ""); 215 SYSCTL_ADD_PROC(&sc->acpi_battery_sysctl_ctx, 216 SYSCTL_CHILDREN(sc->acpi_battery_sysctl_tree), 217 OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RD, 218 &acpi_battery_battinfo.state, 0, acpi_battery_sysctl, "I", ""); 219 SYSCTL_ADD_INT(&sc->acpi_battery_sysctl_ctx, 220 SYSCTL_CHILDREN(sc->acpi_battery_sysctl_tree), 221 OID_AUTO, "units", CTLFLAG_RD, &acpi_batteries_units, 0, ""); | 134static int 135acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg) 136{ 137 int error; 138 int logical_unit; 139 union acpi_battery_ioctl_arg *ioctl_arg; 140 141 ioctl_arg = (union acpi_battery_ioctl_arg *)addr; --- 80 unchanged lines hidden (view full) --- 222 &acpi_battery_battinfo.min, 0, acpi_battery_sysctl, "I", ""); 223 SYSCTL_ADD_PROC(&sc->acpi_battery_sysctl_ctx, 224 SYSCTL_CHILDREN(sc->acpi_battery_sysctl_tree), 225 OID_AUTO, "state", CTLTYPE_INT | CTLFLAG_RD, 226 &acpi_battery_battinfo.state, 0, acpi_battery_sysctl, "I", ""); 227 SYSCTL_ADD_INT(&sc->acpi_battery_sysctl_ctx, 228 SYSCTL_CHILDREN(sc->acpi_battery_sysctl_tree), 229 OID_AUTO, "units", CTLFLAG_RD, &acpi_batteries_units, 0, ""); |
230 SYSCTL_ADD_INT(&sc->acpi_battery_sysctl_ctx, 231 SYSCTL_CHILDREN(sc->acpi_battery_sysctl_tree), 232 OID_AUTO, "info_expire", CTLFLAG_RD | CTLFLAG_RW, 233 &acpi_battery_info_expire, 0, ""); |
|
222 223 return (error); 224} 225 226int 227acpi_battery_register(int type, int phys_unit) 228{ 229 int error; --- 21 unchanged lines hidden --- | 234 235 return (error); 236} 237 238int 239acpi_battery_register(int type, int phys_unit) 240{ 241 int error; --- 21 unchanged lines hidden --- |