提交 b1066410 编写于 作者: M Michał Kępień 提交者: Darren Hart (VMware)

platform/x86: fujitsu-laptop: clean up local variables in call_fext_func()

Set values of FUNC call parameters in a designated initializer.  Do not
initialize status and handle variables as the values these are
initialized to have no influence on execution flow.  Use an array
variable instead of the address of the first element of that array.
Signed-off-by: NMichał Kępień <kernel@kempniu.pl>
Reviewed-by: NJonathan Woithe <jwoithe@just42.net>
Signed-off-by: NDarren Hart (VMware) <dvhart@infradead.org>
上级 1cf034cc
...@@ -219,16 +219,16 @@ static u32 dbg_level = 0x03; ...@@ -219,16 +219,16 @@ static u32 dbg_level = 0x03;
static int call_fext_func(int cmd, int arg0, int arg1, int arg2) static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
{ {
acpi_status status = AE_OK;
union acpi_object params[4] = { union acpi_object params[4] = {
{ .type = ACPI_TYPE_INTEGER }, { .integer.type = ACPI_TYPE_INTEGER, .integer.value = cmd },
{ .type = ACPI_TYPE_INTEGER }, { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg0 },
{ .type = ACPI_TYPE_INTEGER }, { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg1 },
{ .type = ACPI_TYPE_INTEGER } { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg2 }
}; };
struct acpi_object_list arg_list = { 4, &params[0] }; struct acpi_object_list arg_list = { 4, params };
unsigned long long value; unsigned long long value;
acpi_handle handle = NULL; acpi_status status;
acpi_handle handle;
status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle); status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
...@@ -237,11 +237,6 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2) ...@@ -237,11 +237,6 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2)
return -ENODEV; return -ENODEV;
} }
params[0].integer.value = cmd;
params[1].integer.value = arg0;
params[2].integer.value = arg1;
params[3].integer.value = arg2;
status = acpi_evaluate_integer(handle, NULL, &arg_list, &value); status = acpi_evaluate_integer(handle, NULL, &arg_list, &value);
if (ACPI_FAILURE(status)) { if (ACPI_FAILURE(status)) {
vdbg_printk(FUJLAPTOP_DBG_WARN, vdbg_printk(FUJLAPTOP_DBG_WARN,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册