From patchwork Mon Aug 29 15:37:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Azael Avalos X-Patchwork-Id: 9304105 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 90C8B60756 for ; Mon, 29 Aug 2016 15:38:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8174C27BA5 for ; Mon, 29 Aug 2016 15:38:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 750ED2862C; Mon, 29 Aug 2016 15:38:43 +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.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 012BD27BA5 for ; Mon, 29 Aug 2016 15:38:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933326AbcH2PiW (ORCPT ); Mon, 29 Aug 2016 11:38:22 -0400 Received: from mail-oi0-f68.google.com ([209.85.218.68]:33629 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933578AbcH2Phm (ORCPT ); Mon, 29 Aug 2016 11:37:42 -0400 Received: by mail-oi0-f68.google.com with SMTP id s207so12576457oie.0; Mon, 29 Aug 2016 08:37:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YmdOiMGtbyObCS1Mon6qSXhE5WRc5SEZcLfgOWqj3QQ=; b=i3wq4w0eyJixANJj5t3gPLVpkNwA0tefkOfxZBvajsE8vrV8kJhC+nsR5H5YWCElH7 +kPUHEkggpib04Wv0up72BcUwwZoAc9LuJip0hrfdH6sl7hAgc49tczRKiCbLgF3PHxS 0GVuJZToKrlGFXS7eON4Pt+LTdpshN44NewEtLct4eWWIwNvQgLScSZVvUq7qXFqUZSC yREISi4yIUg0WM+KZqDtxMVfMYlH6mS7Qni3sdQLrV+dIOXIO7HK0UaWFB4KFKPswNkv cRrTDmTcx43Y+67X8aqBhHNjQz0xmqVC13/SvwN6hWrsdHADUlqB829y8q+EGtkcS9HS 7Pnw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YmdOiMGtbyObCS1Mon6qSXhE5WRc5SEZcLfgOWqj3QQ=; b=nJ6B5pB0ctybquOxIXslq8Q6+Xh7zYKIHd3lLj++iae4wVDO+bOIDT4zSHwf98vI2j iYRaJClcq8WMECkkotKh3MTELFhL8NEJ5HiQYkvlL8KfTNAbwpInFQvEiA7jukjbBckR DuagPDd6S3CPFl05p4Km0jH7h4HJu6nmUDUVltyw9xUha4T8cX7CKrEAtAxQ8EV8yDpi 0+TriXA0K/YLIHKNaEYV/Ne9LEsA7/wNFgtBf+mCDYpY29BXxz02up+6Wo2np4U/IBux B07moIsAghrm8AVGv1ScXu7kDvZv6zgS6ZOKAdCqkOIvvsHKbkZQuOn6jSHosy/nQdrv TgLg== X-Gm-Message-State: AE9vXwMtkWehbpbl7s0cfU5sXImGEOpLZlqp8iMQPzxTiVJpTysrWdpN/2pOlZ3WomawSw== X-Received: by 10.202.237.65 with SMTP id l62mr12546730oih.21.1472485061525; Mon, 29 Aug 2016 08:37:41 -0700 (PDT) Received: from Shakuras.scurra.org ([148.210.135.66]) by smtp.gmail.com with ESMTPSA id w80sm8543977ota.0.2016.08.29.08.37.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 29 Aug 2016 08:37:40 -0700 (PDT) From: Azael Avalos To: Darren Hart , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Azael Avalos Subject: [PATCH v2 1/3] toshiba_acpi: Clean up variable declaration Date: Mon, 29 Aug 2016 09:37:34 -0600 Message-Id: <20160829153736.18273-2-coproscefalo@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160829153736.18273-1-coproscefalo@gmail.com> References: <20160829153736.18273-1-coproscefalo@gmail.com> 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 This patch moves all the multiple line variable declaration to a single line declaration (except variables being initialized) following the reverse tree order, to conform to the practices of the kernel. Signed-off-by: Azael Avalos --- drivers/platform/x86/toshiba_acpi.c | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c index 9d60a40..54dea64 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) static acpi_status tci_raw(struct toshiba_acpi_dev *dev, const u32 in[TCI_WORDS], u32 out[TCI_WORDS]) { + union acpi_object in_objs[TCI_WORDS], out_objs[TCI_WORDS + 1]; struct acpi_object_list params; - union acpi_object in_objs[TCI_WORDS]; struct acpi_buffer results; - union acpi_object out_objs[TCI_WORDS + 1]; acpi_status status; int i; @@ -387,9 +386,8 @@ static int sci_open(struct toshiba_acpi_dev *dev) { u32 in[TCI_WORDS] = { SCI_OPEN, 0, 0, 0, 0, 0 }; u32 out[TCI_WORDS]; - acpi_status status; + acpi_status status = tci_raw(dev, in, out); - status = tci_raw(dev, in, out); if (ACPI_FAILURE(status)) { pr_err("ACPI call to open SCI failed\n"); return 0; @@ -425,9 +423,8 @@ static void sci_close(struct toshiba_acpi_dev *dev) { u32 in[TCI_WORDS] = { SCI_CLOSE, 0, 0, 0, 0, 0 }; u32 out[TCI_WORDS]; - acpi_status status; + acpi_status status = tci_raw(dev, in, out); - status = tci_raw(dev, in, out); if (ACPI_FAILURE(status)) { pr_err("ACPI call to close SCI failed\n"); return; @@ -509,7 +506,8 @@ static enum led_brightness toshiba_illumination_get(struct led_classdev *cdev) { struct toshiba_acpi_dev *dev = container_of(cdev, struct toshiba_acpi_dev, led_dev); - u32 state, result; + u32 result; + u32 state; /* First request : initialize communication. */ if (!sci_open(dev)) @@ -672,9 +670,9 @@ static int toshiba_touchpad_get(struct toshiba_acpi_dev *dev, u32 *state) /* Eco Mode support */ static void toshiba_eco_mode_available(struct toshiba_acpi_dev *dev) { - acpi_status status; u32 in[TCI_WORDS] = { HCI_GET, HCI_ECO_MODE, 0, 0, 0, 0 }; u32 out[TCI_WORDS]; + acpi_status status; dev->eco_supported = 0; dev->eco_led_registered = false; @@ -1282,9 +1280,9 @@ static struct proc_dir_entry *toshiba_proc_dir; /* LCD Brightness */ static int __get_lcd_brightness(struct toshiba_acpi_dev *dev) { + int brightness = 0; u32 result; u32 value; - int brightness = 0; if (dev->tr_backlight_supported) { 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, struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); char cmd[42]; size_t len; - int levels = dev->backlight_dev->props.max_brightness + 1; + int levels; int value; len = min(count, sizeof(cmd) - 1); @@ -1385,6 +1383,7 @@ static ssize_t lcd_proc_write(struct file *file, const char __user *buf, return -EFAULT; cmd[len] = '\0'; + levels = dev->backlight_dev->props.max_brightness + 1; if (sscanf(cmd, " brightness : %i", &value) != 1 && value < 0 && value > levels) return -EINVAL; @@ -1447,10 +1446,8 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, struct toshiba_acpi_dev *dev = PDE_DATA(file_inode(file)); char *buffer; char *cmd; + int lcd_out, crt_out, tv_out; int remain = count; - int lcd_out = -1; - int crt_out = -1; - int tv_out = -1; int value; int ret; u32 video_out; @@ -1486,6 +1483,7 @@ static ssize_t video_proc_write(struct file *file, const char __user *buf, kfree(cmd); + lcd_out = crt_out = tv_out = -1; ret = get_video_status(dev, &video_out); if (!ret) { unsigned int new_video_out = video_out; @@ -1980,9 +1978,9 @@ static ssize_t usb_sleep_charge_store(struct device *dev, const char *buf, size_t count) { struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); - u32 mode; int state; int ret; + u32 mode; ret = kstrtoint(buf, 0, &state); if (ret) @@ -2021,11 +2019,10 @@ static ssize_t sleep_functions_on_battery_show(struct device *dev, char *buf) { struct toshiba_acpi_dev *toshiba = dev_get_drvdata(dev); - u32 state; - int bat_lvl; - int status; + int bat_lvl, status; int ret; int tmp; + u32 state; ret = toshiba_sleep_functions_status_get(toshiba, &state); if (ret < 0) @@ -3015,8 +3012,8 @@ static int toshiba_acpi_add(struct acpi_device *acpi_dev) { struct toshiba_acpi_dev *dev; const char *hci_method; - u32 dummy; int ret = 0; + u32 dummy; if (toshiba_acpi) return -EBUSY;