linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / acpi / pci_bind.c
index 1e2ae6e..2a718df 100644 (file)
@@ -47,10 +47,11 @@ struct acpi_pci_data {
 static void acpi_pci_data_handler(acpi_handle handle, u32 function,
                                  void *context)
 {
+       ACPI_FUNCTION_TRACE("acpi_pci_data_handler");
 
        /* TBD: Anything we need to do here? */
 
-       return;
+       return_VOID;
 }
 
 /**
@@ -67,24 +68,25 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
        struct acpi_device *device = NULL;
        struct acpi_pci_data *data = NULL;
 
+       ACPI_FUNCTION_TRACE("acpi_get_pci_id");
 
        if (!id)
-               return AE_BAD_PARAMETER;
+               return_ACPI_STATUS(AE_BAD_PARAMETER);
 
        result = acpi_bus_get_device(handle, &device);
        if (result) {
-               printk(KERN_ERR PREFIX
-                           "Invalid ACPI Bus context for device %s\n",
-                           acpi_device_bid(device));
-               return AE_NOT_EXIST;
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI Bus context for device %s\n",
+                                 acpi_device_bid(device)));
+               return_ACPI_STATUS(AE_NOT_EXIST);
        }
 
        status = acpi_get_data(handle, acpi_pci_data_handler, (void **)&data);
        if (ACPI_FAILURE(status) || !data) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Invalid ACPI-PCI context for device %s",
-                               acpi_device_bid(device)));
-               return status;
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI-PCI context for device %s\n",
+                                 acpi_device_bid(device)));
+               return_ACPI_STATUS(status);
        }
 
        *id = data->id;
@@ -101,7 +103,7 @@ acpi_status acpi_get_pci_id(acpi_handle handle, struct acpi_pci_id *id)
                          acpi_device_bid(device), id->segment, id->bus,
                          id->device, id->function));
 
-       return AE_OK;
+       return_ACPI_STATUS(AE_OK);
 }
 
 EXPORT_SYMBOL(acpi_get_pci_id);
@@ -118,13 +120,14 @@ int acpi_pci_bind(struct acpi_device *device)
        struct pci_dev *dev;
        struct pci_bus *bus;
 
+       ACPI_FUNCTION_TRACE("acpi_pci_bind");
 
        if (!device || !device->parent)
-               return -EINVAL;
+               return_VALUE(-EINVAL);
 
        pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
-               return -ENOMEM;
+               return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
        buffer.length = ACPI_PATHNAME_MAX;
        buffer.pointer = pathname;
@@ -132,7 +135,7 @@ int acpi_pci_bind(struct acpi_device *device)
        data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
        if (!data) {
                kfree(pathname);
-               return -ENOMEM;
+               return_VALUE(-ENOMEM);
        }
        memset(data, 0, sizeof(struct acpi_pci_data));
 
@@ -148,9 +151,9 @@ int acpi_pci_bind(struct acpi_device *device)
        status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
                               (void **)&pdata);
        if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Invalid ACPI-PCI context for parent device %s",
-                               acpi_device_bid(device->parent)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Invalid ACPI-PCI context for parent device %s\n",
+                                 acpi_device_bid(device->parent)));
                result = -ENODEV;
                goto end;
        }
@@ -203,10 +206,10 @@ int acpi_pci_bind(struct acpi_device *device)
                goto end;
        }
        if (!data->dev->bus) {
-               printk(KERN_ERR PREFIX
-                           "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
-                           data->id.segment, data->id.bus,
-                           data->id.device, data->id.function);
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Device %02x:%02x:%02x.%02x has invalid 'bus' field\n",
+                                 data->id.segment, data->id.bus,
+                                 data->id.device, data->id.function));
                result = -ENODEV;
                goto end;
        }
@@ -234,9 +237,9 @@ int acpi_pci_bind(struct acpi_device *device)
         */
        status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Unable to attach ACPI-PCI context to device %s",
-                               acpi_device_bid(device)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to attach ACPI-PCI context to device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -266,7 +269,7 @@ int acpi_pci_bind(struct acpi_device *device)
        if (result)
                kfree(data);
 
-       return result;
+       return_VALUE(result);
 }
 
 int acpi_pci_unbind(struct acpi_device *device)
@@ -277,13 +280,14 @@ int acpi_pci_unbind(struct acpi_device *device)
        char *pathname = NULL;
        struct acpi_buffer buffer = { 0, NULL };
 
+       ACPI_FUNCTION_TRACE("acpi_pci_unbind");
 
        if (!device || !device->parent)
-               return -EINVAL;
+               return_VALUE(-EINVAL);
 
        pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
-               return -ENOMEM;
+               return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        buffer.length = ACPI_PATHNAME_MAX;
@@ -297,18 +301,18 @@ int acpi_pci_unbind(struct acpi_device *device)
            acpi_get_data(device->handle, acpi_pci_data_handler,
                          (void **)&data);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Unable to get data from device %s",
-                               acpi_device_bid(device)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to get data from device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
 
        status = acpi_detach_data(device->handle, acpi_pci_data_handler);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Unable to detach data from device %s",
-                               acpi_device_bid(device)));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to detach data from device %s\n",
+                                 acpi_device_bid(device)));
                result = -ENODEV;
                goto end;
        }
@@ -318,7 +322,7 @@ int acpi_pci_unbind(struct acpi_device *device)
        kfree(data);
 
       end:
-       return result;
+       return_VALUE(result);
 }
 
 int
@@ -331,10 +335,11 @@ acpi_pci_bind_root(struct acpi_device *device,
        char *pathname = NULL;
        struct acpi_buffer buffer = { 0, NULL };
 
+       ACPI_FUNCTION_TRACE("acpi_pci_bind_root");
 
        pathname = (char *)kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
        if (!pathname)
-               return -ENOMEM;
+               return_VALUE(-ENOMEM);
        memset(pathname, 0, ACPI_PATHNAME_MAX);
 
        buffer.length = ACPI_PATHNAME_MAX;
@@ -342,13 +347,13 @@ acpi_pci_bind_root(struct acpi_device *device,
 
        if (!device || !id || !bus) {
                kfree(pathname);
-               return -EINVAL;
+               return_VALUE(-EINVAL);
        }
 
        data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
        if (!data) {
                kfree(pathname);
-               return -ENOMEM;
+               return_VALUE(-ENOMEM);
        }
        memset(data, 0, sizeof(struct acpi_pci_data));
 
@@ -364,9 +369,9 @@ acpi_pci_bind_root(struct acpi_device *device,
 
        status = acpi_attach_data(device->handle, acpi_pci_data_handler, data);
        if (ACPI_FAILURE(status)) {
-               ACPI_EXCEPTION((AE_INFO, status,
-                               "Unable to attach ACPI-PCI context to device %s",
-                               pathname));
+               ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
+                                 "Unable to attach ACPI-PCI context to device %s\n",
+                                 pathname));
                result = -ENODEV;
                goto end;
        }
@@ -376,5 +381,5 @@ acpi_pci_bind_root(struct acpi_device *device,
        if (result != 0)
                kfree(data);
 
-       return result;
+       return_VALUE(result);
 }