patch-2.4.10 linux/drivers/acpi/ospm/ac_adapter/ac.c
Next file: linux/drivers/acpi/ospm/ac_adapter/ac_osl.c
Previous file: linux/drivers/acpi/os.c
Back to the patch index
Back to the overall index
- Lines: 276
- Date:
Sun Sep 23 09:42:32 2001
- Orig file:
v2.4.9/linux/drivers/acpi/ospm/ac_adapter/ac.c
- Orig date:
Tue Jul 3 17:08:19 2001
diff -u --recursive --new-file v2.4.9/linux/drivers/acpi/ospm/ac_adapter/ac.c linux/drivers/acpi/ospm/ac_adapter/ac.c
@@ -1,7 +1,7 @@
/*****************************************************************************
*
* Module Name: ac.c
- * $Revision: 19 $
+ * $Revision: 22 $
*
*****************************************************************************/
@@ -51,6 +51,36 @@
ac_print (
AC_CONTEXT *ac_adapter)
{
+#ifdef ACPI_DEBUG
+
+ acpi_buffer buffer;
+
+ PROC_NAME("ac_print");
+
+ if (!ac_adapter) {
+ return;
+ }
+
+ buffer.length = 256;
+ buffer.pointer = acpi_os_callocate(buffer.length);
+ if (!buffer.pointer) {
+ return;
+ }
+
+ /*
+ * Get the full pathname for this ACPI object.
+ */
+ acpi_get_name(ac_adapter->acpi_handle, ACPI_FULL_PATHNAME, &buffer);
+
+ /*
+ * Print out basic adapter information.
+ */
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "| AC Adapter[%02x]:[%p] %s\n", ac_adapter->device_handle, ac_adapter->acpi_handle, buffer.pointer));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INFO, "+------------------------------------------------------------\n"));
+
+ acpi_os_free(buffer.pointer);
+#endif /*ACPI_DEBUG*/
return;
}
@@ -68,18 +98,23 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_add_device(
BM_HANDLE device_handle,
void **context)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
BM_DEVICE *device = NULL;
AC_CONTEXT *ac_adapter = NULL;
- ACPI_DEVICE_INFO info;
+ acpi_device_info info;
+
+ FUNCTION_TRACE("ac_add_device");
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Adding ac_adapter device [%02x].\n", device_handle));
if (!context || *context) {
- return(AE_BAD_PARAMETER);
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid (NULL) context."));
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
@@ -87,7 +122,7 @@
*/
status = bm_get_device_info(device_handle, &device);
if (ACPI_FAILURE(status)) {
- return(status);
+ return_ACPI_STATUS(status);
}
/*
@@ -95,7 +130,7 @@
*/
ac_adapter = acpi_os_callocate(sizeof(AC_CONTEXT));
if (!ac_adapter) {
- return(AE_NO_MEMORY);
+ return_ACPI_STATUS(AE_NO_MEMORY);
}
ac_adapter->device_handle = device->handle;
@@ -106,6 +141,7 @@
*/
status = acpi_get_object_info(ac_adapter->acpi_handle, &info);
if (ACPI_FAILURE(status)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unable to get object info for ac_adapter device."));
goto end;
}
@@ -125,6 +161,7 @@
* -----
*/
if (!(info.valid & ACPI_VALID_STA)) {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Must have valid _STA.\n"));
status = AE_ERROR;
goto end;
}
@@ -143,7 +180,7 @@
acpi_os_free(ac_adapter);
}
- return(status);
+ return_ACPI_STATUS(status);
}
@@ -159,26 +196,30 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_remove_device (
void **context)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
AC_CONTEXT *ac_adapter = NULL;
+ FUNCTION_TRACE("ac_remove_device");
+
if (!context || !*context) {
- return(AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
ac_adapter = (AC_CONTEXT*)*context;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing ac_adapter device [%02x].\n", ac_adapter->device_handle));
+
ac_osl_remove_device(ac_adapter);
acpi_os_free(ac_adapter);
*context = NULL;
- return(status);
+ return_ACPI_STATUS(status);
}
@@ -198,13 +239,15 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_initialize (void)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
+ FUNCTION_TRACE("ac_initialize");
+
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
@@ -218,7 +261,7 @@
status = bm_register_driver(&criteria, &driver);
- return(status);
+ return_ACPI_STATUS(status);
}
@@ -234,13 +277,15 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_terminate (void)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
BM_DEVICE_ID criteria;
BM_DRIVER driver;
+ FUNCTION_TRACE("ac_terminate");
+
MEMSET(&criteria, 0, sizeof(BM_DEVICE_ID));
MEMSET(&driver, 0, sizeof(BM_DRIVER));
@@ -254,7 +299,7 @@
status = bm_unregister_driver(&criteria, &driver);
- return(status);
+ return_ACPI_STATUS(status);
}
@@ -269,16 +314,18 @@
* DESCRIPTION:
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_notify (
BM_NOTIFY notify_type,
BM_HANDLE device_handle,
void **context)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
+
+ FUNCTION_TRACE("ac_notify");
if (!context) {
- return(AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
switch (notify_type) {
@@ -292,6 +339,7 @@
break;
case AC_NOTIFY_STATUS_CHANGE:
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status change event detected.\n"));
status = ac_osl_generate_event(notify_type,
((AC_CONTEXT*)*context));
break;
@@ -301,7 +349,7 @@
break;
}
- return(status);
+ return_ACPI_STATUS(status);
}
@@ -317,18 +365,20 @@
*
****************************************************************************/
-ACPI_STATUS
+acpi_status
ac_request (
BM_REQUEST *request,
void *context)
{
- ACPI_STATUS status = AE_OK;
+ acpi_status status = AE_OK;
+
+ FUNCTION_TRACE("ac_request");
/*
* Must have a valid request structure and context.
*/
if (!request || !context) {
- return(AE_BAD_PARAMETER);
+ return_ACPI_STATUS(AE_BAD_PARAMETER);
}
/*
@@ -344,5 +394,5 @@
request->status = status;
- return(status);
+ return_ACPI_STATUS(status);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)