From patchwork Wed Apr 5 06:50:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBLxJlwaWXFhA==?= X-Patchwork-Id: 9663057 X-Patchwork-Delegate: dvhart@infradead.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCA4060353 for ; Wed, 5 Apr 2017 06:50:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CDEF6284FE for ; Wed, 5 Apr 2017 06:50:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C262628509; Wed, 5 Apr 2017 06:50:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81541284FE for ; Wed, 5 Apr 2017 06:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752783AbdDEGuo (ORCPT ); Wed, 5 Apr 2017 02:50:44 -0400 Received: from mail-lf0-f68.google.com ([209.85.215.68]:34075 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754695AbdDEGum (ORCPT ); Wed, 5 Apr 2017 02:50:42 -0400 Received: by mail-lf0-f68.google.com with SMTP id x137so358834lff.1 for ; Tue, 04 Apr 2017 23:50:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kempniu.pl; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=GRuzBLhrCVbyifU5Vx3bBjlPv3SmxRbDZeiTyNd+57Q=; b=KMSD/XOLHNsLwEWU0LqQvIBUjaqPO+akdWxuItyHx92E9jOLJHOOfz4/4DRpfwHzgj ++VwXCiUTCM3CB2tzmI2u6dRdsS3IOqn0gSCGO59rCjHtqAyiFHfP6G1xAfA3OmGiZOA ZmRUTkvgklM1za5prr6y7Mm+8yt5UhyqUtl+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GRuzBLhrCVbyifU5Vx3bBjlPv3SmxRbDZeiTyNd+57Q=; b=cZGv/hyhEPOOIiQY3nqHYTfF0t6qgrjRRoI6jVKg2ySO0GWq0KmaJ1uSU7gYEheyPP ffi8bAJJM+94hY8ohMCdVxoR6NGXmX+biwiYFv8xh44Xm4EwRXgEOhUBkjL20JAs1/XK AhgDULCoEZIZxZyexBgra2atggyFOUivyXwm47vukOdhtKEZOaoO0FXfw516CDt5weKs PnijAAXUihQwbFsOx4yDzZh64W5aRFoN6gkSTKFpM6c0AKxl1SaJaEjVYw9smhUzDc2T whGAX4FcY2w8V7e3/L24ElVcm2o3nbBw5VunKHfOAge1q+EH1YPDGnHHXTCK16q1x0GX /CcQ== X-Gm-Message-State: AFeK/H13TX/zbQ9WbQ+IQSC8yKpNJ4q3eLwHrUyfLjYi1pQfFaHF0bNxWgEBw8H+8SK+bg== X-Received: by 10.25.215.23 with SMTP id o23mr8533924lfg.135.1491375027125; Tue, 04 Apr 2017 23:50:27 -0700 (PDT) Received: from ozzy.nask.waw.pl ([2001:a10:160:3::3]) by smtp.googlemail.com with ESMTPSA id y15sm3529067ljd.41.2017.04.04.23.50.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Apr 2017 23:50:26 -0700 (PDT) From: =?UTF-8?q?Micha=C5=82=20K=C4=99pie=C5=84?= To: Jonathan Woithe , Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] platform/x86: fujitsu-laptop: clean up local variables in call_fext_func() Date: Wed, 5 Apr 2017 08:50:21 +0200 Message-Id: <20170405065023.3267-2-kernel@kempniu.pl> X-Mailer: git-send-email 2.12.2 In-Reply-To: <20170405065023.3267-1-kernel@kempniu.pl> References: <20170405065023.3267-1-kernel@kempniu.pl> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index f66da4b0c31a..ca1491ff659e 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -219,16 +219,16 @@ static u32 dbg_level = 0x03; static int call_fext_func(int cmd, int arg0, int arg1, int arg2) { - acpi_status status = AE_OK; union acpi_object params[4] = { - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER }, - { .type = ACPI_TYPE_INTEGER } + { .integer.type = ACPI_TYPE_INTEGER, .integer.value = cmd }, + { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg0 }, + { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg1 }, + { .integer.type = ACPI_TYPE_INTEGER, .integer.value = arg2 } }; - struct acpi_object_list arg_list = { 4, ¶ms[0] }; + struct acpi_object_list arg_list = { 4, params }; unsigned long long value; - acpi_handle handle = NULL; + acpi_status status; + acpi_handle handle; status = acpi_get_handle(fujitsu_laptop->acpi_handle, "FUNC", &handle); if (ACPI_FAILURE(status)) { @@ -237,11 +237,6 @@ static int call_fext_func(int cmd, int arg0, int arg1, int arg2) 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); if (ACPI_FAILURE(status)) { vdbg_printk(FUJLAPTOP_DBG_WARN,