Add patches accepted for 2.6.29-rc2
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / releases / upstream / 2.6.29-rc2 / 0008-ACPI-thinkpad-acpi-use-killable-instead-of-interru.patch
blob319cc7079b9d40b9f191def988d2d86f67567f4b
1 From 7646ea88af80a92f2775e17d4283830d7f09ea2d Mon Sep 17 00:00:00 2001
2 From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
3 Date: Sun, 11 Jan 2009 03:01:04 -0200
4 Subject: ACPI: thinkpad-acpi: use killable instead of interruptible mutexes
6 Unfortunately, POSIX in all of its braindamage, do not state that userspace has
7 to deal with EINTR in read/write and friends... so, lesser code just doesn't.
9 Switch from *_interruptible to *_killable on the sysfs- and procfs-related
10 mutexes. This closes this possible can of worms.
12 Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
13 Signed-off-by: Len Brown <len.brown@intel.com>
14 ---
15 drivers/platform/x86/thinkpad_acpi.c | 26 +++++++++++++-------------
16 1 files changed, 13 insertions(+), 13 deletions(-)
18 diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
19 index c1d4041..7670c8e 100644
20 --- a/drivers/platform/x86/thinkpad_acpi.c
21 +++ b/drivers/platform/x86/thinkpad_acpi.c
22 @@ -1878,7 +1878,7 @@ static ssize_t hotkey_mask_show(struct device *dev,
24 int res;
26 - if (mutex_lock_interruptible(&hotkey_mutex))
27 + if (mutex_lock_killable(&hotkey_mutex))
28 return -ERESTARTSYS;
29 res = hotkey_mask_get();
30 mutex_unlock(&hotkey_mutex);
31 @@ -1897,7 +1897,7 @@ static ssize_t hotkey_mask_store(struct device *dev,
32 if (parse_strtoul(buf, 0xffffffffUL, &t))
33 return -EINVAL;
35 - if (mutex_lock_interruptible(&hotkey_mutex))
36 + if (mutex_lock_killable(&hotkey_mutex))
37 return -ERESTARTSYS;
39 res = hotkey_mask_set(t);
40 @@ -1983,7 +1983,7 @@ static ssize_t hotkey_source_mask_store(struct device *dev,
41 ((t & ~TPACPI_HKEY_NVRAM_KNOWN_MASK) != 0))
42 return -EINVAL;
44 - if (mutex_lock_interruptible(&hotkey_mutex))
45 + if (mutex_lock_killable(&hotkey_mutex))
46 return -ERESTARTSYS;
48 HOTKEY_CONFIG_CRITICAL_START
49 @@ -2018,7 +2018,7 @@ static ssize_t hotkey_poll_freq_store(struct device *dev,
50 if (parse_strtoul(buf, 25, &t))
51 return -EINVAL;
53 - if (mutex_lock_interruptible(&hotkey_mutex))
54 + if (mutex_lock_killable(&hotkey_mutex))
55 return -ERESTARTSYS;
57 hotkey_poll_freq = t;
58 @@ -2754,7 +2754,7 @@ static int hotkey_read(char *p)
59 return len;
62 - if (mutex_lock_interruptible(&hotkey_mutex))
63 + if (mutex_lock_killable(&hotkey_mutex))
64 return -ERESTARTSYS;
65 res = hotkey_status_get(&status);
66 if (!res)
67 @@ -2785,7 +2785,7 @@ static int hotkey_write(char *buf)
68 if (!tp_features.hotkey)
69 return -ENODEV;
71 - if (mutex_lock_interruptible(&hotkey_mutex))
72 + if (mutex_lock_killable(&hotkey_mutex))
73 return -ERESTARTSYS;
75 status = -1;
76 @@ -5311,7 +5311,7 @@ static int brightness_set(int value)
77 value < 0)
78 return -EINVAL;
80 - res = mutex_lock_interruptible(&brightness_mutex);
81 + res = mutex_lock_killable(&brightness_mutex);
82 if (res < 0)
83 return res;
85 @@ -5849,7 +5849,7 @@ static int fan_get_status_safe(u8 *status)
86 int rc;
87 u8 s;
89 - if (mutex_lock_interruptible(&fan_mutex))
90 + if (mutex_lock_killable(&fan_mutex))
91 return -ERESTARTSYS;
92 rc = fan_get_status(&s);
93 if (!rc)
94 @@ -5932,7 +5932,7 @@ static int fan_set_level_safe(int level)
95 if (!fan_control_allowed)
96 return -EPERM;
98 - if (mutex_lock_interruptible(&fan_mutex))
99 + if (mutex_lock_killable(&fan_mutex))
100 return -ERESTARTSYS;
102 if (level == TPACPI_FAN_LAST_LEVEL)
103 @@ -5954,7 +5954,7 @@ static int fan_set_enable(void)
104 if (!fan_control_allowed)
105 return -EPERM;
107 - if (mutex_lock_interruptible(&fan_mutex))
108 + if (mutex_lock_killable(&fan_mutex))
109 return -ERESTARTSYS;
111 switch (fan_control_access_mode) {
112 @@ -6009,7 +6009,7 @@ static int fan_set_disable(void)
113 if (!fan_control_allowed)
114 return -EPERM;
116 - if (mutex_lock_interruptible(&fan_mutex))
117 + if (mutex_lock_killable(&fan_mutex))
118 return -ERESTARTSYS;
120 rc = 0;
121 @@ -6047,7 +6047,7 @@ static int fan_set_speed(int speed)
122 if (!fan_control_allowed)
123 return -EPERM;
125 - if (mutex_lock_interruptible(&fan_mutex))
126 + if (mutex_lock_killable(&fan_mutex))
127 return -ERESTARTSYS;
129 rc = 0;
130 @@ -6249,7 +6249,7 @@ static ssize_t fan_pwm1_store(struct device *dev,
131 /* scale down from 0-255 to 0-7 */
132 newlevel = (s >> 5) & 0x07;
134 - if (mutex_lock_interruptible(&fan_mutex))
135 + if (mutex_lock_killable(&fan_mutex))
136 return -ERESTARTSYS;
138 rc = fan_get_status(&status);
140 1.5.6.5