aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichał Kępień <kernel@kempniu.pl>2016-01-22 09:27:18 -0500
committerDarren Hart <dvhart@linux.intel.com>2016-03-23 13:05:40 -0400
commit17070f242aa989c33b227e61ea060f768a77f2dc (patch)
treec6bd59363b8e946a0989cad36652ba4e798c54a7
parent2f262136159fedceb45b42336ae53f20bc0ff714 (diff)
dell-smbios: don't pass an SMBIOS buffer to dell_smbios_send_request()
Passing an SMBIOS buffer pointer to dell_smbios_send_request() is redundant as it should always operate on the SMBIOS buffer exported from the module. Signed-off-by: Michał Kępień <kernel@kempniu.pl> Reviewed-by: Pali Rohár <pali.rohar@gmail.com> Signed-off-by: Darren Hart <dvhart@linux.intel.com>
-rw-r--r--drivers/platform/x86/dell-laptop.c42
-rw-r--r--drivers/platform/x86/dell-smbios.c3
-rw-r--r--drivers/platform/x86/dell-smbios.h3
3 files changed, 23 insertions, 25 deletions
diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c
index 9210acf00d47..0bb22114abce 100644
--- a/drivers/platform/x86/dell-laptop.c
+++ b/drivers/platform/x86/dell-laptop.c
@@ -418,7 +418,7 @@ static int dell_rfkill_set(void *data, bool blocked)
418 418
419 dell_smbios_get_buffer(); 419 dell_smbios_get_buffer();
420 420
421 dell_smbios_send_request(buffer, 17, 11); 421 dell_smbios_send_request(17, 11);
422 ret = buffer->output[0]; 422 ret = buffer->output[0];
423 status = buffer->output[1]; 423 status = buffer->output[1];
424 424
@@ -428,7 +428,7 @@ static int dell_rfkill_set(void *data, bool blocked)
428 dell_smbios_clear_buffer(); 428 dell_smbios_clear_buffer();
429 429
430 buffer->input[0] = 0x2; 430 buffer->input[0] = 0x2;
431 dell_smbios_send_request(buffer, 17, 11); 431 dell_smbios_send_request(17, 11);
432 ret = buffer->output[0]; 432 ret = buffer->output[0];
433 hwswitch = buffer->output[1]; 433 hwswitch = buffer->output[1];
434 434
@@ -441,7 +441,7 @@ static int dell_rfkill_set(void *data, bool blocked)
441 dell_smbios_clear_buffer(); 441 dell_smbios_clear_buffer();
442 442
443 buffer->input[0] = (1 | (radio<<8) | (disable << 16)); 443 buffer->input[0] = (1 | (radio<<8) | (disable << 16));
444 dell_smbios_send_request(buffer, 17, 11); 444 dell_smbios_send_request(17, 11);
445 ret = buffer->output[0]; 445 ret = buffer->output[0];
446 446
447 out: 447 out:
@@ -458,7 +458,7 @@ static void dell_rfkill_update_sw_state(struct rfkill *rfkill, int radio,
458 int block = rfkill_blocked(rfkill); 458 int block = rfkill_blocked(rfkill);
459 dell_smbios_clear_buffer(); 459 dell_smbios_clear_buffer();
460 buffer->input[0] = (1 | (radio << 8) | (block << 16)); 460 buffer->input[0] = (1 | (radio << 8) | (block << 16));
461 dell_smbios_send_request(buffer, 17, 11); 461 dell_smbios_send_request(17, 11);
462 } else { 462 } else {
463 /* No hw-switch, sync BIOS state to sw_state */ 463 /* No hw-switch, sync BIOS state to sw_state */
464 rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16))); 464 rfkill_set_sw_state(rfkill, !!(status & BIT(radio + 16)));
@@ -481,7 +481,7 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
481 481
482 dell_smbios_get_buffer(); 482 dell_smbios_get_buffer();
483 483
484 dell_smbios_send_request(buffer, 17, 11); 484 dell_smbios_send_request(17, 11);
485 ret = buffer->output[0]; 485 ret = buffer->output[0];
486 status = buffer->output[1]; 486 status = buffer->output[1];
487 487
@@ -493,7 +493,7 @@ static void dell_rfkill_query(struct rfkill *rfkill, void *data)
493 dell_smbios_clear_buffer(); 493 dell_smbios_clear_buffer();
494 494
495 buffer->input[0] = 0x2; 495 buffer->input[0] = 0x2;
496 dell_smbios_send_request(buffer, 17, 11); 496 dell_smbios_send_request(17, 11);
497 ret = buffer->output[0]; 497 ret = buffer->output[0];
498 hwswitch = buffer->output[1]; 498 hwswitch = buffer->output[1];
499 499
@@ -521,14 +521,14 @@ static int dell_debugfs_show(struct seq_file *s, void *data)
521 521
522 dell_smbios_get_buffer(); 522 dell_smbios_get_buffer();
523 523
524 dell_smbios_send_request(buffer, 17, 11); 524 dell_smbios_send_request(17, 11);
525 ret = buffer->output[0]; 525 ret = buffer->output[0];
526 status = buffer->output[1]; 526 status = buffer->output[1];
527 527
528 dell_smbios_clear_buffer(); 528 dell_smbios_clear_buffer();
529 529
530 buffer->input[0] = 0x2; 530 buffer->input[0] = 0x2;
531 dell_smbios_send_request(buffer, 17, 11); 531 dell_smbios_send_request(17, 11);
532 hwswitch_ret = buffer->output[0]; 532 hwswitch_ret = buffer->output[0];
533 hwswitch_state = buffer->output[1]; 533 hwswitch_state = buffer->output[1];
534 534
@@ -619,7 +619,7 @@ static void dell_update_rfkill(struct work_struct *ignored)
619 619
620 dell_smbios_get_buffer(); 620 dell_smbios_get_buffer();
621 621
622 dell_smbios_send_request(buffer, 17, 11); 622 dell_smbios_send_request(17, 11);
623 ret = buffer->output[0]; 623 ret = buffer->output[0];
624 status = buffer->output[1]; 624 status = buffer->output[1];
625 625
@@ -629,7 +629,7 @@ static void dell_update_rfkill(struct work_struct *ignored)
629 dell_smbios_clear_buffer(); 629 dell_smbios_clear_buffer();
630 630
631 buffer->input[0] = 0x2; 631 buffer->input[0] = 0x2;
632 dell_smbios_send_request(buffer, 17, 11); 632 dell_smbios_send_request(17, 11);
633 ret = buffer->output[0]; 633 ret = buffer->output[0];
634 634
635 if (ret == 0 && (status & BIT(0))) 635 if (ret == 0 && (status & BIT(0)))
@@ -710,7 +710,7 @@ static int __init dell_setup_rfkill(void)
710 return 0; 710 return 0;
711 711
712 dell_smbios_get_buffer(); 712 dell_smbios_get_buffer();
713 dell_smbios_send_request(buffer, 17, 11); 713 dell_smbios_send_request(17, 11);
714 ret = buffer->output[0]; 714 ret = buffer->output[0];
715 status = buffer->output[1]; 715 status = buffer->output[1];
716 dell_smbios_release_buffer(); 716 dell_smbios_release_buffer();
@@ -878,9 +878,9 @@ static int dell_send_intensity(struct backlight_device *bd)
878 buffer->input[1] = bd->props.brightness; 878 buffer->input[1] = bd->props.brightness;
879 879
880 if (power_supply_is_system_supplied() > 0) 880 if (power_supply_is_system_supplied() > 0)
881 dell_smbios_send_request(buffer, 1, 2); 881 dell_smbios_send_request(1, 2);
882 else 882 else
883 dell_smbios_send_request(buffer, 1, 1); 883 dell_smbios_send_request(1, 1);
884 884
885 ret = dell_smi_error(buffer->output[0]); 885 ret = dell_smi_error(buffer->output[0]);
886 886
@@ -901,9 +901,9 @@ static int dell_get_intensity(struct backlight_device *bd)
901 buffer->input[0] = token; 901 buffer->input[0] = token;
902 902
903 if (power_supply_is_system_supplied() > 0) 903 if (power_supply_is_system_supplied() > 0)
904 dell_smbios_send_request(buffer, 0, 2); 904 dell_smbios_send_request(0, 2);
905 else 905 else
906 dell_smbios_send_request(buffer, 0, 1); 906 dell_smbios_send_request(0, 1);
907 907
908 if (buffer->output[0]) 908 if (buffer->output[0])
909 ret = dell_smi_error(buffer->output[0]); 909 ret = dell_smi_error(buffer->output[0]);
@@ -1160,7 +1160,7 @@ static int kbd_get_info(struct kbd_info *info)
1160 dell_smbios_get_buffer(); 1160 dell_smbios_get_buffer();
1161 1161
1162 buffer->input[0] = 0x0; 1162 buffer->input[0] = 0x0;
1163 dell_smbios_send_request(buffer, 4, 11); 1163 dell_smbios_send_request(4, 11);
1164 ret = buffer->output[0]; 1164 ret = buffer->output[0];
1165 1165
1166 if (ret) { 1166 if (ret) {
@@ -1248,7 +1248,7 @@ static int kbd_get_state(struct kbd_state *state)
1248 dell_smbios_get_buffer(); 1248 dell_smbios_get_buffer();
1249 1249
1250 buffer->input[0] = 0x1; 1250 buffer->input[0] = 0x1;
1251 dell_smbios_send_request(buffer, 4, 11); 1251 dell_smbios_send_request(4, 11);
1252 ret = buffer->output[0]; 1252 ret = buffer->output[0];
1253 1253
1254 if (ret) { 1254 if (ret) {
@@ -1284,7 +1284,7 @@ static int kbd_set_state(struct kbd_state *state)
1284 buffer->input[1] |= (state->timeout_unit & 0x3) << 30; 1284 buffer->input[1] |= (state->timeout_unit & 0x3) << 30;
1285 buffer->input[2] = state->als_setting & 0xFF; 1285 buffer->input[2] = state->als_setting & 0xFF;
1286 buffer->input[2] |= (state->level & 0xFF) << 16; 1286 buffer->input[2] |= (state->level & 0xFF) << 16;
1287 dell_smbios_send_request(buffer, 4, 11); 1287 dell_smbios_send_request(4, 11);
1288 ret = buffer->output[0]; 1288 ret = buffer->output[0];
1289 dell_smbios_release_buffer(); 1289 dell_smbios_release_buffer();
1290 1290
@@ -1326,7 +1326,7 @@ static int kbd_set_token_bit(u8 bit)
1326 dell_smbios_get_buffer(); 1326 dell_smbios_get_buffer();
1327 buffer->input[0] = da_tokens[id].location; 1327 buffer->input[0] = da_tokens[id].location;
1328 buffer->input[1] = da_tokens[id].value; 1328 buffer->input[1] = da_tokens[id].value;
1329 dell_smbios_send_request(buffer, 1, 0); 1329 dell_smbios_send_request(1, 0);
1330 ret = buffer->output[0]; 1330 ret = buffer->output[0];
1331 dell_smbios_release_buffer(); 1331 dell_smbios_release_buffer();
1332 1332
@@ -1348,7 +1348,7 @@ static int kbd_get_token_bit(u8 bit)
1348 1348
1349 dell_smbios_get_buffer(); 1349 dell_smbios_get_buffer();
1350 buffer->input[0] = da_tokens[id].location; 1350 buffer->input[0] = da_tokens[id].location;
1351 dell_smbios_send_request(buffer, 0, 0); 1351 dell_smbios_send_request(0, 0);
1352 ret = buffer->output[0]; 1352 ret = buffer->output[0];
1353 val = buffer->output[1]; 1353 val = buffer->output[1];
1354 dell_smbios_release_buffer(); 1354 dell_smbios_release_buffer();
@@ -2019,7 +2019,7 @@ static int __init dell_init(void)
2019 if (token != -1) { 2019 if (token != -1) {
2020 dell_smbios_get_buffer(); 2020 dell_smbios_get_buffer();
2021 buffer->input[0] = token; 2021 buffer->input[0] = token;
2022 dell_smbios_send_request(buffer, 0, 2); 2022 dell_smbios_send_request(0, 2);
2023 if (buffer->output[0] == 0) 2023 if (buffer->output[0] == 0)
2024 max_intensity = buffer->output[3]; 2024 max_intensity = buffer->output[3];
2025 dell_smbios_release_buffer(); 2025 dell_smbios_release_buffer();
diff --git a/drivers/platform/x86/dell-smbios.c b/drivers/platform/x86/dell-smbios.c
index b1038325a3fc..ac1cbed12710 100644
--- a/drivers/platform/x86/dell-smbios.c
+++ b/drivers/platform/x86/dell-smbios.c
@@ -61,8 +61,7 @@ void dell_smbios_release_buffer(void)
61EXPORT_SYMBOL_GPL(dell_smbios_release_buffer); 61EXPORT_SYMBOL_GPL(dell_smbios_release_buffer);
62 62
63struct calling_interface_buffer * 63struct calling_interface_buffer *
64dell_smbios_send_request(struct calling_interface_buffer *buffer, 64dell_smbios_send_request(int class, int select)
65 int class, int select)
66{ 65{
67 struct smi_cmd command; 66 struct smi_cmd command;
68 67
diff --git a/drivers/platform/x86/dell-smbios.h b/drivers/platform/x86/dell-smbios.h
index 33ed9712430b..4220ac1fe703 100644
--- a/drivers/platform/x86/dell-smbios.h
+++ b/drivers/platform/x86/dell-smbios.h
@@ -42,8 +42,7 @@ void dell_smbios_get_buffer(void);
42void dell_smbios_clear_buffer(void); 42void dell_smbios_clear_buffer(void);
43void dell_smbios_release_buffer(void); 43void dell_smbios_release_buffer(void);
44struct calling_interface_buffer * 44struct calling_interface_buffer *
45dell_smbios_send_request(struct calling_interface_buffer *buffer, 45dell_smbios_send_request(int class, int select);
46 int class, int select);
47 46
48int find_token_id(int tokenid); 47int find_token_id(int tokenid);
49int find_token_location(int tokenid); 48int find_token_location(int tokenid);