Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 39611
b: refs/heads/master
c: 37605a6
h: refs/heads/master
i:
  39609: 95a1ec6
  39607: f1bfe13
v: v3
  • Loading branch information
Alexey Y. Starikovskiy authored and Len Brown committed Oct 14, 2006
1 parent 45537c9 commit d174368
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 22 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fcfc638c6b1345b6646523dbab0065b36a868ffc
refs/heads/master: 37605a6900f6b4d886d995751fcfeef88c4e462c
34 changes: 13 additions & 21 deletions trunk/drivers/acpi/osl.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ static unsigned int acpi_irq_irq;
static acpi_osd_handler acpi_irq_handler;
static void *acpi_irq_context;
static struct workqueue_struct *kacpid_wq;
static struct workqueue_struct *kacpi_notify_wq;

acpi_status acpi_os_initialize(void)
{
Expand All @@ -91,8 +92,9 @@ acpi_status acpi_os_initialize1(void)
return AE_NULL_ENTRY;
}
kacpid_wq = create_singlethread_workqueue("kacpid");
kacpi_notify_wq = create_singlethread_workqueue("kacpi_notify");
BUG_ON(!kacpid_wq);

BUG_ON(!kacpi_notify_wq);
return AE_OK;
}

Expand All @@ -104,6 +106,7 @@ acpi_status acpi_os_terminate(void)
}

destroy_workqueue(kacpid_wq);
destroy_workqueue(kacpi_notify_wq);

return AE_OK;
}
Expand Down Expand Up @@ -566,10 +569,7 @@ void acpi_os_derive_pci_id(acpi_handle rhandle, /* upper bound */

static void acpi_os_execute_deferred(void *context)
{
struct acpi_os_dpc *dpc = NULL;


dpc = (struct acpi_os_dpc *)context;
struct acpi_os_dpc *dpc = (struct acpi_os_dpc *)context;
if (!dpc) {
printk(KERN_ERR PREFIX "Invalid (NULL) context\n");
return;
Expand Down Expand Up @@ -604,14 +604,12 @@ acpi_status acpi_os_execute(acpi_execute_type type,
struct acpi_os_dpc *dpc;
struct work_struct *task;

ACPI_FUNCTION_TRACE("os_queue_for_execution");

ACPI_DEBUG_PRINT((ACPI_DB_EXEC,
"Scheduling function [%p(%p)] for deferred execution.\n",
function, context));

if (!function)
return_ACPI_STATUS(AE_BAD_PARAMETER);
return AE_BAD_PARAMETER;

/*
* Allocate/initialize DPC structure. Note that this memory will be
Expand All @@ -624,26 +622,20 @@ acpi_status acpi_os_execute(acpi_execute_type type,
* from the same memory.
*/

dpc =
kmalloc(sizeof(struct acpi_os_dpc) + sizeof(struct work_struct),
GFP_ATOMIC);
dpc = kmalloc(sizeof(struct acpi_os_dpc) +
sizeof(struct work_struct), GFP_ATOMIC);
if (!dpc)
return_ACPI_STATUS(AE_NO_MEMORY);

return AE_NO_MEMORY;
dpc->function = function;
dpc->context = context;

task = (void *)(dpc + 1);
INIT_WORK(task, acpi_os_execute_deferred, (void *)dpc);

if (!queue_work(kacpid_wq, task)) {
ACPI_DEBUG_PRINT((ACPI_DB_ERROR,
"Call to queue_work() failed.\n"));
kfree(dpc);
if (!queue_work((type == OSL_NOTIFY_HANDLER)?
kacpi_notify_wq : kacpid_wq, task)) {
status = AE_ERROR;
kfree(dpc);
}

return_ACPI_STATUS(status);
return status;
}

EXPORT_SYMBOL(acpi_os_execute);
Expand Down

0 comments on commit d174368

Please sign in to comment.