Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 71627
b: refs/heads/master
c: 6e21578
h: refs/heads/master
i:
  71625: ca4c8bc
  71623: 6af7aac
v: v3
  • Loading branch information
Alexey Starikovskiy authored and Len Brown committed Sep 5, 2007
1 parent 317bb95 commit d1578f3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 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: 21bc42ab852549f4a547d18d77e0e4d1b24ffd96
refs/heads/master: 6e2157858ac94530fddbf19dc59ab6b392baf1f3
15 changes: 10 additions & 5 deletions trunk/drivers/acpi/thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ struct acpi_thermal {
struct acpi_thermal_trips trips;
struct acpi_handle_list devices;
struct timer_list timer;
struct mutex lock;
};

static const struct file_operations acpi_thermal_state_fops = {
Expand Down Expand Up @@ -721,11 +722,15 @@ static void acpi_thermal_check(void *data)
return;
}

/* Check if someone else is already running */
if (!mutex_trylock(&tz->lock))
return;

state = tz->state;

result = acpi_thermal_get_temperature(tz);
if (result)
return;
goto unlock;

memset(&tz->state, 0, sizeof(tz->state));

Expand Down Expand Up @@ -816,8 +821,8 @@ static void acpi_thermal_check(void *data)
add_timer(&(tz->timer));
}
}

return;
unlock:
mutex_unlock(&tz->lock);
}

/* --------------------------------------------------------------------------
Expand Down Expand Up @@ -1254,7 +1259,7 @@ static int acpi_thermal_add(struct acpi_device *device)
strcpy(acpi_device_name(device), ACPI_THERMAL_DEVICE_NAME);
strcpy(acpi_device_class(device), ACPI_THERMAL_CLASS);
acpi_driver_data(device) = tz;

mutex_init(&tz->lock);
result = acpi_thermal_get_info(tz);
if (result)
goto end;
Expand Down Expand Up @@ -1324,7 +1329,7 @@ static int acpi_thermal_remove(struct acpi_device *device, int type)
}

acpi_thermal_remove_fs(device);

mutex_destroy(&tz->lock);
kfree(tz);
return 0;
}
Expand Down

0 comments on commit d1578f3

Please sign in to comment.