From patchwork Tue Feb 20 05:24:48 2018 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: 10229427 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 87627602DC for ; Tue, 20 Feb 2018 05:26:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 79AD426E97 for ; Tue, 20 Feb 2018 05:26:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6E440283A5; Tue, 20 Feb 2018 05:26:49 +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=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI 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 D75AD26E97 for ; Tue, 20 Feb 2018 05:26:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751418AbeBTF0f (ORCPT ); Tue, 20 Feb 2018 00:26:35 -0500 Received: from mail-lf0-f65.google.com ([209.85.215.65]:32997 "EHLO mail-lf0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750773AbeBTFZD (ORCPT ); Tue, 20 Feb 2018 00:25:03 -0500 Received: by mail-lf0-f65.google.com with SMTP id j193so2473298lfe.0 for ; Mon, 19 Feb 2018 21:25:02 -0800 (PST) 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=3cvGszTDqZ7rkqqjvPWxOR89G3/afLdxDFeJ412ojn8=; b=XtPqa4vaoCGv01Dp40fpA9R6MrJ9xg/w06AU28lVTot6gjBRxqaUrcmg9OR4cezqT+ kd9iSi5Xj59WbfWYaL78qVfZN8gKDPpTKcNK3w7cX+izuhCEAvzk1iOaba03NRyX8CFU ocGVYLFyVPN+FGaPB9RcX0M4OIwp5Nw0O+j3k= 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=3cvGszTDqZ7rkqqjvPWxOR89G3/afLdxDFeJ412ojn8=; b=Clnd4j9evJ55/hANmuAhg3S6s3yf3PFsumDmkUrx3GAZjREVYRC714zLBbtP6aIVBg kHvg4AYax3bnDcBjEQUy1PgcnG/faKe+AyxcuTtqyVRVDXN8Kf0yQyDC9k1WgWmKR3OU nVz8GUNpuJiLmHuJFs8LgGNkzsVzA84JyByfQkl3Mlm2U/OCAJJz8s9ae5EyLetjm39Y h+elxNccq3KctsrreRfcwK+rj3aaTq6jcX1rWNALjnG3DfvfopKmmvrvW6hIP9pWApxR e05wf7XiSr3BCIn1akTctU8L3/kt2wEdOGQfn/1ZhwUPNhlpd6mA98mU9yKAP5eU1S7a beXA== X-Gm-Message-State: APf1xPCtAhiANCCBFFRaqzUNIcyrwie2jViGJadeZC5y2FUuyQ8ZIjph jWT2M6AOIyb+E1MgTe5gYADToGQk X-Google-Smtp-Source: AH8x227Vvm5Um3pakqNoDM8rDL7AEzgy/sXJ2mrAby8otUElslPi2lswapZP53oq48oU524lIwp3Ng== X-Received: by 10.25.170.2 with SMTP id t2mr10884702lfe.53.1519104302052; Mon, 19 Feb 2018 21:25:02 -0800 (PST) Received: from kmp-mobile.hq.kempniu.pl (kmp-mobile.hq.kempniu.pl. [2001:470:64df:111::1b01]) by smtp.googlemail.com with ESMTPSA id b27sm3978286ljb.84.2018.02.19.21.25.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 19 Feb 2018 21:25:01 -0800 (PST) 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/7] platform/x86: fujitsu-laptop: Unify local variable naming Date: Tue, 20 Feb 2018 06:24:48 +0100 Message-Id: <20180220052454.11134-2-kernel@kempniu.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180220052454.11134-1-kernel@kempniu.pl> References: <20180220052454.11134-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 Different functions in the module use varying names (error, result, status) for a local variable storing the return value of a function call that has to be checked for errors. Use a common name (ret) for all these local variables to improve code consistency. Merge integer variable declarations in acpi_fujitsu_laptop_add() into one line. Signed-off-by: Michał Kępień --- drivers/platform/x86/fujitsu-laptop.c | 85 +++++++++++++++++------------------ 1 file changed, 41 insertions(+), 44 deletions(-) diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c index 2cfbd3fa5136..b5f782807bfa 100644 --- a/drivers/platform/x86/fujitsu-laptop.c +++ b/drivers/platform/x86/fujitsu-laptop.c @@ -385,7 +385,7 @@ static int fujitsu_backlight_register(struct acpi_device *device) static int acpi_fujitsu_bl_add(struct acpi_device *device) { struct fujitsu_bl *priv; - int error; + int ret; if (acpi_video_get_backlight_type() != acpi_backlight_vendor) return -ENODEV; @@ -399,9 +399,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); device->driver_data = priv; - error = acpi_fujitsu_bl_input_setup(device); - if (error) - return error; + ret = acpi_fujitsu_bl_input_setup(device); + if (ret) + return ret; pr_info("ACPI: %s [%s]\n", acpi_device_name(device), acpi_device_bid(device)); @@ -410,9 +410,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) priv->max_brightness = FUJITSU_LCD_N_LEVELS; get_lcd_level(device); - error = fujitsu_backlight_register(device); - if (error) - return error; + ret = fujitsu_backlight_register(device); + if (ret) + return ret; return 0; } @@ -693,7 +693,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) { struct fujitsu_laptop *priv = acpi_driver_data(device); struct led_classdev *led; - int result; + int ret; if (call_fext_func(device, FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { @@ -704,9 +704,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) led->name = "fujitsu::logolamp"; led->brightness_set_blocking = logolamp_set; led->brightness_get = logolamp_get; - result = devm_led_classdev_register(&device->dev, led); - if (result) - return result; + ret = devm_led_classdev_register(&device->dev, led); + if (ret) + return ret; } if ((call_fext_func(device, @@ -719,9 +719,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) led->name = "fujitsu::kblamps"; led->brightness_set_blocking = kblamps_set; led->brightness_get = kblamps_get; - result = devm_led_classdev_register(&device->dev, led); - if (result) - return result; + ret = devm_led_classdev_register(&device->dev, led); + if (ret) + return ret; } /* @@ -742,9 +742,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) led->brightness_set_blocking = radio_led_set; led->brightness_get = radio_led_get; led->default_trigger = "rfkill-any"; - result = devm_led_classdev_register(&device->dev, led); - if (result) - return result; + ret = devm_led_classdev_register(&device->dev, led); + if (ret) + return ret; } /* Support for eco led is not always signaled in bit corresponding @@ -762,9 +762,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) led->name = "fujitsu::eco_led"; led->brightness_set_blocking = eco_led_set; led->brightness_get = eco_led_get; - result = devm_led_classdev_register(&device->dev, led); - if (result) - return result; + ret = devm_led_classdev_register(&device->dev, led); + if (ret) + return ret; } return 0; @@ -773,8 +773,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) static int acpi_fujitsu_laptop_add(struct acpi_device *device) { struct fujitsu_laptop *priv; - int error; - int i; + int ret, i = 0; priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); if (!priv) @@ -789,23 +788,22 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) /* kfifo */ spin_lock_init(&priv->fifo_lock); - error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), - GFP_KERNEL); - if (error) { + ret = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), + GFP_KERNEL); + if (ret) { pr_err("kfifo_alloc failed\n"); goto err_stop; } - error = acpi_fujitsu_laptop_input_setup(device); - if (error) + ret = acpi_fujitsu_laptop_input_setup(device); + if (ret) goto err_free_fifo; pr_info("ACPI: %s [%s]\n", acpi_device_name(device), acpi_device_bid(device)); - i = 0; - while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 - && (i++) < MAX_HOTKEY_RINGBUFFER_SIZE) + while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 && + i++ < MAX_HOTKEY_RINGBUFFER_SIZE) ; /* No action, result is discarded */ acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", i); @@ -835,12 +833,12 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; } - error = acpi_fujitsu_laptop_leds_register(device); - if (error) + ret = acpi_fujitsu_laptop_leds_register(device); + if (ret) goto err_free_fifo; - error = fujitsu_laptop_platform_add(device); - if (error) + ret = fujitsu_laptop_platform_add(device); + if (ret) goto err_free_fifo; return 0; @@ -848,7 +846,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) err_free_fifo: kfifo_free(&priv->fifo); err_stop: - return error; + return ret; } static int acpi_fujitsu_laptop_remove(struct acpi_device *device) @@ -865,11 +863,11 @@ static int acpi_fujitsu_laptop_remove(struct acpi_device *device) static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) { struct fujitsu_laptop *priv = acpi_driver_data(device); - int status; + int ret; - status = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, - sizeof(scancode), &priv->fifo_lock); - if (status != sizeof(scancode)) { + ret = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, + sizeof(scancode), &priv->fifo_lock); + if (ret != sizeof(scancode)) { dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", scancode); return; @@ -882,13 +880,12 @@ static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) static void acpi_fujitsu_laptop_release(struct acpi_device *device) { struct fujitsu_laptop *priv = acpi_driver_data(device); - int scancode, status; + int scancode, ret; while (true) { - status = kfifo_out_locked(&priv->fifo, - (unsigned char *)&scancode, - sizeof(scancode), &priv->fifo_lock); - if (status != sizeof(scancode)) + ret = kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode, + sizeof(scancode), &priv->fifo_lock); + if (ret != sizeof(scancode)) return; sparse_keymap_report_event(priv->input, scancode, 0, false); dev_dbg(&priv->input->dev,