aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/platform/x86/toshiba_acpi.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
index 9d60a40d8b3f..bbcb7c2ef62a 100644
--- a/drivers/platform/x86/toshiba_acpi.c
+++ b/drivers/platform/x86/toshiba_acpi.c
@@ -321,10 +321,9 @@ static int write_acpi_int(const char *methodName, int val)
321static acpi_status tci_raw(struct toshiba_acpi_dev *dev, 321static acpi_status tci_raw(struct toshiba_acpi_dev *dev,
322 const u32 in[TCI_WORDS], u32 out[TCI_WORDS]) 322 const u32 in[TCI_WORDS], u32 out[TCI_WORDS])
323{ 323{
324 union acpi_object in_objs[TCI_WORDS], out_objs[TCI_WORDS + 1];
324 struct acpi_object_list params; 325 struct acpi_object_list params;
325 union acpi_object in_objs[TCI_WORDS];
326 struct acpi_buffer results; 326 struct acpi_buffer results;
327 union acpi_object out_objs[TCI_WORDS + 1];
328 acpi_status status; 327 acpi_status status;
329 int i; 328 int i;
330 329
@@ -387,9 +386,8 @@ static int sci_open(struct toshiba_acpi_dev *dev)
387{ 386{
388 u32 in[TCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 }; 387 u32 in[TCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 };
389 u32 out[TCI_WORDS]; 388 u32 out[TCI_WORDS];
390 acpi_status status; 389 acpi_status status = tci_raw(dev, in, out);
391 390
392 status = tci_raw(dev, in, out);
393 if (ACPI_FAILURE(status)) { 391 if (ACPI_FAILURE(status)) {
394 pr_err("ACPI call to open SCI failed\n"); 392 pr_err("ACPI call to open SCI failed\n");
395 return 0; 393 return 0;
@@ -425,9 +423,8 @@ static void sci_close(struct toshiba_acpi_dev *dev)
425{ 423{
426 u32 in[TCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 }; 424 u32 in[TCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 };
427 u32 out[TCI_WORDS]; 425 u32 out[TCI_WORDS];
428 acpi_status status; 426 acpi_status status = tci_raw(dev, in, out);
429 427
430 status = tci_raw(dev, in, out);
431 if (ACPI_FAILURE(status)) { 428 if (ACPI_FAILURE(status)) {
432 pr_err("ACPI call to close SCI failed\n"); 429 pr_err("ACPI call to close SCI failed\n");
433 return; 430 return;
@@ -509,7 +506,8 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev)
509{ 506{
510 struct toshiba_acpi_dev *dev = container_of(cdev, 507 struct toshiba_acpi_dev *dev = container_of(cdev,
511 struct toshiba_acpi_dev, led_dev); 508 struct toshiba_acpi_dev, led_dev);
512 u32 state, result; 509 u32 result;
510 u32 state;
513 511
514 /* First request : initialize communication. */ 512 /* First request : initialize communication. */
515 if (!sci_open(dev)) 513 if (!sci_open(dev))
@@ -672,9 +670,9 @@ static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state)
672/* Eco Mode support */ 670/* Eco Mode support */
673static void toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) 671static void toshiba_eco_mode_available(struct toshiba_acpi_dev *dev)
674{ 672{
675 acpi_status status;
676 u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 0, 0, 0 }; 673 u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 0, 0, 0 };
677 u32 out[TCI_WORDS]; 674 u32 out[TCI_WORDS];
675 acpi_status status;
678 676
679 dev->eco_supported = 0; 677 dev->eco_supported = 0;
680 dev->eco_led_registered = false; 678 dev->eco_led_registered = false;
@@ -1282,9 +1280,9 @@ static struct proc_dir_entry *toshiba_proc_dir;
1282/* LCD Brightness */ 1280/* LCD Brightness */
1283static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) 1281static int __get_lcd_brightness(struct toshiba_acpi_dev *dev)
1284{ 1282{
1283 int brightness = 0;
1285 u32 result; 1284 u32 result;
1286 u32 value; 1285 u32 value;
1287 int brightness = 0;
1288 1286
1289 if (dev->tr_backlight_supported) { 1287 if (dev->tr_backlight_supported) {
1290 int ret = get_tr_backlight_status(dev, &value); 1288 int ret = get_tr_backlight_status(dev, &value);
@@ -1377,7 +1375,7 @@ static ssize_t lcd_proc_write(struct file *file, const char __user *buf,
1377 struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); 1375 struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file));
1378 char cmd[42]; 1376 char cmd[42];
1379 size_t len; 1377 size_t len;
1380 int levels = dev->backlight_dev->props.max_brightness + 1; 1378 int levels;
1381 int value; 1379 int value;
1382 1380
1383 len = min(count, sizeof(cmd) - 1); 1381 len = min(count, sizeof(cmd) - 1);
@@ -1385,6 +1383,7 @@ static ssize_t lcd_proc_write(struct file *file, const char __user *buf,
1385 return -EFAULT; 1383 return -EFAULT;
1386 cmd[len] = '\0'; 1384 cmd[len] = '\0';
1387 1385
1386 levels = dev->backlight_dev->props.max_brightness + 1;
1388 if (sscanf(cmd, " brightness : %i", &value) != 1 && 1387 if (sscanf(cmd, " brightness : %i", &value) != 1 &&
1389 value < 0 && value > levels) 1388 value < 0 && value > levels)
1390 return -EINVAL; 1389 return -EINVAL;
@@ -1447,10 +1446,8 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
1447 struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); 1446 struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file));
1448 char *buffer; 1447 char *buffer;
1449 char *cmd; 1448 char *cmd;
1449 int lcd_out, crt_out, tv_out;
1450 int remain = count; 1450 int remain = count;
1451 int lcd_out = -1;
1452 int crt_out = -1;
1453 int tv_out = -1;
1454 int value; 1451 int value;
1455 int ret; 1452 int ret;
1456 u32 video_out; 1453 u32 video_out;
@@ -1486,6 +1483,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf,
1486 1483
1487 kfree(cmd); 1484 kfree(cmd);
1488 1485
1486 lcd_out = crt_out = tv_out = -1;
1489 ret = get_video_status(dev, &video_out); 1487 ret = get_video_status(dev, &video_out);
1490 if (!ret) { 1488 if (!ret) {
1491 unsigned int new_video_out = video_out; 1489 unsigned int new_video_out = video_out;
@@ -1980,8 +1978,8 @@ static ssize_t usb_sleep_charge_store(struct device *dev,
1980 const char *buf, size_t count) 1978 const char *buf, size_t count)
1981{ 1979{
1982 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); 1980 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
1983 u32 mode;
1984 int state; 1981 int state;
1982 u32 mode;
1985 int ret; 1983 int ret;
1986 1984
1987 ret = kstrtoint(buf, 0, &state); 1985 ret = kstrtoint(buf, 0, &state);
@@ -2021,9 +2019,8 @@ static ssize_t sleep_functions_on_battery_show(struct device *dev,
2021 char *buf) 2019 char *buf)
2022{ 2020{
2023 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); 2021 struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev);
2022 int bat_lvl, status;
2024 u32 state; 2023 u32 state;
2025 int bat_lvl;
2026 int status;
2027 int ret; 2024 int ret;
2028 int tmp; 2025 int tmp;
2029 2026