aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-04-04 00:25:48 -0400
committerLen Brown <len.brown@intel.com>2009-04-04 03:14:52 -0400
commit2586d5663d0a17d69383acf6110f16a979a07c4e (patch)
tree5bfe1ef88ee03084175bb94c4c1079402fefbe7b /drivers/platform
parent73a94d86a8625371f76de0ee12dc5bacd3ed42c0 (diff)
thinkpad-acpi: remove HKEY disable functionality
The HKEY disable functionality basically cripples the entire event model of the ThinkPad firmware and of the thinkpad-acpi driver. Remove this functionality from the driver. HKEY must be enabled at all times while thinkpad-acpi is loaded, and disabled otherwise. For sysfs, according to the sysfs ABI and the thinkpad-acpi sysfs rules of engagement, we will just remove the attributes. This will be done in two stages: disable their function now, after two kernel releases, remove the attributes. For procfs, we call WARN(). If nothing triggers it, I will simply remove the enable/disable commands entirely in the future along with the sysfs attributes. I don't expect much, if any fallout from this. There really isn't any reason to mess with hotkey_enable or with the enable/disable commands to /proc/acpi/ibm/hotkey, and this has been true for years... Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c49
1 files changed, 27 insertions, 22 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 852be7c1a172..f003fb7c79ca 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -22,7 +22,7 @@
22 */ 22 */
23 23
24#define TPACPI_VERSION "0.22" 24#define TPACPI_VERSION "0.22"
25#define TPACPI_SYSFS_VERSION 0x020200 25#define TPACPI_SYSFS_VERSION 0x020300
26 26
27/* 27/*
28 * Changelog: 28 * Changelog:
@@ -1424,7 +1424,6 @@ static enum { /* Reasons for waking up */
1424 1424
1425static int hotkey_autosleep_ack; 1425static int hotkey_autosleep_ack;
1426 1426
1427static int hotkey_orig_status;
1428static u32 hotkey_orig_mask; 1427static u32 hotkey_orig_mask;
1429static u32 hotkey_all_mask; 1428static u32 hotkey_all_mask;
1430static u32 hotkey_reserved_mask; 1429static u32 hotkey_reserved_mask;
@@ -1571,9 +1570,9 @@ static int hotkey_status_get(int *status)
1571 return 0; 1570 return 0;
1572} 1571}
1573 1572
1574static int hotkey_status_set(int status) 1573static int hotkey_status_set(bool enable)
1575{ 1574{
1576 if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", status)) 1575 if (!acpi_evalf(hkey_handle, NULL, "MHKC", "vd", enable ? 1 : 0))
1577 return -EIO; 1576 return -EIO;
1578 1577
1579 return 0; 1578 return 0;
@@ -1889,6 +1888,9 @@ static ssize_t hotkey_enable_show(struct device *dev,
1889{ 1888{
1890 int res, status; 1889 int res, status;
1891 1890
1891 printk_deprecated_attribute("hotkey_enable",
1892 "Hotkey reporting is always enabled");
1893
1892 res = hotkey_status_get(&status); 1894 res = hotkey_status_get(&status);
1893 if (res) 1895 if (res)
1894 return res; 1896 return res;
@@ -1901,14 +1903,17 @@ static ssize_t hotkey_enable_store(struct device *dev,
1901 const char *buf, size_t count) 1903 const char *buf, size_t count)
1902{ 1904{
1903 unsigned long t; 1905 unsigned long t;
1904 int res; 1906
1907 printk_deprecated_attribute("hotkey_enable",
1908 "Hotkeys can be disabled through hotkey_mask");
1905 1909
1906 if (parse_strtoul(buf, 1, &t)) 1910 if (parse_strtoul(buf, 1, &t))
1907 return -EINVAL; 1911 return -EINVAL;
1908 1912
1909 res = hotkey_status_set(t); 1913 if (t == 0)
1914 return -EPERM;
1910 1915
1911 return (res) ? res : count; 1916 return count;
1912} 1917}
1913 1918
1914static struct device_attribute dev_attr_hotkey_enable = 1919static struct device_attribute dev_attr_hotkey_enable =
@@ -1964,7 +1969,7 @@ static ssize_t hotkey_bios_enabled_show(struct device *dev,
1964 struct device_attribute *attr, 1969 struct device_attribute *attr,
1965 char *buf) 1970 char *buf)
1966{ 1971{
1967 return snprintf(buf, PAGE_SIZE, "%d\n", hotkey_orig_status); 1972 return sprintf(buf, "0\n");
1968} 1973}
1969 1974
1970static struct device_attribute dev_attr_hotkey_bios_enabled = 1975static struct device_attribute dev_attr_hotkey_bios_enabled =
@@ -2243,7 +2248,7 @@ static void hotkey_exit(void)
2243 "restoring original hot key mask\n"); 2248 "restoring original hot key mask\n");
2244 /* no short-circuit boolean operator below! */ 2249 /* no short-circuit boolean operator below! */
2245 if ((hotkey_mask_set(hotkey_orig_mask) | 2250 if ((hotkey_mask_set(hotkey_orig_mask) |
2246 hotkey_status_set(hotkey_orig_status)) != 0) 2251 hotkey_status_set(false)) != 0)
2247 printk(TPACPI_ERR 2252 printk(TPACPI_ERR
2248 "failed to restore hot key mask " 2253 "failed to restore hot key mask "
2249 "to BIOS defaults\n"); 2254 "to BIOS defaults\n");
@@ -2438,10 +2443,6 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2438 2443
2439 /* hotkey_source_mask *must* be zero for 2444 /* hotkey_source_mask *must* be zero for
2440 * the first hotkey_mask_get */ 2445 * the first hotkey_mask_get */
2441 res = hotkey_status_get(&hotkey_orig_status);
2442 if (res)
2443 goto err_exit;
2444
2445 if (tp_features.hotkey_mask) { 2446 if (tp_features.hotkey_mask) {
2446 res = hotkey_mask_get(); 2447 res = hotkey_mask_get();
2447 if (res) 2448 if (res)
@@ -2581,7 +2582,7 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
2581 } 2582 }
2582 2583
2583 dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n"); 2584 dbg_printk(TPACPI_DBG_INIT, "enabling hot key handling\n");
2584 res = hotkey_status_set(1); 2585 res = hotkey_status_set(true);
2585 if (res) { 2586 if (res) {
2586 hotkey_exit(); 2587 hotkey_exit();
2587 return res; 2588 return res;
@@ -2926,9 +2927,17 @@ static int hotkey_read(char *p)
2926 return len; 2927 return len;
2927} 2928}
2928 2929
2930static void hotkey_enabledisable_warn(void)
2931{
2932 tpacpi_log_usertask("procfs hotkey enable/disable");
2933 WARN(1, TPACPI_WARN
2934 "hotkey enable/disable functionality has been "
2935 "removed from the driver. Hotkeys are always enabled.\n");
2936}
2937
2929static int hotkey_write(char *buf) 2938static int hotkey_write(char *buf)
2930{ 2939{
2931 int res, status; 2940 int res;
2932 u32 mask; 2941 u32 mask;
2933 char *cmd; 2942 char *cmd;
2934 2943
@@ -2938,17 +2947,16 @@ static int hotkey_write(char *buf)
2938 if (mutex_lock_killable(&hotkey_mutex)) 2947 if (mutex_lock_killable(&hotkey_mutex))
2939 return -ERESTARTSYS; 2948 return -ERESTARTSYS;
2940 2949
2941 status = -1;
2942 mask = hotkey_mask; 2950 mask = hotkey_mask;
2943 2951
2944 res = 0; 2952 res = 0;
2945 while ((cmd = next_cmd(&buf))) { 2953 while ((cmd = next_cmd(&buf))) {
2946 if (strlencmp(cmd, "enable") == 0) { 2954 if (strlencmp(cmd, "enable") == 0) {
2947 status = 1; 2955 hotkey_enabledisable_warn();
2948 } else if (strlencmp(cmd, "disable") == 0) { 2956 } else if (strlencmp(cmd, "disable") == 0) {
2949 status = 0; 2957 hotkey_enabledisable_warn();
2958 res = -EPERM;
2950 } else if (strlencmp(cmd, "reset") == 0) { 2959 } else if (strlencmp(cmd, "reset") == 0) {
2951 status = hotkey_orig_status;
2952 mask = hotkey_orig_mask; 2960 mask = hotkey_orig_mask;
2953 } else if (sscanf(cmd, "0x%x", &mask) == 1) { 2961 } else if (sscanf(cmd, "0x%x", &mask) == 1) {
2954 /* mask set */ 2962 /* mask set */
@@ -2959,9 +2967,6 @@ static int hotkey_write(char *buf)
2959 goto errexit; 2967 goto errexit;
2960 } 2968 }
2961 } 2969 }
2962 if (status != -1)
2963 res = hotkey_status_set(status);
2964
2965 if (!res && mask != hotkey_mask) 2970 if (!res && mask != hotkey_mask)
2966 res = hotkey_mask_set(mask); 2971 res = hotkey_mask_set(mask);
2967 2972