summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2005-03-17 22:42:49 +0000
committernjl <njl@FreeBSD.org>2005-03-17 22:42:49 +0000
commit4e0061357a3e770220c7fb5da320e3a0940d0248 (patch)
tree3c2159f789744dc837e683dbfa20e741d176fe37
parentb39d6b16b2181f1aebaca3111a89e89964d1ca52 (diff)
downloadFreeBSD-src-4e0061357a3e770220c7fb5da320e3a0940d0248.zip
FreeBSD-src-4e0061357a3e770220c7fb5da320e3a0940d0248.tar.gz
Introduce a general name for the previously cmbat-only ioctls. It has the
same value as the previous ioctls so no binary change. Also, make a few style changes to reduce diffs to my tree. Loosely based on code from: Hans Petter Selasky
-rw-r--r--sys/dev/acpica/acpi_battery.c18
-rw-r--r--sys/dev/acpica/acpiio.h24
2 files changed, 22 insertions, 20 deletions
diff --git a/sys/dev/acpica/acpi_battery.c b/sys/dev/acpica/acpi_battery.c
index d2adad9..6857e91 100644
--- a/sys/dev/acpica/acpi_battery.c
+++ b/sys/dev/acpica/acpi_battery.c
@@ -66,19 +66,19 @@ acpi_battery_get_units(void)
}
int
-acpi_battery_get_battdesc(int logical_unit, struct acpi_battdesc *battdesc)
+acpi_battery_get_battdesc(int unit, struct acpi_battdesc *battdesc)
{
struct acpi_batteries *bp;
int error, i;
error = ENXIO;
ACPI_SERIAL_BEGIN(battery);
- if (logical_unit < 0 || logical_unit >= acpi_batteries_units)
+ if (unit < 0 || unit >= acpi_batteries_units)
goto out;
i = 0;
TAILQ_FOREACH(bp, &acpi_batteries, link) {
- if (logical_unit == i) {
+ if (unit == i) {
battdesc->type = bp->battdesc.type;
battdesc->phys_unit = bp->battdesc.phys_unit;
error = 0;
@@ -125,7 +125,7 @@ static int
acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
{
union acpi_battery_ioctl_arg *ioctl_arg;
- int error, logical_unit;
+ int error, unit;
ioctl_arg = (union acpi_battery_ioctl_arg *)addr;
error = 0;
@@ -139,12 +139,12 @@ acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
*(int *)addr = acpi_battery_get_units();
break;
case ACPIIO_BATT_GET_BATTDESC:
- logical_unit = ioctl_arg->unit;
- error = acpi_battery_get_battdesc(logical_unit, &ioctl_arg->battdesc);
+ unit = ioctl_arg->unit;
+ error = acpi_battery_get_battdesc(unit, &ioctl_arg->battdesc);
break;
case ACPIIO_BATT_GET_BATTINFO:
- logical_unit = ioctl_arg->unit;
- error = acpi_battery_get_battinfo(logical_unit, &ioctl_arg->battinfo);
+ unit = ioctl_arg->unit;
+ error = acpi_battery_get_battinfo(unit, &ioctl_arg->battinfo);
break;
default:
error = EINVAL;
@@ -157,7 +157,7 @@ acpi_battery_ioctl(u_long cmd, caddr_t addr, void *arg)
static int
acpi_battery_sysctl(SYSCTL_HANDLER_ARGS)
{
- int val, error;
+ int val, error;
acpi_battery_get_battinfo(-1, &acpi_battery_battinfo);
val = *(u_int *)oidp->oid_arg1;
diff --git a/sys/dev/acpica/acpiio.h b/sys/dev/acpica/acpiio.h
index d4221ab..42894f2 100644
--- a/sys/dev/acpica/acpiio.h
+++ b/sys/dev/acpica/acpiio.h
@@ -36,7 +36,7 @@
#define ACPIIO_SETSLPSTATE _IOW('P', 3, int)
struct acpi_battdesc {
- int type; /* battery type: e.g. CMBAT */
+ int type; /* battery type */
int phys_unit; /* physical unit of devclass */
};
@@ -45,7 +45,7 @@ struct acpi_battdesc {
struct acpi_battinfo {
int cap; /* percent */
- int min; /* remaining time */
+ int min; /* remaining time (in minutes) */
int state; /* battery state */
};
@@ -80,24 +80,26 @@ struct acpi_bst {
#define ACPI_BATT_STAT_MAX 0x0007
union acpi_battery_ioctl_arg {
- int unit; /* argument: logical unit (-1 = overall) */
+ int unit; /* argument: logical unit (-1 = overall) */
- struct acpi_battdesc battdesc;
- struct acpi_battinfo battinfo;
+ struct acpi_battdesc battdesc;
+ struct acpi_battinfo battinfo;
- struct acpi_bif bif; /* for acpi_cmbat */
- struct acpi_bst bst; /* for acpi_cmbat */
+ struct acpi_bif bif;
+ struct acpi_bst bst;
};
-/* Common battery ioctl */
+/* Common battery ioctls */
#define ACPIIO_BATT_GET_UNITS _IOR('B', 0x01, int)
#define ACPIIO_BATT_GET_TYPE _IOR('B', 0x02, union acpi_battery_ioctl_arg)
#define ACPIIO_BATT_GET_BATTINFO _IOWR('B', 0x03, union acpi_battery_ioctl_arg)
#define ACPIIO_BATT_GET_BATTDESC _IOWR('B', 0x04, union acpi_battery_ioctl_arg)
+#define ACPIIO_BATT_GET_BIF _IOWR('B', 0x10, union acpi_battery_ioctl_arg)
+#define ACPIIO_BATT_GET_BST _IOWR('B', 0x11, union acpi_battery_ioctl_arg)
-/* Cotrol Method battery ioctl */
-#define ACPIIO_CMBAT_GET_BIF _IOWR('B', 0x10, union acpi_battery_ioctl_arg)
-#define ACPIIO_CMBAT_GET_BST _IOWR('B', 0x11, union acpi_battery_ioctl_arg)
+/* Control Method battery ioctls (deprecated) */
+#define ACPIIO_CMBAT_GET_BIF ACPIIO_BATT_GET_BIF
+#define ACPIIO_CMBAT_GET_BST ACPIIO_BATT_GET_BST
/* Get AC adapter status. */
#define ACPIIO_ACAD_GET_STATUS _IOR('A', 1, int)
OpenPOWER on IntegriCloud