Commit 14966e02 authored by Michał Kępień's avatar Michał Kępień Committed by Darren Hart (VMware)

platform/x86: fujitsu-laptop: Unify local variable naming

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: default avatarMichał Kępień <kernel@kempniu.pl>
Reviewed-by: default avatarJonathan Woithe <jwoithe@just42.net>
Signed-off-by: default avatarDarren Hart (VMware) <dvhart@infradead.org>
parent 5488bfdf
...@@ -385,7 +385,7 @@ static int fujitsu_backlight_register(struct acpi_device *device) ...@@ -385,7 +385,7 @@ static int fujitsu_backlight_register(struct acpi_device *device)
static int acpi_fujitsu_bl_add(struct acpi_device *device) static int acpi_fujitsu_bl_add(struct acpi_device *device)
{ {
struct fujitsu_bl *priv; struct fujitsu_bl *priv;
int error; int ret;
if (acpi_video_get_backlight_type() != acpi_backlight_vendor) if (acpi_video_get_backlight_type() != acpi_backlight_vendor)
return -ENODEV; return -ENODEV;
...@@ -399,9 +399,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) ...@@ -399,9 +399,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)
strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS); strcpy(acpi_device_class(device), ACPI_FUJITSU_CLASS);
device->driver_data = priv; device->driver_data = priv;
error = acpi_fujitsu_bl_input_setup(device); ret = acpi_fujitsu_bl_input_setup(device);
if (error) if (ret)
return error; return ret;
pr_info("ACPI: %s [%s]\n", pr_info("ACPI: %s [%s]\n",
acpi_device_name(device), acpi_device_bid(device)); acpi_device_name(device), acpi_device_bid(device));
...@@ -410,9 +410,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device) ...@@ -410,9 +410,9 @@ static int acpi_fujitsu_bl_add(struct acpi_device *device)
priv->max_brightness = FUJITSU_LCD_N_LEVELS; priv->max_brightness = FUJITSU_LCD_N_LEVELS;
get_lcd_level(device); get_lcd_level(device);
error = fujitsu_backlight_register(device); ret = fujitsu_backlight_register(device);
if (error) if (ret)
return error; return ret;
return 0; return 0;
} }
...@@ -693,7 +693,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) ...@@ -693,7 +693,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
{ {
struct fujitsu_laptop *priv = acpi_driver_data(device); struct fujitsu_laptop *priv = acpi_driver_data(device);
struct led_classdev *led; struct led_classdev *led;
int result; int ret;
if (call_fext_func(device, if (call_fext_func(device,
FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) { FUNC_LEDS, 0x0, 0x0, 0x0) & LOGOLAMP_POWERON) {
...@@ -704,9 +704,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) ...@@ -704,9 +704,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
led->name = "fujitsu::logolamp"; led->name = "fujitsu::logolamp";
led->brightness_set_blocking = logolamp_set; led->brightness_set_blocking = logolamp_set;
led->brightness_get = logolamp_get; led->brightness_get = logolamp_get;
result = devm_led_classdev_register(&device->dev, led); ret = devm_led_classdev_register(&device->dev, led);
if (result) if (ret)
return result; return ret;
} }
if ((call_fext_func(device, if ((call_fext_func(device,
...@@ -719,9 +719,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) ...@@ -719,9 +719,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
led->name = "fujitsu::kblamps"; led->name = "fujitsu::kblamps";
led->brightness_set_blocking = kblamps_set; led->brightness_set_blocking = kblamps_set;
led->brightness_get = kblamps_get; led->brightness_get = kblamps_get;
result = devm_led_classdev_register(&device->dev, led); ret = devm_led_classdev_register(&device->dev, led);
if (result) if (ret)
return result; return ret;
} }
/* /*
...@@ -742,9 +742,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) ...@@ -742,9 +742,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
led->brightness_set_blocking = radio_led_set; led->brightness_set_blocking = radio_led_set;
led->brightness_get = radio_led_get; led->brightness_get = radio_led_get;
led->default_trigger = "rfkill-any"; led->default_trigger = "rfkill-any";
result = devm_led_classdev_register(&device->dev, led); ret = devm_led_classdev_register(&device->dev, led);
if (result) if (ret)
return result; return ret;
} }
/* Support for eco led is not always signaled in bit corresponding /* 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) ...@@ -762,9 +762,9 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device)
led->name = "fujitsu::eco_led"; led->name = "fujitsu::eco_led";
led->brightness_set_blocking = eco_led_set; led->brightness_set_blocking = eco_led_set;
led->brightness_get = eco_led_get; led->brightness_get = eco_led_get;
result = devm_led_classdev_register(&device->dev, led); ret = devm_led_classdev_register(&device->dev, led);
if (result) if (ret)
return result; return ret;
} }
return 0; return 0;
...@@ -773,8 +773,7 @@ static int acpi_fujitsu_laptop_leds_register(struct acpi_device *device) ...@@ -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) static int acpi_fujitsu_laptop_add(struct acpi_device *device)
{ {
struct fujitsu_laptop *priv; struct fujitsu_laptop *priv;
int error; int ret, i = 0;
int i;
priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL); priv = devm_kzalloc(&device->dev, sizeof(*priv), GFP_KERNEL);
if (!priv) if (!priv)
...@@ -789,23 +788,22 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) ...@@ -789,23 +788,22 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
/* kfifo */ /* kfifo */
spin_lock_init(&priv->fifo_lock); spin_lock_init(&priv->fifo_lock);
error = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int), ret = kfifo_alloc(&priv->fifo, RINGBUFFERSIZE * sizeof(int),
GFP_KERNEL); GFP_KERNEL);
if (error) { if (ret) {
pr_err("kfifo_alloc failed\n"); pr_err("kfifo_alloc failed\n");
goto err_stop; goto err_stop;
} }
error = acpi_fujitsu_laptop_input_setup(device); ret = acpi_fujitsu_laptop_input_setup(device);
if (error) if (ret)
goto err_free_fifo; goto err_free_fifo;
pr_info("ACPI: %s [%s]\n", pr_info("ACPI: %s [%s]\n",
acpi_device_name(device), acpi_device_bid(device)); acpi_device_name(device), acpi_device_bid(device));
i = 0; while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 &&
while (call_fext_func(device, FUNC_BUTTONS, 0x1, 0x0, 0x0) != 0 i++ < MAX_HOTKEY_RINGBUFFER_SIZE)
&& (i++) < MAX_HOTKEY_RINGBUFFER_SIZE)
; /* No action, result is discarded */ ; /* No action, result is discarded */
acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n", acpi_handle_debug(device->handle, "Discarded %i ringbuffer entries\n",
i); i);
...@@ -835,12 +833,12 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) ...@@ -835,12 +833,12 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK; fujitsu_bl->bl_device->props.power = FB_BLANK_UNBLANK;
} }
error = acpi_fujitsu_laptop_leds_register(device); ret = acpi_fujitsu_laptop_leds_register(device);
if (error) if (ret)
goto err_free_fifo; goto err_free_fifo;
error = fujitsu_laptop_platform_add(device); ret = fujitsu_laptop_platform_add(device);
if (error) if (ret)
goto err_free_fifo; goto err_free_fifo;
return 0; return 0;
...@@ -848,7 +846,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device) ...@@ -848,7 +846,7 @@ static int acpi_fujitsu_laptop_add(struct acpi_device *device)
err_free_fifo: err_free_fifo:
kfifo_free(&priv->fifo); kfifo_free(&priv->fifo);
err_stop: err_stop:
return error; return ret;
} }
static int acpi_fujitsu_laptop_remove(struct acpi_device *device) static int acpi_fujitsu_laptop_remove(struct acpi_device *device)
...@@ -865,11 +863,11 @@ 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) static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode)
{ {
struct fujitsu_laptop *priv = acpi_driver_data(device); struct fujitsu_laptop *priv = acpi_driver_data(device);
int status; int ret;
status = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode, ret = kfifo_in_locked(&priv->fifo, (unsigned char *)&scancode,
sizeof(scancode), &priv->fifo_lock); sizeof(scancode), &priv->fifo_lock);
if (status != sizeof(scancode)) { if (ret != sizeof(scancode)) {
dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n", dev_info(&priv->input->dev, "Could not push scancode [0x%x]\n",
scancode); scancode);
return; return;
...@@ -882,13 +880,12 @@ static void acpi_fujitsu_laptop_press(struct acpi_device *device, int scancode) ...@@ -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) static void acpi_fujitsu_laptop_release(struct acpi_device *device)
{ {
struct fujitsu_laptop *priv = acpi_driver_data(device); struct fujitsu_laptop *priv = acpi_driver_data(device);
int scancode, status; int scancode, ret;
while (true) { while (true) {
status = kfifo_out_locked(&priv->fifo, ret = kfifo_out_locked(&priv->fifo, (unsigned char *)&scancode,
(unsigned char *)&scancode,
sizeof(scancode), &priv->fifo_lock); sizeof(scancode), &priv->fifo_lock);
if (status != sizeof(scancode)) if (ret != sizeof(scancode))
return; return;
sparse_keymap_report_event(priv->input, scancode, 0, false); sparse_keymap_report_event(priv->input, scancode, 0, false);
dev_dbg(&priv->input->dev, dev_dbg(&priv->input->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment