Received: by 10.223.185.116 with SMTP id b49csp1483956wrg; Sun, 11 Feb 2018 13:12:09 -0800 (PST) X-Google-Smtp-Source: AH8x226paVcv9e5kwLq1+5CwHqhBckvnD2xEP+3hFQhHjAk2ntRBMqdZcIMdviZsy4hsLnsxNUji X-Received: by 2002:a17:902:7485:: with SMTP id h5-v6mr2349993pll.236.1518383529495; Sun, 11 Feb 2018 13:12:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518383529; cv=none; d=google.com; s=arc-20160816; b=Dj4/HDhl3lHwgayI8+g31imnc3DbjD5Vn2lonkW8fNTuCufAFGZomaNB8PrkXcKxtd aNB9kSGWavW9XJY6rFWncDlFh1hx51MUwccDnZcmW96O8Rd/Md+o2PoARAt0U9fzG9Ui 3Mv5cFmbZnYX2d8Wj1MMBWCYoaw1DWwEkTIpdgbihoPnzF5iSubXMmRdehaJ4WDxXm7T nNFCykC/VGBysMcIl6wt5gUUA8RGtl2BqZ2DEHpmOl4pkkUnObxhSx0KEcIiUT+IaQAq 4Cp1gaPmQDIWSYlS+imlEILrtvracJ9gRCk4YBCUFpcGSZwbBe7X3Kn/xx3F+WQFP+lv 5Q5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=3cvGszTDqZ7rkqqjvPWxOR89G3/afLdxDFeJ412ojn8=; b=PfJt9LOnaDVsvV92323SoJTMVo+5Y8xobu4J+zHG+3JJ00WHaO+yS+tYs2TkrgqEih dIA4VDKwnXJqS2xes6xXNnAOdqJ533YmEI9W/36u4es1IJI16lRxOdbBUUTzrzNiTRYg bHalwC5bje0qka3TQiEWzZAxxJ4p+62a1O7Rrx1ib0+rGOpA9r5bADHp9uOpM/gE/x6r QTcIsFW0rSs+GFn8MfiqgVRLZZ9Tsdkunw3TptsEN+aZS+60dXSazrrFWJTX5JFEBHYB WCzA7nx7FJFdiY7QCz4mwhh1cgdZfEi/xydJHcUVxSNe+M29yiE4uAUE6NL+MsYJTCFV djTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kempniu.pl header.s=google header.b=lYHxjIPz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kempniu.pl Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a3si5242449pfh.413.2018.02.11.13.11.55; Sun, 11 Feb 2018 13:12:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kempniu.pl header.s=google header.b=lYHxjIPz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=kempniu.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932292AbeBKVKB (ORCPT + 99 others); Sun, 11 Feb 2018 16:10:01 -0500 Received: from mail-lf0-f67.google.com ([209.85.215.67]:41139 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753693AbeBKVHj (ORCPT ); Sun, 11 Feb 2018 16:07:39 -0500 Received: by mail-lf0-f67.google.com with SMTP id f136so17908665lff.8 for ; Sun, 11 Feb 2018 13:07:38 -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=lYHxjIPzN7HsdBblC1tvet4BnHNLHxMuzHj4Uo+iLfzbZwH/0uWZa72/c6mJ8pDyb5 xk+RYOg3qu+D7QVTTUePH20i9TOXUsHUe8EQdpcXYevXRAWkAG54ZatmvSYjfBfcQxHX h2vXmUCcKb1SNQu+xPHYUT52/jsIk2DmGe+Rg= 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=HBQhpx5BTSOWnmphFlNfzZmamnOAZFkmU8ooUr6MfOn0aCPr0fOH8HW9DHPhKEaMAs UjcYZnRoEt+n8+kHGZCEB2tXgmLVbxEKJr2uDSUekehPCpLap4ti8ofkgUKXV20cWwoF VZ4hFxGq04MtXIm6okDhu6M+oxfrujRmmVOALjNGqkjfZC/1FG1ZHVPOpC1PS+DQ5wuq QgWSY6SCGDvA+vc5N4b7Jv0nMwEOvpwSs5Dt4+H2PxA3uXYQ3FFl7viVldo00z5H69mG Z+i0cO1arziO56yuMOS19KOL8SdIemLf0XTmzDygUkv5Zrd9+s0tDhSul1oEKU16kG5W 3Ngg== X-Gm-Message-State: APf1xPBBCNBfNy64FX/lAfXj/WA99I4T5ezI3GXQvAADEpnlip9qh52c 5Dc3SGDRaNI+GZp2X8y6Ueu1lQ== X-Received: by 10.25.142.72 with SMTP id q69mr3967656lfd.82.1518383257963; Sun, 11 Feb 2018 13:07:37 -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 y198sm1390477lfd.62.2018.02.11.13.07.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Feb 2018 13:07:37 -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 1/7] platform/x86: fujitsu-laptop: Unify local variable naming Date: Sun, 11 Feb 2018 22:07:21 +0100 Message-Id: <20180211210727.12130-2-kernel@kempniu.pl> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180211210727.12130-1-kernel@kempniu.pl> References: <20180211210727.12130-1-kernel@kempniu.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, -- 2.16.1