Re: [PATCH v2 03/11] platform/x86: fujitsu-laptop: merge set_lcd_level_alt() into set_lcd_level()
From: Jonathan Woithe
Date: Fri Apr 07 2017 - 07:54:32 EST
On Wed, Apr 05, 2017 at 08:49:02AM +0200, Micha?? K??pie?? wrote:
> diff --git a/drivers/platform/x86/fujitsu-laptop.c b/drivers/platform/x86/fujitsu-laptop.c
> index 59107a599d22..2f563aa00592 100644
> --- a/drivers/platform/x86/fujitsu-laptop.c
> +++ b/drivers/platform/x86/fujitsu-laptop.c
> @@ -360,41 +360,26 @@ static int set_lcd_level(int level)
> {
> acpi_status status = AE_OK;
> acpi_handle handle = NULL;
> -
> - vdbg_printk(FUJLAPTOP_DBG_TRACE, "set lcd level via SBLL [%d]\n",
> - level);
> -
> - if (level < 0 || level >= fujitsu_bl->max_brightness)
> - return -EINVAL;
> -
> - status = acpi_get_handle(fujitsu_bl->acpi_handle, "SBLL", &handle);
> - if (ACPI_FAILURE(status)) {
> - vdbg_printk(FUJLAPTOP_DBG_ERROR, "SBLL not present\n");
> - return -ENODEV;
> + char *method;
> +
> + switch (use_alt_lcd_levels) {
> + case 1:
> + method = "SBL2";
> + break;
> + default:
> + method = "SBLL";
> + break;
> }
This is not necessary something actionable, but I am wondering about the
rationale of using a switch statement here given that there really are only
two options. In my mind at least a simple "if" clause would be clearer and
easier to read (with or without the braces):
if (use_alt_lcd_levels) {
method = "SBL2";
} else {
method = "SBLL";
}
Regards
jonathan