summaryrefslogtreecommitdiffstats
path: root/sys/dev/acpica/acpi_button.c
diff options
context:
space:
mode:
authornjl <njl@FreeBSD.org>2003-08-11 15:34:43 +0000
committernjl <njl@FreeBSD.org>2003-08-11 15:34:43 +0000
commit913f59e5bd29583d447d856ebff9f64ecdf9297e (patch)
tree9483237ba1c800d6c52ddd78011cffb5e0e0ec97 /sys/dev/acpica/acpi_button.c
parent581beee0a85a43275dca02bc412ddbbfecd3f6af (diff)
downloadFreeBSD-src-913f59e5bd29583d447d856ebff9f64ecdf9297e.zip
FreeBSD-src-913f59e5bd29583d447d856ebff9f64ecdf9297e.tar.gz
Style cleanups to match the rest of this directory. For acpi_battery.c,
remove unused includes.
Diffstat (limited to 'sys/dev/acpica/acpi_button.c')
-rw-r--r--sys/dev/acpica/acpi_button.c58
1 files changed, 26 insertions, 32 deletions
diff --git a/sys/dev/acpica/acpi_button.c b/sys/dev/acpica/acpi_button.c
index f1a9221..f8db68b 100644
--- a/sys/dev/acpica/acpi_button.c
+++ b/sys/dev/acpica/acpi_button.c
@@ -34,28 +34,29 @@
#include <sys/bus.h>
#include "acpi.h"
-
#include <dev/acpica/acpivar.h>
-/*
- * Hooks for the ACPI CA debugging infrastructure
- */
+/* Hooks for the ACPI CA debugging infrastructure */
#define _COMPONENT ACPI_BUTTON
ACPI_MODULE_NAME("BUTTON")
struct acpi_button_softc {
device_t button_dev;
ACPI_HANDLE button_handle;
-#define ACPI_POWER_BUTTON 0
-#define ACPI_SLEEP_BUTTON 1
boolean_t button_type; /* Power or Sleep Button */
+#define ACPI_POWER_BUTTON 0
+#define ACPI_SLEEP_BUTTON 1
};
+#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP 0x80
+#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP 0x02
+
static int acpi_button_probe(device_t dev);
static int acpi_button_attach(device_t dev);
static int acpi_button_suspend(device_t dev);
static int acpi_button_resume(device_t dev);
-static void acpi_button_notify_handler(ACPI_HANDLE h,UINT32 notify, void *context);
+static void acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify,
+ void *context);
static void acpi_button_notify_pressed_for_sleep(void *arg);
static void acpi_button_notify_pressed_for_wakeup(void *arg);
@@ -77,7 +78,8 @@ static driver_t acpi_button_driver = {
};
static devclass_t acpi_button_devclass;
-DRIVER_MODULE(acpi_button, acpi, acpi_button_driver, acpi_button_devclass, 0, 0);
+DRIVER_MODULE(acpi_button, acpi, acpi_button_driver, acpi_button_devclass,
+ 0, 0);
static int
acpi_button_probe(device_t dev)
@@ -90,16 +92,16 @@ acpi_button_probe(device_t dev)
if (acpi_MatchHid(dev, "PNP0C0C")) {
device_set_desc(dev, "Power Button");
sc->button_type = ACPI_POWER_BUTTON;
- return(0);
+ return (0);
}
if (acpi_MatchHid(dev, "PNP0C0E")) {
device_set_desc(dev, "Sleep Button");
sc->button_type = ACPI_SLEEP_BUTTON;
- return(0);
+ return (0);
}
}
}
- return(ENXIO);
+ return (ENXIO);
}
static int
@@ -114,13 +116,15 @@ acpi_button_attach(device_t dev)
sc->button_dev = dev;
sc->button_handle = acpi_get_handle(dev);
- if (ACPI_FAILURE(status = AcpiInstallNotifyHandler(sc->button_handle, ACPI_DEVICE_NOTIFY,
- acpi_button_notify_handler, sc))) {
- device_printf(sc->button_dev, "couldn't install Notify handler - %s\n", AcpiFormatException(status));
- return_VALUE(ENXIO);
+ status = AcpiInstallNotifyHandler(sc->button_handle, ACPI_DEVICE_NOTIFY,
+ acpi_button_notify_handler, sc);
+ if (ACPI_FAILURE(status)) {
+ device_printf(sc->button_dev, "couldn't install Notify handler - %s\n",
+ AcpiFormatException(status));
+ return_VALUE (ENXIO);
}
acpi_device_enable_wake_capability(sc->button_handle, 1);
- return_VALUE(0);
+ return_VALUE (0);
}
static int
@@ -136,7 +140,6 @@ acpi_button_suspend(device_t dev)
static int
acpi_button_resume(device_t dev)
{
-
return (0);
}
@@ -150,9 +153,8 @@ acpi_button_notify_pressed_for_sleep(void *arg)
sc = (struct acpi_button_softc *)arg;
acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
- if (acpi_sc == NULL) {
+ if (acpi_sc == NULL)
return_VOID;
- }
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
@@ -166,7 +168,6 @@ acpi_button_notify_pressed_for_sleep(void *arg)
default:
break; /* unknown button type */
}
- return_VOID;
}
static void
@@ -179,9 +180,8 @@ acpi_button_notify_pressed_for_wakeup(void *arg)
sc = (struct acpi_button_softc *)arg;
acpi_sc = acpi_device_get_parent_softc(sc->button_dev);
- if (acpi_sc == NULL) {
+ if (acpi_sc == NULL)
return_VOID;
- }
switch (sc->button_type) {
case ACPI_POWER_BUTTON:
@@ -195,13 +195,8 @@ acpi_button_notify_pressed_for_wakeup(void *arg)
default:
break; /* unknown button type */
}
- return_VOID;
}
-/* XXX maybe not here */
-#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP 0x80
-#define ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP 0x02
-
static void
acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
{
@@ -211,15 +206,14 @@ acpi_button_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context)
switch (notify) {
case ACPI_NOTIFY_BUTTON_PRESSED_FOR_SLEEP:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_sleep, sc);
+ AcpiOsQueueForExecution(OSD_PRIORITY_LO,
+ acpi_button_notify_pressed_for_sleep, sc);
break;
case ACPI_NOTIFY_BUTTON_PRESSED_FOR_WAKEUP:
- AcpiOsQueueForExecution(OSD_PRIORITY_LO, acpi_button_notify_pressed_for_wakeup, sc);
+ AcpiOsQueueForExecution(OSD_PRIORITY_LO,
+ acpi_button_notify_pressed_for_wakeup, sc);
break;
default:
break; /* unknown notification value */
}
- return_VOID;
}
-
-
OpenPOWER on IntegriCloud