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>
This commit is contained in:
Henrique de Moraes Holschuh 2008-01-08 13:02:49 -02:00 committed by Len Brown
parent e0c7dfe701
commit 35ff8b9fa9
1 changed files with 175 additions and 116 deletions

View File

@ -150,7 +150,8 @@ enum {
#define TPACPI_DBG_EXIT 0x0002
#define dbg_printk(a_dbg_level, format, arg...) \
do { if (dbg_level & a_dbg_level) \
printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); } while (0)
printk(TPACPI_DEBUG "%s: " format, __func__ , ## arg); \
} while (0)
#ifdef CONFIG_THINKPAD_ACPI_DEBUG
#define vdbg_printk(a_dbg_level, format, arg...) \
dbg_printk(a_dbg_level, format, ## arg)
@ -288,7 +289,8 @@ TPACPI_HANDLE(ec, root, "\\_SB.PCI0.ISA.EC0", /* 240, 240x */
TPACPI_HANDLE(ecrd, ec, "ECRD"); /* 570 */
TPACPI_HANDLE(ecwr, ec, "ECWR"); /* 570 */
TPACPI_HANDLE(cmos, root, "\\UCMS", /* R50, R50e, R50p, R51, T4x, X31, X40 */
TPACPI_HANDLE(cmos, root, "\\UCMS", /* R50, R50e, R50p, R51, */
/* T4x, X31, X40 */
"\\CMOS", /* A3x, G4x, R32, T23, T30, X22-24, X30 */
"\\CMS", /* R40, R40e */
); /* all others */
@ -508,10 +510,12 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm)
ibm->acpi->type, dispatch_acpi_notify, ibm);
if (ACPI_FAILURE(status)) {
if (status == AE_ALREADY_EXISTS) {
printk(TPACPI_NOTICE "another device driver is already handling %s events\n",
ibm->name);
printk(TPACPI_NOTICE
"another device driver is already "
"handling %s events\n", ibm->name);
} else {
printk(TPACPI_ERR "acpi_install_notify_handler(%s) failed: %d\n",
printk(TPACPI_ERR
"acpi_install_notify_handler(%s) failed: %d\n",
ibm->name, status);
}
return -ENODEV;
@ -818,7 +822,8 @@ static DRIVER_ATTR(debug_level, S_IWUSR | S_IRUGO,
static ssize_t tpacpi_driver_version_show(struct device_driver *drv,
char *buf)
{
return snprintf(buf, PAGE_SIZE, "%s v%s\n", TPACPI_DESC, TPACPI_VERSION);
return snprintf(buf, PAGE_SIZE, "%s v%s\n",
TPACPI_DESC, TPACPI_VERSION);
}
static DRIVER_ATTR(version, S_IRUGO,
@ -1010,8 +1015,10 @@ static struct attribute_set *hotkey_dev_attributes;
#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
#define HOTKEY_CONFIG_CRITICAL_START \
do { \
mutex_lock(&hotkey_thread_data_mutex); \
hotkey_config_change++;
hotkey_config_change++; \
} while (0);
#define HOTKEY_CONFIG_CRITICAL_END \
mutex_unlock(&hotkey_thread_data_mutex);
#else
@ -1205,8 +1212,11 @@ static void hotkey_read_nvram(struct tp_nvram_state *n, u32 m)
}
#define TPACPI_COMPARE_KEY(__scancode, __member) \
do { if ((mask & (1 << __scancode)) && oldn->__member != newn->__member) \
tpacpi_hotkey_send_key(__scancode); } while (0)
do { \
if ((mask & (1 << __scancode)) && \
oldn->__member != newn->__member) \
tpacpi_hotkey_send_key(__scancode); \
} while (0)
#define TPACPI_MAY_SEND_KEY(__scancode) \
do { if (mask & (1 << __scancode)) \
@ -1352,10 +1362,12 @@ static void hotkey_poll_setup(int may_warn)
(tpacpi_inputdev->users > 0 || hotkey_report_mode < 2)) {
if (!tpacpi_hotkey_task) {
tpacpi_hotkey_task = kthread_run(hotkey_kthread,
NULL, TPACPI_FILE "d");
NULL,
TPACPI_FILE "d");
if (IS_ERR(tpacpi_hotkey_task)) {
tpacpi_hotkey_task = NULL;
printk(TPACPI_ERR "could not create kernel thread "
printk(TPACPI_ERR
"could not create kernel thread "
"for hotkey polling\n");
}
}
@ -1363,7 +1375,8 @@ static void hotkey_poll_setup(int may_warn)
hotkey_poll_stop_sync();
if (may_warn &&
hotkey_source_mask != 0 && hotkey_poll_freq == 0) {
printk(TPACPI_NOTICE "hot keys 0x%08x require polling, "
printk(TPACPI_NOTICE
"hot keys 0x%08x require polling, "
"which is currently disabled\n",
hotkey_source_mask);
}
@ -1829,7 +1842,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
"missing MHKA handler, "
"please report this to %s\n",
TPACPI_MAIL);
hotkey_all_mask = 0x080cU; /* FN+F12, FN+F4, FN+F3 */
/* FN+F12, FN+F4, FN+F3 */
hotkey_all_mask = 0x080cU;
}
}
@ -1882,7 +1896,8 @@ static int __init hotkey_init(struct ibm_init_struct *iibm)
hotkey_keycode_map = kmalloc(TPACPI_HOTKEY_MAP_SIZE,
GFP_KERNEL);
if (!hotkey_keycode_map) {
printk(TPACPI_ERR "failed to allocate memory for key map\n");
printk(TPACPI_ERR
"failed to allocate memory for key map\n");
return -ENOMEM;
}
@ -1953,11 +1968,14 @@ static void hotkey_exit(void)
#endif
if (tp_features.hotkey) {
dbg_printk(TPACPI_DBG_EXIT, "restoring original hot key mask\n");
dbg_printk(TPACPI_DBG_EXIT,
"restoring original hot key mask\n");
/* no short-circuit boolean operator below! */
if ((hotkey_mask_set(hotkey_orig_mask) |
hotkey_status_set(hotkey_orig_status)) != 0)
printk(TPACPI_ERR "failed to restore hot key mask to BIOS defaults\n");
printk(TPACPI_ERR
"failed to restore hot key mask "
"to BIOS defaults\n");
}
if (hotkey_dev_attributes) {
@ -1974,9 +1992,11 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
int ignore_acpi_ev;
if (event != 0x80) {
printk(TPACPI_ERR "unknown HKEY notification event %d\n", event);
printk(TPACPI_ERR
"unknown HKEY notification event %d\n", event);
/* forward it to userspace, maybe it knows how to handle it */
acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
acpi_bus_generate_netlink_event(
ibm->acpi->device->pnp.device_class,
ibm->acpi->device->dev.bus_id,
event, 0);
return;
@ -2009,8 +2029,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
}
} else {
printk(TPACPI_ERR
"hotkey 0x%04x out of range for keyboard map\n",
hkey);
"hotkey 0x%04x out of range "
"for keyboard map\n", hkey);
send_acpi_ev = 1;
}
break;
@ -2020,8 +2040,8 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
* eat up known LID events */
if (hkey != 0x5001 && hkey != 0x5002) {
printk(TPACPI_ERR
"unknown LID-related HKEY event: 0x%04x\n",
hkey);
"unknown LID-related HKEY event: "
"0x%04x\n", hkey);
send_acpi_ev = 1;
} else {
ignore_acpi_ev = 1;
@ -2036,21 +2056,27 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
/* fallthrough to default */
default:
/* case 2: dock-related */
/* 0x2305 - T43 waking up due to bay lever eject while aslept */
/* 0x2305 - T43 waking up due to bay lever
* eject while aslept */
/* case 3: ultra-bay related. maybe bay in dock? */
/* 0x3003 - T43 after wake up by bay lever eject (0x2305) */
printk(TPACPI_NOTICE "unhandled HKEY event 0x%04x\n", hkey);
/* 0x3003 - T43 after wake up by bay lever
* eject (0x2305) */
printk(TPACPI_NOTICE
"unhandled HKEY event 0x%04x\n", hkey);
send_acpi_ev = 1;
}
/* Legacy events */
if (!ignore_acpi_ev && (send_acpi_ev || hotkey_report_mode < 2)) {
acpi_bus_generate_proc_event(ibm->acpi->device, event, hkey);
if (!ignore_acpi_ev &&
(send_acpi_ev || hotkey_report_mode < 2)) {
acpi_bus_generate_proc_event(ibm->acpi->device,
event, hkey);
}
/* netlink events */
if (!ignore_acpi_ev && send_acpi_ev) {
acpi_bus_generate_netlink_event(ibm->acpi->device->pnp.device_class,
acpi_bus_generate_netlink_event(
ibm->acpi->device->pnp.device_class,
ibm->acpi->device->dev.bus_id,
event, hkey);
}
@ -2060,7 +2086,9 @@ static void hotkey_notify(struct ibm_struct *ibm, u32 event)
static void hotkey_resume(void)
{
if (hotkey_mask_get())
printk(TPACPI_ERR "error while trying to read hot key mask from firmware\n");
printk(TPACPI_ERR
"error while trying to read hot key mask "
"from firmware\n");
tpacpi_input_send_radiosw();
#ifdef CONFIG_THINKPAD_ACPI_HOTKEY_POLL
hotkey_poll_setup_safe(0);
@ -2663,7 +2691,8 @@ static int video_outputsw_set(int status)
res = acpi_evalf(vid_handle, NULL,
"ASWT", "vdd", status * 0x100, 0);
if (!autosw && video_autosw_set(autosw)) {
printk(TPACPI_ERR "video auto-switch left enabled due to error\n");
printk(TPACPI_ERR
"video auto-switch left enabled due to error\n");
return -EIO;
}
break;
@ -2732,7 +2761,8 @@ static int video_outputsw_cycle(void)
return -ENOSYS;
}
if (!autosw && video_autosw_set(autosw)) {
printk(TPACPI_ERR "video auto-switch left enabled due to error\n");
printk(TPACPI_ERR
"video auto-switch left enabled due to error\n");
return -EIO;
}
@ -3340,7 +3370,8 @@ enum { /* For TPACPI_LED_OLD */
static enum led_access_mode led_supported;
TPACPI_HANDLE(led, ec, "SLED", /* 570 */
"SYSL", /* 600e/x, 770e, 770x, A21e, A2xm/p, T20-22, X20-21 */
"SYSL", /* 600e/x, 770e, 770x, A21e, A2xm/p, */
/* T20-22, X20-21 */
"LED", /* all others */
); /* R30, R31 */
@ -3437,12 +3468,10 @@ static int led_write(char *buf)
led = 1 << led;
ret = ec_write(TPACPI_LED_EC_HLMS, led);
if (ret >= 0)
ret =
ec_write(TPACPI_LED_EC_HLBL,
ret = ec_write(TPACPI_LED_EC_HLBL,
led * led_exp_hlbl[ind]);
if (ret >= 0)
ret =
ec_write(TPACPI_LED_EC_HLCL,
ret = ec_write(TPACPI_LED_EC_HLCL,
led * led_exp_hlcl[ind]);
if (ret < 0)
return ret;
@ -3651,7 +3680,8 @@ static ssize_t thermal_temp_input_show(struct device *dev,
}
#define THERMAL_SENSOR_ATTR_TEMP(_idxA, _idxB) \
SENSOR_ATTR(temp##_idxA##_input, S_IRUGO, thermal_temp_input_show, NULL, _idxB)
SENSOR_ATTR(temp##_idxA##_input, S_IRUGO, \
thermal_temp_input_show, NULL, _idxB)
static struct sensor_device_attribute sensor_dev_attr_thermal_temp_input[] = {
THERMAL_SENSOR_ATTR_TEMP(1, 0),
@ -3747,7 +3777,8 @@ static int __init thermal_init(struct ibm_init_struct *iibm)
if (acpi_tmp7) {
printk(TPACPI_ERR
"ThinkPad ACPI EC access misbehaving, "
"falling back to ACPI TMPx access mode\n");
"falling back to ACPI TMPx access "
"mode\n");
thermal_read_mode = TPACPI_THERMAL_ACPI_TMP07;
} else {
printk(TPACPI_ERR
@ -4081,7 +4112,8 @@ static int __init brightness_check_levels(void)
/* Search for a BCLL package with 16 levels */
status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3,
brightness_find_bcll, NULL, &found_node);
brightness_find_bcll, NULL,
&found_node);
return (ACPI_SUCCESS(status) && found_node != NULL);
}
@ -4129,12 +4161,14 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
if (!brightness_enable) {
dbg_printk(TPACPI_DBG_INIT,
"brightness support disabled by module parameter\n");
"brightness support disabled by "
"module parameter\n");
return 1;
} else if (brightness_enable > 1) {
if (brightness_check_std_acpi_support()) {
printk(TPACPI_NOTICE
"standard ACPI backlight interface available, not loading native one...\n");
"standard ACPI backlight interface "
"available, not loading native one...\n");
return 1;
}
}
@ -4161,7 +4195,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm)
return 1;
if (tp_features.bright_16levels)
printk(TPACPI_INFO "detected a 16-level brightness capable ThinkPad\n");
printk(TPACPI_INFO
"detected a 16-level brightness capable ThinkPad\n");
ibm_backlight_device = backlight_device_register(
TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL,
@ -4195,7 +4230,8 @@ static int brightness_read(char *p)
int len = 0;
int level;
if ((level = brightness_get(NULL)) < 0) {
level = brightness_get(NULL);
if (level < 0) {
len += sprintf(p + len, "level:\t\tunreadable\n");
} else {
len += sprintf(p + len, "level:\t\t%d\n", level);
@ -4303,8 +4339,11 @@ static int volume_write(char *buf)
} else
return -EINVAL;
if (new_level != level) { /* mute doesn't change */
cmos_cmd = new_level > level ? TP_CMOS_VOLUME_UP : TP_CMOS_VOLUME_DOWN;
if (new_level != level) {
/* mute doesn't change */
cmos_cmd = (new_level > level) ?
TP_CMOS_VOLUME_UP : TP_CMOS_VOLUME_DOWN;
inc = new_level > level ? 1 : -1;
if (mute && (issue_thinkpad_cmos_command(cmos_cmd) ||
@ -4316,14 +4355,18 @@ static int volume_write(char *buf)
!acpi_ec_write(volume_offset, i + inc))
return -EIO;
if (mute && (issue_thinkpad_cmos_command(TP_CMOS_VOLUME_MUTE) ||
!acpi_ec_write(volume_offset,
new_level + mute)))
if (mute &&
(issue_thinkpad_cmos_command(TP_CMOS_VOLUME_MUTE) ||
!acpi_ec_write(volume_offset, new_level + mute))) {
return -EIO;
}
}
if (new_mute != mute) { /* level doesn't change */
cmos_cmd = new_mute ? TP_CMOS_VOLUME_MUTE : TP_CMOS_VOLUME_UP;
if (new_mute != mute) {
/* level doesn't change */
cmos_cmd = (new_mute) ?
TP_CMOS_VOLUME_MUTE : TP_CMOS_VOLUME_UP;
if (issue_thinkpad_cmos_command(cmos_cmd) ||
!acpi_ec_write(volume_offset, level + new_mute))
@ -4790,7 +4833,8 @@ static void fan_watchdog_reset(void)
if (!schedule_delayed_work(&fan_watchdog_task,
msecs_to_jiffies(fan_watchdog_maxinterval
* 1000))) {
printk(TPACPI_ERR "failed to schedule the fan watchdog, "
printk(TPACPI_ERR
"failed to schedule the fan watchdog, "
"watchdog will not trigger\n");
}
} else
@ -5076,9 +5120,9 @@ static int __init fan_init(struct ibm_init_struct *iibm)
case 0x3637: /* TP-76 */
case 0x3037: /* TP-70 */
printk(TPACPI_NOTICE
"fan_init: initial fan status is "
"unknown, assuming it is in auto "
"mode\n");
"fan_init: initial fan status "
"is unknown, assuming it is "
"in auto mode\n");
tp_features.fan_ctrl_status_undef = 1;
;;
}
@ -5151,11 +5195,13 @@ static int __init fan_init(struct ibm_init_struct *iibm)
static void fan_exit(void)
{
vdbg_printk(TPACPI_DBG_EXIT, "cancelling any pending fan watchdog tasks\n");
vdbg_printk(TPACPI_DBG_EXIT,
"cancelling any pending fan watchdog tasks\n");
/* FIXME: can we really do this unconditionally? */
sysfs_remove_group(&tpacpi_sensors_pdev->dev.kobj, &fan_attr_group);
driver_remove_file(&tpacpi_hwmon_pdriver.driver, &driver_attr_fan_watchdog);
driver_remove_file(&tpacpi_hwmon_pdriver.driver,
&driver_attr_fan_watchdog);
cancel_delayed_work(&fan_watchdog_task);
flush_scheduled_work();
@ -5171,7 +5217,8 @@ static int fan_read(char *p)
switch (fan_status_access_mode) {
case TPACPI_FAN_RD_ACPI_GFAN:
/* 570, 600e/x, 770e, 770x */
if ((rc = fan_get_status_safe(&status)) < 0)
rc = fan_get_status_safe(&status);
if (rc < 0)
return rc;
len += sprintf(p + len, "status:\t\t%s\n"
@ -5181,7 +5228,8 @@ static int fan_read(char *p)
case TPACPI_FAN_RD_TPEC:
/* all except 570, 600e/x, 770e, 770x */
if ((rc = fan_get_status_safe(&status)) < 0)
rc = fan_get_status_safe(&status);
if (rc < 0)
return rc;
if (unlikely(tp_features.fan_ctrl_status_undef)) {
@ -5196,7 +5244,8 @@ static int fan_read(char *p)
len += sprintf(p + len, "status:\t\t%s\n",
(status != 0) ? "enabled" : "disabled");
if ((rc = fan_get_speed(&speed)) < 0)
rc = fan_get_speed(&speed);
if (rc < 0)
return rc;
len += sprintf(p + len, "speed:\t\t%d\n", speed);
@ -5232,8 +5281,8 @@ static int fan_read(char *p)
if (fan_control_commands & TPACPI_FAN_CMD_ENABLE)
len += sprintf(p + len, "commands:\tenable, disable\n"
"commands:\twatchdog <timeout> (<timeout> is 0 (off), "
"1-120 (seconds))\n");
"commands:\twatchdog <timeout> (<timeout> "
"is 0 (off), 1-120 (seconds))\n");
if (fan_control_commands & TPACPI_FAN_CMD_SPEED)
len += sprintf(p + len, "commands:\tspeed <speed>"
@ -5254,7 +5303,8 @@ static int fan_write_cmd_level(const char *cmd, int *rc)
else if (sscanf(cmd, "level %d", &level) != 1)
return 0;
if ((*rc = fan_set_level_safe(level)) == -ENXIO)
*rc = fan_set_level_safe(level);
if (*rc == -ENXIO)
printk(TPACPI_ERR "level command accepted for unsupported "
"access mode %d", fan_control_access_mode);
@ -5266,7 +5316,8 @@ static int fan_write_cmd_enable(const char *cmd, int *rc)
if (strlencmp(cmd, "enable") != 0)
return 0;
if ((*rc = fan_set_enable()) == -ENXIO)
*rc = fan_set_enable();
if (*rc == -ENXIO)
printk(TPACPI_ERR "enable command accepted for unsupported "
"access mode %d", fan_control_access_mode);
@ -5278,7 +5329,8 @@ static int fan_write_cmd_disable(const char *cmd, int *rc)
if (strlencmp(cmd, "disable") != 0)
return 0;
if ((*rc = fan_set_disable()) == -ENXIO)
*rc = fan_set_disable();
if (*rc == -ENXIO)
printk(TPACPI_ERR "disable command accepted for unsupported "
"access mode %d", fan_control_access_mode);
@ -5295,7 +5347,8 @@ static int fan_write_cmd_speed(const char *cmd, int *rc)
if (sscanf(cmd, "speed %d", &speed) != 1)
return 0;
if ((*rc = fan_set_speed(speed)) == -ENXIO)
*rc = fan_set_speed(speed);
if (*rc == -ENXIO)
printk(TPACPI_ERR "speed command accepted for unsupported "
"access mode %d", fan_control_access_mode);
@ -5832,7 +5885,8 @@ static int __init thinkpad_acpi_module_init(void)
proc_dir = proc_mkdir(TPACPI_PROC_DIR, acpi_root_dir);
if (!proc_dir) {
printk(TPACPI_ERR "unable to create proc dir " TPACPI_PROC_DIR);
printk(TPACPI_ERR
"unable to create proc dir " TPACPI_PROC_DIR);
thinkpad_acpi_module_exit();
return -ENODEV;
}
@ -5840,7 +5894,8 @@ static int __init thinkpad_acpi_module_init(void)
ret = platform_driver_register(&tpacpi_pdriver);
if (ret) {
printk(TPACPI_ERR "unable to register main platform driver\n");
printk(TPACPI_ERR
"unable to register main platform driver\n");
thinkpad_acpi_module_exit();
return ret;
}
@ -5848,7 +5903,8 @@ static int __init thinkpad_acpi_module_init(void)
ret = platform_driver_register(&tpacpi_hwmon_pdriver);
if (ret) {
printk(TPACPI_ERR "unable to register hwmon platform driver\n");
printk(TPACPI_ERR
"unable to register hwmon platform driver\n");
thinkpad_acpi_module_exit();
return ret;
}
@ -5857,10 +5913,12 @@ static int __init thinkpad_acpi_module_init(void)
ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
if (!ret) {
tp_features.platform_drv_attrs_registered = 1;
ret = tpacpi_create_driver_attributes(&tpacpi_hwmon_pdriver.driver);
ret = tpacpi_create_driver_attributes(
&tpacpi_hwmon_pdriver.driver);
}
if (ret) {
printk(TPACPI_ERR "unable to create sysfs driver attributes\n");
printk(TPACPI_ERR
"unable to create sysfs driver attributes\n");
thinkpad_acpi_module_exit();
return ret;
}
@ -5883,7 +5941,8 @@ static int __init thinkpad_acpi_module_init(void)
if (IS_ERR(tpacpi_sensors_pdev)) {
ret = PTR_ERR(tpacpi_sensors_pdev);
tpacpi_sensors_pdev = NULL;
printk(TPACPI_ERR "unable to register hwmon platform device\n");
printk(TPACPI_ERR
"unable to register hwmon platform device\n");
thinkpad_acpi_module_exit();
return ret;
}