Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55830
b: refs/heads/master
c: 00eb43a
h: refs/heads/master
v: v3
  • Loading branch information
Lennart Poettering authored and Len Brown committed May 10, 2007
1 parent 964346d commit 9ac1c6b
Show file tree
Hide file tree
Showing 69 changed files with 731 additions and 709 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: f142051505154da4ba689e129deb06524c5ece8a
refs/heads/master: 00eb43a1897a8845d0edb198cec69ac5f1f299dd
12 changes: 5 additions & 7 deletions trunk/drivers/acpi/dispatcher/dsmethod.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,8 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
* Obtain the method mutex if necessary. Do not acquire mutex for a
* recursive call.
*/
if (!walk_state ||
!obj_desc->method.mutex->mutex.owner_thread ||
(walk_state->thread !=
obj_desc->method.mutex->mutex.owner_thread)) {
if (acpi_os_get_thread_id() !=
obj_desc->method.mutex->mutex.owner_thread_id) {
/*
* Acquire the method mutex. This releases the interpreter if we
* block (and reacquires it before it returns)
Expand All @@ -248,14 +246,14 @@ acpi_ds_begin_method_execution(struct acpi_namespace_node *method_node,
}

/* Update the mutex and walk info and save the original sync_level */
obj_desc->method.mutex->mutex.owner_thread_id =
acpi_os_get_thread_id();

if (walk_state) {
obj_desc->method.mutex->mutex.
original_sync_level =
walk_state->thread->current_sync_level;

obj_desc->method.mutex->mutex.owner_thread =
walk_state->thread;
walk_state->thread->current_sync_level =
obj_desc->method.sync_level;
} else {
Expand Down Expand Up @@ -569,7 +567,7 @@ acpi_ds_terminate_control_method(union acpi_operand_object *method_desc,

acpi_os_release_mutex(method_desc->method.mutex->mutex.
os_mutex);
method_desc->method.mutex->mutex.owner_thread = NULL;
method_desc->method.mutex->mutex.owner_thread_id = ACPI_MUTEX_NOT_ACQUIRED;
}
}

Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/acpi/dispatcher/dsopcode.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,8 @@ acpi_ds_eval_data_object_operands(struct acpi_walk_state *walk_state,
((op->common.parent->common.aml_opcode != AML_PACKAGE_OP) &&
(op->common.parent->common.aml_opcode !=
AML_VAR_PACKAGE_OP)
&& (op->common.parent->common.aml_opcode != AML_NAME_OP))) {
&& (op->common.parent->common.aml_opcode !=
AML_NAME_OP))) {
walk_state->result_obj = obj_desc;
}
}
Expand Down
7 changes: 4 additions & 3 deletions trunk/drivers/acpi/dispatcher/dsutils.c
Original file line number Diff line number Diff line change
Expand Up @@ -556,9 +556,10 @@ acpi_ds_create_operand(struct acpi_walk_state *walk_state,
* indicate this to the interpreter, set the
* object to the root
*/
obj_desc = ACPI_CAST_PTR(union
acpi_operand_object,
acpi_gbl_root_node);
obj_desc =
ACPI_CAST_PTR(union
acpi_operand_object,
acpi_gbl_root_node);
status = AE_OK;
} else {
/*
Expand Down
9 changes: 6 additions & 3 deletions trunk/drivers/acpi/dispatcher/dswstate.c
Original file line number Diff line number Diff line change
Expand Up @@ -630,9 +630,12 @@ struct acpi_walk_state *acpi_ds_pop_walk_state(struct acpi_thread_state *thread)
*
******************************************************************************/

struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id, union acpi_parse_object
*origin, union acpi_operand_object
*method_desc, struct acpi_thread_state
struct acpi_walk_state *acpi_ds_create_walk_state(acpi_owner_id owner_id,
union acpi_parse_object
*origin,
union acpi_operand_object
*method_desc,
struct acpi_thread_state
*thread)
{
struct acpi_walk_state *walk_state;
Expand Down
39 changes: 23 additions & 16 deletions trunk/drivers/acpi/ec.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event,
return 0;
}

static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count)
static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event,
unsigned count, int force_poll)
{
if (acpi_ec_mode == EC_POLL) {
if (unlikely(force_poll) || acpi_ec_mode == EC_POLL) {
unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY);
while (time_before(jiffies, delay)) {
if (acpi_ec_check_status(ec, event, 0))
Expand All @@ -173,14 +174,15 @@ static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, unsigned count)

static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
const u8 * wdata, unsigned wdata_len,
u8 * rdata, unsigned rdata_len)
u8 * rdata, unsigned rdata_len,
int force_poll)
{
int result = 0;
unsigned count = atomic_read(&ec->event_count);
acpi_ec_write_cmd(ec, command);

for (; wdata_len > 0; --wdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll);
if (result) {
printk(KERN_ERR PREFIX
"write_cmd timeout, command = %d\n", command);
Expand All @@ -191,7 +193,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
}

if (!rdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, count, force_poll);
if (result) {
printk(KERN_ERR PREFIX
"finish-write timeout, command = %d\n", command);
Expand All @@ -202,7 +204,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,
}

for (; rdata_len > 0; --rdata_len) {
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count);
result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, count, force_poll);
if (result) {
printk(KERN_ERR PREFIX "read timeout, command = %d\n",
command);
Expand All @@ -217,7 +219,8 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command,

static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
const u8 * wdata, unsigned wdata_len,
u8 * rdata, unsigned rdata_len)
u8 * rdata, unsigned rdata_len,
int force_poll)
{
int status;
u32 glk;
Expand All @@ -240,7 +243,7 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
/* Make sure GPE is enabled before doing transaction */
acpi_enable_gpe(NULL, ec->gpe, ACPI_NOT_ISR);

status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0);
status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0, 0);
if (status) {
printk(KERN_DEBUG PREFIX
"input buffer is not empty, aborting transaction\n");
Expand All @@ -249,7 +252,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,

status = acpi_ec_transaction_unlocked(ec, command,
wdata, wdata_len,
rdata, rdata_len);
rdata, rdata_len,
force_poll);

end:

Expand All @@ -267,12 +271,12 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command,
int acpi_ec_burst_enable(struct acpi_ec *ec)
{
u8 d;
return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1);
return acpi_ec_transaction(ec, ACPI_EC_BURST_ENABLE, NULL, 0, &d, 1, 0);
}

int acpi_ec_burst_disable(struct acpi_ec *ec)
{
return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0);
return acpi_ec_transaction(ec, ACPI_EC_BURST_DISABLE, NULL, 0, NULL, 0, 0);
}

static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
Expand All @@ -281,7 +285,7 @@ static int acpi_ec_read(struct acpi_ec *ec, u8 address, u8 * data)
u8 d;

result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_READ,
&address, 1, &d, 1);
&address, 1, &d, 1, 0);
*data = d;
return result;
}
Expand All @@ -290,7 +294,7 @@ static int acpi_ec_write(struct acpi_ec *ec, u8 address, u8 data)
{
u8 wdata[2] = { address, data };
return acpi_ec_transaction(ec, ACPI_EC_COMMAND_WRITE,
wdata, 2, NULL, 0);
wdata, 2, NULL, 0, 0);
}

/*
Expand Down Expand Up @@ -349,13 +353,15 @@ EXPORT_SYMBOL(ec_write);

int ec_transaction(u8 command,
const u8 * wdata, unsigned wdata_len,
u8 * rdata, unsigned rdata_len)
u8 * rdata, unsigned rdata_len,
int force_poll)
{
if (!first_ec)
return -ENODEV;

return acpi_ec_transaction(first_ec, command, wdata,
wdata_len, rdata, rdata_len);
wdata_len, rdata, rdata_len,
force_poll);
}

EXPORT_SYMBOL(ec_transaction);
Expand All @@ -374,7 +380,7 @@ static int acpi_ec_query(struct acpi_ec *ec, u8 * data)
* bit to be cleared (and thus clearing the interrupt source).
*/

result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1);
result = acpi_ec_transaction(ec, ACPI_EC_COMMAND_QUERY, NULL, 0, &d, 1, 0);
if (result)
return result;

Expand Down Expand Up @@ -410,6 +416,7 @@ static u32 acpi_ec_gpe_handler(void *data)
acpi_status status = AE_OK;
u8 value;
struct acpi_ec *ec = data;

atomic_inc(&ec->event_count);

if (acpi_ec_mode == EC_INTR) {
Expand Down
5 changes: 3 additions & 2 deletions trunk/drivers/acpi/events/evgpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,9 @@ struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,

/* A Non-NULL gpe_device means this is a GPE Block Device */

obj_desc = acpi_ns_get_attached_object((struct acpi_namespace_node *)
gpe_device);
obj_desc =
acpi_ns_get_attached_object((struct acpi_namespace_node *)
gpe_device);
if (!obj_desc || !obj_desc->device.gpe_block) {
return (NULL);
}
Expand Down
3 changes: 2 additions & 1 deletion trunk/drivers/acpi/events/evgpeblk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,8 @@ acpi_ev_initialize_gpe_block(struct acpi_namespace_node *gpe_device,

if (((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
ACPI_GPE_DISPATCH_METHOD)
&& (gpe_event_info->flags & ACPI_GPE_TYPE_RUNTIME)) {
&& (gpe_event_info->
flags & ACPI_GPE_TYPE_RUNTIME)) {
gpe_enabled_count++;
}

Expand Down
20 changes: 10 additions & 10 deletions trunk/drivers/acpi/events/evmisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,15 @@ acpi_ev_queue_notify_request(struct acpi_namespace_node * node,
notify_info->notify.value = (u16) notify_value;
notify_info->notify.handler_obj = handler_obj;

status =
acpi_os_execute(OSL_NOTIFY_HANDLER, acpi_ev_notify_dispatch,
notify_info);
acpi_ex_exit_interpreter();

acpi_ev_notify_dispatch(notify_info);

status = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status)) {
acpi_ut_delete_generic_state(notify_info);
return_ACPI_STATUS(status);
}

}

if (!handler_obj) {
Expand Down Expand Up @@ -320,9 +323,8 @@ static u32 acpi_ev_global_lock_handler(void *context)
acpi_gbl_global_lock_acquired = TRUE;
/* Send a unit to the semaphore */

if (ACPI_FAILURE
(acpi_os_signal_semaphore
(acpi_gbl_global_lock_semaphore, 1))) {
if (ACPI_FAILURE(acpi_os_signal_semaphore(
acpi_gbl_global_lock_semaphore, 1))) {
ACPI_ERROR((AE_INFO,
"Could not signal Global Lock semaphore"));
}
Expand Down Expand Up @@ -448,9 +450,7 @@ acpi_status acpi_ev_acquire_global_lock(u16 timeout)
}

if (ACPI_FAILURE(status)) {
status =
acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex,
timeout);
status = acpi_ex_system_wait_mutex(acpi_gbl_global_lock_mutex, timeout);
}
if (ACPI_FAILURE(status)) {
return_ACPI_STATUS(status);
Expand Down
15 changes: 11 additions & 4 deletions trunk/drivers/acpi/events/evregion.c
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
u32 bit_width, acpi_integer * value)
{
acpi_status status;
acpi_status status2;
acpi_adr_space_handler handler;
acpi_adr_space_setup region_setup;
union acpi_operand_object *handler_desc;
Expand Down Expand Up @@ -344,15 +345,18 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* setup will potentially execute control methods
* (e.g., _REG method for this region)
*/
acpi_ex_relinquish_interpreter();
acpi_ex_exit_interpreter();

status = region_setup(region_obj, ACPI_REGION_ACTIVATE,
handler_desc->address_space.context,
&region_context);

/* Re-enter the interpreter */

acpi_ex_reacquire_interpreter();
status2 = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}

/* Check for failure of the Region Setup */

Expand Down Expand Up @@ -405,7 +409,7 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* exit the interpreter because the handler *might* block -- we don't
* know what it will do, so we can't hold the lock on the intepreter.
*/
acpi_ex_relinquish_interpreter();
acpi_ex_exit_interpreter();
}

/* Call the handler */
Expand All @@ -426,7 +430,10 @@ acpi_ev_address_space_dispatch(union acpi_operand_object *region_obj,
* We just returned from a non-default handler, we must re-enter the
* interpreter
*/
acpi_ex_reacquire_interpreter();
status2 = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status2)) {
return_ACPI_STATUS(status2);
}
}

return_ACPI_STATUS(status);
Expand Down
3 changes: 1 addition & 2 deletions trunk/drivers/acpi/events/evrgnini.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,7 @@ acpi_ev_pci_config_region_setup(acpi_handle handle,

/* Install a handler for this PCI root bridge */

status =
acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
status = acpi_install_address_space_handler((acpi_handle) pci_root_node, ACPI_ADR_SPACE_PCI_CONFIG, ACPI_DEFAULT_HANDLER, NULL, NULL);
if (ACPI_FAILURE(status)) {
if (status == AE_SAME_HANDLER) {
/*
Expand Down
7 changes: 5 additions & 2 deletions trunk/drivers/acpi/events/evxface.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ acpi_status acpi_install_exception_handler(acpi_exception_handler handler)

ACPI_EXPORT_SYMBOL(acpi_install_exception_handler)
#endif /* ACPI_FUTURE_USAGE */

/*******************************************************************************
*
* FUNCTION: acpi_install_fixed_event_handler
Expand Down Expand Up @@ -767,9 +768,11 @@ acpi_status acpi_acquire_global_lock(u16 timeout, u32 * handle)
return (AE_BAD_PARAMETER);
}

/* Must lock interpreter to prevent race conditions */
status = acpi_ex_enter_interpreter();
if (ACPI_FAILURE(status)) {
return (status);
}

acpi_ex_enter_interpreter();
status = acpi_ev_acquire_global_lock(timeout);
acpi_ex_exit_interpreter();

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/acpi/events/evxfevnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,7 @@ acpi_status acpi_clear_gpe(acpi_handle gpe_device, u32 gpe_number, u32 flags)
}

ACPI_EXPORT_SYMBOL(acpi_clear_gpe)

#ifdef ACPI_FUTURE_USAGE
/*******************************************************************************
*
Expand Down Expand Up @@ -567,6 +568,7 @@ acpi_get_gpe_status(acpi_handle gpe_device,

ACPI_EXPORT_SYMBOL(acpi_get_gpe_status)
#endif /* ACPI_FUTURE_USAGE */

/*******************************************************************************
*
* FUNCTION: acpi_install_gpe_block
Expand Down
Loading

0 comments on commit 9ac1c6b

Please sign in to comment.