i2c-pxa: only define 'blue_murder'-function if DEBUG is #defined
[safe/jmp/linux-2.6] / drivers / acpi / osl.c
index c5b4f1e..7594f65 100644 (file)
@@ -58,6 +58,7 @@ struct acpi_os_dpc {
        acpi_osd_exec_callback function;
        void *context;
        struct work_struct work;
+       int wait;
 };
 
 #ifdef CONFIG_ACPI_CUSTOM_DSDT
@@ -192,7 +193,7 @@ acpi_status __init acpi_os_initialize(void)
 
 static void bind_to_cpu0(struct work_struct *work)
 {
-       set_cpus_allowed(current, cpumask_of_cpu(0));
+       set_cpus_allowed_ptr(current, cpumask_of(0));
        kfree(work);
 }
 
@@ -435,7 +436,7 @@ acpi_status acpi_os_remove_interrupt_handler(u32 irq, acpi_osd_handler handler)
  * Running in interpreter thread context, safe to sleep
  */
 
-void acpi_os_sleep(acpi_integer ms)
+void acpi_os_sleep(u64 ms)
 {
        schedule_timeout_interruptible(msecs_to_jiffies(ms));
 }
@@ -602,7 +603,7 @@ acpi_os_read_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
 
 acpi_status
 acpi_os_write_pci_configuration(struct acpi_pci_id * pci_id, u32 reg,
-                               acpi_integer value, u32 width)
+                               u64 value, u32 width)
 {
        int result, size;
 
@@ -698,31 +699,12 @@ void acpi_os_derive_pci_id(acpi_handle rhandle,   /* upper bound  */
 static void acpi_os_execute_deferred(struct work_struct *work)
 {
        struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
-       if (!dpc) {
-               printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
-               return;
-       }
-
-       dpc->function(dpc->context);
-       kfree(dpc);
-
-       return;
-}
-
-static void acpi_os_execute_hp_deferred(struct work_struct *work)
-{
-       struct acpi_os_dpc *dpc = container_of(work, struct acpi_os_dpc, work);
-       if (!dpc) {
-               printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
-               return;
-       }
 
-       acpi_os_wait_events_complete(NULL);
+       if (dpc->wait)
+               acpi_os_wait_events_complete(NULL);
 
        dpc->function(dpc->context);
        kfree(dpc);
-
-       return;
 }
 
 /*******************************************************************************
@@ -746,15 +728,11 @@ static acpi_status __acpi_os_execute(acpi_execute_type type,
        acpi_status status = AE_OK;
        struct acpi_os_dpc *dpc;
        struct workqueue_struct *queue;
-       work_func_t func;
        int ret;
        ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
                          "Scheduling function [%p(%p)] for deferred execution.\n",
                          function, context));
 
-       if (!function)
-               return AE_BAD_PARAMETER;
-
        /*
         * Allocate/initialize DPC structure.  Note that this memory will be
         * freed by the callee.  The kernel handles the work_struct list  in a
@@ -779,8 +757,15 @@ static acpi_status __acpi_os_execute(acpi_execute_type type,
         */
        queue = hp ? kacpi_hotplug_wq :
                (type == OSL_NOTIFY_HANDLER ? kacpi_notify_wq : kacpid_wq);
-       func = hp ? acpi_os_execute_hp_deferred : acpi_os_execute_deferred;
-       INIT_WORK(&dpc->work, func);
+       dpc->wait = hp ? 1 : 0;
+
+       if (queue == kacpi_hotplug_wq)
+               INIT_WORK(&dpc->work, acpi_os_execute_deferred);
+       else if (queue == kacpi_notify_wq)
+               INIT_WORK(&dpc->work, acpi_os_execute_deferred);
+       else
+               INIT_WORK(&dpc->work, acpi_os_execute_deferred);
+
        ret = queue_work(queue, &dpc->work);
 
        if (!ret) {
@@ -1140,7 +1125,7 @@ __setup("acpi_enforce_resources=", acpi_enforce_resources_setup);
 
 /* Check for resource conflicts between ACPI OperationRegions and native
  * drivers */
-int acpi_check_resource_conflict(struct resource *res)
+int acpi_check_resource_conflict(const struct resource *res)
 {
        struct acpi_res_list *res_list_elem;
        int ioport;
@@ -1173,17 +1158,17 @@ int acpi_check_resource_conflict(struct resource *res)
 
        if (clash) {
                if (acpi_enforce_resources != ENFORCE_RESOURCES_NO) {
-                       printk("%sACPI: %s resource %s [0x%llx-0x%llx]"
-                              " conflicts with ACPI region %s"
-                              " [0x%llx-0x%llx]\n",
-                              acpi_enforce_resources == ENFORCE_RESOURCES_LAX
-                              ? KERN_WARNING : KERN_ERR,
-                              ioport ? "I/O" : "Memory", res->name,
-                              (long long) res->start, (long long) res->end,
-                              res_list_elem->name,
-                              (long long) res_list_elem->start,
-                              (long long) res_list_elem->end);
-                       printk(KERN_INFO "ACPI: Device needs an ACPI driver\n");
+                       printk(KERN_WARNING "ACPI: resource %s %pR"
+                              " conflicts with ACPI region %s %pR\n",
+                              res->name, res, res_list_elem->name,
+                              res_list_elem);
+                       if (acpi_enforce_resources == ENFORCE_RESOURCES_LAX)
+                               printk(KERN_NOTICE "ACPI: This conflict may"
+                                      " cause random problems and system"
+                                      " instability\n");
+                       printk(KERN_INFO "ACPI: If an ACPI driver is available"
+                              " for this device, you should use it instead of"
+                              " the native driver\n");
                }
                if (acpi_enforce_resources == ENFORCE_RESOURCES_STRICT)
                        return -EBUSY;