aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2008-01-08 10:02:49 -0500
committerLen Brown <len.brown@intel.com>2008-02-01 22:26:07 -0500
commit35ff8b9fa90d97f3a19ea3e2311385927535ebc9 (patch)
treeda54f0e166cc68d9cbe112f213295f95ff323b5a /drivers/misc/thinkpad_acpi.c
parente0c7dfe70170ccee2b538494f92e61de8edab990 (diff)
ACPI: thinkpad-acpi: some checkpatch.pl fluff
Fix some of the crap reported by checkpatch.pl. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.c')
-rw-r--r--drivers/misc/thinkpad_acpi.c291
1 files changed, 175 insertions, 116 deletions
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c
index c92ae8d92b28..dd6fa81fa868 100644
--- a/drivers/misc/thinkpad_acpi.c
+++ b/drivers/misc/thinkpad_acpi.c
@@ -150,7 +150,8 @@ enum {
150#define TPACPI_DBG_EXIT 0x0002 150#define TPACPI_DBG_EXIT 0x0002
151#define dbg_printk(a_dbg_level, format, arg...) \ 151#define dbg_printk(a_dbg_level, format, arg...) \
152 do { if (dbg_level & a_dbg_level) \ 152 do { if (dbg_level & a_dbg_level) \
153 printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); } while (0) 153 printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \
154 } while (0)
154#ifdef CONFIG_THINKPAD_ACPI_DEBUG 155#ifdef CONFIG_THINKPAD_ACPI_DEBUG
155#define vdbg_printk(a_dbg_level, format, arg...) \ 156#define vdbg_printk(a_dbg_level, format, arg...) \
156 dbg_printk(a_dbg_level, format, ## arg) 157 dbg_printk(a_dbg_level, format, ## arg)
@@ -159,9 +160,9 @@ static const char *str_supported(int is_supported);
159#define vdbg_printk(a_dbg_level, format, arg...) 160#define vdbg_printk(a_dbg_level, format, arg...)
160#endif 161#endif
161 162
162#define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") 163#define onoff(status, bit) ((status) & (1 << (bit)) ? "on" : "off")
163#define enabled(status,bit) ((status) & (1 << (bit)) ? "enabled" : "disabled") 164#define enabled(status, bit) ((status) & (1 << (bit)) ? "enabled" : "disabled")
164#define strlencmp(a,b) (strncmp((a), (b), strlen(b))) 165#define strlencmp(a, b) (strncmp((a), (b), strlen(b)))
165 166
166 167
167/**************************************************************************** 168/****************************************************************************
@@ -288,7 +289,8 @@ TPACPI_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */
288TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */ 289TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */
289TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */ 290TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */
290 291
291TPACPI_HANDLE(cmos, root, "\\UCMS", /* R50, R50e, R50p, R51, T4x, X31, X40 */ 292TPACPI_HANDLE(cmos, root, "\\UCMS", /* R50, R50e, R50p, R51, */
293 /* T4x, X31, X40 */
292 "\\CMOS", /* A3x, G4x, R32, T23, T30, X22-24, X30 */ 294 "\\CMOS", /* A3x, G4x, R32, T23, T30, X22-24, X30 */
293 "\\CMS", /* R40, R40e */ 295 "\\CMS", /* R40, R40e */
294 ); /* all others */ 296 ); /* all others */
@@ -382,7 +384,7 @@ static int acpi_evalf(acpi_handle handle,
382 return success; 384 return success;
383} 385}
384 386
385static int acpi_ec_read(int i, u8 * p) 387static int acpi_ec_read(int i, u8 *p)
386{ 388{
387 int v; 389 int v;
388 390
@@ -436,8 +438,8 @@ static int issue_thinkpad_cmos_command(int cmos_cmd)
436 * ACPI device model 438 * ACPI device model
437 */ 439 */
438 440
439#define TPACPI_ACPIHANDLE_INIT(object) \ 441#define TPACPI_ACPIHANDLE_INIT(object) \
440 drv_acpi_handle_init(#object, &object##_handle, *object##_parent, \ 442 drv_acpi_handle_init(#object, &object##_handle, *object##_parent, \
441 object##_paths, ARRAY_SIZE(object##_paths), &object##_path) 443 object##_paths, ARRAY_SIZE(object##_paths), &object##_path)
442 444
443static void drv_acpi_handle_init(char *name, 445static void drv_acpi_handle_init(char *name,
@@ -508,11 +510,13 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm)
508 ibm->acpi->type, dispatch_acpi_notify, ibm); 510 ibm->acpi->type, dispatch_acpi_notify, ibm);
509 if (ACPI_FAILURE(status)) { 511 if (ACPI_FAILURE(status)) {
510 if (status == AE_ALREADY_EXISTS) { 512 if (status == AE_ALREADY_EXISTS) {
511 printk(TPACPI_NOTICE "another device driver is already handling %s events\n", 513 printk(TPACPI_NOTICE
512 ibm->name); 514 "another device driver is already "
515 "handling %s events\n", ibm->name);
513 } else { 516 } else {
514 printk(TPACPI_ERR "acpi_install_notify_handler(%s) failed: %d\n", 517 printk(TPACPI_ERR
515 ibm->name, status); 518 "acpi_install_notify_handler(%s) failed: %d\n",
519 ibm->name, status);
516 } 520 }
517 return -ENODEV; 521 return -ENODEV;
518 } 522 }
@@ -592,7 +596,7 @@ static int dispatch_procfs_read(char *page, char **start, off_t off,
592} 596}
593 597
594static int dispatch_procfs_write(struct file *file, 598static int dispatch_procfs_write(struct file *file,
595 const char __user * userbuf, 599 const char __user *userbuf,
596 unsigned long count, void *data) 600 unsigned long count, void *data)
597{ 601{
598 struct ibm_struct *ibm = data; 602 struct ibm_struct *ibm = data;
@@ -698,7 +702,7 @@ struct attribute_set_obj {
698} __attribute__((packed)); 702} __attribute__((packed));
699 703
700static struct attribute_set *create_attr_set(unsigned int max_members, 704static struct attribute_set *create_attr_set(unsigned int max_members,
701 const char* name) 705 const char *name)
702{ 706{
703 struct attribute_set_obj *sobj; 707 struct attribute_set_obj *sobj;
704 708
@@ -722,7 +726,7 @@ static struct attribute_set *create_attr_set(unsigned int max_members,
722 kfree(_set); 726 kfree(_set);
723 727
724/* not multi-threaded safe, use it in a single thread per set */ 728/* not multi-threaded safe, use it in a single thread per set */
725static int add_to_attr_set(struct attribute_set* s, struct attribute *attr) 729static int add_to_attr_set(struct attribute_set *s, struct attribute *attr)
726{ 730{
727 if (!s || !attr) 731 if (!s || !attr)
728 return -EINVAL; 732 return -EINVAL;
@@ -736,7 +740,7 @@ static int add_to_attr_set(struct attribute_set* s, struct attribute *attr)
736 return 0; 740 return 0;
737} 741}
738 742
739static int add_many_to_attr_set(struct attribute_set* s, 743static int add_many_to_attr_set(struct attribute_set *s,
740 struct attribute **attr, 744 struct attribute **attr,
741 unsigned int count) 745 unsigned int count)
742{ 746{
@@ -751,7 +755,7 @@ static int add_many_to_attr_set(struct attribute_set* s,
751 return 0; 755 return 0;
752} 756}
753 757
754static void delete_attr_set(struct attribute_set* s, struct kobject *kobj) 758static void delete_attr_set(struct attribute_set *s, struct kobject *kobj)
755{ 759{
756 sysfs_remove_group(kobj, &s->group); 760 sysfs_remove_group(kobj, &s->group);
757 destroy_attr_set(s); 761 destroy_attr_set(s);
@@ -818,7 +822,8 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
818static ssize_t tpacpi_driver_version_show(struct device_driver *drv, 822static ssize_t tpacpi_driver_version_show(struct device_driver *drv,
819 char *buf) 823 char *buf)
820{ 824{
821 return snprintf(buf, PAGE_SIZE, "%s v%s\n", TPACPI_DESC, TPACPI_VERSION); 825 return snprintf(buf, PAGE_SIZE, "%s v%s\n",
826 TPACPI_DESC, TPACPI_VERSION);
822} 827}
823 828
824static DRIVER_ATTR(version, S_IRUGO, 829static DRIVER_ATTR(version, S_IRUGO,
@@ -826,7 +831,7 @@ static DRIVER_ATTR(version, S_IRUGO,
826 831
827/* --------------------------------------------------------------------- */ 832/* --------------------------------------------------------------------- */
828 833
829static struct driver_attribute* tpacpi_driver_attributes[] = { 834static struct driver_attribute *tpacpi_driver_attributes[] = {
830 &driver_attr_debug_level, &driver_attr_version, 835 &driver_attr_debug_level, &driver_attr_version,
831 &driver_attr_interface_version, 836 &driver_attr_interface_version,
832}; 837};
@@ -849,7 +854,7 @@ static void tpacpi_remove_driver_attributes(struct device_driver *drv)
849{ 854{
850 int i; 855 int i;
851 856
852 for(i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++) 857 for (i = 0; i < ARRAY_SIZE(tpacpi_driver_attributes); i++)
853 driver_remove_file(drv, tpacpi_driver_attributes[i]); 858 driver_remove_file(drv, tpacpi_driver_attributes[i]);
854} 859}
855 860
@@ -1010,8 +1015,10 @@ static struct attribute_set *hotkey_dev_attributes;
1010 1015
1011#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 1016#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
1012#define HOTKEY_CONFIG_CRITICAL_START \ 1017#define HOTKEY_CONFIG_CRITICAL_START \
1013 mutex_lock(&hotkey_thread_data_mutex); \ 1018 do { \
1014 hotkey_config_change++; 1019 mutex_lock(&hotkey_thread_data_mutex); \
1020 hotkey_config_change++; \
1021 } while (0);
1015#define HOTKEY_CONFIG_CRITICAL_END \ 1022#define HOTKEY_CONFIG_CRITICAL_END \
1016 mutex_unlock(&hotkey_thread_data_mutex); 1023 mutex_unlock(&hotkey_thread_data_mutex);
1017#else 1024#else
@@ -1205,15 +1212,18 @@ static void hotkey_read_nvram(struct tp_nvram_state *n, u32 m)
1205} 1212}
1206 1213
1207#define TPACPI_COMPARE_KEY(__scancode, __member) \ 1214#define TPACPI_COMPARE_KEY(__scancode, __member) \
1208 do { if ((mask & (1 << __scancode)) && oldn->__member != newn->__member) \ 1215 do { \
1209 tpacpi_hotkey_send_key(__scancode); } while (0) 1216 if ((mask & (1 << __scancode)) && \
1217 oldn->__member != newn->__member) \
1218 tpacpi_hotkey_send_key(__scancode); \
1219 } while (0)
1210 1220
1211#define TPACPI_MAY_SEND_KEY(__scancode) \ 1221#define TPACPI_MAY_SEND_KEY(__scancode) \
1212 do { if (mask & (1 << __scancode)) \ 1222 do { if (mask & (1 << __scancode)) \
1213 tpacpi_hotkey_send_key(__scancode); } while (0) 1223 tpacpi_hotkey_send_key(__scancode); } while (0)
1214 1224
1215static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn, 1225static void hotkey_compare_and_issue_event(struct tp_nvram_state *oldn,
1216 struct tp_nvram_state *newn, 1226 struct tp_nvram_state *newn,
1217 u32 mask) 1227 u32 mask)
1218{ 1228{
1219 TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_THINKPAD, thinkpad_toggle); 1229 TPACPI_COMPARE_KEY(TP_ACPI_HOTKEYSCAN_THINKPAD, thinkpad_toggle);
@@ -1316,7 +1326,7 @@ static int hotkey_kthread(void *data)
1316 hotkey_read_nvram(&s[si], mask); 1326 hotkey_read_nvram(&s[si], mask);
1317 if (likely(si != so)) { 1327 if (likely(si != so)) {
1318 hotkey_compare_and_issue_event(&s[so], &s[si], 1328 hotkey_compare_and_issue_event(&s[so], &s[si],
1319 mask); 1329 mask);
1320 } 1330 }
1321 } 1331 }
1322 1332
@@ -1352,10 +1362,12 @@ static void hotkey_poll_setup(int may_warn)
1352 (tpacpi_inputdev->users > 0 || hotkey_report_mode < 2)) { 1362 (tpacpi_inputdev->users > 0 || hotkey_report_mode < 2)) {
1353 if (!tpacpi_hotkey_task) { 1363 if (!tpacpi_hotkey_task) {
1354 tpacpi_hotkey_task = kthread_run(hotkey_kthread, 1364 tpacpi_hotkey_task = kthread_run(hotkey_kthread,
1355 NULL, TPACPI_FILE "d"); 1365 NULL,
1366 TPACPI_FILE "d");
1356 if (IS_ERR(tpacpi_hotkey_task)) { 1367 if (IS_ERR(tpacpi_hotkey_task)) {
1357 tpacpi_hotkey_task = NULL; 1368 tpacpi_hotkey_task = NULL;
1358 printk(TPACPI_ERR "could not create kernel thread " 1369 printk(TPACPI_ERR
1370 "could not create kernel thread "
1359 "for hotkey polling\n"); 1371 "for hotkey polling\n");
1360 } 1372 }
1361 } 1373 }
@@ -1363,7 +1375,8 @@ static void hotkey_poll_setup(int may_warn)
1363 hotkey_poll_stop_sync(); 1375 hotkey_poll_stop_sync();
1364 if (may_warn && 1376 if (may_warn &&
1365 hotkey_source_mask != 0 && hotkey_poll_freq == 0) { 1377 hotkey_source_mask != 0 && hotkey_poll_freq == 0) {
1366 printk(TPACPI_NOTICE "hot keys 0x%08x require polling, " 1378 printk(TPACPI_NOTICE
1379 "hot keys 0x%08x require polling, "
1367 "which is currently disabled\n", 1380 "which is currently disabled\n",
1368 hotkey_source_mask); 1381 hotkey_source_mask);
1369 } 1382 }
@@ -1829,7 +1842,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1829 "missing MHKA handler, " 1842 "missing MHKA handler, "
1830 "please report this to %s\n", 1843 "please report this to %s\n",
1831 TPACPI_MAIL); 1844 TPACPI_MAIL);
1832 hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */ 1845 /* FN+F12, FN+F4, FN+F3 */
1846 hotkey_all_mask = 0x080cU;
1833 } 1847 }
1834 } 1848 }
1835 1849
@@ -1882,7 +1896,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
1882 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE, 1896 hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE,
1883 GFP_KERNEL); 1897 GFP_KERNEL);
1884 if (!hotkey_keycode_map) { 1898 if (!hotkey_keycode_map) {
1885 printk(TPACPI_ERR "failed to allocate memory for key map\n"); 1899 printk(TPACPI_ERR
1900 "failed to allocate memory for key map\n");
1886 return -ENOMEM; 1901 return -ENOMEM;
1887 } 1902 }
1888 1903
@@ -1953,11 +1968,14 @@ static void hotkey_exit(void)
1953#endif 1968#endif
1954 1969
1955 if (tp_features.hotkey) { 1970 if (tp_features.hotkey) {
1956 dbg_printk(TPACPI_DBG_EXIT, "restoring original hot key mask\n"); 1971 dbg_printk(TPACPI_DBG_EXIT,
1972 "restoring original hot key mask\n");
1957 /* no short-circuit boolean operator below! */ 1973 /* no short-circuit boolean operator below! */
1958 if ((hotkey_mask_set(hotkey_orig_mask) | 1974 if ((hotkey_mask_set(hotkey_orig_mask) |
1959 hotkey_status_set(hotkey_orig_status)) != 0) 1975 hotkey_status_set(hotkey_orig_status)) != 0)
1960 printk(TPACPI_ERR "failed to restore hot key mask to BIOS defaults\n"); 1976 printk(TPACPI_ERR
1977 "failed to restore hot key mask "
1978 "to BIOS defaults\n");
1961 } 1979 }
1962 1980
1963 if (hotkey_dev_attributes) { 1981 if (hotkey_dev_attributes) {
@@ -1974,11 +1992,13 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
1974 int ignore_acpi_ev; 1992 int ignore_acpi_ev;
1975 1993
1976 if (event != 0x80) { 1994 if (event != 0x80) {
1977 printk(TPACPI_ERR "unknown HKEY notification event %d\n", event); 1995 printk(TPACPI_ERR
1996 "unknown HKEY notification event %d\n", event);
1978 /* forward it to userspace, maybe it knows how to handle it */ 1997 /* forward it to userspace, maybe it knows how to handle it */
1979 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 1998 acpi_bus_generate_netlink_event(
1980 ibm->acpi->device->dev.bus_id, 1999 ibm->acpi->device->pnp.device_class,
1981 event, 0); 2000 ibm->acpi->device->dev.bus_id,
2001 event, 0);
1982 return; 2002 return;
1983 } 2003 }
1984 2004
@@ -2009,8 +2029,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2009 } 2029 }
2010 } else { 2030 } else {
2011 printk(TPACPI_ERR 2031 printk(TPACPI_ERR
2012 "hotkey 0x%04x out of range for keyboard map\n", 2032 "hotkey 0x%04x out of range "
2013 hkey); 2033 "for keyboard map\n", hkey);
2014 send_acpi_ev = 1; 2034 send_acpi_ev = 1;
2015 } 2035 }
2016 break; 2036 break;
@@ -2020,8 +2040,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2020 * eat up known LID events */ 2040 * eat up known LID events */
2021 if (hkey != 0x5001 && hkey != 0x5002) { 2041 if (hkey != 0x5001 && hkey != 0x5002) {
2022 printk(TPACPI_ERR 2042 printk(TPACPI_ERR
2023 "unknown LID-related HKEY event: 0x%04x\n", 2043 "unknown LID-related HKEY event: "
2024 hkey); 2044 "0x%04x\n", hkey);
2025 send_acpi_ev = 1; 2045 send_acpi_ev = 1;
2026 } else { 2046 } else {
2027 ignore_acpi_ev = 1; 2047 ignore_acpi_ev = 1;
@@ -2036,23 +2056,29 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2036 /* fallthrough to default */ 2056 /* fallthrough to default */
2037 default: 2057 default:
2038 /* case 2: dock-related */ 2058 /* case 2: dock-related */
2039 /* 0x2305 - T43 waking up due to bay lever eject while aslept */ 2059 /* 0x2305 - T43 waking up due to bay lever
2060 * eject while aslept */
2040 /* case 3: ultra-bay related. maybe bay in dock? */ 2061 /* case 3: ultra-bay related. maybe bay in dock? */
2041 /* 0x3003 - T43 after wake up by bay lever eject (0x2305) */ 2062 /* 0x3003 - T43 after wake up by bay lever
2042 printk(TPACPI_NOTICE "unhandled HKEY event 0x%04x\n", hkey); 2063 * eject (0x2305) */
2064 printk(TPACPI_NOTICE
2065 "unhandled HKEY event 0x%04x\n", hkey);
2043 send_acpi_ev = 1; 2066 send_acpi_ev = 1;
2044 } 2067 }
2045 2068
2046 /* Legacy events */ 2069 /* Legacy events */
2047 if (!ignore_acpi_ev && (send_acpi_ev || hotkey_report_mode < 2)) { 2070 if (!ignore_acpi_ev &&
2048 acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey); 2071 (send_acpi_ev || hotkey_report_mode < 2)) {
2072 acpi_bus_generate_proc_event(ibm->acpi->device,
2073 event, hkey);
2049 } 2074 }
2050 2075
2051 /* netlink events */ 2076 /* netlink events */
2052 if (!ignore_acpi_ev && send_acpi_ev) { 2077 if (!ignore_acpi_ev && send_acpi_ev) {
2053 acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class, 2078 acpi_bus_generate_netlink_event(
2054 ibm->acpi->device->dev.bus_id, 2079 ibm->acpi->device->pnp.device_class,
2055 event, hkey); 2080 ibm->acpi->device->dev.bus_id,
2081 event, hkey);
2056 } 2082 }
2057 } 2083 }
2058} 2084}
@@ -2060,7 +2086,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
2060static void hotkey_resume(void) 2086static void hotkey_resume(void)
2061{ 2087{
2062 if (hotkey_mask_get()) 2088 if (hotkey_mask_get())
2063 printk(TPACPI_ERR "error while trying to read hot key mask from firmware\n"); 2089 printk(TPACPI_ERR
2090 "error while trying to read hot key mask "
2091 "from firmware\n");
2064 tpacpi_input_send_radiosw(); 2092 tpacpi_input_send_radiosw();
2065#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL 2093#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
2066 hotkey_poll_setup_safe(0); 2094 hotkey_poll_setup_safe(0);
@@ -2663,13 +2691,14 @@ static int video_outputsw_set(int status)
2663 res = acpi_evalf(vid_handle, NULL, 2691 res = acpi_evalf(vid_handle, NULL,
2664 "ASWT", "vdd", status * 0x100, 0); 2692 "ASWT", "vdd", status * 0x100, 0);
2665 if (!autosw && video_autosw_set(autosw)) { 2693 if (!autosw && video_autosw_set(autosw)) {
2666 printk(TPACPI_ERR "video auto-switch left enabled due to error\n"); 2694 printk(TPACPI_ERR
2695 "video auto-switch left enabled due to error\n");
2667 return -EIO; 2696 return -EIO;
2668 } 2697 }
2669 break; 2698 break;
2670 case TPACPI_VIDEO_NEW: 2699 case TPACPI_VIDEO_NEW:
2671 res = acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0x80) && 2700 res = acpi_evalf(NULL, NULL, "\\VUPS", "vd", 0x80) &&
2672 acpi_evalf(NULL, NULL, "\\VSDS", "vdd", status, 1); 2701 acpi_evalf(NULL, NULL, "\\VSDS", "vdd", status, 1);
2673 break; 2702 break;
2674 default: 2703 default:
2675 return -ENOSYS; 2704 return -ENOSYS;
@@ -2732,7 +2761,8 @@ static int video_outputsw_cycle(void)
2732 return -ENOSYS; 2761 return -ENOSYS;
2733 } 2762 }
2734 if (!autosw && video_autosw_set(autosw)) { 2763 if (!autosw && video_autosw_set(autosw)) {
2735 printk(TPACPI_ERR "video auto-switch left enabled due to error\n"); 2764 printk(TPACPI_ERR
2765 "video auto-switch left enabled due to error\n");
2736 return -EIO; 2766 return -EIO;
2737 } 2767 }
2738 2768
@@ -3340,7 +3370,8 @@ enum { /* For TPACPI_LED_OLD */
3340static enum led_access_mode led_supported; 3370static enum led_access_mode led_supported;
3341 3371
3342TPACPI_HANDLE(led, ec, "SLED", /* 570 */ 3372TPACPI_HANDLE(led, ec, "SLED", /* 570 */
3343 "SYSL", /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */ 3373 "SYSL", /* 600e/x, 770e, 770x, A21e, A2xm/p, */
3374 /* T20-22, X20-21 */
3344 "LED", /* all others */ 3375 "LED", /* all others */
3345 ); /* R30, R31 */ 3376 ); /* R30, R31 */
3346 3377
@@ -3437,13 +3468,11 @@ static int led_write(char *buf)
3437 led = 1 << led; 3468 led = 1 << led;
3438 ret = ec_write(TPACPI_LED_EC_HLMS, led); 3469 ret = ec_write(TPACPI_LED_EC_HLMS, led);
3439 if (ret >= 0) 3470 if (ret >= 0)
3440 ret = 3471 ret = ec_write(TPACPI_LED_EC_HLBL,
3441 ec_write(TPACPI_LED_EC_HLBL, 3472 led * led_exp_hlbl[ind]);
3442 led * led_exp_hlbl[ind]);
3443 if (ret >= 0) 3473 if (ret >= 0)
3444 ret = 3474 ret = ec_write(TPACPI_LED_EC_HLCL,
3445 ec_write(TPACPI_LED_EC_HLCL, 3475 led * led_exp_hlcl[ind]);
3446 led * led_exp_hlcl[ind]);
3447 if (ret < 0) 3476 if (ret < 0)
3448 return ret; 3477 return ret;
3449 } else { 3478 } else {
@@ -3620,7 +3649,7 @@ static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s)
3620 if (thermal_read_mode == TPACPI_THERMAL_TPEC_16) 3649 if (thermal_read_mode == TPACPI_THERMAL_TPEC_16)
3621 n = 16; 3650 n = 16;
3622 3651
3623 for(i = 0 ; i < n; i++) { 3652 for (i = 0 ; i < n; i++) {
3624 res = thermal_get_sensor(i, &s->temp[i]); 3653 res = thermal_get_sensor(i, &s->temp[i]);
3625 if (res) 3654 if (res)
3626 return res; 3655 return res;
@@ -3651,7 +3680,8 @@ static ssize_t thermal_temp_input_show(struct device *dev,
3651} 3680}
3652 3681
3653#define THERMAL_SENSOR_ATTR_TEMP(_idxA, _idxB) \ 3682#define THERMAL_SENSOR_ATTR_TEMP(_idxA, _idxB) \
3654 SENSOR_ATTR(temp##_idxA##_input, S_IRUGO, thermal_temp_input_show, NULL, _idxB) 3683 SENSOR_ATTR(temp##_idxA##_input, S_IRUGO, \
3684 thermal_temp_input_show, NULL, _idxB)
3655 3685
3656static struct sensor_device_attribute sensor_dev_attr_thermal_temp_input[] = { 3686static struct sensor_device_attribute sensor_dev_attr_thermal_temp_input[] = {
3657 THERMAL_SENSOR_ATTR_TEMP(1, 0), 3687 THERMAL_SENSOR_ATTR_TEMP(1, 0),
@@ -3747,7 +3777,8 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
3747 if (acpi_tmp7) { 3777 if (acpi_tmp7) {
3748 printk(TPACPI_ERR 3778 printk(TPACPI_ERR
3749 "ThinkPad ACPI EC access misbehaving, " 3779 "ThinkPad ACPI EC access misbehaving, "
3750 "falling back to ACPI TMPx access mode\n"); 3780 "falling back to ACPI TMPx access "
3781 "mode\n");
3751 thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07; 3782 thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07;
3752 } else { 3783 } else {
3753 printk(TPACPI_ERR 3784 printk(TPACPI_ERR
@@ -3777,7 +3808,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
3777 str_supported(thermal_read_mode != TPACPI_THERMAL_NONE), 3808 str_supported(thermal_read_mode != TPACPI_THERMAL_NONE),
3778 thermal_read_mode); 3809 thermal_read_mode);
3779 3810
3780 switch(thermal_read_mode) { 3811 switch (thermal_read_mode) {
3781 case TPACPI_THERMAL_TPEC_16: 3812 case TPACPI_THERMAL_TPEC_16:
3782 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj, 3813 res = sysfs_create_group(&tpacpi_sensors_pdev->dev.kobj,
3783 &thermal_temp_input16_group); 3814 &thermal_temp_input16_group);
@@ -3802,7 +3833,7 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
3802 3833
3803static void thermal_exit(void) 3834static void thermal_exit(void)
3804{ 3835{
3805 switch(thermal_read_mode) { 3836 switch (thermal_read_mode) {
3806 case TPACPI_THERMAL_TPEC_16: 3837 case TPACPI_THERMAL_TPEC_16:
3807 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, 3838 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj,
3808 &thermal_temp_input16_group); 3839 &thermal_temp_input16_group);
@@ -4020,8 +4051,8 @@ static int brightness_update_status(struct backlight_device *bd)
4020} 4051}
4021 4052
4022static struct backlight_ops ibm_backlight_data = { 4053static struct backlight_ops ibm_backlight_data = {
4023 .get_brightness = brightness_get, 4054 .get_brightness = brightness_get,
4024 .update_status = brightness_update_status, 4055 .update_status = brightness_update_status,
4025}; 4056};
4026 4057
4027/* --------------------------------------------------------------------- */ 4058/* --------------------------------------------------------------------- */
@@ -4081,7 +4112,8 @@ static int __init brightness_check_levels(void)
4081 4112
4082 /* Search for a BCLL package with 16 levels */ 4113 /* Search for a BCLL package with 16 levels */
4083 status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3, 4114 status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3,
4084 brightness_find_bcll, NULL, &found_node); 4115 brightness_find_bcll, NULL,
4116 &found_node);
4085 4117
4086 return (ACPI_SUCCESS(status) && found_node != NULL); 4118 return (ACPI_SUCCESS(status) && found_node != NULL);
4087} 4119}
@@ -4114,7 +4146,7 @@ static int __init brightness_check_std_acpi_support(void)
4114 4146
4115 /* Search for a _BCL method, but don't execute it */ 4147 /* Search for a _BCL method, but don't execute it */
4116 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, 4148 status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3,
4117 brightness_find_bcl, NULL, &found_node); 4149 brightness_find_bcl, NULL, &found_node);
4118 4150
4119 return (ACPI_SUCCESS(status) && found_node != NULL); 4151 return (ACPI_SUCCESS(status) && found_node != NULL);
4120} 4152}
@@ -4129,12 +4161,14 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
4129 4161
4130 if (!brightness_enable) { 4162 if (!brightness_enable) {
4131 dbg_printk(TPACPI_DBG_INIT, 4163 dbg_printk(TPACPI_DBG_INIT,
4132 "brightness support disabled by module parameter\n"); 4164 "brightness support disabled by "
4165 "module parameter\n");
4133 return 1; 4166 return 1;
4134 } else if (brightness_enable > 1) { 4167 } else if (brightness_enable > 1) {
4135 if (brightness_check_std_acpi_support()) { 4168 if (brightness_check_std_acpi_support()) {
4136 printk(TPACPI_NOTICE 4169 printk(TPACPI_NOTICE
4137 "standard ACPI backlight interface available, not loading native one...\n"); 4170 "standard ACPI backlight interface "
4171 "available, not loading native one...\n");
4138 return 1; 4172 return 1;
4139 } 4173 }
4140 } 4174 }
@@ -4161,7 +4195,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
4161 return 1; 4195 return 1;
4162 4196
4163 if (tp_features.bright_16levels) 4197 if (tp_features.bright_16levels)
4164 printk(TPACPI_INFO "detected a 16-level brightness capable ThinkPad\n"); 4198 printk(TPACPI_INFO
4199 "detected a 16-level brightness capable ThinkPad\n");
4165 4200
4166 ibm_backlight_device = backlight_device_register( 4201 ibm_backlight_device = backlight_device_register(
4167 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, 4202 TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
@@ -4195,7 +4230,8 @@ static int brightness_read(char *p)
4195 int len = 0; 4230 int len = 0;
4196 int level; 4231 int level;
4197 4232
4198 if ((level = brightness_get(NULL)) < 0) { 4233 level = brightness_get(NULL);
4234 if (level < 0) {
4199 len += sprintf(p + len, "level:\t\tunreadable\n"); 4235 len += sprintf(p + len, "level:\t\tunreadable\n");
4200 } else { 4236 } else {
4201 len += sprintf(p + len, "level:\t\t%d\n", level); 4237 len += sprintf(p + len, "level:\t\t%d\n", level);
@@ -4303,8 +4339,11 @@ static int volume_write(char *buf)
4303 } else 4339 } else
4304 return -EINVAL; 4340 return -EINVAL;
4305 4341
4306 if (new_level != level) { /* mute doesn't change */ 4342 if (new_level != level) {
4307 cmos_cmd = new_level > level ? TP_CMOS_VOLUME_UP : TP_CMOS_VOLUME_DOWN; 4343 /* mute doesn't change */
4344
4345 cmos_cmd = (new_level > level) ?
4346 TP_CMOS_VOLUME_UP : TP_CMOS_VOLUME_DOWN;
4308 inc = new_level > level ? 1 : -1; 4347 inc = new_level > level ? 1 : -1;
4309 4348
4310 if (mute && (issue_thinkpad_cmos_command(cmos_cmd) || 4349 if (mute && (issue_thinkpad_cmos_command(cmos_cmd) ||
@@ -4316,14 +4355,18 @@ static int volume_write(char *buf)
4316 !acpi_ec_write(volume_offset, i + inc)) 4355 !acpi_ec_write(volume_offset, i + inc))
4317 return -EIO; 4356 return -EIO;
4318 4357
4319 if (mute && (issue_thinkpad_cmos_command(TP_CMOS_VOLUME_MUTE) || 4358 if (mute &&
4320 !acpi_ec_write(volume_offset, 4359 (issue_thinkpad_cmos_command(TP_CMOS_VOLUME_MUTE) ||
4321 new_level + mute))) 4360 !acpi_ec_write(volume_offset, new_level + mute))) {
4322 return -EIO; 4361 return -EIO;
4362 }
4323 } 4363 }
4324 4364
4325 if (new_mute != mute) { /* level doesn't change */ 4365 if (new_mute != mute) {
4326 cmos_cmd = new_mute ? TP_CMOS_VOLUME_MUTE : TP_CMOS_VOLUME_UP; 4366 /* level doesn't change */
4367
4368 cmos_cmd = (new_mute) ?
4369 TP_CMOS_VOLUME_MUTE : TP_CMOS_VOLUME_UP;
4327 4370
4328 if (issue_thinkpad_cmos_command(cmos_cmd) || 4371 if (issue_thinkpad_cmos_command(cmos_cmd) ||
4329 !acpi_ec_write(volume_offset, level + new_mute)) 4372 !acpi_ec_write(volume_offset, level + new_mute))
@@ -4694,7 +4737,7 @@ static int fan_set_enable(void)
4694 s |= 4; 4737 s |= 4;
4695 4738
4696 if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s)) 4739 if (!acpi_evalf(sfan_handle, NULL, NULL, "vd", s))
4697 rc= -EIO; 4740 rc = -EIO;
4698 else 4741 else
4699 rc = 0; 4742 rc = 0;
4700 break; 4743 break;
@@ -4790,7 +4833,8 @@ static void fan_watchdog_reset(void)
4790 if (!schedule_delayed_work(&fan_watchdog_task, 4833 if (!schedule_delayed_work(&fan_watchdog_task,
4791 msecs_to_jiffies(fan_watchdog_maxinterval 4834 msecs_to_jiffies(fan_watchdog_maxinterval
4792 * 1000))) { 4835 * 1000))) {
4793 printk(TPACPI_ERR "failed to schedule the fan watchdog, " 4836 printk(TPACPI_ERR
4837 "failed to schedule the fan watchdog, "
4794 "watchdog will not trigger\n"); 4838 "watchdog will not trigger\n");
4795 } 4839 }
4796 } else 4840 } else
@@ -5076,9 +5120,9 @@ static int __init fan_init(struct ibm_init_struct *iibm)
5076 case 0x3637: /* TP-76 */ 5120 case 0x3637: /* TP-76 */
5077 case 0x3037: /* TP-70 */ 5121 case 0x3037: /* TP-70 */
5078 printk(TPACPI_NOTICE 5122 printk(TPACPI_NOTICE
5079 "fan_init: initial fan status is " 5123 "fan_init: initial fan status "
5080 "unknown, assuming it is in auto " 5124 "is unknown, assuming it is "
5081 "mode\n"); 5125 "in auto mode\n");
5082 tp_features.fan_ctrl_status_undef = 1; 5126 tp_features.fan_ctrl_status_undef = 1;
5083 ;; 5127 ;;
5084 } 5128 }
@@ -5151,11 +5195,13 @@ static int __init fan_init(struct ibm_init_struct *iibm)
5151 5195
5152static void fan_exit(void) 5196static void fan_exit(void)
5153{ 5197{
5154 vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n"); 5198 vdbg_printk(TPACPI_DBG_EXIT,
5199 "cancelling any pending fan watchdog tasks\n");
5155 5200
5156 /* FIXME: can we really do this unconditionally? */ 5201 /* FIXME: can we really do this unconditionally? */
5157 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, &fan_attr_group); 5202 sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, &fan_attr_group);
5158 driver_remove_file(&tpacpi_hwmon_pdriver.driver, &driver_attr_fan_watchdog); 5203 driver_remove_file(&tpacpi_hwmon_pdriver.driver,
5204 &driver_attr_fan_watchdog);
5159 5205
5160 cancel_delayed_work(&fan_watchdog_task); 5206 cancel_delayed_work(&fan_watchdog_task);
5161 flush_scheduled_work(); 5207 flush_scheduled_work();
@@ -5171,7 +5217,8 @@ static int fan_read(char *p)
5171 switch (fan_status_access_mode) { 5217 switch (fan_status_access_mode) {
5172 case TPACPI_FAN_RD_ACPI_GFAN: 5218 case TPACPI_FAN_RD_ACPI_GFAN:
5173 /* 570, 600e/x, 770e, 770x */ 5219 /* 570, 600e/x, 770e, 770x */
5174 if ((rc = fan_get_status_safe(&status)) < 0) 5220 rc = fan_get_status_safe(&status);
5221 if (rc < 0)
5175 return rc; 5222 return rc;
5176 5223
5177 len += sprintf(p + len, "status:\t\t%s\n" 5224 len += sprintf(p + len, "status:\t\t%s\n"
@@ -5181,7 +5228,8 @@ static int fan_read(char *p)
5181 5228
5182 case TPACPI_FAN_RD_TPEC: 5229 case TPACPI_FAN_RD_TPEC:
5183 /* all except 570, 600e/x, 770e, 770x */ 5230 /* all except 570, 600e/x, 770e, 770x */
5184 if ((rc = fan_get_status_safe(&status)) < 0) 5231 rc = fan_get_status_safe(&status);
5232 if (rc < 0)
5185 return rc; 5233 return rc;
5186 5234
5187 if (unlikely(tp_features.fan_ctrl_status_undef)) { 5235 if (unlikely(tp_features.fan_ctrl_status_undef)) {
@@ -5196,7 +5244,8 @@ static int fan_read(char *p)
5196 len += sprintf(p + len, "status:\t\t%s\n", 5244 len += sprintf(p + len, "status:\t\t%s\n",
5197 (status != 0) ? "enabled" : "disabled"); 5245 (status != 0) ? "enabled" : "disabled");
5198 5246
5199 if ((rc = fan_get_speed(&speed)) < 0) 5247 rc = fan_get_speed(&speed);
5248 if (rc < 0)
5200 return rc; 5249 return rc;
5201 5250
5202 len += sprintf(p + len, "speed:\t\t%d\n", speed); 5251 len += sprintf(p + len, "speed:\t\t%d\n", speed);
@@ -5232,8 +5281,8 @@ static int fan_read(char *p)
5232 5281
5233 if (fan_control_commands & TPACPI_FAN_CMD_ENABLE) 5282 if (fan_control_commands & TPACPI_FAN_CMD_ENABLE)
5234 len += sprintf(p + len, "commands:\tenable, disable\n" 5283 len += sprintf(p + len, "commands:\tenable, disable\n"
5235 "commands:\twatchdog <timeout> (<timeout> is 0 (off), " 5284 "commands:\twatchdog <timeout> (<timeout> "
5236 "1-120 (seconds))\n"); 5285 "is 0 (off), 1-120 (seconds))\n");
5237 5286
5238 if (fan_control_commands & TPACPI_FAN_CMD_SPEED) 5287 if (fan_control_commands & TPACPI_FAN_CMD_SPEED)
5239 len += sprintf(p + len, "commands:\tspeed <speed>" 5288 len += sprintf(p + len, "commands:\tspeed <speed>"
@@ -5249,12 +5298,13 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
5249 if (strlencmp(cmd, "level auto") == 0) 5298 if (strlencmp(cmd, "level auto") == 0)
5250 level = TP_EC_FAN_AUTO; 5299 level = TP_EC_FAN_AUTO;
5251 else if ((strlencmp(cmd, "level disengaged") == 0) | 5300 else if ((strlencmp(cmd, "level disengaged") == 0) |
5252 (strlencmp(cmd, "level full-speed") == 0)) 5301 (strlencmp(cmd, "level full-speed") == 0))
5253 level = TP_EC_FAN_FULLSPEED; 5302 level = TP_EC_FAN_FULLSPEED;
5254 else if (sscanf(cmd, "level %d", &level) != 1) 5303 else if (sscanf(cmd, "level %d", &level) != 1)
5255 return 0; 5304 return 0;
5256 5305
5257 if ((*rc = fan_set_level_safe(level)) == -ENXIO) 5306 *rc = fan_set_level_safe(level);
5307 if (*rc == -ENXIO)
5258 printk(TPACPI_ERR "level command accepted for unsupported " 5308 printk(TPACPI_ERR "level command accepted for unsupported "
5259 "access mode %d", fan_control_access_mode); 5309 "access mode %d", fan_control_access_mode);
5260 5310
@@ -5266,7 +5316,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc)
5266 if (strlencmp(cmd, "enable") != 0) 5316 if (strlencmp(cmd, "enable") != 0)
5267 return 0; 5317 return 0;
5268 5318
5269 if ((*rc = fan_set_enable()) == -ENXIO) 5319 *rc = fan_set_enable();
5320 if (*rc == -ENXIO)
5270 printk(TPACPI_ERR "enable command accepted for unsupported " 5321 printk(TPACPI_ERR "enable command accepted for unsupported "
5271 "access mode %d", fan_control_access_mode); 5322 "access mode %d", fan_control_access_mode);
5272 5323
@@ -5278,7 +5329,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc)
5278 if (strlencmp(cmd, "disable") != 0) 5329 if (strlencmp(cmd, "disable") != 0)
5279 return 0; 5330 return 0;
5280 5331
5281 if ((*rc = fan_set_disable()) == -ENXIO) 5332 *rc = fan_set_disable();
5333 if (*rc == -ENXIO)
5282 printk(TPACPI_ERR "disable command accepted for unsupported " 5334 printk(TPACPI_ERR "disable command accepted for unsupported "
5283 "access mode %d", fan_control_access_mode); 5335 "access mode %d", fan_control_access_mode);
5284 5336
@@ -5295,7 +5347,8 @@ static int fan_write_cmd_speed(const char *cmd, int *rc)
5295 if (sscanf(cmd, "speed %d", &speed) != 1) 5347 if (sscanf(cmd, "speed %d", &speed) != 1)
5296 return 0; 5348 return 0;
5297 5349
5298 if ((*rc = fan_set_speed(speed)) == -ENXIO) 5350 *rc = fan_set_speed(speed);
5351 if (*rc == -ENXIO)
5299 printk(TPACPI_ERR "speed command accepted for unsupported " 5352 printk(TPACPI_ERR "speed command accepted for unsupported "
5300 "access mode %d", fan_control_access_mode); 5353 "access mode %d", fan_control_access_mode);
5301 5354
@@ -5703,38 +5756,38 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp)
5703 5756
5704module_param(experimental, int, 0); 5757module_param(experimental, int, 0);
5705MODULE_PARM_DESC(experimental, 5758MODULE_PARM_DESC(experimental,
5706 "Enables experimental features when non-zero"); 5759 "Enables experimental features when non-zero");
5707 5760
5708module_param_named(debug, dbg_level, uint, 0); 5761module_param_named(debug, dbg_level, uint, 0);
5709MODULE_PARM_DESC(debug, "Sets debug level bit-mask"); 5762MODULE_PARM_DESC(debug, "Sets debug level bit-mask");
5710 5763
5711module_param(force_load, bool, 0); 5764module_param(force_load, bool, 0);
5712MODULE_PARM_DESC(force_load, 5765MODULE_PARM_DESC(force_load,
5713 "Attempts to load the driver even on a " 5766 "Attempts to load the driver even on a "
5714 "mis-identified ThinkPad when true"); 5767 "mis-identified ThinkPad when true");
5715 5768
5716module_param_named(fan_control, fan_control_allowed, bool, 0); 5769module_param_named(fan_control, fan_control_allowed, bool, 0);
5717MODULE_PARM_DESC(fan_control, 5770MODULE_PARM_DESC(fan_control,
5718 "Enables setting fan parameters features when true"); 5771 "Enables setting fan parameters features when true");
5719 5772
5720module_param_named(brightness_mode, brightness_mode, int, 0); 5773module_param_named(brightness_mode, brightness_mode, int, 0);
5721MODULE_PARM_DESC(brightness_mode, 5774MODULE_PARM_DESC(brightness_mode,
5722 "Selects brightness control strategy: " 5775 "Selects brightness control strategy: "
5723 "0=auto, 1=EC, 2=CMOS, 3=both"); 5776 "0=auto, 1=EC, 2=CMOS, 3=both");
5724 5777
5725module_param(brightness_enable, uint, 0); 5778module_param(brightness_enable, uint, 0);
5726MODULE_PARM_DESC(brightness_enable, 5779MODULE_PARM_DESC(brightness_enable,
5727 "Enables backlight control when 1, disables when 0"); 5780 "Enables backlight control when 1, disables when 0");
5728 5781
5729module_param(hotkey_report_mode, uint, 0); 5782module_param(hotkey_report_mode, uint, 0);
5730MODULE_PARM_DESC(hotkey_report_mode, 5783MODULE_PARM_DESC(hotkey_report_mode,
5731 "used for backwards compatibility with userspace, " 5784 "used for backwards compatibility with userspace, "
5732 "see documentation"); 5785 "see documentation");
5733 5786
5734#define TPACPI_PARAM(feature) \ 5787#define TPACPI_PARAM(feature) \
5735 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \ 5788 module_param_call(feature, set_ibm_param, NULL, NULL, 0); \
5736 MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \ 5789 MODULE_PARM_DESC(feature, "Simulates thinkpad-aci procfs command " \
5737 "at module load, see documentation") 5790 "at module load, see documentation")
5738 5791
5739TPACPI_PARAM(hotkey); 5792TPACPI_PARAM(hotkey);
5740TPACPI_PARAM(bluetooth); 5793TPACPI_PARAM(bluetooth);
@@ -5832,7 +5885,8 @@ static int __init thinkpad_acpi_module_init(void)
5832 5885
5833 proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir); 5886 proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir);
5834 if (!proc_dir) { 5887 if (!proc_dir) {
5835 printk(TPACPI_ERR "unable to create proc dir " TPACPI_PROC_DIR); 5888 printk(TPACPI_ERR
5889 "unable to create proc dir " TPACPI_PROC_DIR);
5836 thinkpad_acpi_module_exit(); 5890 thinkpad_acpi_module_exit();
5837 return -ENODEV; 5891 return -ENODEV;
5838 } 5892 }
@@ -5840,7 +5894,8 @@ static int __init thinkpad_acpi_module_init(void)
5840 5894
5841 ret = platform_driver_register(&tpacpi_pdriver); 5895 ret = platform_driver_register(&tpacpi_pdriver);
5842 if (ret) { 5896 if (ret) {
5843 printk(TPACPI_ERR "unable to register main platform driver\n"); 5897 printk(TPACPI_ERR
5898 "unable to register main platform driver\n");
5844 thinkpad_acpi_module_exit(); 5899 thinkpad_acpi_module_exit();
5845 return ret; 5900 return ret;
5846 } 5901 }
@@ -5848,7 +5903,8 @@ static int __init thinkpad_acpi_module_init(void)
5848 5903
5849 ret = platform_driver_register(&tpacpi_hwmon_pdriver); 5904 ret = platform_driver_register(&tpacpi_hwmon_pdriver);
5850 if (ret) { 5905 if (ret) {
5851 printk(TPACPI_ERR "unable to register hwmon platform driver\n"); 5906 printk(TPACPI_ERR
5907 "unable to register hwmon platform driver\n");
5852 thinkpad_acpi_module_exit(); 5908 thinkpad_acpi_module_exit();
5853 return ret; 5909 return ret;
5854 } 5910 }
@@ -5857,10 +5913,12 @@ static int __init thinkpad_acpi_module_init(void)
5857 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver); 5913 ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
5858 if (!ret) { 5914 if (!ret) {
5859 tp_features.platform_drv_attrs_registered = 1; 5915 tp_features.platform_drv_attrs_registered = 1;
5860 ret = tpacpi_create_driver_attributes(&tpacpi_hwmon_pdriver.driver); 5916 ret = tpacpi_create_driver_attributes(
5917 &tpacpi_hwmon_pdriver.driver);
5861 } 5918 }
5862 if (ret) { 5919 if (ret) {
5863 printk(TPACPI_ERR "unable to create sysfs driver attributes\n"); 5920 printk(TPACPI_ERR
5921 "unable to create sysfs driver attributes\n");
5864 thinkpad_acpi_module_exit(); 5922 thinkpad_acpi_module_exit();
5865 return ret; 5923 return ret;
5866 } 5924 }
@@ -5878,12 +5936,13 @@ static int __init thinkpad_acpi_module_init(void)
5878 return ret; 5936 return ret;
5879 } 5937 }
5880 tpacpi_sensors_pdev = platform_device_register_simple( 5938 tpacpi_sensors_pdev = platform_device_register_simple(
5881 TPACPI_HWMON_DRVR_NAME, 5939 TPACPI_HWMON_DRVR_NAME,
5882 -1, NULL, 0); 5940 -1, NULL, 0);
5883 if (IS_ERR(tpacpi_sensors_pdev)) { 5941 if (IS_ERR(tpacpi_sensors_pdev)) {
5884 ret = PTR_ERR(tpacpi_sensors_pdev); 5942 ret = PTR_ERR(tpacpi_sensors_pdev);
5885 tpacpi_sensors_pdev = NULL; 5943 tpacpi_sensors_pdev = NULL;
5886 printk(TPACPI_ERR "unable to register hwmon platform device\n"); 5944 printk(TPACPI_ERR
5945 "unable to register hwmon platform device\n");
5887 thinkpad_acpi_module_exit(); 5946 thinkpad_acpi_module_exit();
5888 return ret; 5947 return ret;
5889 } 5948 }
@@ -5891,7 +5950,7 @@ static int __init thinkpad_acpi_module_init(void)
5891 &dev_attr_thinkpad_acpi_pdev_name); 5950 &dev_attr_thinkpad_acpi_pdev_name);
5892 if (ret) { 5951 if (ret) {
5893 printk(TPACPI_ERR 5952 printk(TPACPI_ERR
5894 "unable to create sysfs hwmon device attributes\n"); 5953 "unable to create sysfs hwmon device attributes\n");
5895 thinkpad_acpi_module_exit(); 5954 thinkpad_acpi_module_exit();
5896 return ret; 5955 return ret;
5897 } 5956 }